summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2018-12-22 23:46:15 -0200
committerJonas Ã…dahl <jadahl@gmail.com>2019-02-13 08:05:49 +0000
commit0c4fdb2d31fd7be251acdfc2116764d9673371d6 (patch)
tree5d443b037e488c63346597e1edb6c190b72d1f9b
parent4504a313f79beca8034c71076b2c76e15c3c63c0 (diff)
downloadmutter-gbsneto/cleanup-x11-from-meta-window.tar.gz
window-x11: Cleanup header and shuffle function locationsgbsneto/cleanup-x11-from-meta-window
The functions meta_window_x11_create_sync_request_alarm() and meta_window_x11_destroy_sync_request_alarm() are not used outside MetaWindowX11 now, and don't need to be exposed in window-x11.h Remove them from window-x11.h and shuffle these functions to before their first usage, to avoid having to add their prototypes. https://gitlab.gnome.org/GNOME/mutter/merge_requests/372
-rw-r--r--src/x11/window-x11.c182
-rw-r--r--src/x11/window-x11.h2
2 files changed, 91 insertions, 93 deletions
diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c
index 167c22dfe..cefeca4b2 100644
--- a/src/x11/window-x11.c
+++ b/src/x11/window-x11.c
@@ -511,6 +511,97 @@ meta_window_apply_session_info (MetaWindow *window,
}
static void
+meta_window_x11_create_sync_request_alarm (MetaWindow *window)
+{
+ MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
+ MetaWindowX11Private *priv =
+ meta_window_x11_get_instance_private (window_x11);
+ MetaX11Display *x11_display = window->display->x11_display;
+ XSyncAlarmAttributes values;
+ XSyncValue init;
+
+ if (priv->sync_request_counter == None ||
+ priv->sync_request_alarm != None)
+ return;
+
+ meta_x11_error_trap_push (x11_display);
+
+ /* In the new (extended style), the counter value is initialized by
+ * the client before mapping the window. In the old style, we're
+ * responsible for setting the initial value of the counter.
+ */
+ if (priv->extended_sync_request_counter)
+ {
+ if (!XSyncQueryCounter(x11_display->xdisplay,
+ priv->sync_request_counter,
+ &init))
+ {
+ meta_x11_error_trap_pop_with_return (x11_display);
+ priv->sync_request_counter = None;
+ return;
+ }
+
+ priv->sync_request_serial =
+ XSyncValueLow32 (init) + ((gint64)XSyncValueHigh32 (init) << 32);
+ }
+ else
+ {
+ XSyncIntToValue (&init, 0);
+ XSyncSetCounter (x11_display->xdisplay,
+ priv->sync_request_counter, init);
+ priv->sync_request_serial = 0;
+ }
+
+ values.trigger.counter = priv->sync_request_counter;
+ values.trigger.test_type = XSyncPositiveComparison;
+
+ /* Initialize to one greater than the current value */
+ values.trigger.value_type = XSyncRelative;
+ XSyncIntToValue (&values.trigger.wait_value, 1);
+
+ /* After triggering, increment test_value by this until
+ * until the test condition is false */
+ XSyncIntToValue (&values.delta, 1);
+
+ /* we want events (on by default anyway) */
+ values.events = True;
+
+ priv->sync_request_alarm = XSyncCreateAlarm (x11_display->xdisplay,
+ XSyncCACounter |
+ XSyncCAValueType |
+ XSyncCAValue |
+ XSyncCATestType |
+ XSyncCADelta |
+ XSyncCAEvents,
+ &values);
+
+ if (meta_x11_error_trap_pop_with_return (x11_display) == Success)
+ meta_x11_display_register_sync_alarm (x11_display, &priv->sync_request_alarm, window);
+ else
+ {
+ priv->sync_request_alarm = None;
+ priv->sync_request_counter = None;
+ }
+}
+
+static void
+meta_window_x11_destroy_sync_request_alarm (MetaWindow *window)
+{
+ MetaWindowX11Private *priv =
+ meta_window_x11_get_instance_private (META_WINDOW_X11 (window));
+ MetaX11Display *x11_display = window->display->x11_display;
+
+ if (priv->sync_request_alarm != None)
+ {
+ /* Has to be unregistered _before_ clearing the structure field */
+ meta_x11_display_unregister_sync_alarm (x11_display, priv->sync_request_alarm);
+ XSyncDestroyAlarm (x11_display->xdisplay,
+ priv->sync_request_alarm);
+ priv->sync_request_alarm = None;
+ }
+}
+
+static void
meta_window_x11_manage (MetaWindow *window)
{
MetaDisplay *display = window->display;
@@ -3622,97 +3713,6 @@ meta_window_x11_set_allowed_actions_hint (MetaWindow *window)
}
void
-meta_window_x11_create_sync_request_alarm (MetaWindow *window)
-{
- MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
- MetaWindowX11Private *priv =
- meta_window_x11_get_instance_private (window_x11);
- MetaX11Display *x11_display = window->display->x11_display;
- XSyncAlarmAttributes values;
- XSyncValue init;
-
- if (priv->sync_request_counter == None ||
- priv->sync_request_alarm != None)
- return;
-
- meta_x11_error_trap_push (x11_display);
-
- /* In the new (extended style), the counter value is initialized by
- * the client before mapping the window. In the old style, we're
- * responsible for setting the initial value of the counter.
- */
- if (priv->extended_sync_request_counter)
- {
- if (!XSyncQueryCounter(x11_display->xdisplay,
- priv->sync_request_counter,
- &init))
- {
- meta_x11_error_trap_pop_with_return (x11_display);
- priv->sync_request_counter = None;
- return;
- }
-
- priv->sync_request_serial =
- XSyncValueLow32 (init) + ((gint64)XSyncValueHigh32 (init) << 32);
- }
- else
- {
- XSyncIntToValue (&init, 0);
- XSyncSetCounter (x11_display->xdisplay,
- priv->sync_request_counter, init);
- priv->sync_request_serial = 0;
- }
-
- values.trigger.counter = priv->sync_request_counter;
- values.trigger.test_type = XSyncPositiveComparison;
-
- /* Initialize to one greater than the current value */
- values.trigger.value_type = XSyncRelative;
- XSyncIntToValue (&values.trigger.wait_value, 1);
-
- /* After triggering, increment test_value by this until
- * until the test condition is false */
- XSyncIntToValue (&values.delta, 1);
-
- /* we want events (on by default anyway) */
- values.events = True;
-
- priv->sync_request_alarm = XSyncCreateAlarm (x11_display->xdisplay,
- XSyncCACounter |
- XSyncCAValueType |
- XSyncCAValue |
- XSyncCATestType |
- XSyncCADelta |
- XSyncCAEvents,
- &values);
-
- if (meta_x11_error_trap_pop_with_return (x11_display) == Success)
- meta_x11_display_register_sync_alarm (x11_display, &priv->sync_request_alarm, window);
- else
- {
- priv->sync_request_alarm = None;
- priv->sync_request_counter = None;
- }
-}
-
-void
-meta_window_x11_destroy_sync_request_alarm (MetaWindow *window)
-{
- MetaWindowX11Private *priv =
- meta_window_x11_get_instance_private (META_WINDOW_X11 (window));
- MetaX11Display *x11_display = window->display->x11_display;
-
- if (priv->sync_request_alarm != None)
- {
- /* Has to be unregistered _before_ clearing the structure field */
- meta_x11_display_unregister_sync_alarm (x11_display, priv->sync_request_alarm);
- XSyncDestroyAlarm (x11_display->xdisplay,
- priv->sync_request_alarm);
- priv->sync_request_alarm = None;
- }
-}
-
-void
meta_window_x11_update_sync_request_counter (MetaWindow *window,
gint64 new_counter_value)
{
diff --git a/src/x11/window-x11.h b/src/x11/window-x11.h
index 1af55a83f..0e5df2775 100644
--- a/src/x11/window-x11.h
+++ b/src/x11/window-x11.h
@@ -59,8 +59,6 @@ void meta_window_x11_set_wm_delete_window (MetaWindow *window,
gboolean delete_window);
void meta_window_x11_set_allowed_actions_hint (MetaWindow *window);
-void meta_window_x11_create_sync_request_alarm (MetaWindow *window);
-void meta_window_x11_destroy_sync_request_alarm (MetaWindow *window);
void meta_window_x11_update_sync_request_counter (MetaWindow *window,
gint64 new_counter_value);