amake locate-pointer not interfere with media keys
This commit is contained in:
parent
fc1b48d7a3
commit
d4c991aba7
@ -1,6 +1,6 @@
|
||||
Name: gnome-settings-daemon
|
||||
Version: 2.27.4
|
||||
Release: 2%{?dist}
|
||||
Release: 3%{?dist}
|
||||
Summary: The daemon sharing settings from GNOME to GTK+/KDE applications
|
||||
|
||||
Group: System Environment/Daemons
|
||||
@ -34,6 +34,8 @@ BuildRequires: fontconfig-devel
|
||||
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=483639
|
||||
Patch12: gnome-settings-daemon-2.26.1-fix-touchpad.patch
|
||||
# http://bugzilla.gnome.org/show_bug.cgi?id=524499
|
||||
Patch13: locate-pointer-process.patch
|
||||
|
||||
%description
|
||||
A daemon to share settings from GNOME to other applications. It also
|
||||
@ -54,6 +56,7 @@ developing applications that use %{name}.
|
||||
%setup -q
|
||||
|
||||
%patch12 -p1 -b .lefthand-touchpad
|
||||
%patch13 -p1 -b .locate-pointer
|
||||
|
||||
autoreconf -i -f
|
||||
|
||||
@ -154,6 +157,7 @@ fi
|
||||
%{_sysconfdir}/gconf/schemas/*
|
||||
%{_libdir}/gnome-settings-daemon-2.0
|
||||
%{_libexecdir}/gnome-settings-daemon
|
||||
%{_libexecdir}/gsd-locate-pointer
|
||||
%{_datadir}/gnome-settings-daemon/
|
||||
%{_datadir}/gnome-control-center/keybindings/50-accessibility.xml
|
||||
%{_datadir}/dbus-1/services/org.gnome.SettingsDaemon.service
|
||||
@ -166,6 +170,9 @@ fi
|
||||
%{_libdir}/pkgconfig/gnome-settings-daemon.pc
|
||||
|
||||
%changelog
|
||||
* Tue Jul 21 2009 Matthias Clasen <mclasen@redhat.com> 2.27.4-3
|
||||
- Make locate-pointer not interfere with media keys
|
||||
|
||||
* Wed Jul 15 2009 Matthias Clasen <mclasen@redhat.com> 2.27.4-2
|
||||
- Rebuild against new libgnomekbd
|
||||
|
||||
|
381
locate-pointer-process.patch
Normal file
381
locate-pointer-process.patch
Normal file
@ -0,0 +1,381 @@
|
||||
--- gnome-settings-daemon-2.27.4/plugins/mouse/gsd-mouse-manager.c 2009-07-21 20:59:56.686332813 -0400
|
||||
+++ gnome-settings-daemon-2.27.4.hacked/plugins/mouse/gsd-mouse-manager.c 2009-07-21 20:56:10.516337831 -0400
|
||||
@@ -50,8 +50,6 @@
|
||||
#include "gnome-settings-profile.h"
|
||||
#include "gsd-mouse-manager.h"
|
||||
|
||||
-#include "gsd-locate-pointer.h"
|
||||
-
|
||||
#define GSD_MOUSE_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_MOUSE_MANAGER, GsdMouseManagerPrivate))
|
||||
|
||||
#define GCONF_MOUSE_DIR "/desktop/gnome/peripherals/mouse"
|
||||
@@ -78,6 +76,8 @@
|
||||
gboolean mousetweaks_daemon_running;
|
||||
gboolean syndaemon_spawned;
|
||||
GPid syndaemon_pid;
|
||||
+ gboolean locate_pointer_spawned;
|
||||
+ GPid locate_pointer_pid;
|
||||
};
|
||||
|
||||
static void gsd_mouse_manager_class_init (GsdMouseManagerClass *klass);
|
||||
@@ -714,149 +714,39 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
-#define KEYBOARD_GROUP_SHIFT 13
|
||||
-#define KEYBOARD_GROUP_MASK ((1 << 13) | (1 << 14))
|
||||
-
|
||||
-/* Owen magic */
|
||||
-static GdkFilterReturn
|
||||
-filter (GdkXEvent *xevent,
|
||||
- GdkEvent *event,
|
||||
- gpointer data)
|
||||
+static void
|
||||
+set_locate_pointer (GsdMouseManager *manager,
|
||||
+ gboolean state)
|
||||
{
|
||||
- XEvent *xev = (XEvent *) xevent;
|
||||
- guint keyval;
|
||||
- gint group;
|
||||
+ if (state) {
|
||||
+ GError *error = NULL;
|
||||
+ const char *args[2];
|
||||
|
||||
- GdkScreen *screen = (GdkScreen *)data;
|
||||
+ if (manager->priv->locate_pointer_spawned)
|
||||
+ return 0;
|
||||
|
||||
- if (xev->type == KeyPress ||
|
||||
- xev->type == KeyRelease) {
|
||||
- /* get the keysym */
|
||||
- group = (xev->xkey.state & KEYBOARD_GROUP_MASK) >> KEYBOARD_GROUP_SHIFT;
|
||||
- gdk_keymap_translate_keyboard_state (gdk_keymap_get_default (),
|
||||
- xev->xkey.keycode,
|
||||
- xev->xkey.state,
|
||||
- group,
|
||||
- &keyval,
|
||||
- NULL, NULL, NULL);
|
||||
- if (keyval == GDK_Control_L || keyval == GDK_Control_R) {
|
||||
- if (xev->type == KeyPress) {
|
||||
- XAllowEvents (xev->xkey.display,
|
||||
- SyncKeyboard,
|
||||
- xev->xkey.time);
|
||||
- } else {
|
||||
- XAllowEvents (xev->xkey.display,
|
||||
- AsyncKeyboard,
|
||||
- xev->xkey.time);
|
||||
- gsd_locate_pointer (screen);
|
||||
- }
|
||||
- } else {
|
||||
- XAllowEvents (xev->xkey.display,
|
||||
- ReplayKeyboard,
|
||||
- xev->xkey.time);
|
||||
- XUngrabKeyboard (gdk_x11_get_default_xdisplay (),
|
||||
- xev->xkey.time);
|
||||
- }
|
||||
- }
|
||||
- return GDK_FILTER_CONTINUE;
|
||||
-}
|
||||
+ args[0] = "/usr/libexec/gsd-locate-pointer";
|
||||
+ args[1] = NULL;
|
||||
|
||||
-static void
|
||||
-set_locate_pointer (GsdMouseManager *manager,
|
||||
- gboolean locate_pointer)
|
||||
-{
|
||||
- GdkKeymapKey *keys;
|
||||
- GdkDisplay *display;
|
||||
- int n_screens;
|
||||
- int n_keys;
|
||||
- gboolean has_entries;
|
||||
- static const guint keyvals[] = { GDK_Control_L, GDK_Control_R };
|
||||
- unsigned j;
|
||||
-
|
||||
- display = gdk_display_get_default ();
|
||||
- n_screens = gdk_display_get_n_screens (display);
|
||||
-
|
||||
- for (j = 0 ; j < G_N_ELEMENTS (keyvals) ; j++) {
|
||||
- has_entries = gdk_keymap_get_entries_for_keyval (gdk_keymap_get_default (),
|
||||
- keyvals[j],
|
||||
- &keys,
|
||||
- &n_keys);
|
||||
- if (has_entries) {
|
||||
- gint i, j;
|
||||
-
|
||||
- for (i = 0; i < n_keys; i++) {
|
||||
- for(j=0; j< n_screens; j++) {
|
||||
- GdkScreen *screen = gdk_display_get_screen (display, j);
|
||||
- Window xroot = gdk_x11_drawable_get_xid (gdk_screen_get_root_window (screen));
|
||||
-
|
||||
- if (locate_pointer) {
|
||||
- XGrabKey (GDK_DISPLAY_XDISPLAY (display),
|
||||
- keys[i].keycode,
|
||||
- 0,
|
||||
- xroot,
|
||||
- False,
|
||||
- GrabModeAsync,
|
||||
- GrabModeSync);
|
||||
- XGrabKey (GDK_DISPLAY_XDISPLAY (display),
|
||||
- keys[i].keycode,
|
||||
- LockMask,
|
||||
- xroot,
|
||||
- False,
|
||||
- GrabModeAsync,
|
||||
- GrabModeSync);
|
||||
- XGrabKey (GDK_DISPLAY_XDISPLAY (display),
|
||||
- keys[i].keycode,
|
||||
- Mod2Mask,
|
||||
- xroot,
|
||||
- False,
|
||||
- GrabModeAsync,
|
||||
- GrabModeSync);
|
||||
- XGrabKey (GDK_DISPLAY_XDISPLAY (display),
|
||||
- keys[i].keycode,
|
||||
- Mod4Mask,
|
||||
- xroot,
|
||||
- False,
|
||||
- GrabModeAsync,
|
||||
- GrabModeSync);
|
||||
- } else {
|
||||
- XUngrabKey (GDK_DISPLAY_XDISPLAY (display),
|
||||
- keys[i].keycode,
|
||||
- Mod4Mask,
|
||||
- xroot);
|
||||
- XUngrabKey (GDK_DISPLAY_XDISPLAY (display),
|
||||
- keys[i].keycode,
|
||||
- Mod2Mask,
|
||||
- xroot);
|
||||
- XUngrabKey (GDK_DISPLAY_XDISPLAY (display),
|
||||
- keys[i].keycode,
|
||||
- LockMask,
|
||||
- xroot);
|
||||
- XUngrabKey (GDK_DISPLAY_XDISPLAY (display),
|
||||
- keys[i].keycode,
|
||||
- 0,
|
||||
- xroot);
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- g_free (keys);
|
||||
- if (locate_pointer) {
|
||||
- for (i = 0; i < n_screens; i++) {
|
||||
- GdkScreen *screen;
|
||||
- screen = gdk_display_get_screen (display, i);
|
||||
- gdk_window_add_filter (gdk_screen_get_root_window (screen),
|
||||
- filter,
|
||||
- screen);
|
||||
- }
|
||||
- } else {
|
||||
- for (i = 0; i < n_screens; i++) {
|
||||
- GdkScreen *screen;
|
||||
- screen = gdk_display_get_screen (display, i);
|
||||
- gdk_window_remove_filter (gdk_screen_get_root_window (screen),
|
||||
- filter,
|
||||
- screen);
|
||||
- }
|
||||
- }
|
||||
+ g_spawn_async (NULL, args, NULL,
|
||||
+ 0, NULL, NULL,
|
||||
+ &manager->priv->locate_pointer_pid, &error);
|
||||
+
|
||||
+ manager->priv->locate_pointer_spawned = (error == NULL);
|
||||
+
|
||||
+ if (error) {
|
||||
+ GConfClient *client;
|
||||
+ client = gconf_client_get_default ();
|
||||
+ gconf_client_set_bool (client, KEY_LOCATE_POINTER, FALSE, NULL);
|
||||
+ g_object_unref (client);
|
||||
+ g_error_free (error);
|
||||
}
|
||||
+
|
||||
+ }
|
||||
+ else if (manager->priv->locate_pointer_spawned) {
|
||||
+ kill (manager->priv->locate_pointer_pid, SIGHUP);
|
||||
+ g_spawn_close_pid (manager->priv->locate_pointer_pid);
|
||||
+ manager->priv->locate_pointer_spawned = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
--- gnome-settings-daemon-2.27.4/plugins/mouse/gsd-locate-pointer.c 2009-06-15 05:09:35.000000000 -0400
|
||||
+++ gnome-settings-daemon-2.27.4.hacked/plugins/mouse/gsd-locate-pointer.c 2009-07-21 20:54:29.284087108 -0400
|
||||
@@ -21,6 +21,10 @@
|
||||
#include "gsd-timeline.h"
|
||||
#include "gsd-locate-pointer.h"
|
||||
|
||||
+#include <gdk/gdkkeysyms.h>
|
||||
+#include <gdk/gdkx.h>
|
||||
+#include <X11/keysym.h>
|
||||
+
|
||||
#define ANIMATION_LENGTH 750
|
||||
#define WINDOW_SIZE 101
|
||||
#define N_CIRCLES 4
|
||||
@@ -343,3 +347,132 @@
|
||||
|
||||
gsd_timeline_start (data->timeline);
|
||||
}
|
||||
+
|
||||
+
|
||||
+#define KEYBOARD_GROUP_SHIFT 13
|
||||
+#define KEYBOARD_GROUP_MASK ((1 << 13) | (1 << 14))
|
||||
+
|
||||
+/* Owen magic */
|
||||
+static GdkFilterReturn
|
||||
+filter (GdkXEvent *xevent,
|
||||
+ GdkEvent *event,
|
||||
+ gpointer data)
|
||||
+{
|
||||
+ XEvent *xev = (XEvent *) xevent;
|
||||
+ guint keyval;
|
||||
+ gint group;
|
||||
+
|
||||
+ GdkScreen *screen = (GdkScreen *)data;
|
||||
+
|
||||
+ if (xev->type == KeyPress ||
|
||||
+ xev->type == KeyRelease) {
|
||||
+ /* get the keysym */
|
||||
+ group = (xev->xkey.state & KEYBOARD_GROUP_MASK) >> KEYBOARD_GROUP_SHIFT;
|
||||
+ gdk_keymap_translate_keyboard_state (gdk_keymap_get_default (),
|
||||
+ xev->xkey.keycode,
|
||||
+ xev->xkey.state,
|
||||
+ group,
|
||||
+ &keyval,
|
||||
+ NULL, NULL, NULL);
|
||||
+ if (keyval == GDK_Control_L || keyval == GDK_Control_R) {
|
||||
+ if (xev->type == KeyPress) {
|
||||
+ XAllowEvents (xev->xkey.display,
|
||||
+ SyncKeyboard,
|
||||
+ xev->xkey.time);
|
||||
+ } else {
|
||||
+ XAllowEvents (xev->xkey.display,
|
||||
+ AsyncKeyboard,
|
||||
+ xev->xkey.time);
|
||||
+ gsd_locate_pointer (screen);
|
||||
+ }
|
||||
+ } else {
|
||||
+ XAllowEvents (xev->xkey.display,
|
||||
+ ReplayKeyboard,
|
||||
+ xev->xkey.time);
|
||||
+ XUngrabKeyboard (gdk_x11_get_default_xdisplay (),
|
||||
+ xev->xkey.time);
|
||||
+ }
|
||||
+ }
|
||||
+ return GDK_FILTER_CONTINUE;
|
||||
+}
|
||||
+
|
||||
+set_locate_pointer (void)
|
||||
+{
|
||||
+ GdkKeymapKey *keys;
|
||||
+ GdkDisplay *display;
|
||||
+ int n_screens;
|
||||
+ int n_keys;
|
||||
+ gboolean has_entries;
|
||||
+ static const guint keyvals[] = { GDK_Control_L, GDK_Control_R };
|
||||
+ unsigned j;
|
||||
+
|
||||
+ display = gdk_display_get_default ();
|
||||
+ n_screens = gdk_display_get_n_screens (display);
|
||||
+
|
||||
+ for (j = 0 ; j < G_N_ELEMENTS (keyvals) ; j++) {
|
||||
+ has_entries = gdk_keymap_get_entries_for_keyval (gdk_keymap_get_default (),
|
||||
+ keyvals[j],
|
||||
+ &keys,
|
||||
+ &n_keys);
|
||||
+ if (has_entries) {
|
||||
+ gint i, j;
|
||||
+ for (i = 0; i < n_keys; i++) {
|
||||
+ for(j=0; j< n_screens; j++) {
|
||||
+ GdkScreen *screen = gdk_display_get_screen (display, j);
|
||||
+ Window xroot = gdk_x11_drawable_get_xid (gdk_screen_get_root_window (screen));
|
||||
+
|
||||
+ XGrabKey (GDK_DISPLAY_XDISPLAY (display),
|
||||
+ keys[i].keycode,
|
||||
+ 0,
|
||||
+ xroot,
|
||||
+ False,
|
||||
+ GrabModeAsync,
|
||||
+ GrabModeSync);
|
||||
+ XGrabKey (GDK_DISPLAY_XDISPLAY (display),
|
||||
+ keys[i].keycode,
|
||||
+ LockMask,
|
||||
+ xroot,
|
||||
+ False,
|
||||
+ GrabModeAsync,
|
||||
+ GrabModeSync);
|
||||
+ XGrabKey (GDK_DISPLAY_XDISPLAY (display),
|
||||
+ keys[i].keycode,
|
||||
+ Mod2Mask,
|
||||
+ xroot,
|
||||
+ False,
|
||||
+ GrabModeAsync,
|
||||
+ GrabModeSync);
|
||||
+ XGrabKey (GDK_DISPLAY_XDISPLAY (display),
|
||||
+ keys[i].keycode,
|
||||
+ Mod4Mask,
|
||||
+ xroot,
|
||||
+ False,
|
||||
+ GrabModeAsync,
|
||||
+ GrabModeSync);
|
||||
+ }
|
||||
+ }
|
||||
+ g_free (keys);
|
||||
+ for (i = 0; i < n_screens; i++) {
|
||||
+ GdkScreen *screen;
|
||||
+ screen = gdk_display_get_screen (display, i);
|
||||
+ gdk_window_add_filter (gdk_screen_get_root_window (screen),
|
||||
+ filter,
|
||||
+ screen);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+
|
||||
+int
|
||||
+main (int argc, char *argv[])
|
||||
+{
|
||||
+ gtk_init (&argc, &argv);
|
||||
+
|
||||
+ set_locate_pointer ();
|
||||
+
|
||||
+ gtk_main ();
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
--- gnome-settings-daemon-2.27.4/plugins/mouse/Makefile.am 2009-05-03 14:15:30.000000000 -0400
|
||||
+++ gnome-settings-daemon-2.27.4.hacked/plugins/mouse/Makefile.am 2009-07-21 20:58:10.619086849 -0400
|
||||
@@ -4,11 +4,7 @@
|
||||
gsd-mouse-plugin.h \
|
||||
gsd-mouse-plugin.c \
|
||||
gsd-mouse-manager.h \
|
||||
- gsd-mouse-manager.c \
|
||||
- gsd-locate-pointer.h \
|
||||
- gsd-locate-pointer.c \
|
||||
- gsd-timeline.h \
|
||||
- gsd-timeline.c
|
||||
+ gsd-mouse-manager.c
|
||||
|
||||
libmouse_la_CPPFLAGS = \
|
||||
-I$(top_srcdir)/gnome-settings-daemon \
|
||||
@@ -30,6 +26,21 @@
|
||||
|
||||
plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin)
|
||||
|
||||
+libexec_PROGRAMS = gsd-locate-pointer
|
||||
+
|
||||
+gsd_locate_pointer_SOURCES = \
|
||||
+ gsd-locate-pointer.h \
|
||||
+ gsd-locate-pointer.c \
|
||||
+ gsd-timeline.h \
|
||||
+ gsd-timeline.c
|
||||
+
|
||||
+gsd_locate_pointer_CFLAGS = \
|
||||
+ $(SETTINGS_PLUGIN_CFLAGS) \
|
||||
+ $(AM_CFLAGS)
|
||||
+
|
||||
+gsd_locate_pointer_LDADD = \
|
||||
+ $(SETTINGS_PLUGIN_LIBS)
|
||||
+
|
||||
EXTRA_DIST = $(plugin_in_files)
|
||||
CLEANFILES = $(plugin_DATA)
|
||||
DISTCLEANFILES = $(plugin_DATA)
|
Loading…
Reference in New Issue
Block a user