gnome-settings-daemon r224 - in trunk: . plugins/media-keys
- From: mccann svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-settings-daemon r224 - in trunk: . plugins/media-keys
- Date: Thu, 20 Mar 2008 18:53:39 +0000 (GMT)
Author: mccann
Date: Thu Mar 20 18:53:39 2008
New Revision: 224
URL: http://svn.gnome.org/viewvc/gnome-settings-daemon?rev=224&view=rev
Log:
2008-03-20 William Jon McCann <jmccann redhat com>
* plugins/media-keys/Makefile.am:
* plugins/media-keys/gsd-media-keys-manager.c: (grab_key_real),
(init_kbd), (acme_filter_events), (gsd_media_keys_manager_start):
* plugins/media-keys/test-media-keys.c: (main):
Add a tool to test media keys.
Added:
trunk/plugins/media-keys/test-media-keys.c
Modified:
trunk/ChangeLog
trunk/plugins/media-keys/Makefile.am
trunk/plugins/media-keys/gsd-media-keys-manager.c
Modified: trunk/plugins/media-keys/Makefile.am
==============================================================================
--- trunk/plugins/media-keys/Makefile.am (original)
+++ trunk/plugins/media-keys/Makefile.am Thu Mar 20 18:53:39 2008
@@ -1,3 +1,5 @@
+NULL =
+
SUBDIRS = actions
plugin_LTLIBRARIES = \
@@ -6,7 +8,8 @@
BUILT_SOURCES = \
gsd-media-keys-manager-glue.h \
gsd-marshal.h \
- gsd-marshal.c
+ gsd-marshal.c \
+ $(NULL)
gsd-media-keys-manager-glue.h: gsd-media-keys-manager.xml Makefile
dbus-binding-tool --prefix=gsd_media_keys_manager --mode=glib-server $< > xgen-$(@F) \
@@ -28,7 +31,8 @@
gsd-media-keys-window.c \
eggaccelerators.h \
eggaccelerators.c \
- $(BUILT_SOURCES)
+ $(BUILT_SOURCES) \
+ $(NULL)
libmedia_keys_la_CPPFLAGS = \
-I$(top_srcdir)/gnome-settings-daemon \
@@ -57,12 +61,15 @@
plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin)
noinst_PROGRAMS = \
- test-media-window
+ test-media-keys \
+ test-media-window \
+ $(NULL)
test_media_window_SOURCES = \
gsd-media-keys-window.c \
gsd-media-keys-window.h \
- test-media-window.c
+ test-media-window.c \
+ $(NULL)
test_media_window_CPPFLAGS = \
-I$(top_srcdir)/gnome-settings-daemon \
@@ -82,6 +89,36 @@
$(XF86MISC_LIBS) \
$(GST_LIBS)
+test_media_keys_SOURCES = \
+ gsd-media-keys-manager.c \
+ gsd-media-keys-manager.h \
+ gsd-media-keys-window.h \
+ gsd-media-keys-window.c \
+ eggaccelerators.h \
+ eggaccelerators.c \
+ test-media-keys.c \
+ $(BUILT_SOURCES) \
+ $(NULL)
+
+test_media_keys_CPPFLAGS = \
+ -I$(top_srcdir)/gnome-settings-daemon \
+ -I$(top_builddir)/plugins/media-keys/actions \
+ -DPIXMAPDIR=\""$(pkgdatadir)"\" \
+ -DGLADEDIR=\""$(pkgdatadir)"\" \
+ -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \
+ $(AM_CPPFLAGS)
+
+test_media_keys_CFLAGS = \
+ $(SETTINGS_PLUGIN_CFLAGS) \
+ $(AM_CFLAGS)
+
+test_media_keys_LDADD = \
+ $(top_builddir)/plugins/media-keys/actions/libacme.la \
+ $(SETTINGS_DAEMON_LIBS) \
+ $(SETTINGS_PLUGIN_LIBS) \
+ $(XF86MISC_LIBS) \
+ $(GST_LIBS)
+
EXTRA_DIST = \
gsd-media-keys-manager.xml \
gsd-marshal.list \
Modified: trunk/plugins/media-keys/gsd-media-keys-manager.c
==============================================================================
--- trunk/plugins/media-keys/gsd-media-keys-manager.c (original)
+++ trunk/plugins/media-keys/gsd-media-keys-manager.c Thu Mar 20 18:53:39 2008
@@ -62,7 +62,7 @@
these modifiers mean
these are the mods whose combinations are bound by the keygrabbing code */
#define IGNORED_MODS (0x2000 /*Xkb modifier*/ | GDK_LOCK_MASK | \
- GDK_MOD2_MASK | GDK_MOD3_MASK | GDK_MOD4_MASK | GDK_MOD5_MASK)
+ GDK_MOD2_MASK | GDK_MOD3_MASK | GDK_MOD4_MASK | GDK_MOD5_MASK)
/* these are the ones we actually use for global keys, we always only check
* for these set */
#define USED_MODS (GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK)
@@ -281,6 +281,7 @@
{
gdk_error_trap_push ();
if (grab) {
+ g_debug ("Grab: %d %d %x %s", result, (int)key->keycode, key->state, XKeysymToString (key->keysym));
XGrabKey (GDK_DISPLAY (),
key->keycode,
(result | key->state),
@@ -289,6 +290,7 @@
GrabModeAsync,
GrabModeAsync);
} else {
+ g_debug ("UnGrab: %d %d %x", result, (int)key->keycode, key->state);
XUngrabKey (GDK_DISPLAY (),
key->keycode,
(result | key->state),
@@ -434,6 +436,7 @@
keys[i].gconf_key,
NULL);
if (!is_valid_shortcut (tmp)) {
+ g_debug ("Not a valid shortcut: '%s'", tmp);
g_free (tmp);
continue;
}
@@ -441,6 +444,8 @@
key = g_new0 (Key, 1);
if (!egg_accelerator_parse_virtual (tmp, &key->keysym, &key->keycode, &key->state)
|| key->keycode == 0) {
+ g_debug ("Unable to parse: '%s'", tmp);
+
g_free (tmp);
g_free (key);
continue;
@@ -951,6 +956,8 @@
keycode = xev->xkey.keycode;
state = xev->xkey.state;
+ g_debug ("Got key: %u state: %u");
+
for (i = 0; i < HANDLED_KEYS; i++) {
if (keys[i].key == NULL) {
continue;
@@ -1008,6 +1015,9 @@
/* Start filtering the events */
for (l = manager->priv->screens; l != NULL; l = l->next) {
+ g_debug ("adding key filter for screen: %d",
+ gdk_screen_get_number (l->data));
+
gdk_window_add_filter (gdk_screen_get_root_window (l->data),
(GdkFilterFunc)acme_filter_events,
manager);
Added: trunk/plugins/media-keys/test-media-keys.c
==============================================================================
--- (empty file)
+++ trunk/plugins/media-keys/test-media-keys.c Thu Mar 20 18:53:39 2008
@@ -0,0 +1,64 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007 William Jon McCann <mccann jhu edu>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+
+#include "gsd-media-keys-manager.h"
+
+static GsdMediaKeysManager *manager = NULL;
+
+int
+main (int argc,
+ char **argv)
+{
+ GError *error;
+ gboolean res;
+
+#ifdef ENABLE_NLS
+ bindtextdomain (GETTEXT_PACKAGE, GNOME_SETTINGS_LOCALEDIR);
+# ifdef HAVE_BIND_TEXTDOMAIN_CODESET
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+# endif
+ textdomain (GETTEXT_PACKAGE);
+#endif
+
+ error = NULL;
+ if (! gtk_init_with_args (&argc, &argv, NULL, NULL, NULL, &error)) {
+ fprintf (stderr, "%s", error->message);
+ g_error_free (error);
+ exit (1);
+ }
+
+ manager = gsd_media_keys_manager_new ();
+
+ error = NULL;
+ res = gsd_media_keys_manager_start (manager, &error);
+
+ gtk_main ();
+
+ return 0;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]