[gnome-settings-daemon/wip/benzea/cleanups-and-small-fixes: 46/51] clipboard: Use X11 specific error trap functions



commit e01d5354f17eacc07046f7f3823a1b7eeacb1ecc
Author: Benjamin Berg <bberg redhat com>
Date:   Mon Feb 25 16:31:15 2019 +0100

    clipboard: Use X11 specific error trap functions
    
    The module only works for X11, and the generic functions are deprecated.
    Use the X11 specific functions to fix compile time warnings.

 plugins/clipboard/gsd-clipboard-manager.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)
---
diff --git a/plugins/clipboard/gsd-clipboard-manager.c b/plugins/clipboard/gsd-clipboard-manager.c
index 571533a2..66dd4dd7 100644
--- a/plugins/clipboard/gsd-clipboard-manager.c
+++ b/plugins/clipboard/gsd-clipboard-manager.c
@@ -131,6 +131,7 @@ send_selection_notify (GsdClipboardManager *manager,
                        Bool                 success)
 {
         XSelectionEvent notify;
+        GdkDisplay *display = gdk_display_get_default ();
 
         notify.type = SelectionNotify;
         notify.serial = 0;
@@ -142,7 +143,7 @@ send_selection_notify (GsdClipboardManager *manager,
         notify.property = success ? manager->property : None;
         notify.time = manager->time;
 
-        gdk_error_trap_push ();
+        gdk_x11_display_error_trap_push (display);
 
         XSendEvent (manager->display,
                     manager->requestor,
@@ -151,7 +152,7 @@ send_selection_notify (GsdClipboardManager *manager,
                     (XEvent *)&notify);
         XSync (manager->display, False);
 
-        gdk_error_trap_pop_ignored ();
+        gdk_x11_display_error_trap_pop_ignored (display);
 }
 
 static void
@@ -160,6 +161,7 @@ finish_selection_request (GsdClipboardManager *manager,
                           Bool                 success)
 {
         XSelectionEvent notify;
+        GdkDisplay *display = gdk_display_get_default ();
 
         notify.type = SelectionNotify;
         notify.serial = 0;
@@ -171,14 +173,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 (display);
 
         XSendEvent (xev->xselectionrequest.display,
                     xev->xselectionrequest.requestor,
                     False, NoEventMask, (XEvent *) &notify);
         XSync (manager->display, False);
 
-        gdk_error_trap_pop_ignored ();
+        gdk_x11_display_error_trap_pop_ignored (display);
 }
 
 static gsize
@@ -424,6 +426,7 @@ convert_clipboard_manager (GsdClipboardManager *manager,
         unsigned long nitems;
         unsigned long remaining;
         Atom         *targets = NULL;
+        GdkDisplay   *display = gdk_display_get_default ();
 
         if (xev->xselectionrequest.target == XA_SAVE_TARGETS) {
                 if (manager->requestor != None || manager->contents != NULL) {
@@ -432,7 +435,7 @@ convert_clipboard_manager (GsdClipboardManager *manager,
                          */
                         finish_selection_request (manager, xev, False);
                 } else {
-                        gdk_error_trap_push ();
+                        gdk_x11_display_error_trap_push (display);
 
                         clipboard_manager_watch_cb (manager,
                                                     xev->xselectionrequest.requestor,
@@ -444,11 +447,11 @@ convert_clipboard_manager (GsdClipboardManager *manager,
                                       StructureNotifyMask);
                         XSync (manager->display, False);
 
-                        if (gdk_error_trap_pop () != Success)
+                        if (gdk_x11_display_error_trap_pop (display) != Success)
                                 return;
 
                         if (xev->xselectionrequest.property != None) {
-                                gdk_error_trap_push ();
+                                gdk_x11_display_error_trap_push (display);
 
                                 XGetWindowProperty (manager->display,
                                                     xev->xselectionrequest.requestor,
@@ -457,7 +460,7 @@ convert_clipboard_manager (GsdClipboardManager *manager,
                                                     &type, &format, &nitems, &remaining,
                                                     (unsigned char **) &targets);
 
-                                if (gdk_error_trap_pop () != Success) {
+                                if (gdk_x11_display_error_trap_pop (display) != Success) {
                                         if (targets)
                                                 XFree (targets);
 
@@ -513,6 +516,7 @@ convert_clipboard_target (IncrConversion      *rdata,
         List             *list;
         unsigned long     items;
         XWindowAttributes atts;
+        GdkDisplay       *display = gdk_display_get_default ();
 
         if (rdata->target == XA_TARGETS) {
                 n_targets = list_length (manager->contents) + 2;
@@ -566,7 +570,7 @@ convert_clipboard_target (IncrConversion      *rdata,
                         /* start incremental transfer */
                         rdata->offset = 0;
 
-                        gdk_error_trap_push ();
+                        gdk_x11_display_error_trap_push (display);
 
                         XGetWindowAttributes (manager->display, rdata->requestor, &atts);
 
@@ -586,7 +590,7 @@ convert_clipboard_target (IncrConversion      *rdata,
 
                         XSync (manager->display, False);
 
-                        gdk_error_trap_pop_ignored ();
+                        gdk_x11_display_error_trap_pop_ignored (display);
                 }
         }
 }


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