[metacity] compositor: replace set_updates with updates_frozen
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [metacity] compositor: replace set_updates with updates_frozen
- Date: Sun, 5 Mar 2017 23:40:24 +0000 (UTC)
commit 7b2b511ae72b2102074f67398e91683a848115fa
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Sat Mar 4 19:44:48 2017 +0200
compositor: replace set_updates with updates_frozen
https://git.gnome.org/browse/mutter/commit/?id=c9343e3ee3df0159fb3000bd38c61d9ff984fd8e
src/compositor/meta-compositor-none.c | 8 +++---
src/compositor/meta-compositor-private.h | 4 +-
src/compositor/meta-compositor-xrender.c | 8 +++---
src/compositor/meta-compositor.c | 8 +++---
src/core/window-private.h | 5 ++++
src/core/window.c | 36 +++++++++++++++++++++++++++--
src/include/meta-compositor.h | 4 +-
7 files changed, 54 insertions(+), 19 deletions(-)
---
diff --git a/src/compositor/meta-compositor-none.c b/src/compositor/meta-compositor-none.c
index f42b848..5813cf3 100644
--- a/src/compositor/meta-compositor-none.c
+++ b/src/compositor/meta-compositor-none.c
@@ -65,9 +65,9 @@ meta_compositor_none_hide_window (MetaCompositor *compositor,
}
static void
-meta_compositor_none_set_updates (MetaCompositor *compositor,
- MetaWindow *window,
- gboolean updates)
+meta_compositor_none_set_updates_frozen (MetaCompositor *compositor,
+ MetaWindow *window,
+ gboolean updates_frozen)
{
}
@@ -152,7 +152,7 @@ meta_compositor_none_class_init (MetaCompositorNoneClass *none_class)
compositor_class->remove_window = meta_compositor_none_remove_window;
compositor_class->show_window = meta_compositor_none_show_window;
compositor_class->hide_window = meta_compositor_none_hide_window;
- compositor_class->set_updates = meta_compositor_none_set_updates;
+ compositor_class->set_updates_frozen = meta_compositor_none_set_updates_frozen;
compositor_class->process_event = meta_compositor_none_process_event;
compositor_class->get_window_surface = meta_compositor_none_get_window_surface;
compositor_class->set_active_window = meta_compositor_none_set_active_window;
diff --git a/src/compositor/meta-compositor-private.h b/src/compositor/meta-compositor-private.h
index 43da63d..8ade140 100644
--- a/src/compositor/meta-compositor-private.h
+++ b/src/compositor/meta-compositor-private.h
@@ -46,9 +46,9 @@ struct _MetaCompositorClass
MetaWindow *window,
MetaEffectType effect);
- void (* set_updates) (MetaCompositor *compositor,
+ void (* set_updates_frozen) (MetaCompositor *compositor,
MetaWindow *window,
- gboolean update);
+ gboolean updates_frozen);
void (* process_event) (MetaCompositor *compositor,
XEvent *event,
diff --git a/src/compositor/meta-compositor-xrender.c b/src/compositor/meta-compositor-xrender.c
index c60ef19..890a4c7 100644
--- a/src/compositor/meta-compositor-xrender.c
+++ b/src/compositor/meta-compositor-xrender.c
@@ -3015,9 +3015,9 @@ meta_compositor_xrender_hide_window (MetaCompositor *compositor,
}
static void
-meta_compositor_xrender_set_updates (MetaCompositor *compositor,
- MetaWindow *window,
- gboolean updates)
+meta_compositor_xrender_set_updates_frozen (MetaCompositor *compositor,
+ MetaWindow *window,
+ gboolean updates_frozen)
{
}
@@ -3460,7 +3460,7 @@ meta_compositor_xrender_class_init (MetaCompositorXRenderClass *xrender_class)
compositor_class->remove_window = meta_compositor_xrender_remove_window;
compositor_class->show_window = meta_compositor_xrender_show_window;
compositor_class->hide_window = meta_compositor_xrender_hide_window;
- compositor_class->set_updates = meta_compositor_xrender_set_updates;
+ compositor_class->set_updates_frozen = meta_compositor_xrender_set_updates_frozen;
compositor_class->process_event = meta_compositor_xrender_process_event;
compositor_class->get_window_surface = meta_compositor_xrender_get_window_surface;
compositor_class->set_active_window = meta_compositor_xrender_set_active_window;
diff --git a/src/compositor/meta-compositor.c b/src/compositor/meta-compositor.c
index ea71479..29244d6 100644
--- a/src/compositor/meta-compositor.c
+++ b/src/compositor/meta-compositor.c
@@ -242,15 +242,15 @@ meta_compositor_hide_window (MetaCompositor *compositor,
}
void
-meta_compositor_set_updates (MetaCompositor *compositor,
- MetaWindow *window,
- gboolean updates)
+meta_compositor_set_updates_frozen (MetaCompositor *compositor,
+ MetaWindow *window,
+ gboolean updates_frozen)
{
MetaCompositorClass *compositor_class;
compositor_class = META_COMPOSITOR_GET_CLASS (compositor);
- compositor_class->set_updates (compositor, window, updates);
+ compositor_class->set_updates_frozen (compositor, window, updates_frozen);
}
void
diff --git a/src/core/window-private.h b/src/core/window-private.h
index dd65195..e210270 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -337,6 +337,9 @@ struct _MetaWindow
/* if TRUE, window is attached to its parent */
guint attached : 1;
+ /* if TRUE, we are freezing updates during a resize */
+ guint updates_frozen_for_resize : 1;
+
/* if non-NULL, the bounds of the window frame */
cairo_region_t *frame_bounds;
@@ -717,4 +720,6 @@ gboolean meta_window_should_attach_to_parent (MetaWindow *window);
MetaFrameType meta_window_get_frame_type (MetaWindow *window);
+gboolean meta_window_updates_are_frozen (MetaWindow *window);
+
#endif
diff --git a/src/core/window.c b/src/core/window.c
index 301ebf3..3854a64 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -3532,6 +3532,36 @@ send_sync_request (MetaWindow *window)
g_get_current_time (&window->sync_request_time);
}
+/**
+ * meta_window_updates_are_frozen:
+ * @window: a #MetaWindow
+ *
+ * Gets whether the compositor should be updating the window contents;
+ * window content updates may be frozen at client request by setting
+ * an odd value in the extended _NET_WM_SYNC_REQUEST_COUNTER counter r
+ * by the window manager during a resize operation while waiting for
+ * the client to redraw.
+ *
+ * Return value: %TRUE if updates are currently frozen
+ */
+gboolean
+meta_window_updates_are_frozen (MetaWindow *window)
+{
+ return window->updates_frozen_for_resize;
+}
+
+static void
+meta_window_set_updates_frozen_for_resize (MetaWindow *window,
+ gboolean updates_frozen)
+{
+ if (updates_frozen != window->updates_frozen_for_resize)
+ {
+ window->updates_frozen_for_resize = updates_frozen;
+ meta_compositor_set_updates_frozen (window->display->compositor, window,
+ meta_window_updates_are_frozen (window));
+ }
+}
+
static gboolean
maybe_move_attached_dialog (MetaWindow *window,
void *data)
@@ -3942,7 +3972,7 @@ meta_window_move_resize_internal (MetaWindow *window,
window->sync_request_time.tv_sec == 0)
{
/* turn off updating */
- meta_compositor_set_updates (window->display->compositor, window, FALSE);
+ meta_window_set_updates_frozen_for_resize (window, TRUE);
send_sync_request (window);
}
@@ -7792,7 +7822,7 @@ update_resize (MetaWindow *window,
}
/* If we get here, it means the client should have redrawn itself */
- meta_compositor_set_updates (window->display->compositor, window, TRUE);
+ meta_window_set_updates_frozen_for_resize (window, FALSE);
/* Remove any scheduled compensation events */
if (window->display->grab_resize_timeout_id)
@@ -8078,7 +8108,7 @@ meta_window_handle_mouse_grab_op_event (MetaWindow *window,
event->xbutton.y_root,
TRUE);
- meta_compositor_set_updates (window->display->compositor, window, TRUE);
+ meta_window_set_updates_frozen_for_resize (window, FALSE);
/* If a tiled window has been dragged free with a
* mouse resize without snapping back to the tiled
diff --git a/src/include/meta-compositor.h b/src/include/meta-compositor.h
index 0d4d2fd..8d722db 100644
--- a/src/include/meta-compositor.h
+++ b/src/include/meta-compositor.h
@@ -63,9 +63,9 @@ void meta_compositor_hide_window (MetaCompositor *composi
MetaWindow *window,
MetaEffectType effect);
-void meta_compositor_set_updates (MetaCompositor *compositor,
+void meta_compositor_set_updates_frozen (MetaCompositor *compositor,
MetaWindow *window,
- gboolean updates);
+ gboolean updates_frozen);
void meta_compositor_process_event (MetaCompositor *compositor,
XEvent *event,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]