[gnome-screensaver] Use gdk api to detect caps lock mode
- From: William Jon McCann <mccann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-screensaver] Use gdk api to detect caps lock mode
- Date: Fri, 2 Jul 2010 01:36:50 +0000 (UTC)
commit d30694d542ebe7db6d254bdfd8c9ba77e4b54df2
Author: William Jon McCann <jmccann redhat com>
Date: Wed Jun 30 17:09:57 2010 -0400
Use gdk api to detect caps lock mode
src/gs-lock-plug.c | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/src/gs-lock-plug.c b/src/gs-lock-plug.c
index e08cc08..822c086 100644
--- a/src/gs-lock-plug.c
+++ b/src/gs-lock-plug.c
@@ -35,7 +35,6 @@
#include <glib/gi18n.h>
#include <gdk/gdkkeysyms.h>
#include <gdk/gdkx.h>
-#include <X11/XKBlib.h>
#include <gtk/gtk.h>
#include <gconf/gconf-client.h>
@@ -286,15 +285,17 @@ capslock_update (GSLockPlug *plug,
static gboolean
is_capslock_on (void)
{
- XkbStateRec states;
- Display *dsp;
+ GdkKeymap *keymap;
+ gboolean res;
- dsp = GDK_DISPLAY ();
- if (XkbGetState (dsp, XkbUseCoreKbd, &states) != Success) {
- return FALSE;
+ res = FALSE;
+
+ keymap = gdk_keymap_get_default ();
+ if (keymap != NULL) {
+ res = gdk_keymap_get_caps_lock_state (keymap);
}
- return (states.locked_mods & LockMask) != 0;
+ return res;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]