[mutter/gbsneto/cleanup-x11-from-meta-window: 5/5] window-x11: Cleanup header and shuffle function locations



commit c70b078ec18e6b63e1f1c2d5186a40a85c40a39b
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Sat Dec 22 23:46:15 2018 -0200

    window-x11: Cleanup header and shuffle function locations
    
    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

 src/x11/window-x11.c | 182 +++++++++++++++++++++++++--------------------------
 src/x11/window-x11.h |   2 -
 2 files changed, 91 insertions(+), 93 deletions(-)
---
diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c
index 6e67b56b1..e6ca36364 100644
--- a/src/x11/window-x11.c
+++ b/src/x11/window-x11.c
@@ -510,6 +510,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)
 {
@@ -3559,97 +3650,6 @@ meta_window_x11_set_allowed_actions_hint (MetaWindow *window)
 #undef MAX_N_ACTIONS
 }
 
-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 5c21145a3..4f3f71b57 100644
--- a/src/x11/window-x11.h
+++ b/src/x11/window-x11.h
@@ -53,8 +53,6 @@ void meta_window_x11_set_net_wm_state            (MetaWindow *window);
 void meta_window_x11_set_wm_state                (MetaWindow *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);
 


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