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

Nick Schermer noreply at xfce.org
Sat May 21 18:40:04 CEST 2011


Updating branch refs/heads/nick/pointers
         to 0f1600035b34cd6a816efc38422b1802d3db1d92 (commit)
       from f93df45646446c4e4945dbe89bb1ef7c48e0bc16 (commit)

commit 0f1600035b34cd6a816efc38422b1802d3db1d92
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/keyboards.c     |   19 ++++++-------------
 2 files changed, 9 insertions(+), 19 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/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