[mutter] window: Remove the concept of surface_mapped



commit 7159d3bc35a07d0a9a2d1986b79ba6349d62d2b0
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon Jul 14 14:49:18 2014 -0400

    window: Remove the concept of surface_mapped
    
    The implementation was just wrong. We now consider it an error to attach
    a NULL buffer to an xdg_surface. Users should destroy the surface properly.

 src/core/window-private.h          |    7 -------
 src/core/window.c                  |   15 ---------------
 src/wayland/meta-wayland-surface.c |   13 ++++++++++---
 src/x11/window-x11.c               |    2 --
 4 files changed, 10 insertions(+), 27 deletions(-)
---
diff --git a/src/core/window-private.h b/src/core/window-private.h
index 77248c8..3c75dd1 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -347,10 +347,6 @@ struct _MetaWindow
   /* whether or not the window is from a program running on another machine */
   guint is_remote : 1;
 
-  /* Used for Wayland -- surfaces can behave as if they were unmapped if
-   * they have a NULL buffer attached... */
-  guint surface_mapped;
-
   /* if non-NULL, the bounds of the window frame */
   cairo_region_t *frame_bounds;
 
@@ -672,9 +668,6 @@ void meta_window_handle_leave (MetaWindow  *window);
 gboolean meta_window_handle_ungrabbed_event (MetaWindow         *window,
                                              const ClutterEvent *event);
 
-void meta_window_set_surface_mapped (MetaWindow *window,
-                                     gboolean    surface_mapped);
-
 void meta_window_get_client_area_rect (const MetaWindow      *window,
                                        cairo_rectangle_int_t *rect);
 void meta_window_get_titlebar_rect (MetaWindow    *window,
diff --git a/src/core/window.c b/src/core/window.c
index 1debad3..bd57345 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -785,7 +785,6 @@ _meta_window_shared_new (MetaDisplay         *display,
   window->client_type = client_type;
   window->surface = surface;
   window->xwindow = xwindow;
-  window->surface_mapped = FALSE;
 
   /* this is in window->screen->display, but that's too annoying to
    * type
@@ -1568,9 +1567,6 @@ meta_window_should_be_showing (MetaWindow  *window)
 {
   gboolean on_workspace;
 
-  if (!window->surface_mapped)
-    return FALSE;
-
   meta_verbose ("Should be showing for window %s\n", window->desc);
 
   /* See if we're on the workspace */
@@ -7999,17 +7995,6 @@ meta_window_handle_ungrabbed_event (MetaWindow         *window,
 }
 
 void
-meta_window_set_surface_mapped (MetaWindow *window,
-                                gboolean    surface_mapped)
-{
-  if (window->surface_mapped == (guint) surface_mapped)
-    return;
-
-  window->surface_mapped = surface_mapped;
-  meta_window_queue (window, META_QUEUE_CALC_SHOWING);
-}
-
-void
 meta_window_set_custom_frame_extents (MetaWindow *window,
                                       GtkBorder  *extents)
 {
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index 1ff253b..fa7c18e 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -163,7 +163,7 @@ cursor_surface_commit (MetaWaylandSurface      *surface,
 }
 
 static void
-toplevel_surface_commit (MetaWaylandSurface             *surface,
+toplevel_surface_commit (MetaWaylandSurface      *surface,
                          MetaWaylandPendingState *pending)
 {
   if (pending->frame_extents_changed)
@@ -174,9 +174,16 @@ toplevel_surface_commit (MetaWaylandSurface             *surface,
       MetaWindow *window = surface->window;
       MetaWaylandBuffer *buffer = pending->buffer;
 
-      meta_window_set_surface_mapped (window, buffer != NULL);
+      if (buffer == NULL)
+        {
+          wl_resource_post_error (surface->resource,
+                                  WL_DISPLAY_ERROR_INVALID_OBJECT,
+                                  "Cannot commit a NULL buffer to an xdg_surface");
+          return;
+        }
+
       /* We resize X based surfaces according to X events */
-      if (buffer != NULL && window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND)
+      if (window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND)
         {
           int new_width, new_height;
 
diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c
index d75be06..af99b03 100644
--- a/src/x11/window-x11.c
+++ b/src/x11/window-x11.c
@@ -2985,8 +2985,6 @@ meta_window_x11_new (MetaDisplay       *display,
       meta_display_grab_focus_window_button (window->display, window);
     }
 
-  meta_window_set_surface_mapped (window, TRUE);
-
   meta_error_trap_pop (display); /* pop the XSync()-reducing trap */
   return window;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]