[Xfce4-commits] <xfce4-settings:master> Add debugging to keyboards object.

Nick Schermer noreply at xfce.org
Mon Feb 28 17:16:12 CET 2011


Updating branch refs/heads/master
         to 439a2674bdd2486776467dc8a1f7da097db03341 (commit)
       from 73e04c6fbde03b1103315a1df3304199670ec0bd (commit)

commit 439a2674bdd2486776467dc8a1f7da097db03341
Author: Nick Schermer <nick at xfce.org>
Date:   Wed Feb 23 22:26:42 2011 +0100

    Add debugging to keyboards object.

 xfsettingsd/debug.c     |    1 +
 xfsettingsd/debug.h     |    1 +
 xfsettingsd/keyboards.c |   18 ++++++++++++++----
 3 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/xfsettingsd/debug.c b/xfsettingsd/debug.c
index bce4bab..3dffa0e 100644
--- a/xfsettingsd/debug.c
+++ b/xfsettingsd/debug.c
@@ -35,6 +35,7 @@ static const GDebugKey dbg_keys[] =
     { "xsettings",  XFSD_DEBUG_XSETTINGS },
     { "fontconfig", XFSD_DEBUG_FONTCONFIG },
     { "keyboard-layout", XFSD_DEBUG_KEYBOARD_LAYOUT },
+    { "keyboards", XFSD_DEBUG_KEYBOARDS },
 };
 
 
diff --git a/xfsettingsd/debug.h b/xfsettingsd/debug.h
index f6674ad..6c07f29 100644
--- a/xfsettingsd/debug.h
+++ b/xfsettingsd/debug.h
@@ -27,6 +27,7 @@ typedef enum
    XFSD_DEBUG_XSETTINGS       = 1 << 1,
    XFSD_DEBUG_FONTCONFIG      = 1 << 2,
    XFSD_DEBUG_KEYBOARD_LAYOUT = 1 << 3,
+   XFSD_DEBUG_KEYBOARDS       = 1 << 4,
 
 }
 XfsdDebugDomain;
diff --git a/xfsettingsd/keyboards.c b/xfsettingsd/keyboards.c
index 2fe0fbf..f29220d 100644
--- a/xfsettingsd/keyboards.c
+++ b/xfsettingsd/keyboards.c
@@ -41,6 +41,7 @@
 #include <xfconf/xfconf.h>
 #include <libxfce4util/libxfce4util.h>
 
+#include "debug.h"
 #include "keyboards.h"
 
 
@@ -92,17 +93,21 @@ static void
 xfce_keyboards_helper_init (XfceKeyboardsHelper *helper)
 {
     gint dummy;
+    gint marjor_ver, minor_ver;
 
     /* init */
     helper->channel = NULL;
 
-    if (XkbQueryExtension (GDK_DISPLAY (), &dummy, &dummy, &dummy, &dummy, &dummy))
+    if (XkbQueryExtension (GDK_DISPLAY (), &dummy, &dummy, &dummy, &marjor_ver, &minor_ver))
     {
+        xfsettings_dbg (XFSD_DEBUG_KEYBOARDS, "initialized xkb %d.%d", marjor_ver, minor_ver);
+
         /* open the channel */
         helper->channel = xfconf_channel_get ("keyboards");
 
         /* monitor channel changes */
-        g_signal_connect (G_OBJECT (helper->channel), "property-changed", G_CALLBACK (xfce_keyboards_helper_channel_property_changed), helper);
+        g_signal_connect (G_OBJECT (helper->channel), "property-changed",
+            G_CALLBACK (xfce_keyboards_helper_channel_property_changed), helper);
 
         /* load settings */
         xfce_keyboards_helper_set_auto_repeat_mode (helper);
@@ -146,10 +151,10 @@ xfce_keyboards_helper_set_auto_repeat_mode (XfceKeyboardsHelper *helper)
 
     /* set key repeat */
     values.auto_repeat_mode = repeat ? 1 : 0;
-
-    /* set key repeat */
     XChangeKeyboardControl (GDK_DISPLAY (), KBAutoRepeatMode, &values);
 
+    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 ();
@@ -185,6 +190,9 @@ xfce_keyboards_helper_set_repeat_rate (XfceKeyboardsHelper *helper)
         /* set updated controls */
         XkbSetControls (GDK_DISPLAY (), XkbRepeatKeysMask, xkb);
 
+        xfsettings_dbg (XFSD_DEBUG_KEYBOARDS, "set key repeat (delay=%d, rate=%d)",
+                        xkb->ctrls->repeat_delay, xkb->ctrls->repeat_interval);
+
         /* cleanup */
         XkbFreeControls (xkb, XkbRepeatKeysMask, True);
         XFree (xkb);
@@ -233,6 +241,8 @@ xfce_keyboards_helper_restore_numlock_state (XfconfChannel *channel)
     numlock_mask = XkbKeysymToModifiers (dpy, XK_Num_Lock);
 
     XkbLockModifiers (dpy, XkbUseCoreKbd, numlock_mask, state ? numlock_mask : 0);
+
+    xfsettings_dbg (XFSD_DEBUG_KEYBOARDS, "set numlock %s", state ? "on" : "off");
 }
 
 



More information about the Xfce4-commits mailing list