[Xfce4-commits] <xfce4-settings:master> Remove flush calls around error traps.

Nick Schermer noreply at xfce.org
Wed May 25 19:00:04 CEST 2011


Updating branch refs/heads/master
         to ce7664a26755fc606039f6cbba515a0002f57ada (commit)
       from 95ee98c7055528a040cd71423389f98b4796d663 (commit)

commit ce7664a26755fc606039f6cbba515a0002f57ada
Author: Nick Schermer <nick at xfce.org>
Date:   Fri May 20 18:37:18 2011 +0200

    Remove flush calls around error traps.

 xfsettingsd/accessibility.c |    9 +++------
 xfsettingsd/displays.c      |    4 ----
 xfsettingsd/keyboards.c     |   19 ++++++-------------
 3 files changed, 9 insertions(+), 23 deletions(-)

diff --git a/xfsettingsd/accessibility.c b/xfsettingsd/accessibility.c
index 85f4d54..5581c4b 100644
--- a/xfsettingsd/accessibility.c
+++ b/xfsettingsd/accessibility.c
@@ -176,8 +176,6 @@ xfce_accessibility_helper_set_xkb (XfceAccessibilityHelper *helper,
     gint       delay, interval, time_to_max;
     gint       max_speed, curve;
 
-    /* flush x and trap errors */
-    gdk_flush ();
     gdk_error_trap_push ();
 
     /* allocate */
@@ -339,12 +337,11 @@ xfce_accessibility_helper_set_xkb (XfceAccessibilityHelper *helper,
     else
     {
         /* warning */
-        g_error ("XkbAllocKeyboard() returned a null pointer");
+        g_critical ("XkbAllocKeyboard() returned a null pointer");
     }
 
-    /* flush and remove the x error trap */
-    gdk_flush ();
-    gdk_error_trap_pop ();
+    if (gdk_error_trap_pop () != 0)
+       g_critical ("Failed to set keyboard controls");
 }
 
 
diff --git a/xfsettingsd/displays.c b/xfsettingsd/displays.c
index 5537aa3..c34a1f9 100644
--- a/xfsettingsd/displays.c
+++ b/xfsettingsd/displays.c
@@ -502,8 +502,6 @@ xfce_displays_helper_channel_apply (XfceDisplaysHelper *helper,
     GHashTable         *saved_outputs;
     XfceRROutput       *output;
 
-    /* flush x and trap errors */
-    gdk_flush ();
     gdk_error_trap_push ();
 
     /* get the default display */
@@ -826,8 +824,6 @@ err_cleanup:
     /* free the screen resources */
     XRRFreeScreenResources (resources);
 
-    /* flush and remove the x error trap */
-    gdk_flush ();
     gdk_error_trap_pop ();
 }
 
diff --git a/xfsettingsd/keyboards.c b/xfsettingsd/keyboards.c
index f29220d..f5c7edc 100644
--- a/xfsettingsd/keyboards.c
+++ b/xfsettingsd/keyboards.c
@@ -145,19 +145,15 @@ xfce_keyboards_helper_set_auto_repeat_mode (XfceKeyboardsHelper *helper)
     /* load setting */
     repeat = xfconf_channel_get_bool (helper->channel, "/Default/KeyRepeat", TRUE);
 
-    /* flush x and trap errors */
-    gdk_flush ();
-    gdk_error_trap_push ();
-
     /* set key repeat */
     values.auto_repeat_mode = repeat ? 1 : 0;
+
+    gdk_error_trap_push ();
     XChangeKeyboardControl (GDK_DISPLAY (), KBAutoRepeatMode, &values);
+    if (gdk_error_trap_pop () != 0)
+        g_critical ("Failed to change keyboard repeat mode");
 
     xfsettings_dbg (XFSD_DEBUG_KEYBOARDS, "set auto repeat %s", repeat ? "on" : "off");
-
-    /* flush and remove the x error trap */
-    gdk_flush ();
-    gdk_error_trap_pop ();
 }
 
 
@@ -172,8 +168,6 @@ 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);
 
-    /* flush x and trap errors */
-    gdk_flush ();
     gdk_error_trap_push ();
 
     /* allocate xkb structure */
@@ -198,9 +192,8 @@ xfce_keyboards_helper_set_repeat_rate (XfceKeyboardsHelper *helper)
         XFree (xkb);
     }
 
-    /* flush and remove the x error trap */
-    gdk_flush ();
-    gdk_error_trap_pop ();
+    if (gdk_error_trap_pop () != 0)
+        g_critical ("Failed to change the keyboard repeat");
 }
 
 



More information about the Xfce4-commits mailing list