[Xfce4-commits] [xfce/xfce4-settings] 01/01: Fix gtk 3.22 deprecations (Bug 14273)

noreply at xfce.org noreply at xfce.org
Thu Mar 15 02:24:45 CET 2018


This is an automated email from the git hooks/post-receive script.

b   l   u   e   s   a   b   r   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository xfce/xfce4-settings.

commit c6c7ca212de9d4fa93d3cd05b22a4a3c8bfaec0c
Author: Sean Davis <smd.seandavis at gmail.com>
Date:   Wed Mar 14 21:23:32 2018 -0400

    Fix gtk 3.22 deprecations (Bug 14273)
    
    Original patch by Andre Miranda. Made several adjustments to get Xfce Settings 4.13 building on Ubuntu 18.04 without disabling debug.
---
 dialogs/display-settings/main.c                    |  6 +-
 dialogs/mouse-settings/main.c                      | 40 ++++++------
 xfce4-settings-editor/xfce-settings-editor-box.c   |  2 +-
 xfce4-settings-editor/xfce-settings-prop-dialog.c  |  2 +-
 .../xfce-settings-manager-dialog.c                 |  2 +-
 xfsettingsd/accessibility.c                        |  4 +-
 xfsettingsd/clipboard-manager.c                    | 20 +++---
 xfsettingsd/displays.c                             | 46 +++++++-------
 xfsettingsd/keyboards.c                            | 20 +++---
 xfsettingsd/pointers.c                             | 72 +++++++++++-----------
 xfsettingsd/workspaces.c                           | 12 ++--
 xfsettingsd/xsettings.c                            | 12 ++--
 12 files changed, 121 insertions(+), 117 deletions(-)

