[mutter] window: Update the shape, input, and opaque regions immediately



commit 64a82c8d7703186b8004d73299b4425545cab990
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Feb 26 19:42:31 2014 -0500

    window: Update the shape, input, and opaque regions immediately
    
    ... and individually. It turns out that updating the opaque region
    was causing the shape region to be updated, which was causing a new
    shape mask to be generated and uploaded to the GPU. Considering
    GTK+ regenerates the opaque region on pretty much any focus change,
    this is not good.

 src/compositor/compositor.c                |   28 ++++++++++++++++++++++++++--
 src/compositor/meta-window-actor-private.h |    5 ++++-
 src/compositor/meta-window-actor.c         |    6 +++---
 src/core/window.c                          |    6 +++---
 src/meta/compositor.h                      |    6 +++++-
 5 files changed, 41 insertions(+), 10 deletions(-)
---
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index 51e27f3..f955cee 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -823,7 +823,31 @@ is_grabbed_event (MetaDisplay *display,
 }
 
 void
-meta_compositor_window_shape_changed (MetaCompositor *compositor,
+meta_compositor_update_shape_region (MetaCompositor *compositor,
+                                     MetaWindow     *window)
+{
+  MetaWindowActor *window_actor;
+  window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
+  if (!window_actor)
+    return;
+
+  meta_window_actor_update_shape_region (window_actor);
+}
+
+void
+meta_compositor_update_input_region (MetaCompositor *compositor,
+                                     MetaWindow     *window)
+{
+  MetaWindowActor *window_actor;
+  window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
+  if (!window_actor)
+    return;
+
+  meta_window_actor_update_input_region (window_actor);
+}
+
+void
+meta_compositor_update_opaque_region (MetaCompositor *compositor,
                                       MetaWindow     *window)
 {
   MetaWindowActor *window_actor;
@@ -831,7 +855,7 @@ meta_compositor_window_shape_changed (MetaCompositor *compositor,
   if (!window_actor)
     return;
 
-  meta_window_actor_update_shape (window_actor);
+  meta_window_actor_update_opaque_region (window_actor);
 }
 
 void
diff --git a/src/compositor/meta-window-actor-private.h b/src/compositor/meta-window-actor-private.h
index 75a19e1..7d2a10f 100644
--- a/src/compositor/meta-window-actor-private.h
+++ b/src/compositor/meta-window-actor-private.h
@@ -46,7 +46,6 @@ gboolean meta_window_actor_effect_in_progress  (MetaWindowActor *self);
 void     meta_window_actor_sync_actor_geometry (MetaWindowActor *self,
                                                 gboolean         did_placement);
 void     meta_window_actor_sync_visibility     (MetaWindowActor *self);
-void     meta_window_actor_update_shape        (MetaWindowActor *self);
 void     meta_window_actor_update_opacity      (MetaWindowActor *self);
 void     meta_window_actor_mapped              (MetaWindowActor *self);
 void     meta_window_actor_unmapped            (MetaWindowActor *self);
@@ -58,4 +57,8 @@ void     meta_window_actor_queue_frame_drawn   (MetaWindowActor *self,
 void meta_window_actor_effect_completed (MetaWindowActor *actor,
                                          gulong           event);
 
+void meta_window_actor_update_shape_region (MetaWindowActor *self);
+void meta_window_actor_update_input_region (MetaWindowActor *self);
+void meta_window_actor_update_opaque_region (MetaWindowActor *self);
+
 #endif /* META_WINDOW_ACTOR_PRIVATE_H */
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index 7ab4de4..63658b1 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -1973,7 +1973,7 @@ build_and_scan_frame_mask (MetaWindowActor       *self,
   g_free (mask_data);
 }
 
-static void
+void
 meta_window_actor_update_shape_region (MetaWindowActor *self)
 {
   MetaWindowActorPrivate *priv = self->priv;
@@ -2011,7 +2011,7 @@ meta_window_actor_update_shape_region (MetaWindowActor *self)
   meta_window_actor_invalidate_shadow (self);
 }
 
-static void
+void
 meta_window_actor_update_input_region (MetaWindowActor *self)
 {
   MetaWindowActorPrivate *priv = self->priv;
@@ -2049,7 +2049,7 @@ meta_window_actor_update_input_region (MetaWindowActor *self)
   cairo_region_destroy (region);
 }
 
-static void
+void
 meta_window_actor_update_opaque_region (MetaWindowActor *self)
 {
   MetaWindowActorPrivate *priv = self->priv;
diff --git a/src/core/window.c b/src/core/window.c
index 115a93d..5e47bd3 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -7677,7 +7677,7 @@ meta_window_set_opaque_region (MetaWindow     *window,
     window->opaque_region = cairo_region_reference (region);
 
   if (window->display->compositor)
-    meta_compositor_window_shape_changed (window->display->compositor, window);
+    meta_compositor_update_opaque_region (window->display->compositor, window);
 }
 
 void
@@ -7763,7 +7763,7 @@ meta_window_set_shape_region (MetaWindow     *window,
     window->shape_region = cairo_region_reference (region);
 
   if (window->display->compositor)
-    meta_compositor_window_shape_changed (window->display->compositor, window);
+    meta_compositor_update_shape_region (window->display->compositor, window);
 }
 
 void
@@ -7848,7 +7848,7 @@ meta_window_set_input_region (MetaWindow     *window,
     window->input_region = cairo_region_reference (region);
 
   if (window->display->compositor)
-    meta_compositor_window_shape_changed (window->display->compositor, window);
+    meta_compositor_update_input_region (window->display->compositor, window);
 }
 
 void
diff --git a/src/meta/compositor.h b/src/meta/compositor.h
index d1be47e..eb5372d 100644
--- a/src/meta/compositor.h
+++ b/src/meta/compositor.h
@@ -62,7 +62,11 @@ void meta_compositor_manage_screen   (MetaCompositor *compositor,
 void meta_compositor_unmanage_screen (MetaCompositor *compositor,
                                       MetaScreen     *screen);
 
-void meta_compositor_window_shape_changed (MetaCompositor *compositor,
+void meta_compositor_update_shape_region (MetaCompositor *compositor,
+                                          MetaWindow     *window);
+void meta_compositor_update_input_region (MetaCompositor *compositor,
+                                          MetaWindow     *window);
+void meta_compositor_update_opaque_region (MetaCompositor *compositor,
                                            MetaWindow     *window);
 void meta_compositor_window_opacity_changed (MetaCompositor *compositor,
                                              MetaWindow     *window);


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