- Update from F-12 branch

This commit is contained in:
Bastien Nocera 2009-10-27 22:44:05 +00:00
parent f3645f2c0d
commit 89b8e99431
11 changed files with 115 additions and 1220 deletions

View File

@ -1,57 +0,0 @@
From b097ceeb19cee5f3e49311b8f03cf9463caea628 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Wed, 9 Sep 2009 11:59:21 +0100
Subject: [PATCH] =?utf-8?q?Bug=C2=A0594617=20-=20Touchpad=20left-handed=20bug=20fixes?=
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
1) Don't swap mouse buttons for left-handers on the touchpad (otherwise
a tap would be a right-click)
2) If XInput is supported, don't switch the core pointer to left-handed,
as it would cancel our other settings
---
plugins/mouse/gsd-mouse-manager.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/plugins/mouse/gsd-mouse-manager.c b/plugins/mouse/gsd-mouse-manager.c
index b5c96a1..e09d38c 100644
--- a/plugins/mouse/gsd-mouse-manager.c
+++ b/plugins/mouse/gsd-mouse-manager.c
@@ -84,6 +84,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);
+static XDevice* device_is_touchpad (XDeviceInfo deviceinfo);
G_DEFINE_TYPE (GsdMouseManager, gsd_mouse_manager, G_TYPE_OBJECT)
@@ -284,6 +285,14 @@ set_xinput_devices_left_handed (gboolean left_handed)
(!xinput_device_has_buttons (&device_info[i])))
continue;
+ /* If the device is a touchpad, don't swap buttons
+ * around */
+ device = device_is_touchpad (device_info[i]);
+ if (device != NULL) {
+ XCloseDevice (GDK_DISPLAY (), device);
+ continue;
+ }
+
gdk_error_trap_push ();
device = XOpenDevice (GDK_DISPLAY (), device_info[i].id);
@@ -371,7 +380,10 @@ set_left_handed (GsdMouseManager *manager,
#ifdef HAVE_X11_EXTENSIONS_XINPUT_H
if (supports_xinput_devices ()) {
+ /* When XInput support is available, never set the
+ * button ordering on the core pointer */
set_xinput_devices_left_handed (left_handed);
+ return;
}
#endif
--
1.6.2.5

View File

@ -0,0 +1,66 @@
From fadc8f8aaa65eecc855350a1dea9cfc8c255620f Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Mon, 26 Oct 2009 14:55:55 +0000
Subject: [PATCH 1/3] Fix bluriness in level bar, and popup
By shifting the top-left coordinates by half a pixel, to match
the cairo grid.
This makes the outter border of the popup, as well as the
level bar's borders much sharper.
https://bugzilla.gnome.org/show_bug.cgi?id=567249
---
plugins/media-keys/gsd-media-keys-window.c | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/plugins/media-keys/gsd-media-keys-window.c b/plugins/media-keys/gsd-media-keys-window.c
index 9306b92..f890344 100644
--- a/plugins/media-keys/gsd-media-keys-window.c
+++ b/plugins/media-keys/gsd-media-keys-window.c
@@ -610,7 +610,11 @@ draw_volume_boxes (GsdMediaKeysWindow *window,
GdkColor color;
double r, g, b;
- x1 = width * percentage;
+ x0 += 0.5;
+ y0 += 0.5;
+ height = round (height) - 1;
+ width = round (width) - 1;
+ x1 = round ((width - 1) * percentage);
/* bar background */
color = GTK_WIDGET (window)->style->dark [GTK_STATE_NORMAL];
@@ -636,7 +640,7 @@ draw_volume_boxes (GsdMediaKeysWindow *window,
r = (float)color.red / 65535.0;
g = (float)color.green / 65535.0;
b = (float)color.blue / 65535.0;
- cairo_rectangle (cr, x0, y0, x1, height);
+ cairo_rectangle (cr, x0 + 0.5, y0 + 0.5, x1, height - 1);
cairo_set_source_rgba (cr, r, g, b, FG_ALPHA);
cairo_fill (cr);
}
@@ -659,15 +663,15 @@ draw_action_volume (GsdMediaKeysWindow *window,
gtk_window_get_size (GTK_WINDOW (window), &window_width, &window_height);
- icon_box_width = window_width * 0.65;
- icon_box_height = window_height * 0.65;
+ icon_box_width = round (window_width * 0.65);
+ icon_box_height = round (window_height * 0.65);
volume_box_width = icon_box_width;
- volume_box_height = window_height * 0.05;
+ volume_box_height = round (window_height * 0.05);
icon_box_x0 = (window_width - icon_box_width) / 2;
icon_box_y0 = (window_height - icon_box_height - volume_box_height) / 2;
- volume_box_x0 = icon_box_x0;
- volume_box_y0 = icon_box_height + icon_box_y0;
+ volume_box_x0 = round (icon_box_x0);
+ volume_box_y0 = round (icon_box_height + icon_box_y0);
#if 0
g_message ("icon box: w=%f h=%f x0=%f y0=%f",
--
1.6.5.rc2

View File

@ -1,180 +0,0 @@
From 5f24fe80d888f9bf8670f03c37af63e96799285a Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Fri, 14 Aug 2009 18:16:10 +0100
Subject: [PATCH] Update gnome-volume-control code
Should cut down on the feedback loops.
---
plugins/media-keys/cut-n-paste/gvc-channel-map.c | 15 +++++++++++----
plugins/media-keys/cut-n-paste/gvc-channel-map.h | 5 +++--
plugins/media-keys/cut-n-paste/gvc-mixer-control.c | 2 +-
plugins/media-keys/cut-n-paste/gvc-mixer-stream.c | 16 +++++++++++++---
plugins/media-keys/gsd-media-keys-manager.c | 3 +++
5 files changed, 31 insertions(+), 10 deletions(-)
diff --git a/plugins/media-keys/cut-n-paste/gvc-channel-map.c b/plugins/media-keys/cut-n-paste/gvc-channel-map.c
index 32750ef..ea3e5af 100644
--- a/plugins/media-keys/cut-n-paste/gvc-channel-map.c
+++ b/plugins/media-keys/cut-n-paste/gvc-channel-map.c
@@ -44,6 +44,7 @@
struct GvcChannelMapPrivate
{
pa_channel_map pa_map;
+ gboolean pa_volume_is_set;
pa_cvolume pa_volume;
gdouble extern_volume[NUM_TYPES]; /* volume, balance, fade, lfe */
gboolean can_balance;
@@ -208,15 +209,16 @@ gvc_channel_map_class_init (GvcChannelMapClass *klass)
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GvcChannelMapClass, volume_changed),
NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ g_cclosure_marshal_VOID__BOOLEAN,
+ G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
g_type_class_add_private (klass, sizeof (GvcChannelMapPrivate));
}
void
gvc_channel_map_volume_changed (GvcChannelMap *map,
- const pa_cvolume *cv)
+ const pa_cvolume *cv,
+ gboolean set)
{
g_return_if_fail (GVC_IS_CHANNEL_MAP (map));
g_return_if_fail (cv != NULL);
@@ -227,13 +229,18 @@ gvc_channel_map_volume_changed (GvcChannelMap *map,
map->priv->pa_volume = *cv;
- g_signal_emit (map, signals[VOLUME_CHANGED], 0);
+ if (map->priv->pa_volume_is_set == FALSE) {
+ map->priv->pa_volume_is_set = TRUE;
+ return;
+ }
+ g_signal_emit (map, signals[VOLUME_CHANGED], 0, set);
}
static void
gvc_channel_map_init (GvcChannelMap *map)
{
map->priv = GVC_CHANNEL_MAP_GET_PRIVATE (map);
+ map->priv->pa_volume_is_set = FALSE;
}
static void
diff --git a/plugins/media-keys/cut-n-paste/gvc-channel-map.h b/plugins/media-keys/cut-n-paste/gvc-channel-map.h
index b35c9cb..497ce69 100644
--- a/plugins/media-keys/cut-n-paste/gvc-channel-map.h
+++ b/plugins/media-keys/cut-n-paste/gvc-channel-map.h
@@ -44,7 +44,7 @@ typedef struct
typedef struct
{
GObjectClass parent_class;
- void (*volume_changed) (GvcChannelMap *channel_map);
+ void (*volume_changed) (GvcChannelMap *channel_map, gboolean set);
} GvcChannelMapClass;
enum {
@@ -67,7 +67,8 @@ gboolean gvc_channel_map_can_fade (GvcChannelMap
gboolean gvc_channel_map_has_lfe (GvcChannelMap *map);
void gvc_channel_map_volume_changed (GvcChannelMap *map,
- const pa_cvolume *cv);
+ const pa_cvolume *cv,
+ gboolean set);
const char * gvc_channel_map_get_mapping (GvcChannelMap *map);
/* private */
diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-control.c b/plugins/media-keys/cut-n-paste/gvc-mixer-control.c
index 0b5feee..eba8f55 100644
--- a/plugins/media-keys/cut-n-paste/gvc-mixer-control.c
+++ b/plugins/media-keys/cut-n-paste/gvc-mixer-control.c
@@ -691,7 +691,7 @@ update_sink (GvcMixerControl *control,
if (map == NULL)
map = gvc_mixer_stream_get_channel_map (stream);
- gvc_channel_map_volume_changed (map, &info->volume);
+ gvc_channel_map_volume_changed (map, &info->volume, TRUE);
}
static void
diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-stream.c b/plugins/media-keys/cut-n-paste/gvc-mixer-stream.c
index caea0f1..2a9a7ce 100644
--- a/plugins/media-keys/cut-n-paste/gvc-mixer-stream.c
+++ b/plugins/media-keys/cut-n-paste/gvc-mixer-stream.c
@@ -153,7 +153,7 @@ gvc_mixer_stream_set_volume (GvcMixerStream *stream,
pa_cvolume_scale(&cv, volume);
if (!pa_cvolume_equal(gvc_channel_map_get_cvolume(stream->priv->channel_map), &cv)) {
- gvc_channel_map_volume_changed(stream->priv->channel_map, &cv);
+ gvc_channel_map_volume_changed(stream->priv->channel_map, &cv, FALSE);
g_object_notify (G_OBJECT (stream), "volume");
}
@@ -172,7 +172,7 @@ gvc_mixer_stream_set_decibel (GvcMixerStream *stream,
pa_cvolume_scale(&cv, pa_sw_volume_from_dB(db));
if (!pa_cvolume_equal(gvc_channel_map_get_cvolume(stream->priv->channel_map), &cv)) {
- gvc_channel_map_volume_changed(stream->priv->channel_map, &cv);
+ gvc_channel_map_volume_changed(stream->priv->channel_map, &cv, FALSE);
g_object_notify (G_OBJECT (stream), "volume");
}
@@ -323,9 +323,11 @@ gvc_mixer_stream_set_application_id (GvcMixerStream *stream,
static void
on_channel_map_volume_changed (GvcChannelMap *channel_map,
+ gboolean set,
GvcMixerStream *stream)
{
- gvc_mixer_stream_push_volume (stream);
+ if (set == TRUE)
+ gvc_mixer_stream_push_volume (stream);
g_object_notify (G_OBJECT (stream), "volume");
}
@@ -650,7 +652,15 @@ gvc_mixer_stream_push_volume (GvcMixerStream *stream)
{
pa_operation *op;
gboolean ret;
+
g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), FALSE);
+
+ if (stream->priv->is_event_stream != FALSE)
+ return TRUE;
+
+ g_debug ("Pushing new volume to stream '%s' (%s)",
+ stream->priv->description, stream->priv->name);
+
ret = GVC_MIXER_STREAM_GET_CLASS (stream)->push_volume (stream, (gpointer *) &op);
if (ret) {
if (stream->priv->change_volume_op != NULL)
diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
index 8438875..2b14bcc 100644
--- a/plugins/media-keys/gsd-media-keys-manager.c
+++ b/plugins/media-keys/gsd-media-keys-manager.c
@@ -688,9 +688,11 @@ do_sound_action (GsdMediaKeysManager *manager,
manager->priv->num_expected_update_signals = 2;
gvc_mixer_stream_change_is_muted (manager->priv->stream, !muted);
gvc_mixer_stream_set_volume (manager->priv->stream, 0);
+ gvc_mixer_stream_push_volume (manager->priv->stream);
} else if (!muted) {
manager->priv->num_expected_update_signals = 1;
gvc_mixer_stream_set_volume (manager->priv->stream, vol - norm_vol_step);
+ gvc_mixer_stream_push_volume (manager->priv->stream);
}
break;
case VOLUME_UP_KEY:
@@ -698,6 +700,7 @@ do_sound_action (GsdMediaKeysManager *manager,
if (vol == 0) {
manager->priv->num_expected_update_signals = 2;
gvc_mixer_stream_set_volume (manager->priv->stream, vol + norm_vol_step);
+ gvc_mixer_stream_push_volume (manager->priv->stream);
gvc_mixer_stream_change_is_muted (manager->priv->stream, !muted);
} else {
manager->priv->num_expected_update_signals = 1;
--
1.6.2.5

View File

@ -1,14 +1,14 @@
From 8fe2c6627deb4d783715f3bbd315c65023451775 Mon Sep 17 00:00:00 2001
From dab2e6b44c57e14dd373adf04d4530bd5915f582 Mon Sep 17 00:00:00 2001
From: William Jon McCann <jmccann@redhat.com>
Date: Wed, 23 Sep 2009 20:23:31 -0400
Subject: [PATCH 1/2] Use a rounded instead of curved rectangle
Subject: [PATCH 2/3] Use a rounded instead of curved rectangle
---
plugins/media-keys/gsd-media-keys-window.c | 101 +++++++++++++---------------
1 files changed, 48 insertions(+), 53 deletions(-)
diff --git a/plugins/media-keys/gsd-media-keys-window.c b/plugins/media-keys/gsd-media-keys-window.c
index 9306b92..89071b8 100644
index f890344..cffbe3e 100644
--- a/plugins/media-keys/gsd-media-keys-window.c
+++ b/plugins/media-keys/gsd-media-keys-window.c
@@ -260,59 +260,54 @@ gsd_media_keys_window_set_volume_level (GsdMediaKeysWindow *window,
@ -119,7 +119,7 @@ index 9306b92..89071b8 100644
cairo_close_path (cr);
}
@@ -795,7 +790,7 @@ on_expose_event (GtkWidget *widget,
@@ -799,7 +794,7 @@ on_expose_event (GtkWidget *widget,
cairo_paint (cr);
/* draw a box */
@ -129,5 +129,5 @@ index 9306b92..89071b8 100644
r = (float)color.red / 65535.0;
g = (float)color.green / 65535.0;
--
1.6.4.4
1.6.5.rc2

View File

@ -1,14 +1,14 @@
From cca9a6d853b4c1366cf965750f0a7c6e9c74e3a1 Mon Sep 17 00:00:00 2001
From 26041c5b936263d3f5aa4aa7fc7ffedd128ed444 Mon Sep 17 00:00:00 2001
From: William Jon McCann <jmccann@redhat.com>
Date: Wed, 23 Sep 2009 21:15:45 -0400
Subject: [PATCH 2/2] Improve the media keys overlay design
Subject: [PATCH 3/3] Improve the media keys overlay design
---
plugins/media-keys/gsd-media-keys-window.c | 69 ++++++++++++++++++++--------
1 files changed, 50 insertions(+), 19 deletions(-)
plugins/media-keys/gsd-media-keys-window.c | 59 +++++++++++++++++++++-------
1 files changed, 45 insertions(+), 14 deletions(-)
diff --git a/plugins/media-keys/gsd-media-keys-window.c b/plugins/media-keys/gsd-media-keys-window.c
index 89071b8..a31edca 100644
index cffbe3e..c33d624 100644
--- a/plugins/media-keys/gsd-media-keys-window.c
+++ b/plugins/media-keys/gsd-media-keys-window.c
@@ -33,7 +33,7 @@
@ -57,12 +57,12 @@ index 89071b8..a31edca 100644
draw_volume_boxes (GsdMediaKeysWindow *window,
cairo_t *cr,
double percentage,
@@ -605,35 +635,36 @@ draw_volume_boxes (GsdMediaKeysWindow *window,
GdkColor color;
double r, g, b;
- x1 = width * percentage;
+ x1 = (width - 2) * percentage;
@@ -609,33 +639,34 @@ draw_volume_boxes (GsdMediaKeysWindow *window,
y0 += 0.5;
height = round (height) - 1;
width = round (width) - 1;
- x1 = round ((width - 1) * percentage);
+ x1 = round ((width - 2) * percentage);
/* bar background */
- color = GTK_WIDGET (window)->style->dark [GTK_STATE_NORMAL];
@ -91,25 +91,18 @@ index 89071b8..a31edca 100644
/* bar progress */
- color = GTK_WIDGET (window)->style->bg [GTK_STATE_SELECTED];
- r = (float)color.red / 65535.0;
- g = (float)color.green / 65535.0;
- b = (float)color.blue / 65535.0;
- cairo_rectangle (cr, x0, y0, x1, height);
- cairo_set_source_rgba (cr, r, g, b, FG_ALPHA);
- cairo_fill (cr);
+ if (percentage > 0.01) {
+ if (percentage < 0.01)
+ return;
+ color = GTK_WIDGET (window)->style->bg[GTK_STATE_NORMAL];
+ r = (float)color.red / 65535.0;
+ g = (float)color.green / 65535.0;
+ b = (float)color.blue / 65535.0;
+ rounded_rectangle (cr, 1.0, x0 + 1, y0 + 1, height / 8, x1, height - 2);
+ cairo_set_source_rgba (cr, r, g, b, FG_ALPHA);
+ cairo_fill (cr);
+ }
r = (float)color.red / 65535.0;
g = (float)color.green / 65535.0;
b = (float)color.blue / 65535.0;
- cairo_rectangle (cr, x0 + 0.5, y0 + 0.5, x1, height - 1);
+ rounded_rectangle (cr, 1.0, x0 + 0.5, y0 + 0.5, height / 8, x1, height - 2);
cairo_set_source_rgba (cr, r, g, b, FG_ALPHA);
cairo_fill (cr);
}
static void
@@ -791,18 +822,18 @@ on_expose_event (GtkWidget *widget,
@@ -795,18 +826,18 @@ on_expose_event (GtkWidget *widget,
/* draw a box */
rounded_rectangle (cr, 1.0, 0.5, 0.5, height / 10, width-1, height-1);
@ -132,5 +125,5 @@ index 89071b8..a31edca 100644
cairo_stroke (cr);
--
1.6.4.4
1.6.5.rc2

View File

@ -1,38 +0,0 @@
--- gnome-settings-daemon-2.27.1/plugins/mouse/gsd-locate-pointer.c 2009-05-03 14:15:30.000000000 -0400
+++ hacked/plugins/mouse/gsd-locate-pointer.c 2009-06-08 21:54:05.537099156 -0400
@@ -195,6 +195,22 @@
}
static void
+unset_transparent_shape (GdkWindow *window)
+{
+ gdk_window_shape_combine_mask (data->window, NULL, 0, 0);
+}
+
+static void
+composited_changed (GtkWidget *widget,
+ GsdLocatePointerData *data)
+{
+ if (!gtk_widget_is_composited (widget))
+ set_transparent_shape (data->window);
+ else
+ unset_transparent_shape (data->window);
+}
+
+static void
timeline_finished_cb (GsdTimeline *timeline,
gpointer user_data)
{
@@ -317,8 +333,10 @@
data->progress = 0.;
- if (!gtk_widget_is_composited (data->widget))
- set_transparent_shape (data->window);
+ g_signal_connect (data->widget, "composited-changed",
+ G_CALLBACK (composited_changed), data);
+
+ composited_changed (data->widget, data);
gdk_window_show (data->window);
move_locate_pointer_window (data, screen);

View File

@ -1,451 +0,0 @@
diff -up /dev/null gnome-settings-daemon-2.26.0/data/desktop_gnome_peripherals_touchpad.schemas.in
--- /dev/null 2009-04-08 15:58:42.372260448 -0400
+++ gnome-settings-daemon-2.26.0/data/desktop_gnome_peripherals_touchpad.schemas.in 2009-04-08 20:29:32.449768001 -0400
@@ -0,0 +1,54 @@
+<?xml version="1.0"?>
+<gconfschemafile>
+ <schemalist>
+
+ <schema>
+ <key>/schemas/desktop/gnome/peripherals/touchpad/disable_while_typing</key>
+ <applyto>/desktop/gnome/peripherals/touchpad/disable_while_typing</applyto>
+ <owner>gnome</owner>
+ <type>bool</type>
+ <default>FALSE</default>
+ <locale name="C">
+ <short>Disable touchpad while typing</short>
+ <long>Set this to TRUE if you have problems with accidentally hitting the touchpad while typing.</long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/desktop/gnome/peripherals/touchpad/tap_to_click</key>
+ <applyto>/desktop/gnome/peripherals/touchpad/tap_to_click</applyto>
+ <owner>gnome</owner>
+ <type>bool</type>
+ <default>FALSE</default>
+ <locale name="C">
+ <short>Enable mouse clicks with touchpad</short>
+ <long>Set this to TRUE to be able to send mouse clicks by tapping on the touchpad.</long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/desktop/gnome/peripherals/touchpad/scroll_method</key>
+ <applyto>/desktop/gnome/peripherals/touchpad/scroll_method</applyto>
+ <owner>gnome</owner>
+ <type>int</type>
+ <default>0</default>
+ <locale name="C">
+ <short>Select the touchpad scroll method</short>
+ <long>Select the touchpad scroll method. Supported values are: 0 - disabled, 1 - edge scrolling, 2 - two-finger scrolling</long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/desktop/gnome/peripherals/touchpad/horiz_scroll_enabled</key>
+ <applyto>/desktop/gnome/peripherals/touchpad/horiz_scroll_enabled</applyto>
+ <owner>gnome</owner>
+ <type>bool</type>
+ <default>FALSE</default>
+ <locale name="C">
+ <short>Enable horizontal scrolling</short>
+ <long>Set this to TRUE to allow horizontal scrolling by the same method selected with the scroll_method key.</long>
+ </locale>
+ </schema>
+
+ </schemalist>
+</gconfschemafile>
diff -up gnome-settings-daemon-2.26.0/data/Makefile.am.support-touchpads gnome-settings-daemon-2.26.0/data/Makefile.am
--- gnome-settings-daemon-2.26.0/data/Makefile.am.support-touchpads 2009-02-16 11:34:08.000000000 -0500
+++ gnome-settings-daemon-2.26.0/data/Makefile.am 2009-04-08 20:29:32.449768001 -0400
@@ -10,6 +10,7 @@ schemas_in_files = \
desktop_gnome_font_rendering.schemas.in \
desktop_gnome_keybindings.schemas.in \
apps_gnome_settings_daemon_xrandr.schemas.in \
+ desktop_gnome_peripherals_touchpad.schemas.in \
$(NULL)
schemas_DATA = $(schemas_in_files:.schemas.in=.schemas)
diff -up gnome-settings-daemon-2.26.0/plugins/mouse/gsd-mouse-manager.c.support-touchpads gnome-settings-daemon-2.26.0/plugins/mouse/gsd-mouse-manager.c
--- gnome-settings-daemon-2.26.0/plugins/mouse/gsd-mouse-manager.c.support-touchpads 2009-04-08 20:29:32.446745868 -0400
+++ gnome-settings-daemon-2.26.0/plugins/mouse/gsd-mouse-manager.c 2009-04-08 21:23:16.465987950 -0400
@@ -38,9 +38,11 @@
#include <gdk/gdkx.h>
#include <gdk/gdkkeysyms.h>
#include <X11/keysym.h>
+#include <X11/Xatom.h>
#ifdef HAVE_X11_EXTENSIONS_XINPUT_H
#include <X11/extensions/XInput.h>
+#include <X11/extensions/XIproto.h>
#endif
#include <gconf/gconf.h>
#include <gconf/gconf-client.h>
@@ -54,6 +56,7 @@
#define GCONF_MOUSE_DIR "/desktop/gnome/peripherals/mouse"
#define GCONF_MOUSE_A11Y_DIR "/desktop/gnome/accessibility/mouse"
+#define GCONF_TOUCHPAD_DIR "/desktop/gnome/peripherals/touchpad"
#define KEY_LEFT_HANDED GCONF_MOUSE_DIR "/left_handed"
#define KEY_MOTION_ACCELERATION GCONF_MOUSE_DIR "/motion_acceleration"
@@ -61,13 +64,20 @@
#define KEY_LOCATE_POINTER GCONF_MOUSE_DIR "/locate_pointer"
#define KEY_DWELL_ENABLE GCONF_MOUSE_A11Y_DIR "/dwell_enable"
#define KEY_DELAY_ENABLE GCONF_MOUSE_A11Y_DIR "/delay_enable"
+#define KEY_TOUCHPAD_DISABLE_W_TYPING GCONF_TOUCHPAD_DIR "/disable_while_typing"
+#define KEY_TAP_TO_CLICK GCONF_TOUCHPAD_DIR "/tap_to_click"
+#define KEY_SCROLL_METHOD GCONF_TOUCHPAD_DIR "/scroll_method"
+#define KEY_PAD_HORIZ_SCROLL GCONF_TOUCHPAD_DIR "/horiz_scroll_enabled"
struct GsdMouseManagerPrivate
{
guint notify;
guint notify_a11y;
+ guint notify_touchpad;
gboolean mousetweaks_daemon_running;
+ gboolean syndaemon_spawned;
+ GPid syndaemon_pid;
};
static void gsd_mouse_manager_class_init (GsdMouseManagerClass *klass);
@@ -261,6 +271,9 @@ set_xinput_devices_left_handed (gboolean
device_info = XListInputDevices (GDK_DISPLAY (), &n_devices);
+ if (device_info == NULL)
+ return;
+
if (n_devices > 0)
buttons = g_new (guchar, buttons_capacity);
else
@@ -436,6 +449,256 @@ set_motion_threshold (GsdMouseManager *m
0, 0, motion_threshold);
}
+static XDevice*
+device_is_touchpad (XDeviceInfo deviceinfo)
+{
+ XDevice *device;
+ Atom realtype, prop;
+ int realformat;
+ unsigned long nitems, bytes_after;
+ unsigned char *data;
+
+ if (deviceinfo.type != XInternAtom(GDK_DISPLAY(), XI_TOUCHPAD, False))
+ return NULL;
+
+ prop = XInternAtom(GDK_DISPLAY(), "Synaptics Off", False);
+ if (!prop)
+ return NULL;
+
+ gdk_error_trap_push();
+ device = XOpenDevice(GDK_DISPLAY(), deviceinfo.id);
+ if (gdk_error_trap_pop() || (device == NULL))
+ return NULL;
+
+ gdk_error_trap_push();
+ if ((XGetDeviceProperty(GDK_DISPLAY(), device, prop, 0, 1, False,
+ XA_INTEGER, &realtype, &realformat, &nitems,
+ &bytes_after, &data) == Success) && (realtype != None)) {
+ gdk_error_trap_pop();
+ XFree(data);
+ return device;
+ }
+ gdk_error_trap_pop();
+
+ XCloseDevice(GDK_DISPLAY(), device);
+ return NULL;
+}
+
+static int
+set_disable_w_typing (GsdMouseManager *manager, gboolean state)
+{
+ GError *error = NULL;
+
+ if (state) {
+ char *args[4];
+
+ args[0] = "syndaemon";
+ args[1] = "-i";
+ args[2] = "0.5";
+ args[3] = NULL;
+
+ if (!g_find_program_in_path(args[0]))
+ return 0;
+
+ g_spawn_async(g_get_home_dir(), args, NULL,
+ G_SPAWN_SEARCH_PATH, NULL, NULL,
+ &manager->priv->syndaemon_pid, &error);
+
+ if (error) {
+ GConfClient *client;
+ client = gconf_client_get_default();
+ gconf_client_set_bool(client, KEY_TOUCHPAD_DISABLE_W_TYPING, FALSE, NULL);
+ }
+
+ manager->priv->syndaemon_spawned = (error == NULL);
+
+ } else if (manager->priv->syndaemon_spawned)
+ {
+ kill(manager->priv->syndaemon_pid, SIGHUP);
+ g_spawn_close_pid(manager->priv->syndaemon_pid);
+ manager->priv->syndaemon_spawned = False;
+ }
+
+ return 0;
+}
+
+static int
+set_tap_to_click (gboolean state)
+{
+ int numdevices, i, format, rc;
+ unsigned long nitems, bytes_after;
+ XDeviceInfo *devicelist = XListInputDevices (GDK_DISPLAY(), &numdevices);
+ XDevice * device;
+ unsigned char* data;
+ Atom prop, type;
+
+ if (devicelist == NULL)
+ return 0;
+
+ prop = XInternAtom(GDK_DISPLAY(), "Synaptics Tap Action", False);
+
+ if (!prop)
+ return 0;
+
+ for (i = 0; i < numdevices; i++) {
+ if ((device = device_is_touchpad(devicelist[i]))) {
+ gdk_error_trap_push();
+ rc = XGetDeviceProperty(GDK_DISPLAY(), device, prop, 0, 2,
+ False, XA_INTEGER, &type, &format, &nitems,
+ &bytes_after, &data);
+
+ if (rc == Success && type == XA_INTEGER && format == 8 && nitems >= 7)
+ {
+ /* Set RLM mapping for 1/2/3 fingers*/
+ data[4] = (state) ? 1 : 0;
+ data[5] = (state) ? 3 : 0;
+ data[6] = (state) ? 2 : 0;
+ XChangeDeviceProperty(GDK_DISPLAY(), device, prop, XA_INTEGER, 8,
+ PropModeReplace, data, nitems);
+ }
+
+ if (rc == Success)
+ XFree(data);
+ XCloseDevice (GDK_DISPLAY(), device);
+ if (gdk_error_trap_pop()) {
+ g_warning("Error in setting tap to click on \"%s\"", devicelist[i].name);
+ continue;
+ }
+ }
+ }
+
+ XFreeDeviceList(devicelist);
+ return 0;
+}
+
+static int
+set_horiz_scroll (gboolean state)
+{
+ int numdevices, i, rc;
+ XDeviceInfo *devicelist = XListInputDevices (GDK_DISPLAY(), &numdevices);
+ XDevice *device;
+ Atom act_type, prop_edge, prop_twofinger;
+ int act_format;
+ unsigned long nitems, bytes_after;
+ unsigned char *data;
+
+ if (devicelist == NULL)
+ return 0;
+
+ prop_edge = XInternAtom(GDK_DISPLAY(), "Synaptics Edge Scrolling", False);
+ prop_twofinger = XInternAtom(GDK_DISPLAY(), "Synaptics Two-Finger Scrolling", False);
+
+ if (!prop_edge || !prop_twofinger)
+ return 0;
+
+ for (i = 0; i < numdevices; i++) {
+ if ((device = device_is_touchpad(devicelist[i]))) {
+ gdk_error_trap_push();
+ rc = XGetDeviceProperty(GDK_DISPLAY(), device,
+ prop_edge, 0, 1, False,
+ XA_INTEGER, &act_type, &act_format, &nitems,
+ &bytes_after, &data);
+ if (rc == Success && act_type == XA_INTEGER &&
+ act_format == 8 && nitems >= 2) {
+ data[1] = (state && data[0]);
+ XChangeDeviceProperty(GDK_DISPLAY(), device,
+ prop_edge, XA_INTEGER, 8,
+ PropModeReplace, data, nitems);
+ }
+
+ XFree(data);
+
+ rc = XGetDeviceProperty(GDK_DISPLAY(), device,
+ prop_twofinger, 0, 1, False,
+ XA_INTEGER, &act_type, &act_format, &nitems,
+ &bytes_after, &data);
+ if (rc == Success && act_type == XA_INTEGER &&
+ act_format == 8 && nitems >= 2) {
+ data[1] = (state && data[0]);
+ XChangeDeviceProperty(GDK_DISPLAY(), device,
+ prop_twofinger, XA_INTEGER, 8,
+ PropModeReplace, data, nitems);
+ }
+
+ XFree(data);
+ XCloseDevice (GDK_DISPLAY(), device);
+ if (gdk_error_trap_pop()) {
+ g_warning("Error in setting horiz scroll on \"%s\"", devicelist[i].name);
+ continue;
+ }
+ }
+ }
+
+ XFreeDeviceList(devicelist);
+ return 0;
+}
+
+
+/**
+ * Scroll methods are: 0 - disabled, 1 - edge scrolling, 2 - twofinger
+ * scrolling
+ */
+static int
+set_edge_scroll (int method)
+{
+ int numdevices, i, rc;
+ XDeviceInfo *devicelist = XListInputDevices (GDK_DISPLAY(), &numdevices);
+ XDevice *device;
+ Atom act_type, prop_edge, prop_twofinger;
+ int act_format;
+ unsigned long nitems, bytes_after;
+ unsigned char *data;
+
+ if (devicelist == NULL)
+ return 0;
+
+ prop_edge = XInternAtom(GDK_DISPLAY(), "Synaptics Edge Scrolling", False);
+ prop_twofinger = XInternAtom(GDK_DISPLAY(), "Synaptics Two-Finger Scrolling", False);
+
+ if (!prop_edge || !prop_twofinger)
+ return 0;
+
+ for (i = 0; i < numdevices; i++) {
+ if ((device = device_is_touchpad(devicelist[i]))) {
+ gdk_error_trap_push();
+ rc = XGetDeviceProperty(GDK_DISPLAY(), device,
+ prop_edge, 0, 1, False,
+ XA_INTEGER, &act_type, &act_format, &nitems,
+ &bytes_after, &data);
+ if (rc == Success && act_type == XA_INTEGER &&
+ act_format == 8 && nitems >= 2) {
+ data[0] = (method == 1) ? 1 : 0;
+ XChangeDeviceProperty(GDK_DISPLAY(), device,
+ prop_edge, XA_INTEGER, 8,
+ PropModeReplace, data, nitems);
+ }
+
+ XFree(data);
+
+ rc = XGetDeviceProperty(GDK_DISPLAY(), device,
+ prop_twofinger, 0, 1, False,
+ XA_INTEGER, &act_type, &act_format, &nitems,
+ &bytes_after, &data);
+ if (rc == Success && act_type == XA_INTEGER &&
+ act_format == 8 && nitems >= 2) {
+ data[0] = (method == 2) ? 1 : 0;
+ XChangeDeviceProperty(GDK_DISPLAY(), device,
+ prop_twofinger, XA_INTEGER, 8,
+ PropModeReplace, data, nitems);
+ }
+
+ XFree(data);
+ XCloseDevice (GDK_DISPLAY(), device);
+ if (gdk_error_trap_pop()) {
+ g_warning("Error in setting edge scroll on \"%s\"", devicelist[i].name);
+ continue;
+ }
+ }
+ }
+
+ XFreeDeviceList(devicelist);
+ return 0;
+}
#define KEYBOARD_GROUP_SHIFT 13
#define KEYBOARD_GROUP_MASK ((1 << 13) | (1 << 14))
@@ -647,6 +910,11 @@ set_mouse_settings (GsdMouseManager *man
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));
+ set_disable_w_typing (manager, gconf_client_get_bool (client, KEY_TOUCHPAD_DISABLE_W_TYPING, NULL));
+ set_tap_to_click (gconf_client_get_bool (client, KEY_TAP_TO_CLICK, NULL));
+ set_edge_scroll (gconf_client_get_int (client, KEY_SCROLL_METHOD, NULL));
+ set_horiz_scroll (gconf_client_get_bool (client, KEY_PAD_HORIZ_SCROLL, NULL));
+
g_object_unref (client);
}
@@ -668,6 +936,20 @@ mouse_callback (GConfClient *clie
if (entry->value->type == GCONF_VALUE_INT) {
set_motion_threshold (manager, gconf_value_get_int (entry->value));
}
+ } else if (! strcmp (entry->key, KEY_TOUCHPAD_DISABLE_W_TYPING)) {
+ if (entry->value->type == GCONF_VALUE_BOOL)
+ set_disable_w_typing (manager, gconf_value_get_bool (entry->value));
+ } else if (! strcmp (entry->key, KEY_TAP_TO_CLICK)) {
+ if (entry->value->type == GCONF_VALUE_BOOL)
+ set_tap_to_click (gconf_value_get_bool (entry->value));
+ } else if (! strcmp (entry->key, KEY_SCROLL_METHOD)) {
+ if (entry->value->type == GCONF_VALUE_INT) {
+ set_edge_scroll (gconf_value_get_int (entry->value));
+ set_horiz_scroll (gconf_client_get_bool (client, KEY_PAD_HORIZ_SCROLL, NULL));
+ }
+ } else if (! strcmp (entry->key, KEY_PAD_HORIZ_SCROLL)) {
+ if (entry->value->type == GCONF_VALUE_BOOL)
+ set_horiz_scroll (gconf_value_get_bool (entry->value));
} else if (! strcmp (entry->key, KEY_LOCATE_POINTER)) {
if (entry->value->type == GCONF_VALUE_BOOL) {
set_locate_pointer (manager, gconf_value_get_bool (entry->value));
@@ -722,6 +1004,12 @@ gsd_mouse_manager_idle_cb (GsdMouseManag
client,
GCONF_MOUSE_A11Y_DIR,
(GConfClientNotifyFunc) mouse_callback);
+ manager->priv->notify_touchpad =
+ register_config_callback (manager,
+ client,
+ GCONF_TOUCHPAD_DIR,
+ (GConfClientNotifyFunc) mouse_callback);
+ manager->priv->syndaemon_spawned = False;
#ifdef HAVE_X11_EXTENSIONS_XINPUT_H
set_devicepresence_handler (manager);
@@ -732,6 +1020,11 @@ gsd_mouse_manager_idle_cb (GsdMouseManag
gconf_client_get_bool (client, KEY_DWELL_ENABLE, NULL),
gconf_client_get_bool (client, KEY_DELAY_ENABLE, NULL));
+ set_disable_w_typing (manager, gconf_client_get_bool (client, KEY_TOUCHPAD_DISABLE_W_TYPING, NULL));
+ set_tap_to_click (gconf_client_get_bool (client, KEY_TAP_TO_CLICK, NULL));
+ set_edge_scroll (gconf_client_get_int (client, KEY_SCROLL_METHOD, NULL));
+ set_horiz_scroll (gconf_client_get_bool (client, KEY_PAD_HORIZ_SCROLL, NULL));
+
g_object_unref (client);
gnome_settings_profile_end (NULL);
@@ -774,6 +1067,12 @@ gsd_mouse_manager_stop (GsdMouseManager
p->notify_a11y = 0;
}
+ if (p->notify_touchpad != 0) {
+ gconf_client_remove_dir (client, GCONF_TOUCHPAD_DIR, NULL);
+ gconf_client_notify_remove (client, p->notify_touchpad);
+ p->notify_touchpad = 0;
+ }
+
g_object_unref (client);
set_locate_pointer (manager, FALSE);

View File

@ -1,6 +1,6 @@
Name: gnome-settings-daemon
Version: 2.28.0
Release: 3%{?dist}
Version: 2.28.1
Release: 4%{?dist}
Summary: The daemon sharing settings from GNOME to GTK+/KDE applications
Group: System Environment/Daemons
@ -33,8 +33,16 @@ BuildRequires: fontconfig-devel
BuildRequires: libcanberra-devel
# https://bugzilla.gnome.org/show_bug.cgi?id=596136
Patch0: osd-rounded-rectangle.patch
Patch1: osd-visual-refresh.patch
Patch0: 0002-Use-a-rounded-instead-of-curved-rectangle.patch
Patch1: 0003-Improve-the-media-keys-overlay-design.patch
# https://bugzilla.gnome.org/show_bug.cgi?id=567249
Patch4: 0001-Fix-bluriness-in-level-bar-and-popup.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=498249
Patch2: left-handed-touchpad.patch
# change font rendering
Patch3: slight-hinting.patch
%description
A daemon to share settings from GNOME to other applications. It also
@ -53,8 +61,11 @@ developing applications that use %{name}.
%prep
%setup -q
%patch4 -p1 -b .blurry
%patch0 -p1 -b .osd-rounded-rectangle
%patch1 -p1 -b .osd-visual-refresh
%patch2 -p1 -b .left-handed-touchpad
%patch3 -p1 -b .slight-hinting
%build
%configure --enable-static=no --enable-profiling --disable-esd
@ -166,6 +177,12 @@ fi
%{_libdir}/pkgconfig/gnome-settings-daemon.pc
%changelog
* Tue Oct 27 2009 Bastien Nocera <bnocera@redhat.com> 2.28.1-4
- Update from F-12 branch
* Tue Oct 27 2009 Bastien Nocera <bnocera@redhat.com> 2.28.0-4
- Fix blurriness in the OSD display
* Fri Sep 25 2009 Matthias Clasen <mclasen@redhat.com> - 2.28.0-3
- Align the OSD visuals with the notification theme

View File

@ -1,62 +0,0 @@
--- gnome-settings-daemon-2.27.91/plugins/mouse/gsd-locate-pointer.c 2009-08-30 02:33:02.791519895 -0400
+++ hacked/plugins/mouse/gsd-locate-pointer.c 2009-08-30 02:32:13.785515177 -0400
@@ -126,27 +126,29 @@
cairo_t *cr;
GdkBitmap *mask;
- if (event->window != data->window)
+ if (event && event->window != data->window)
return FALSE;
- cr = gdk_cairo_create (data->window);
-
if (gtk_widget_is_composited (data->widget))
- locate_pointer_paint (data, cr, TRUE);
- else
{
- locate_pointer_paint (data, cr, FALSE);
+ cr = gdk_cairo_create (data->window);
+ locate_pointer_paint (data, cr, TRUE);
cairo_destroy (cr);
-
+ }
+ else
+ {
/* create a bitmap for the shape, reuse the cairo_t to paint on it */
mask = gdk_pixmap_new (data->window, WINDOW_SIZE, WINDOW_SIZE, 1);
cr = gdk_cairo_create (mask);
locate_pointer_paint (data, cr, FALSE);
gdk_window_shape_combine_mask (data->window, mask, 0, 0);
g_object_unref (mask);
- }
+ cairo_destroy (cr);
- cairo_destroy (cr);
+ cr = gdk_cairo_create (data->window);
+ locate_pointer_paint (data, cr, FALSE);
+ cairo_destroy (cr);
+ }
return TRUE;
}
@@ -168,7 +170,7 @@
else if (progress >= data->progress + CIRCLES_PROGRESS_INTERVAL)
{
/* only invalidate window each circle interval */
- gdk_window_invalidate_rect (data->window, NULL, FALSE);
+ locate_pointer_expose (data->widget, NULL, data);
data->progress += CIRCLES_PROGRESS_INTERVAL;
}
@@ -340,10 +342,9 @@
g_signal_connect (data->widget, "composited-changed",
G_CALLBACK (composited_changed), data);
+ move_locate_pointer_window (data, screen);
composited_changed (data->widget, data);
-
gdk_window_show (data->window);
- move_locate_pointer_window (data, screen);
gsd_timeline_start (data->timeline);
}

View File

@ -1,381 +0,0 @@
--- 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)

View File

@ -1,12 +0,0 @@
diff -up gnome-settings-daemon-2.27.3/plugins/keyboard/gsd-keyboard-xkb.c.xklavier4 gnome-settings-daemon-2.27.3/plugins/keyboard/gsd-keyboard-xkb.c
--- gnome-settings-daemon-2.27.3/plugins/keyboard/gsd-keyboard-xkb.c.xklavier4 2009-07-01 09:19:26.936571862 -0400
+++ gnome-settings-daemon-2.27.3/plugins/keyboard/gsd-keyboard-xkb.c 2009-07-01 09:32:19.620817134 -0400
@@ -168,7 +168,7 @@ filter_xkb_config (void)
xkl_debug (100, "Filtering configuration against the registry\n");
if (!xkl_registry) {
xkl_registry = xkl_config_registry_get_instance (xkl_engine);
- if (!xkl_config_registry_load (xkl_registry)) {
+ if (!xkl_config_registry_load (xkl_registry, FALSE)) {
g_object_unref (xkl_registry);
xkl_registry = NULL;
return FALSE;