diff --git a/dialogs/display-settings/main.c b/dialogs/display-settings/main.c
index 629b27d..4649a89 100644
--- a/dialogs/display-settings/main.c
+++ b/dialogs/display-settings/main.c
@@ -2284,7 +2284,7 @@ on_output_event (FooScrollArea      *area,
     if (event->type == FOO_MOTION_OUTSIDE)
         return;
 
-    if (!mirrored == 1 && get_n_connected() > 1)
+    if (!mirrored && get_n_connected() > 1)
         set_cursor (GTK_WIDGET (area), GDK_FLEUR);
 
     if (event->type == FOO_BUTTON_PRESS)
@@ -2293,7 +2293,7 @@ on_output_event (FooScrollArea      *area,
 
         gtk_combo_box_set_active (GTK_COMBO_BOX(randr_outputs_combobox), output->id);
 
-        if (!mirrored == 1 && get_n_connected() > 1)
+        if (!mirrored && get_n_connected() > 1)
         {
             foo_scroll_area_begin_grab (area, on_output_event, data);
 
@@ -2658,7 +2658,7 @@ on_area_paint (FooScrollArea  *area,
         i = g_list_position (connected_outputs, list);
         /* Always paint the currently selected display last, i.e. on top, so it's
            visible and the name is readable */
-        if (i == active_output) {
+        if (i >= 0 && (guint)i == active_output) {
             continue;
         }
         paint_output (cr, i, &x, &y);
diff --git a/dialogs/mouse-settings/main.c b/dialogs/mouse-settings/main.c
index aea9cfa..b32ca1d 100644
--- a/dialogs/mouse-settings/main.c
+++ b/dialogs/mouse-settings/main.c
@@ -613,11 +613,11 @@ mouse_settings_get_device_prop (Display     *xdisplay,
     prop = XInternAtom (xdisplay, prop_name, False);
     float_type = XInternAtom (xdisplay, "FLOAT", False);
 
-    gdk_error_trap_push ();
+    gdk_x11_display_error_trap_push (gdk_display_get_default ());
     rc = XGetDeviceProperty (xdisplay, device, prop, 0, 1, False,
                              type, &type_ret, &format, &n_items_ret,
                              &bytes_after, &data);
-    gdk_error_trap_pop_ignored ();
+    gdk_x11_display_error_trap_pop_ignored (gdk_display_get_default ());
     if (rc == Success && type_ret == type && n_items_ret >= n_items)
     {
         success = TRUE;
@@ -750,12 +750,12 @@ mouse_settings_device_get_int_property (XDevice *device,
     gint     val = -1;
     gint     res;
 
-    gdk_error_trap_push ();
+    gdk_x11_display_error_trap_push (gdk_display_get_default ());
     res = XGetDeviceProperty (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()),
                               device, prop, 0, 1000, False,
                               AnyPropertyType, &type, &format,
                               &n_items, &bytes_after, &data);
-    if (gdk_error_trap_pop () == 0 && res == Success)
+    if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) == 0 && res == Success)
     {
         if (type == XA_INTEGER)
         {
@@ -801,9 +801,9 @@ mouse_settings_device_get_selected (GtkBuilder  *builder,
         if (device != NULL)
         {
             /* open the device */
-            gdk_error_trap_push ();
+            gdk_x11_display_error_trap_push (gdk_display_get_default ());
             *device = XOpenDevice (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), xid);
-            if (gdk_error_trap_pop () != 0 || *device == NULL)
+            if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) != 0 || *device == NULL)
             {
                 g_critical ("Unable to open device %ld", xid);
                 *device = NULL;
@@ -916,12 +916,12 @@ mouse_settings_synaptics_set_tap_to_click (GtkBuilder *builder)
         object = gtk_builder_get_object (builder, "synaptics-tap-to-click");
         tap_to_click = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (object));
 
-        gdk_error_trap_push ();
+        gdk_x11_display_error_trap_push (gdk_display_get_default ());
         tap_ation_prop = XInternAtom (xdisplay, "Synaptics Tap Action", True);
         res = XGetDeviceProperty (xdisplay, device, tap_ation_prop, 0, 1000, False,
                                   AnyPropertyType, &type, &format,
                                   &n_items, &bytes_after, &data);
-        if (gdk_error_trap_pop () == 0
+        if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) == 0
             && res == Success)
         {
             if (type == XA_INTEGER
@@ -1213,9 +1213,9 @@ mouse_settings_device_selection_changed (GtkBuilder *builder)
     /* get the selected item */
     if (mouse_settings_device_get_selected (builder, &device, NULL))
     {
-        gdk_error_trap_push ();
+        gdk_x11_display_error_trap_push (gdk_display_get_default ());
         device_info = XListInputDevices (xdisplay, &ndevices);
-        if (gdk_error_trap_pop () == 0 && device_info != NULL)
+        if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) == 0 && device_info != NULL)
         {
             /* find mode and number of buttons */
             for (i = 0; i < ndevices; i++)
@@ -1251,9 +1251,9 @@ mouse_settings_device_selection_changed (GtkBuilder *builder)
             if (nbuttons > 0)
             {
                 buttonmap = g_new0 (guchar, nbuttons);
-                gdk_error_trap_push ();
+                gdk_x11_display_error_trap_push (gdk_display_get_default ());
                 XGetDeviceButtonMapping (xdisplay, device, buttonmap, nbuttons);
-                if (gdk_error_trap_pop () != 0)
+                if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) != 0)
                     g_critical ("Failed to get button map");
 
                 /* figure out the position of the first and second/third button in the map */
@@ -1282,9 +1282,9 @@ mouse_settings_device_selection_changed (GtkBuilder *builder)
 #endif /* HAVE_LIBINPUT */
         {
             /* get the feedback states for this device */
-            gdk_error_trap_push ();
+            gdk_x11_display_error_trap_push (gdk_display_get_default ());
             states = XGetFeedbackControl (xdisplay, device, &nstates);
-            if (gdk_error_trap_pop () != 0 || states == NULL)
+            if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) != 0 || states == NULL)
             {
                  g_critical ("Failed to get feedback states");
             }
@@ -1325,9 +1325,9 @@ mouse_settings_device_selection_changed (GtkBuilder *builder)
         wacom_rotation_prop = XInternAtom (xdisplay, "Wacom Rotation", True);
 
         /* check if this is a synaptics or wacom device */
-        gdk_error_trap_push ();
+        gdk_x11_display_error_trap_push (gdk_display_get_default ());
         props = XListDeviceProperties (xdisplay, device, &nprops);
-        if (gdk_error_trap_pop () == 0 && props != NULL)
+        if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) == 0 && props != NULL)
         {
             for (i = 0; i < nprops; i++)
             {
@@ -1652,9 +1652,9 @@ mouse_settings_device_populate_store (GtkBuilder *builder,
     }
 
     /* get all the registered devices */
-    gdk_error_trap_push ();
+    gdk_x11_display_error_trap_push (gdk_display_get_default ());
     device_list = XListInputDevices (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), &ndevices);
-    if (gdk_error_trap_pop () != 0 || device_list == NULL)
+    if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) != 0 || device_list == NULL)
     {
         g_message ("No devices found");
         goto bailout;
@@ -1813,10 +1813,10 @@ mouse_settings_create_event_filter (GtkBuilder *builder)
     XEventClass  event_class;
 
     /* monitor device change events */
-    gdk_error_trap_push ();
+    gdk_x11_display_error_trap_push (gdk_display_get_default ());
     DevicePresence (xdisplay, device_presence_event_type, event_class);
     XSelectExtensionEvent (xdisplay, RootWindow (xdisplay, DefaultScreen (xdisplay)), &event_class, 1);
-    if (gdk_error_trap_pop () != 0)
+    if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) != 0)
     {
         g_critical ("Failed to setup the device event filter");
         return;
diff --git a/xfce4-settings-editor/xfce-settings-editor-box.c b/xfce4-settings-editor/xfce-settings-editor-box.c
index 9b2a271..cffe4c6 100644
--- a/xfce4-settings-editor/xfce-settings-editor-box.c
+++ b/xfce4-settings-editor/xfce-settings-editor-box.c
@@ -728,7 +728,7 @@ xfce_settings_editor_box_properties_load (XfceSettingsEditorBox *self,
 
     gtk_tree_store_clear (self->props_store);
 
-    self->props_channel = g_object_ref (G_OBJECT (channel));
+    self->props_channel = (XfconfChannel *) g_object_ref (G_OBJECT (channel));
 
     props = xfconf_channel_get_properties (channel, NULL);
     if (G_LIKELY (props != NULL))
diff --git a/xfce4-settings-editor/xfce-settings-prop-dialog.c b/xfce4-settings-editor/xfce-settings-prop-dialog.c
index 79ea426..63f5c2c 100644
--- a/xfce4-settings-editor/xfce-settings-prop-dialog.c
+++ b/xfce4-settings-editor/xfce-settings-prop-dialog.c
@@ -646,7 +646,7 @@ xfce_settings_prop_dialog_new (GtkWindow     *parent,
 
     dialog = g_object_new (XFCE_TYPE_SETTINGS_PROP_DIALOG, NULL);
 
-    dialog->channel = g_object_ref (G_OBJECT (channel));
+    dialog->channel = (XfconfChannel *) g_object_ref (G_OBJECT (channel));
 
     if (property != NULL)
     {
diff --git a/xfce4-settings-manager/xfce-settings-manager-dialog.c b/xfce4-settings-manager/xfce-settings-manager-dialog.c
index f74f818..b501623 100644
--- a/xfce4-settings-manager/xfce-settings-manager-dialog.c
+++ b/xfce4-settings-manager/xfce-settings-manager-dialog.c
@@ -1066,7 +1066,7 @@ xfce_settings_manager_dialog_add_category (XfceSettingsManagerDialog *dialog,
     DialogCategory  *category;
 
     category = g_slice_new0 (DialogCategory);
-    category->directory = g_object_ref (G_OBJECT (directory));
+    category->directory = (GarconMenuDirectory *) g_object_ref (G_OBJECT (directory));
     category->dialog = dialog;
 
     /* filter category from main store */
diff --git a/xfsettingsd/accessibility.c b/xfsettingsd/accessibility.c
index 30da3ca..eb5bb9c 100644
--- a/xfsettingsd/accessibility.c
+++ b/xfsettingsd/accessibility.c
@@ -175,7 +175,7 @@ xfce_accessibility_helper_set_xkb (XfceAccessibilityHelper *helper,
     gint       delay, interval, time_to_max;
     gint       max_speed, curve;
 
-    gdk_error_trap_push ();
+    gdk_x11_display_error_trap_push (gdk_display_get_default ());
 
     /* allocate */
     xkb = XkbAllocKeyboard ();
@@ -361,7 +361,7 @@ xfce_accessibility_helper_set_xkb (XfceAccessibilityHelper *helper,
         g_critical ("XkbAllocKeyboard() returned a null pointer");
     }
 
-    if (gdk_error_trap_pop () != 0)
+    if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) != 0)
        g_critical ("Failed to set keyboard controls");
 }
 
diff --git a/xfsettingsd/clipboard-manager.c b/xfsettingsd/clipboard-manager.c
index ce7533f..e620fab 100644
--- a/xfsettingsd/clipboard-manager.c
+++ b/xfsettingsd/clipboard-manager.c
@@ -180,7 +180,7 @@ send_selection_notify (GsdClipboardManager *manager,
         notify.property = success ? manager->priv->property : None;
         notify.time = manager->priv->time;
 
-        gdk_error_trap_push ();
+        gdk_x11_display_error_trap_push (gdk_display_get_default ());
 
         XSendEvent (manager->priv->display,
                     manager->priv->requestor,
@@ -189,7 +189,7 @@ send_selection_notify (GsdClipboardManager *manager,
                     (XEvent *)&notify);
         XSync (manager->priv->display, False);
 
-        if (gdk_error_trap_pop () != 0)
+        if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) != 0)
         {
                 g_critical ("Failed to notify clipboard selection");
         }
@@ -212,14 +212,14 @@ finish_selection_request (GsdClipboardManager *manager,
         notify.property = success ? xev->xselectionrequest.property : None;
         notify.time = xev->xselectionrequest.time;
 
-        gdk_error_trap_push ();
+        gdk_x11_display_error_trap_push (gdk_display_get_default ());
 
         XSendEvent (xev->xselectionrequest.display,
                     xev->xselectionrequest.requestor,
                     False, NoEventMask, (XEvent *) &notify);
         XSync (manager->priv->display, False);
 
-        if (gdk_error_trap_pop () != 0)
+        if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) != 0)
         {
                 g_critical ("Failed to send selection request");
         }
@@ -464,7 +464,7 @@ convert_clipboard_manager (GsdClipboardManager *manager,
                          */
                         finish_selection_request (manager, xev, False);
                 } else {
-                        gdk_error_trap_push ();
+                        gdk_x11_display_error_trap_push (gdk_display_get_default ());
 
                         clipboard_manager_watch_cb (manager,
                                                     xev->xselectionrequest.requestor,
@@ -476,10 +476,10 @@ convert_clipboard_manager (GsdClipboardManager *manager,
                                       StructureNotifyMask);
                         XSync (manager->priv->display, False);
 
-                        if (gdk_error_trap_pop () != Success)
+                        if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) != Success)
                                 return;
 
-                        gdk_error_trap_push ();
+                        gdk_x11_display_error_trap_push (gdk_display_get_default ());
 
                         if (xev->xselectionrequest.property != None) {
                                 XGetWindowProperty (manager->priv->display,
@@ -489,7 +489,7 @@ convert_clipboard_manager (GsdClipboardManager *manager,
                                                     &type, &format, &nitems, &remaining,
                                                     (guchar **) &targets);
 
-                                if (gdk_error_trap_pop () != Success) {
+                                if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) != Success) {
                                         if (targets)
                                                 XFree (targets);
 
@@ -592,7 +592,7 @@ convert_clipboard_target (IncrConversion      *rdata,
                         /* start incremental transfer */
                         rdata->offset = 0;
 
-                        gdk_error_trap_push ();
+                        gdk_x11_display_error_trap_push (gdk_display_get_default ());
 
                         XGetWindowAttributes (manager->priv->display, rdata->requestor, &atts);
                         XSelectInput (manager->priv->display, rdata->requestor,
@@ -605,7 +605,7 @@ convert_clipboard_target (IncrConversion      *rdata,
 
                         XSync (manager->priv->display, False);
 
-                        if (gdk_error_trap_pop () != 0)
+                        if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) != 0)
                         {
                                 g_critical ("Failed to transfer clipboard contents");
                         }
diff --git a/xfsettingsd/displays.c b/xfsettingsd/displays.c
index 146014b..b45d679 100644
--- a/xfsettingsd/displays.c
+++ b/xfsettingsd/displays.c
@@ -227,12 +227,12 @@ xfce_displays_helper_init (XfceDisplaysHelper *helper)
         if (XRRQueryVersion (helper->xdisplay, &major, &minor)
             && (major > 1 || (major == 1 && minor >= 2)))
         {
-            gdk_error_trap_push ();
+            gdk_x11_display_error_trap_push (gdk_display_get_default ());
             /* get the screen resource */
             helper->resources = XRRGetScreenResources (helper->xdisplay,
                                                        GDK_WINDOW_XID (helper->root_window));
-            gdk_flush ();
-            err = gdk_error_trap_pop ();
+            gdk_display_flush (gdk_display_get_default ());
+            err = gdk_x11_display_error_trap_pop (gdk_display_get_default ());
             if (err)
             {
                 g_critical ("XRRGetScreenResources failed (err: %d). "
@@ -348,10 +348,10 @@ xfce_displays_helper_finalize (GObject *object)
     /* Free the screen resources */
     if (helper->resources)
     {
-        gdk_error_trap_push ();
+        gdk_x11_display_error_trap_push (gdk_display_get_default ());
         XRRFreeScreenResources (helper->resources);
-        gdk_flush ();
-        if (gdk_error_trap_pop () != 0)
+        gdk_display_flush (gdk_display_get_default ());
+        if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) != 0)
         {
             g_critical ("Failed to free screen resources");
         }
@@ -374,7 +374,7 @@ xfce_displays_helper_reload (XfceDisplaysHelper *helper)
     g_ptr_array_unref (helper->outputs);
     g_ptr_array_unref (helper->crtcs);
 
-    gdk_error_trap_push ();
+    gdk_x11_display_error_trap_push (gdk_display_get_default ());
 
     /* Free the screen resources */
     XRRFreeScreenResources (helper->resources);
@@ -392,8 +392,8 @@ xfce_displays_helper_reload (XfceDisplaysHelper *helper)
     helper->resources = XRRGetScreenResources (helper->xdisplay,
                                                GDK_WINDOW_XID (helper->root_window));
 
-    gdk_flush ();
-    err = gdk_error_trap_pop ();
+    gdk_display_flush (gdk_display_get_default ());
+    err = gdk_x11_display_error_trap_pop (gdk_display_get_default ());
     if (err)
         g_critical ("Failed to reload the RandR cache (err: %d).", err);
 
@@ -506,7 +506,9 @@ xfce_displays_helper_screen_on_event (GdkXEvent *xevent,
                         {
                             crtc->mode = output->preferred_mode;
                             crtc->rotation = RR_Rotate_0;
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
                             if ((crtc->x > gdk_screen_width() + 1) || (crtc->y > gdk_screen_height() + 1)) {
+G_GNUC_END_IGNORE_DEPRECATIONS
                                 crtc->x = crtc->y = 0;
                             } /* else - leave values from last time we saw the monitor */
                             /* set width and height */
@@ -828,10 +830,10 @@ xfce_displays_helper_list_outputs (XfceDisplaysHelper *helper)
     outputs = g_ptr_array_new_with_free_func ((GDestroyNotify) xfce_displays_helper_free_output);
     for (n = 0; n < helper->resources->noutput; ++n)
     {
-        gdk_error_trap_push ();
+        gdk_x11_display_error_trap_push (gdk_display_get_default ());
         output_info = XRRGetOutputInfo (helper->xdisplay, helper->resources, helper->resources->outputs[n]);
-        gdk_flush ();
-        err = gdk_error_trap_pop ();
+        gdk_display_flush (gdk_display_get_default ());
+        err = gdk_x11_display_error_trap_pop (gdk_display_get_default ());
         if (err || !output_info)
         {
             g_warning ("Failed to load info for output %lu (err: %d). Skipping.",
@@ -906,10 +908,10 @@ xfce_displays_helper_free_output (XfceRROutput *output)
     if (output == NULL)
         return;
 
-    gdk_error_trap_push ();
+    gdk_x11_display_error_trap_push (gdk_display_get_default ());
     XRRFreeOutputInfo (output->info);
-    gdk_flush ();
-    if (gdk_error_trap_pop () != 0)
+    gdk_display_flush (gdk_display_get_default ());
+    if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) != 0)
     {
         g_critical ("Failed to free output info");
     }
@@ -934,10 +936,10 @@ xfce_displays_helper_list_crtcs (XfceDisplaysHelper *helper)
     {
         xfsettings_dbg (XFSD_DEBUG_DISPLAYS, "Detected CRTC %lu.", helper->resources->crtcs[n]);
 
-        gdk_error_trap_push ();
+        gdk_x11_display_error_trap_push (gdk_display_get_default ());
         crtc_info = XRRGetCrtcInfo (helper->xdisplay, helper->resources, helper->resources->crtcs[n]);
-        gdk_flush ();
-        err = gdk_error_trap_pop ();
+        gdk_display_flush (gdk_display_get_default ());
+        err = gdk_x11_display_error_trap_pop (gdk_display_get_default ());
         if (err || !crtc_info)
         {
             g_warning ("Failed to load info for CRTC %lu (err: %d). Skipping.",
@@ -1232,7 +1234,7 @@ xfce_displays_helper_apply_all (XfceDisplaysHelper *helper)
     g_ptr_array_foreach (helper->crtcs, (GFunc) xfce_displays_helper_get_topleftmost_pos, helper);
     g_ptr_array_foreach (helper->crtcs, (GFunc) xfce_displays_helper_normalize_crtc, helper);
 
-    gdk_error_trap_push ();
+    gdk_x11_display_error_trap_push (gdk_display_get_default ());
 
     /* grab server to prevent clients from thinking no output is enabled */
     gdk_x11_display_grab (helper->display);
@@ -1254,8 +1256,8 @@ xfce_displays_helper_apply_all (XfceDisplaysHelper *helper)
 
     /* release the grab, changes are done */
     gdk_x11_display_ungrab (helper->display);
-    gdk_flush ();
-    if (gdk_error_trap_pop () != 0)
+    gdk_display_flush (gdk_display_get_default ());
+    if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) != 0)
     {
         g_critical ("Failed to apply display settings");
     }
@@ -1408,7 +1410,9 @@ xfce_displays_helper_toggle_internal (gpointer           *power,
                 return;
             crtc->mode = lvds->preferred_mode;
             crtc->rotation = RR_Rotate_0;
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
             if ((crtc->x > gdk_screen_width() + 1) || (crtc->y > gdk_screen_height() + 1)) {
+G_GNUC_END_IGNORE_DEPRECATIONS
                 crtc->x = crtc->y = 0;
             } /* else - leave values from last time we saw the monitor */
             /* set width and height */
diff --git a/xfsettingsd/keyboards.c b/xfsettingsd/keyboards.c
index 2617105..aa5c615 100644
--- a/xfsettingsd/keyboards.c
+++ b/xfsettingsd/keyboards.c
@@ -132,12 +132,12 @@ xfce_keyboards_helper_init (XfceKeyboardsHelper *helper)
         if (G_LIKELY (xdisplay != NULL))
         {
             /* monitor device changes */
-            gdk_error_trap_push ();
+            gdk_x11_display_error_trap_push (gdk_display_get_default ());
             DevicePresence (xdisplay, helper->device_presence_event_type, event_class);
             XSelectExtensionEvent (xdisplay, RootWindow (xdisplay, DefaultScreen (xdisplay)), &event_class, 1);
 
             /* add an event filter */
-            if (gdk_error_trap_pop () == 0)
+            if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) == 0)
                 gdk_window_add_filter (NULL, xfce_keyboards_helper_event_filter, helper);
             else
                 g_warning ("Failed to create device filter");
@@ -181,9 +181,9 @@ xfce_keyboards_helper_set_auto_repeat_mode (XfceKeyboardsHelper *helper)
     /* set key repeat */
     values.auto_repeat_mode = repeat ? 1 : 0;
 
-    gdk_error_trap_push ();
+    gdk_x11_display_error_trap_push (gdk_display_get_default ());
     XChangeKeyboardControl (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), KBAutoRepeatMode, &values);
-    if (gdk_error_trap_pop () != 0)
+    if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) != 0)
         g_critical ("Failed to change keyboard repeat mode");
 
     xfsettings_dbg (XFSD_DEBUG_KEYBOARDS, "set auto repeat %s", repeat ? "on" : "off");
@@ -201,7 +201,7 @@ xfce_keyboards_helper_set_repeat_rate (XfceKeyboardsHelper *helper)
     delay = xfconf_channel_get_int (helper->channel, "/Default/KeyRepeat/Delay", 500);
     rate = xfconf_channel_get_int (helper->channel, "/Default/KeyRepeat/Rate", 20);
 
-    gdk_error_trap_push ();
+    gdk_x11_display_error_trap_push (gdk_display_get_default ());
 
     /* allocate xkb structure */
     xkb = XkbAllocKeyboard ();
@@ -225,7 +225,7 @@ xfce_keyboards_helper_set_repeat_rate (XfceKeyboardsHelper *helper)
         XFree (xkb);
     }
 
-    if (gdk_error_trap_pop () != 0)
+    if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) != 0)
         g_critical ("Failed to change the keyboard repeat");
 }
 
@@ -266,13 +266,13 @@ xfce_keyboards_helper_restore_numlock_state (XfconfChannel *channel)
     {
         state = xfconf_channel_get_bool (channel, "/Default/Numlock", FALSE);
 
-        gdk_error_trap_push ();
+        gdk_x11_display_error_trap_push (gdk_display_get_default ());
 
         dpy = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
         numlock_mask = XkbKeysymToModifiers (dpy, XK_Num_Lock);
         XkbLockModifiers (dpy, XkbUseCoreKbd, numlock_mask, state ? numlock_mask : 0);
 
-        if (gdk_error_trap_pop () != 0)
+        if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) != 0)
             g_critical ("Failed to change numlock modifier");
 
         xfsettings_dbg (XFSD_DEBUG_KEYBOARDS, "set numlock %s", state ? "on" : "off");
@@ -292,13 +292,13 @@ xfce_keyboards_helper_save_numlock_state (XfconfChannel *channel)
     Bool     numlock_state;
     Atom     numlock;
 
-    gdk_error_trap_push ();
+    gdk_x11_display_error_trap_push (gdk_display_get_default ());
 
     dpy = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
     numlock = XInternAtom(dpy, "Num Lock", False);
     XkbGetNamedIndicator (dpy, numlock, NULL, &numlock_state, NULL, NULL);
 
-    if (gdk_error_trap_pop () != 0)
+    if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) != 0)
         g_critical ("Failed to get numlock state");
 
     xfsettings_dbg (XFSD_DEBUG_KEYBOARDS, "save numlock %s", numlock_state ? "on" : "off");
diff --git a/xfsettingsd/pointers.c b/xfsettingsd/pointers.c
index 05ef03b..86b551f 100644
--- a/xfsettingsd/pointers.c
+++ b/xfsettingsd/pointers.c
@@ -177,12 +177,12 @@ xfce_pointers_helper_init (XfcePointersHelper *helper)
         if (G_LIKELY (xdisplay != NULL))
         {
             /* monitor device changes */
-            gdk_error_trap_push ();
+            gdk_x11_display_error_trap_push (gdk_display_get_default ());
             DevicePresence (xdisplay, helper->device_presence_event_type, event_class);
             XSelectExtensionEvent (xdisplay, RootWindow (xdisplay, DefaultScreen (xdisplay)), &event_class, 1);
 
             /* add an event filter */
-            if (gdk_error_trap_pop () == 0)
+            if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) == 0)
                 gdk_window_add_filter (NULL, xfce_pointers_helper_event_filter, helper);
             else
                 g_warning ("Failed to create device filter");
@@ -215,11 +215,11 @@ xfce_pointers_is_enabled (Display *xdisplay,
     gboolean enabled;
 
     prop = XInternAtom (xdisplay, DEVICE_ENABLED, False);
-    gdk_error_trap_push ();
+    gdk_x11_display_error_trap_push (gdk_display_get_default ());
     rc = XGetDeviceProperty (xdisplay, device, prop, 0, 1, False,
                              XA_INTEGER, &type, &format, &n_items,
                              &bytes_after, &data);
-    gdk_error_trap_pop_ignored ();
+    gdk_x11_display_error_trap_pop_ignored (gdk_display_get_default ());
     if (rc == Success)
     {
         enabled = (gboolean) *data;
@@ -242,11 +242,11 @@ xfce_pointers_is_libinput (Display *xdisplay,
     guchar  *data;
 
     prop = XInternAtom (xdisplay, LIBINPUT_PROP_LEFT_HANDED, False);
-    gdk_error_trap_push ();
+    gdk_x11_display_error_trap_push (gdk_display_get_default ());
     rc = XGetDeviceProperty (xdisplay, device, prop, 0, 1, False,
                              XA_INTEGER, &type, &format, &n_items,
                              &bytes_after, &data);
-    gdk_error_trap_pop_ignored ();
+    gdk_x11_display_error_trap_pop_ignored (gdk_display_get_default ());
     if (rc == Success)
     {
         XFree (data);
@@ -299,9 +299,9 @@ xfce_pointers_helper_syndaemon_check (XfcePointersHelper *helper)
     if (!xfconf_channel_get_bool (helper->channel, "/DisableTouchpadWhileTyping", FALSE))
         goto start_stop_daemon;
 
-    gdk_error_trap_push ();
+    gdk_x11_display_error_trap_push (gdk_display_get_default ());
     device_list = XListInputDevices (xdisplay, &ndevices);
-    if (gdk_error_trap_pop () != 0 || device_list == NULL)
+    if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) != 0 || device_list == NULL)
         goto start_stop_daemon;
 
     touchpad_type = XInternAtom (xdisplay, XI_TOUCHPAD, True);
@@ -313,18 +313,18 @@ xfce_pointers_helper_syndaemon_check (XfcePointersHelper *helper)
         if (device_list[n].type != touchpad_type)
             continue;
 
-        gdk_error_trap_push ();
+        gdk_x11_display_error_trap_push (gdk_display_get_default ());
         device = XOpenDevice (xdisplay, device_list[n].id);
-        if (gdk_error_trap_pop () != 0 || device == NULL)
+        if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) != 0 || device == NULL)
         {
             g_critical ("Unable to open device %s", device_list[n].name);
             break;
         }
 
         /* look for the Synaptics Off property */
-        gdk_error_trap_push ();
+        gdk_x11_display_error_trap_push (gdk_display_get_default ());
         props = XListDeviceProperties (xdisplay, device, &nprops);
-        if (gdk_error_trap_pop () == 0
+        if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) == 0
             && props != NULL)
         {
             for (i = 0; !have_synaptics && i < nprops; i++)
@@ -476,9 +476,9 @@ xfce_pointers_helper_change_button_mapping (XDeviceInfo *device_info,
     /* allocate the button map */
     buttonmap = g_new0 (guchar, num_buttons);
 
-    gdk_error_trap_push ();
+    gdk_x11_display_error_trap_push (gdk_display_get_default ());
     XGetDeviceButtonMapping (xdisplay, device, buttonmap, num_buttons);
-    if (gdk_error_trap_pop () != 0)
+    if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) != 0)
     {
         g_warning ("Failed to get button mapping");
         goto leave;
@@ -512,9 +512,9 @@ xfce_pointers_helper_change_button_mapping (XDeviceInfo *device_info,
     /* only set on changes */
     if (map_changed)
     {
-        gdk_error_trap_push ();
+        gdk_x11_display_error_trap_push (gdk_display_get_default ());
         XSetDeviceButtonMapping (xdisplay, device, buttonmap, num_buttons);
-        if (gdk_error_trap_pop () != 0)
+        if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) != 0)
             g_warning ("Failed to set button mapping");
 
         /* don't put a hard time on ourselves and make debugging a lot better */
@@ -579,9 +579,9 @@ xfce_pointers_helper_change_feedback (XDeviceInfo *device_info,
     }
 #endif /* HAVE_LIBINPUT */
     /* get the feedback states for this device */
-    gdk_error_trap_push ();
+    gdk_x11_display_error_trap_push (gdk_display_get_default ());
     states = XGetFeedbackControl (xdisplay, device, &num_feedbacks);
-    if (gdk_error_trap_pop() != 0 || states == NULL)
+    if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) != 0 || states == NULL)
     {
         g_critical ("Failed to get the feedback states of device %s",
                     device_info->name);
@@ -641,10 +641,10 @@ xfce_pointers_helper_change_feedback (XDeviceInfo *device_info,
         }
 
         /* update the feedback of the device */
-        gdk_error_trap_push ();
+        gdk_x11_display_error_trap_push (gdk_display_get_default ());
         XChangeFeedbackControl (xdisplay, device, mask,
                                 (XFeedbackControl *) &feedback);
-        if (gdk_error_trap_pop() != 0)
+        if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) != 0)
         {
             g_warning ("Failed to set feedback states for device %s",
                        device_info->name);
@@ -688,9 +688,9 @@ xfce_pointers_helper_change_mode (XDeviceInfo  *device_info,
         return;
     }
 
-    gdk_error_trap_push ();
+    gdk_x11_display_error_trap_push (gdk_display_get_default ());
     XSetDeviceMode (xdisplay, device, mode);
-    if (gdk_error_trap_pop () != 0)
+    if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) != 0)
         g_critical ("Failed to change the device mode");
 
     xfsettings_dbg (XFSD_DEBUG_POINTERS,
@@ -783,9 +783,9 @@ xfce_pointers_helper_change_property (XDeviceInfo  *device_info,
         return;
 #endif /* HAVE_LIBINPUT */
 
-    gdk_error_trap_push ();
+    gdk_x11_display_error_trap_push (gdk_display_get_default ());
     props = XListDeviceProperties (xdisplay, device, &n_props);
-    if (gdk_error_trap_pop () || props == NULL)
+    if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) || props == NULL)
         return;
 
     float_atom = XInternAtom (xdisplay, "FLOAT", False);
