[Xfce4-commits] [xfce/xfwm4] 02/03: Use convenient display functions

noreply at xfce.org noreply at xfce.org
Thu Apr 5 11:52:31 CEST 2018


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

o   l   i   v   i   e   r       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/xfwm4.

commit e63cdb19cfa98bac6e8001a22b0a69445abd9a6b
Author: Olivier Fourdan <fourdan at xfce.org>
Date:   Wed Apr 4 22:14:51 2018 +0200

    Use convenient display functions
---
 src/client.c               |  6 +-----
 src/cycle.c                |  6 +-----
 src/event_filter.c         | 15 +++------------
 src/icons.c                | 24 ++++--------------------
 src/menu.c                 |  6 +-----
 src/misc.c                 | 13 +++----------
 src/moveresize.c           | 12 ++----------
 src/screen.c               | 14 ++------------
 src/settings.c             |  6 +-----
 src/startup_notification.c | 14 ++------------
 10 files changed, 20 insertions(+), 96 deletions(-)

diff --git a/src/client.c b/src/client.c
index 1685a75..2bf66bf 100644
--- a/src/client.c
+++ b/src/client.c
@@ -3854,11 +3854,7 @@ clientButtonPress (Client *c, Window w, XfwmEventButton *event)
     if (!g1)
     {
         TRACE ("grab failed in clientButtonPress");
-#if GTK_CHECK_VERSION(3, 22, 0)
-        gdk_display_beep (display_info->gdisplay);
-#else
-        gdk_beep ();
-#endif
+        myDisplayBeep (display_info);
         return;
     }
 
