gnome-settings-daemon r573 - in branches/gnome-2-24: . plugins/mouse
- From: jensg svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-settings-daemon r573 - in branches/gnome-2-24: . plugins/mouse
- Date: Sat, 1 Nov 2008 12:38:31 +0000 (UTC)
Author: jensg
Date: Sat Nov 1 12:38:30 2008
New Revision: 573
URL: http://svn.gnome.org/viewvc/gnome-settings-daemon?rev=573&view=rev
Log:
2008-11-01 Jens Granseuer <jensgr gmx net>
Merged from trunk.
Patch by: William Grant <wgrant ubuntu com>
* plugins/mouse/gsd-mouse-manager.c: (devicepresence_filter),
(set_devicepresence_handler), (set_mouse_settings),
(gsd_mouse_manager_start), (gsd_mouse_manager_stop): listen for
X device changes, and reconfigure the mouse if necessary so that the
settings aren't ignored when hotplugging (bug #549267)
Modified:
branches/gnome-2-24/ChangeLog
branches/gnome-2-24/plugins/mouse/gsd-mouse-manager.c
Modified: branches/gnome-2-24/plugins/mouse/gsd-mouse-manager.c
==============================================================================
--- branches/gnome-2-24/plugins/mouse/gsd-mouse-manager.c (original)
+++ branches/gnome-2-24/plugins/mouse/gsd-mouse-manager.c Sat Nov 1 12:38:30 2008
@@ -71,6 +71,7 @@
static void gsd_mouse_manager_class_init (GsdMouseManagerClass *klass);
static void gsd_mouse_manager_init (GsdMouseManager *mouse_manager);
static void gsd_mouse_manager_finalize (GObject *object);
+static void set_mouse_settings (GsdMouseManager *manager);
G_DEFINE_TYPE (GsdMouseManager, gsd_mouse_manager, G_TYPE_OBJECT)
@@ -302,6 +303,40 @@
if (device_info != NULL)
XFreeDeviceList (device_info);
}
+
+static GdkFilterReturn
+devicepresence_filter (GdkXEvent *xevent,
+ GdkEvent *event,
+ gpointer data)
+{
+ XEvent *xev = (XEvent *) xevent;
+ XEventClass class_presence;
+ int xi_presence;
+
+ DevicePresence (gdk_x11_get_default_xdisplay (), xi_presence, class_presence);
+
+ if (xev->type == xi_presence)
+ {
+ XDevicePresenceNotifyEvent *dpn = (XDevicePresenceNotifyEvent *) xev;
+ if (dpn->devchange == DeviceAdded)
+ set_mouse_settings ((GsdMouseManager *) data);
+ }
+ return GDK_FILTER_CONTINUE;
+}
+
+static void
+set_devicepresence_handler (GsdMouseManager *manager)
+{
+ Display *display = gdk_x11_get_default_xdisplay ();
+ XEventClass class_presence;
+ int xi_presence;
+
+ DevicePresence (display, xi_presence, class_presence);
+ XSelectExtensionEvent (display,
+ RootWindow (display, DefaultScreen (display)),
+ &class_presence, 1);
+ gdk_window_add_filter (NULL, devicepresence_filter, manager);
+}
#endif
static void
@@ -585,6 +620,18 @@
}
static void
+set_mouse_settings (GsdMouseManager *manager)
+{
+ GConfClient *client = gconf_client_get_default ();
+
+ set_left_handed (manager, gconf_client_get_bool (client, KEY_LEFT_HANDED, NULL));
+ set_motion_acceleration (manager, gconf_client_get_float (client, KEY_MOTION_ACCELERATION , NULL));
+ set_motion_threshold (manager, gconf_client_get_int (client, KEY_MOTION_THRESHOLD, NULL));
+
+ g_object_unref (client);
+}
+
+static void
mouse_callback (GConfClient *client,
guint cnxn_id,
GConfEntry *entry,
@@ -659,9 +706,10 @@
GCONF_MOUSE_A11Y_DIR,
(GConfClientNotifyFunc) mouse_callback);
- set_left_handed (manager, gconf_client_get_bool (client, KEY_LEFT_HANDED, NULL));
- set_motion_acceleration (manager, gconf_client_get_float (client, KEY_MOTION_ACCELERATION , NULL));
- set_motion_threshold (manager, gconf_client_get_int (client, KEY_MOTION_THRESHOLD, NULL));
+#ifdef HAVE_XINPUT
+ set_devicepresence_handler (manager);
+#endif
+ set_mouse_settings (manager);
set_locate_pointer (manager, gconf_client_get_bool (client, KEY_LOCATE_POINTER, NULL));
set_mousetweaks_daemon (manager,
gconf_client_get_bool (client, KEY_DWELL_ENABLE, NULL),
@@ -699,6 +747,10 @@
g_object_unref (client);
set_locate_pointer (manager, FALSE);
+
+#ifdef HAVE_XINPUT
+ gdk_window_remove_filter (NULL, devicepresence_filter, manager);
+#endif
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]