@@ -796,11 +796,11 @@ xfce_pointers_helper_change_property (XDeviceInfo  *device_info,
         if (props[n] != prop)
             continue;
 
-        gdk_error_trap_push ();
+        gdk_x11_display_error_trap_push (gdk_display_get_default ());
         rc = XGetDeviceProperty (xdisplay, device, prop, 0, 1000, False,
                                  AnyPropertyType, &type, &format,
                                  &n_items, &bytes_after, &data.c);
-        if (!gdk_error_trap_pop () && rc == Success)
+        if (!gdk_x11_display_error_trap_pop (gdk_display_get_default ()) && rc == Success)
         {
             if (n_items == 1
                 && (G_VALUE_HOLDS_INT (value)
@@ -878,11 +878,11 @@ xfce_pointers_helper_change_property (XDeviceInfo  *device_info,
 
             if (n_succeeds == n_items)
             {
-                gdk_error_trap_push ();
+                gdk_x11_display_error_trap_push (gdk_display_get_default ());
                 XChangeDeviceProperty (xdisplay, device, prop, type, format,
                                        PropModeReplace, data.c, n_items);
                 XSync (xdisplay, FALSE);
-                if (gdk_error_trap_pop ())
+                if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()))
                 {
                     g_critical ("Failed to set device property %s for %s",
                                 prop_name, device_info->name);
@@ -943,9 +943,9 @@ xfce_pointers_helper_restore_devices (XfcePointersHelper *helper,
 #endif
     const gchar     *mode;
 
-    gdk_error_trap_push ();
+    gdk_x11_display_error_trap_push (gdk_display_get_default ());
     device_list = XListInputDevices (xdisplay, &ndevices);
-    if (gdk_error_trap_pop () != 0 || device_list == NULL)
+    if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) != 0 || device_list == NULL)
     {
         g_message ("No input devices found");
         return;
@@ -964,9 +964,9 @@ xfce_pointers_helper_restore_devices (XfcePointersHelper *helper,
             continue;
 
         /* open the device */
-        gdk_error_trap_push ();
+        gdk_x11_display_error_trap_push (gdk_display_get_default ());
         device = XOpenDevice (xdisplay, device_info->id);
-        if (gdk_error_trap_pop () != 0 || device == NULL)
+        if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) != 0 || device == NULL)
         {
             g_critical ("Unable to open device %s", device_info->name);
             continue;
@@ -1064,9 +1064,9 @@ xfce_pointers_helper_channel_property_changed (XfconfChannel      *channel,
 
     if (names != NULL && g_strv_length (names) >= 2)
     {
-        gdk_error_trap_push ();
+        gdk_x11_display_error_trap_push (gdk_display_get_default ());
         device_list = XListInputDevices (xdisplay, &ndevices);
-        if (gdk_error_trap_pop () != 0 || device_list == NULL)
+        if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) != 0 || device_list == NULL)
         {
             g_message ("No input devices found");
             return;
@@ -1085,9 +1085,9 @@ xfce_pointers_helper_channel_property_changed (XfconfChannel      *channel,
             if (strcmp (names[0], device_name) == 0)
             {
                 /* open the device */
-                gdk_error_trap_push ();
+                gdk_x11_display_error_trap_push (gdk_display_get_default ());
                 device = XOpenDevice (xdisplay, device_info->id);
-                if (gdk_error_trap_pop () != 0 || device == NULL)
+                if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) != 0 || device == NULL)
                 {
                     g_critical ("Unable to open device %s", device_info->name);
                     continue;
diff --git a/xfsettingsd/workspaces.c b/xfsettingsd/workspaces.c
index 99d4ab2..d912106 100644
--- a/xfsettingsd/workspaces.c
+++ b/xfsettingsd/workspaces.c
@@ -206,7 +206,7 @@ xfce_workspaces_helper_get_names (void)
     GValue      *val;
     const gchar *p;
 
-    gdk_error_trap_push ();
+    gdk_x11_display_error_trap_push (gdk_display_get_default ());
 
     utf8_atom = gdk_atom_intern_static_string ("UTF8_STRING");
     succeed = gdk_property_get (gdk_get_default_root_window (),
@@ -216,7 +216,7 @@ xfce_workspaces_helper_get_names (void)
                                 FALSE, &type_returned, NULL, &length,
                                 (guchar **) &data);
 
-    if (gdk_error_trap_pop () == 0
+    if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) == 0
         && succeed
         && type_returned == utf8_atom
         && data != NULL
@@ -263,7 +263,7 @@ xfce_workspaces_helper_get_count (void)
     GdkAtom   cardinal_atom, type_returned;
     gint      format_returned;
 
-    gdk_error_trap_push ();
+    gdk_x11_display_error_trap_push (gdk_display_get_default ());
 
     cardinal_atom = gdk_atom_intern_static_string ("CARDINAL");
     succeed = gdk_property_get (gdk_get_default_root_window (),
@@ -273,7 +273,7 @@ xfce_workspaces_helper_get_count (void)
                                 FALSE, &type_returned, &format_returned, NULL,
                                 &data);
 
-    if (gdk_error_trap_pop () == 0
+    if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) == 0
         && succeed
         && data != NULL
         && type_returned == cardinal_atom
@@ -346,7 +346,7 @@ xfce_workspaces_helper_set_names_real (XfceWorkspacesHelper *helper)
         g_get_current_time (&helper->timestamp);
         g_time_val_add (&helper->timestamp, G_USEC_PER_SEC);
 
-        gdk_error_trap_push();
+        gdk_x11_display_error_trap_push (gdk_display_get_default ());
 
         gdk_property_change (gdk_get_default_root_window (),
                              gdk_atom_intern_static_string ("_NET_DESKTOP_NAMES"),
@@ -355,7 +355,7 @@ xfce_workspaces_helper_set_names_real (XfceWorkspacesHelper *helper)
                              (guchar *) names_str->str,
                              names_str->len + 1);
 
-        if (gdk_error_trap_pop () != 0)
+        if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) != 0)
             g_warning ("Failed to change _NET_DESKTOP_NAMES.");
 
         xfsettings_dbg (XFSD_DEBUG_WORKSPACES, "%d desktop names set from xfconf", i);
diff --git a/xfsettingsd/xsettings.c b/xfsettingsd/xsettings.c
index 383d932..22e0dea 100644
--- a/xfsettingsd/xsettings.c
+++ b/xfsettingsd/xsettings.c
@@ -692,7 +692,7 @@ xfce_xsettings_helper_notify_xft (XfceXSettingsHelper *helper)
     xfce_xsettings_helper_notify_xft_update (resource, "Xcursor.theme_core:", &bool_val);
     g_value_unset (&bool_val);
 
-    gdk_error_trap_push ();
+    gdk_x11_display_error_trap_push (gdk_display_get_default ());
 
     /* set the new resource manager string */
     XChangeProperty (xdisplay,
@@ -704,7 +704,7 @@ xfce_xsettings_helper_notify_xft (XfceXSettingsHelper *helper)
 
     XCloseDisplay (xdisplay);
 
-    if (gdk_error_trap_pop () != 0)
+    if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) != 0)
         g_critical ("Failed to update the resource manager string");
 
     xfsettings_dbg (XFSD_DEBUG_XSETTINGS,
@@ -941,7 +941,7 @@ xfce_xsettings_helper_notify (XfceXSettingsHelper *helper)
     needle = notify->buf + 8;
     *(CARD32 *)needle = notify->n_settings;
 
-    gdk_error_trap_push ();
+    gdk_x11_display_error_trap_push (gdk_display_get_default ());
 
     /* set new xsettings buffer to the screens */
     for (li = helper->screens; li != NULL; li = li->next)
@@ -961,7 +961,7 @@ xfce_xsettings_helper_notify (XfceXSettingsHelper *helper)
                          8, PropModeReplace, notify->buf, notify->buf_len);
     }
 
-    if (gdk_error_trap_pop () != 0)
+    if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) != 0)
     {
         g_critical ("Failed to set properties");
     }
@@ -1086,7 +1086,7 @@ xfce_xsettings_helper_register (XfceXSettingsHelper *helper,
     xdisplay = GDK_DISPLAY_XDISPLAY (gdkdisplay);
     helper->xsettings_atom = XInternAtom (xdisplay, "_XSETTINGS_SETTINGS", False);
 
-    gdk_error_trap_push ();
+    gdk_x11_display_error_trap_push (gdk_display_get_default ());
 
     /* Previously, gdk_display_get_n_screens. Since Gtk 3.10, the number of screens is always 1. */
     n_screens = 1;
@@ -1166,7 +1166,7 @@ xfce_xsettings_helper_register (XfceXSettingsHelper *helper,
         }
     }
 
-    if (gdk_error_trap_pop () != 0)
+    if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) != 0)
         g_critical ("Failed to initialize screens");
 
     if (helper->screens != NULL)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list