diff --git a/src/cycle.c b/src/cycle.c
index ce0bc82..434e37f 100644
--- a/src/cycle.c
+++ b/src/cycle.c
@@ -498,11 +498,7 @@ clientCycle (Client * c, XfwmEventKey *event)
     if (!myScreenGrabKeyboard (screen_info, KeyPressMask | KeyReleaseMask, event->time))
     {
         TRACE ("grab failed in clientCycle");
-#if GTK_CHECK_VERSION(3, 22, 0)
-        gdk_display_beep (display_info->gdisplay);
-#else
-        gdk_beep ();
-#endif
+        myDisplayBeep (display_info);
         myScreenUngrabKeyboard (screen_info, myDisplayGetCurrentTime (display_info));
         myScreenUngrabPointer (screen_info, myDisplayGetCurrentTime (display_info));
         g_list_free (client_list);
diff --git a/src/event_filter.c b/src/event_filter.c
index 2da8ff4..920ede5 100644
--- a/src/event_filter.c
+++ b/src/event_filter.c
@@ -30,6 +30,7 @@
 #include <X11/Xlib.h>
 
 #include <libxfce4util/libxfce4util.h>
+#include "display.h"
 #include "event_filter.h"
 
 static eventFilterStatus
@@ -235,11 +236,7 @@ eventFilterAddWin (GdkScreen *gscr, XfwmDevices *devices, long event_mask)
     gdisplay = gdk_window_get_display (event_win);
     dpy = gdk_x11_display_get_xdisplay (gdisplay);
 
-#if GTK_CHECK_VERSION(3, 22, 0)
-    gdk_x11_display_error_trap_push (gdisplay);
-#else
-    gdk_error_trap_push ();
-#endif
+    myDisplayErrorTrapPush (myDisplayGetDefault ());
     gdk_x11_grab_server ();
 
     XGetWindowAttributes (dpy, xroot, &attribs);
@@ -249,13 +246,7 @@ eventFilterAddWin (GdkScreen *gscr, XfwmDevices *devices, long event_mask)
 #endif
 
     gdk_x11_ungrab_server ();
-#if GTK_CHECK_VERSION(3, 22, 0)
-    gdk_display_flush (gdisplay);
-    error = gdk_x11_display_error_trap_pop (gdisplay);
-#else
-    gdk_flush ();
-    error = gdk_error_trap_pop ();
-#endif
+    error = myDisplayErrorTrapPop (myDisplayGetDefault ());
 
     if (error)
     {
diff --git a/src/icons.c b/src/icons.c
index 6503bc2..f55e011 100644
--- a/src/icons.c
+++ b/src/icons.c
@@ -430,11 +430,7 @@ try_pixmap_and_mask (ScreenInfo *screen_info, Pixmap src_pixmap, Pixmap src_mask
         return NULL;
     }
 
-#if GTK_CHECK_VERSION(3, 22, 0)
-    gdk_x11_display_error_trap_push (screen_info->display_info->gdisplay);
-#else
-    gdk_error_trap_push ();
-#endif
+    myDisplayErrorTrapPush (screen_info->display_info);
     get_pixmap_geometry (myScreenGetXDisplay(screen_info), src_pixmap, &w, &h, &depth);
     unscaled = get_pixbuf_from_pixmap (screen_info, src_pixmap, w, h, depth);
     icon = NULL;
@@ -445,11 +441,7 @@ try_pixmap_and_mask (ScreenInfo *screen_info, Pixmap src_pixmap, Pixmap src_mask
         get_pixmap_geometry (myScreenGetXDisplay(screen_info), src_mask, &w, &h, &depth);
         mask = get_pixbuf_from_pixmap (screen_info, src_mask, w, h, depth);
     }
-#if GTK_CHECK_VERSION(3, 22, 0)
-    gdk_x11_display_error_trap_pop_ignored (screen_info->display_info->gdisplay);
-#else
-    gdk_error_trap_pop_ignored ();
-#endif
+    myDisplayErrorTrapPopIgnored (screen_info->display_info);
 
     if (mask)
     {
@@ -529,17 +521,9 @@ getAppIcon (ScreenInfo *screen_info, Window window, guint width, guint height)
         return scaled_from_pixdata (pixdata, w, h, width, height);
     }
 
-#if GTK_CHECK_VERSION(3, 22, 0)
-    gdk_x11_display_error_trap_push (screen_info->display_info->gdisplay);
-#else
-    gdk_error_trap_push ();
-#endif
+    myDisplayErrorTrapPush (screen_info->display_info);
     hints = XGetWMHints (myScreenGetXDisplay(screen_info), window);
-#if GTK_CHECK_VERSION(3, 22, 0)
-    gdk_x11_display_error_trap_pop_ignored (screen_info->display_info->gdisplay);
-#else
-    gdk_error_trap_pop_ignored ();
-#endif
+    myDisplayErrorTrapPopIgnored (screen_info->display_info);
 
     if (hints)
     {
diff --git a/src/menu.c b/src/menu.c
index 899137c..d6e5da8 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -549,11 +549,7 @@ menu_popup (Menu *menu, gint root_x, gint root_y, guint button, guint32 timestam
 
         if (g_object_get_data (G_OBJECT (menu->menu), "gtk-menu-transfer-window") == NULL)
         {
-#if GTK_CHECK_VERSION(3, 22, 0)
-            gdk_display_beep (gdk_display_get_default ());
-#else
-            gdk_beep ();
-#endif
+            myDisplayBeep (myDisplayGetDefault ());
             g_message (_("%s: GtkMenu failed to grab the pointer\n"), g_get_prgname ());
             gtk_menu_popdown (GTK_MENU (menu->menu));
             menu_open = NULL;
diff --git a/src/misc.c b/src/misc.c
index 94a6060..3685916 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -152,21 +152,14 @@ checkWindowOnRoot(ScreenInfo *screen_info, Window w)
     display_info = screen_info->display_info;
     wins = NULL;
 
-#if GTK_CHECK_VERSION(3, 22, 0)
-        gdk_x11_display_error_trap_push (display_info->gdisplay);
-#else
-        gdk_error_trap_push ();
-#endif
+    myDisplayErrorTrapPush (display_info);
     test = XQueryTree(display_info->dpy, w, &dummy_root, &parent, &wins, &count);
     if (wins)
     {
         XFree (wins);
     }
-#if GTK_CHECK_VERSION(3, 22, 0)
-        ret = gdk_x11_display_error_trap_pop (display_info->gdisplay);
-#else
-        ret = gdk_error_trap_pop ();
-#endif
+    ret = myDisplayErrorTrapPop (display_info);
+
     return ((ret == 0) && (test != 0) && (dummy_root == parent));
 }
 
diff --git a/src/moveresize.c b/src/moveresize.c
index cbbda37..30ec98e 100644
--- a/src/moveresize.c
+++ b/src/moveresize.c
@@ -1203,11 +1203,7 @@ clientMove (Client * c, XfwmEventButton *event)
     {
         TRACE ("grab failed in clientMove");
 
-#if GTK_CHECK_VERSION(3, 22, 0)
-        gdk_display_beep (display_info->gdisplay);
-#else
-        gdk_beep ();
-#endif
+        myDisplayBeep (display_info);
         myScreenUngrabKeyboard (screen_info, myDisplayGetCurrentTime (display_info));
         myScreenUngrabPointer (screen_info, myDisplayGetCurrentTime (display_info));
 
@@ -1764,11 +1760,7 @@ clientResize (Client * c, int handle, XfwmEventButton *event)
     {
         TRACE ("grab failed in clientResize");
 
-#if GTK_CHECK_VERSION(3, 22, 0)
-        gdk_display_beep (display_info->gdisplay);
-#else
-        gdk_beep ();
-#endif
+        myDisplayBeep (display_info);
         myScreenUngrabKeyboard (screen_info, myDisplayGetCurrentTime (display_info));
         myScreenUngrabPointer (screen_info, myDisplayGetCurrentTime (display_info));
 
diff --git a/src/screen.c b/src/screen.c
index 75d49c0..a40e3db 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -108,20 +108,10 @@ myScreenSetWMAtom (ScreenInfo *screen_info, gboolean replace_wm)
 
             return FALSE;
         }
-#if GTK_CHECK_VERSION(3, 22, 0)
-        gdk_x11_display_error_trap_push (display_info->gdisplay);
-#else
-        gdk_error_trap_push ();
-#endif
+        myDisplayErrorTrapPush (display_info);
         attrs.event_mask = StructureNotifyMask;
         XChangeWindowAttributes (display_info->dpy, current_wm, CWEventMask, &attrs);
-#if GTK_CHECK_VERSION(3, 22, 0)
-        gdk_display_flush (display_info->gdisplay);
-        if (gdk_x11_display_error_trap_pop (display_info->gdisplay))
-#else
-        gdk_flush ();
-        if (gdk_error_trap_pop ())
-#endif
+        if (myDisplayErrorTrapPop (display_info))
         {
             current_wm = None;
         }
diff --git a/src/settings.c b/src/settings.c
index 11d9107..8474c2e 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -1025,11 +1025,7 @@ initSettings (ScreenInfo *screen_info)
     g_signal_connect (screen_info->xfwm4_channel, "property-changed",
                       G_CALLBACK (cb_xfwm4_channel_property_changed), screen_info);
 
-#if GTK_CHECK_VERSION(3, 22, 0)
-    keymap = gdk_keymap_get_for_display (display_info->gdisplay);
-#else
-    keymap = gdk_keymap_get_default ();
-#endif
+    keymap = myDisplayGetKeymap (display_info);
     g_signal_connect (keymap, "keys-changed",
                       G_CALLBACK (cb_keys_changed), screen_info);
 
diff --git a/src/startup_notification.c b/src/startup_notification.c
index 34025c4..7ff6140 100644
--- a/src/startup_notification.c
+++ b/src/startup_notification.c
@@ -61,23 +61,13 @@ static gboolean sn_startup_sequence_timeout (void *data);
 static void
 sn_error_trap_push (SnDisplay * d, Display * dpy)
 {
-#if GTK_CHECK_VERSION(3, 22, 0)
-    DisplayInfo *display_info = myDisplayGetDefault ();
-    gdk_x11_display_error_trap_push (display_info->gdisplay);
-#else
-    gdk_error_trap_push ();
-#endif
+    myDisplayErrorTrapPush (myDisplayGetDefault ());
 }
 
 static void
 sn_error_trap_pop (SnDisplay * d, Display * dpy)
 {
-#if GTK_CHECK_VERSION(3, 22, 0)
-    DisplayInfo *display_info = myDisplayGetDefault ();
-    gdk_x11_display_error_trap_pop_ignored (display_info->gdisplay);
-#else
-    gdk_error_trap_pop_ignored ();
-#endif
+    myDisplayErrorTrapPopIgnored (myDisplayGetDefault ());
 }
 
 static void

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


More information about the Xfce4-commits mailing list