mirror of
git://git.openembedded.org/meta-openembedded
synced 2026-04-02 02:49:12 +00:00
xfce4-settings: add a 'Touchscreen pointer' option in mouse settings
'Touchscreen pointer' can be set per pointer device. If the pointer device gets active (Press/Move/Plugin) and this option is set: * Mouse cursor is hidden during normal operation * When waiting for startup-notification a wait cursor is displayed * The gtk2 setting TouchscreenMode is set to e.g disable prelighting buttons on mouse over The changes are in use for a while now on my devices help using XFCE on touchsreen devices. The git-version of this patch series was sent to https://bugzilla.xfce.org/show_bug.cgi?id=9474 but no response was received yet. In the patch series attached here the binary cursor files 'invisible' and 'wait' were taken out of patch 0001.. because the files were not created by do_patch. Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
This commit is contained in:
parent
f52e530ac4
commit
8663bf9e29
@ -0,0 +1,248 @@
|
||||
From 4be18d7c8f2ac72b402dcbe8385922638fcd0a89 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@googlemail.com>
|
||||
Date: Tue, 30 Oct 2012 13:14:11 +0100
|
||||
Subject: [PATCH 1/5] add cursor-theme "xfce-invisible"
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
|
||||
Upstream-Status: Submitted [1]
|
||||
[1] https://bugzilla.xfce.org/show_bug.cgi?id=9474
|
||||
---
|
||||
Makefile.am | 1 +
|
||||
configure.ac | 2 +
|
||||
cursors/Makefile.am | 178 +++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
cursors/index.theme | 3 +
|
||||
6 files changed, 184 insertions(+), 0 deletions(-)
|
||||
create mode 100644 cursors/Makefile.am
|
||||
create mode 100644 cursors/index.theme
|
||||
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index 3060bac..3f0dd1d 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -1,6 +1,7 @@
|
||||
# $Id$
|
||||
|
||||
SUBDIRS = \
|
||||
+ cursors \
|
||||
dialogs \
|
||||
xfce4-settings-manager \
|
||||
xfce4-settings-editor \
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 0e7907d..1378049 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -157,6 +157,7 @@ dnl *** Optional support for Xcursor ***
|
||||
dnl ************************************
|
||||
XDT_CHECK_OPTIONAL_PACKAGE([XCURSOR], [xcursor], [1.1.0],
|
||||
[xcursor], [Cursor themes support])
|
||||
+AC_SUBST(cursordir, "\${datadir}/icons/xfce-invisible/cursors")
|
||||
|
||||
dnl ****************************************
|
||||
dnl *** Optional support for Libxklavier ***
|
||||
@@ -232,6 +233,7 @@ AC_SUBST([PLATFORM_LDFLAGS])
|
||||
AC_OUTPUT([
|
||||
Makefile
|
||||
po/Makefile.in
|
||||
+cursors/Makefile
|
||||
dialogs/Makefile
|
||||
dialogs/appearance-settings/Makefile
|
||||
dialogs/accessibility-settings/Makefile
|
||||
diff --git a/cursors/Makefile.am b/cursors/Makefile.am
|
||||
new file mode 100644
|
||||
index 0000000..c9e5a9f
|
||||
--- /dev/null
|
||||
+++ b/cursors/Makefile.am
|
||||
@@ -0,0 +1,178 @@
|
||||
+CURSOR_NAMES_INVISIBLE = \
|
||||
+ 00008160000006810000408080010102 \
|
||||
+ 028006030e0e7ebffc7f7070c0600140 \
|
||||
+ 2870a09082c103050810ffdffffe0204 \
|
||||
+ 03b6e0fcb3499374a867c041f52298f0 \
|
||||
+ 0876e1c15ff2fc01f906f1c363074c0f \
|
||||
+ 08ffe1cb5fe6fc01f906f1c063814ccf \
|
||||
+ 08ffe1e65f80fcfdf9fff11263e74c48 \
|
||||
+ 1001208387f90000800003000700f6ff \
|
||||
+ 1081e37283d90000800003c07f3ef6bf \
|
||||
+ 14fef782d02440884392942c11205230 \
|
||||
+ 208530c400c041818281048008011002 \
|
||||
+ 3085a0e285430894940527032f8b26df \
|
||||
+ 4498f0e0c1937ffe01fd06f973665830 \
|
||||
+ 5aca4d189052212118709018842178c0 \
|
||||
+ 5c6cd98b3f3ebcb1f9c7f1c204630408 \
|
||||
+ 6407b0e94181790501fd1e167b474872 \
|
||||
+ 640fb0e74195791501fd1ed57b41487f \
|
||||
+ 9081237383d90e509aa00f00170e968f \
|
||||
+ 9d800788f1b08800ae810202380a0822 \
|
||||
+ a2a266d0498c3104214a47bd64ab0fc8 \
|
||||
+ b66166c04f8c3109214a4fbd64a50fc8 \
|
||||
+ c7088f0f3e6c8088236ef8e1e3e70000 \
|
||||
+ d9ce0ab605698f320427677b458ad60b \
|
||||
+ e29285e634086352946a0e7090d73106 \
|
||||
+ f41c0e382c94c0958e07017e42b00462 \
|
||||
+ f41c0e382c97c0938e07017e42800402 \
|
||||
+ fcf1c3c7cd4491d801f1e1c78f100000 \
|
||||
+ fcf21c00b30f7e3f83fe0dfd12e71cff \
|
||||
+ alias \
|
||||
+ all-scroll \
|
||||
+ arrow \
|
||||
+ base_arrow_down \
|
||||
+ base_arrow_up \
|
||||
+ based_arrow_down \
|
||||
+ based_arrow_up \
|
||||
+ bd_double_arrow \
|
||||
+ boat \
|
||||
+ bottom_left_corner \
|
||||
+ bottom_right_corner \
|
||||
+ bottom_side \
|
||||
+ bottom_tee \
|
||||
+ cell \
|
||||
+ center_ptr \
|
||||
+ circle \
|
||||
+ closedhand \
|
||||
+ color-picker \
|
||||
+ col-resize \
|
||||
+ copy \
|
||||
+ cross \
|
||||
+ cross_reverse \
|
||||
+ crossed_circle \
|
||||
+ crosshair \
|
||||
+ default \
|
||||
+ diamond_cross \
|
||||
+ dnd-ask \
|
||||
+ dnd-copy \
|
||||
+ dnd-link \
|
||||
+ dnd-move \
|
||||
+ dnd-no-drop \
|
||||
+ dnd-none \
|
||||
+ dot \
|
||||
+ dot_box_mask \
|
||||
+ dotbox \
|
||||
+ double_arrow \
|
||||
+ down_arrow \
|
||||
+ draft_large \
|
||||
+ draft_small \
|
||||
+ draped_box \
|
||||
+ e-resize \
|
||||
+ ew-resize \
|
||||
+ exchange \
|
||||
+ fd_double_arrow \
|
||||
+ fleur \
|
||||
+ forbidden \
|
||||
+ grab \
|
||||
+ grabbing \
|
||||
+ gumby \
|
||||
+ h_double_arrow \
|
||||
+ hand \
|
||||
+ hand1 \
|
||||
+ hand2 \
|
||||
+ help \
|
||||
+ ibeam \
|
||||
+ icon \
|
||||
+ left_arrow \
|
||||
+ left_ptr \
|
||||
+ left_side \
|
||||
+ left_tee \
|
||||
+ link \
|
||||
+ ll_angle \
|
||||
+ lr_angle \
|
||||
+ move \
|
||||
+ ne-resize \
|
||||
+ nesw-resize \
|
||||
+ no-drop \
|
||||
+ not-allowed \
|
||||
+ n-resize \
|
||||
+ ns-resize \
|
||||
+ nw-resize \
|
||||
+ nwse-resize \
|
||||
+ openhand \
|
||||
+ pencil \
|
||||
+ pirate \
|
||||
+ plus \
|
||||
+ pointer \
|
||||
+ pointing_hand \
|
||||
+ question_arrow \
|
||||
+ right_arrow \
|
||||
+ right_ptr \
|
||||
+ right_side \
|
||||
+ right_tee \
|
||||
+ row-resize \
|
||||
+ sailboat \
|
||||
+ sb_down_arrow \
|
||||
+ sb_h_double_arrow \
|
||||
+ sb_left_arrow \
|
||||
+ sb_right_arrow \
|
||||
+ sb_up_arrow \
|
||||
+ sb_v_double_arrow \
|
||||
+ se-resize \
|
||||
+ size_all \
|
||||
+ size_bdiag \
|
||||
+ size_fdiag \
|
||||
+ size_hor \
|
||||
+ size_ver \
|
||||
+ sizing \
|
||||
+ shuttle \
|
||||
+ split_h \
|
||||
+ split_v \
|
||||
+ s-resize \
|
||||
+ sw-resize \
|
||||
+ target \
|
||||
+ tcross \
|
||||
+ text \
|
||||
+ top_left_arrow \
|
||||
+ top_left_corner \
|
||||
+ top_right_corner \
|
||||
+ top_side \
|
||||
+ top_tee \
|
||||
+ trek \
|
||||
+ ul_angle \
|
||||
+ up_arrow \
|
||||
+ ur_angle \
|
||||
+ vertical-text \
|
||||
+ v_double_arrow \
|
||||
+ whats_this \
|
||||
+ w-resize \
|
||||
+ X_cursor \
|
||||
+ xterm \
|
||||
+ zoom-in \
|
||||
+ zoom-out
|
||||
+
|
||||
+CURSOR_NAMES = \
|
||||
+ 3ecb610c1bf2410f44200f48c40d3599 \
|
||||
+ 08e8e1c95fe2fc01f976f1e063a24ccd \
|
||||
+ 00000000000000020006000e7e9ffc3f \
|
||||
+ half-busy \
|
||||
+ left_ptr_watch \
|
||||
+ progress \
|
||||
+ watch
|
||||
+
|
||||
+
|
||||
+EXTRA_DIST = invisible wait index.theme
|
||||
+
|
||||
+install-data-local:
|
||||
+ $(mkinstalldirs) $(DESTDIR)@cursordir@;
|
||||
+ $(INSTALL_DATA) index.theme $(DESTDIR)/@cursordir@/..
|
||||
+ $(INSTALL_DATA) invisible wait $(DESTDIR)@cursordir@/
|
||||
+ for CURSOR in $(CURSOR_NAMES_INVISIBLE); do \
|
||||
+ echo '-- Installing invisible cursor '$$CURSOR; \
|
||||
+ ln -s invisible $(DESTDIR)@cursordir@/$$CURSOR; \
|
||||
+ done
|
||||
+ for CURSOR in $(CURSOR_NAMES); do \
|
||||
+ echo '-- Installing visible cursor '$$CURSOR; \
|
||||
+ ln -s wait $(DESTDIR)@cursordir@/$$CURSOR; \
|
||||
+ done
|
||||
+
|
||||
diff --git a/cursors/index.theme b/cursors/index.theme
|
||||
new file mode 100644
|
||||
index 0000000..0c48458
|
||||
--- /dev/null
|
||||
+++ b/cursors/index.theme
|
||||
@@ -0,0 +1,3 @@
|
||||
+[Icon Theme]
|
||||
+Name=xfce-invisible
|
||||
+Example=invisible
|
||||
--
|
||||
1.7.6.5
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,137 @@
|
||||
From a3b0218137c8796fbb7bd6d852dc8ab5895a65cb Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@googlemail.com>
|
||||
Date: Sat, 3 Nov 2012 18:32:01 +0100
|
||||
Subject: [PATCH 3/5] XfcePointersHelper gets a pointer to XfceXSettingsHelper
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
|
||||
Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
|
||||
Upstream-Status: Submitted [1]
|
||||
[1] https://bugzilla.xfce.org/show_bug.cgi?id=9474
|
||||
---
|
||||
xfsettingsd/main.c | 2 +-
|
||||
xfsettingsd/pointers.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 56 insertions(+), 1 deletions(-)
|
||||
|
||||
diff --git a/xfsettingsd/main.c b/xfsettingsd/main.c
|
||||
index 55c4183..99982f7 100644
|
||||
--- a/xfsettingsd/main.c
|
||||
+++ b/xfsettingsd/main.c
|
||||
@@ -273,7 +273,7 @@ main (gint argc, gchar **argv)
|
||||
#ifdef HAVE_XRANDR
|
||||
displays_helper = g_object_new (XFCE_TYPE_DISPLAYS_HELPER, NULL);
|
||||
#endif
|
||||
- pointer_helper = g_object_new (XFCE_TYPE_POINTERS_HELPER, NULL);
|
||||
+ pointer_helper = g_object_new (XFCE_TYPE_POINTERS_HELPER, "xsettings-helper", xsettings_helper, NULL);
|
||||
keyboards_helper = g_object_new (XFCE_TYPE_KEYBOARDS_HELPER, NULL);
|
||||
accessibility_helper = g_object_new (XFCE_TYPE_ACCESSIBILITY_HELPER, NULL);
|
||||
shortcuts_helper = g_object_new (XFCE_TYPE_KEYBOARD_SHORTCUTS_HELPER, NULL);
|
||||
diff --git a/xfsettingsd/pointers.c b/xfsettingsd/pointers.c
|
||||
index e7192e7..62ebc60 100644
|
||||
--- a/xfsettingsd/pointers.c
|
||||
+++ b/xfsettingsd/pointers.c
|
||||
@@ -47,8 +47,16 @@
|
||||
|
||||
#define XFCONF_TYPE_G_VALUE_ARRAY (dbus_g_type_get_collection ("GPtrArray", G_TYPE_VALUE))
|
||||
|
||||
+/* Property identifiers */
|
||||
+enum
|
||||
+{
|
||||
+ PROP_0,
|
||||
+ PROP_XSETTINGS_HELPER,
|
||||
+};
|
||||
+
|
||||
|
||||
|
||||
+static void xfce_pointers_helper_constructed (GObject *object);
|
||||
static void xfce_pointers_helper_finalize (GObject *object);
|
||||
static void xfce_pointers_helper_syndaemon_stop (XfcePointersHelper *helper);
|
||||
static void xfce_pointers_helper_syndaemon_check (XfcePointersHelper *helper);
|
||||
@@ -63,6 +71,10 @@ static GdkFilterReturn xfce_pointers_helper_event_filter (GdkXEvent
|
||||
GdkEvent *gdk_event,
|
||||
gpointer user_data);
|
||||
#endif
|
||||
+static void xfce_pointers_helper_set_property (GObject *object,
|
||||
+ guint prop_id,
|
||||
+ const GValue *value,
|
||||
+ GParamSpec *pspec);
|
||||
|
||||
|
||||
|
||||
@@ -75,6 +87,8 @@ struct _XfcePointersHelper
|
||||
{
|
||||
GObject __parent__;
|
||||
|
||||
+ GObject *xsettings_helper;
|
||||
+
|
||||
/* xfconf channel */
|
||||
XfconfChannel *channel;
|
||||
|
||||
@@ -108,7 +122,18 @@ xfce_pointers_helper_class_init (XfcePointersHelperClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
+ gobject_class->constructed = xfce_pointers_helper_constructed;
|
||||
gobject_class->finalize = xfce_pointers_helper_finalize;
|
||||
+ gobject_class->set_property = xfce_pointers_helper_set_property;
|
||||
+
|
||||
+ g_object_class_install_property (gobject_class,
|
||||
+ PROP_XSETTINGS_HELPER,
|
||||
+ g_param_spec_object ("xsettings-helper",
|
||||
+ "xsettings-helper",
|
||||
+ "xsettings-helper",
|
||||
+ G_TYPE_OBJECT,
|
||||
+ G_PARAM_CONSTRUCT_ONLY |
|
||||
+ G_PARAM_WRITABLE));
|
||||
}
|
||||
|
||||
|
||||
@@ -116,6 +141,15 @@ xfce_pointers_helper_class_init (XfcePointersHelperClass *klass)
|
||||
static void
|
||||
xfce_pointers_helper_init (XfcePointersHelper *helper)
|
||||
{
|
||||
+ /* All initialisation is done at xfce_pointers_helper_constructed */
|
||||
+}
|
||||
+
|
||||
+
|
||||
+
|
||||
+static void
|
||||
+xfce_pointers_helper_constructed (GObject *object)
|
||||
+{
|
||||
+ XfcePointersHelper *helper = XFCE_POINTERS_HELPER (object);
|
||||
XExtensionVersion *version = NULL;
|
||||
Display *xdisplay;
|
||||
#ifdef DEVICE_HOTPLUGGING
|
||||
@@ -181,6 +215,27 @@ xfce_pointers_helper_init (XfcePointersHelper *helper)
|
||||
|
||||
|
||||
static void
|
||||
+xfce_pointers_helper_set_property (GObject *object,
|
||||
+ guint prop_id,
|
||||
+ const GValue *value,
|
||||
+ GParamSpec *pspec)
|
||||
+{
|
||||
+ XfcePointersHelper *helper = XFCE_POINTERS_HELPER (object);
|
||||
+
|
||||
+ switch (prop_id)
|
||||
+ {
|
||||
+ case PROP_XSETTINGS_HELPER:
|
||||
+ helper->xsettings_helper = g_value_get_object (value);
|
||||
+ break;
|
||||
+ default:
|
||||
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
+ break;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+
|
||||
+
|
||||
+static void
|
||||
xfce_pointers_helper_finalize (GObject *object)
|
||||
{
|
||||
xfce_pointers_helper_syndaemon_stop (XFCE_POINTERS_HELPER (object));
|
||||
--
|
||||
1.7.6.5
|
||||
|
||||
@ -0,0 +1,251 @@
|
||||
From 878fe1287a4c73f67dd2b51d1d7c450097aeffa7 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@googlemail.com>
|
||||
Date: Thu, 20 Dec 2012 16:49:18 +0100
|
||||
Subject: [PATCH 4/5] XfceXSettingsHelper gets a property
|
||||
"touchscreen-pointer"
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
When this property is set, it overrides overrides cursor theme to
|
||||
"xfce-invisible" and sets /Gtk/TouchscreenMode.
|
||||
|
||||
Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
|
||||
Upstream-Status: Submitted [1]
|
||||
[1] https://bugzilla.xfce.org/show_bug.cgi?id=9474
|
||||
---
|
||||
xfsettingsd/xsettings.c | 122 ++++++++++++++++++++++++++++++++++++++++++++-
|
||||
xfsettingsd/xsettings.xml | 1 +
|
||||
2 files changed, 122 insertions(+), 1 deletions(-)
|
||||
|
||||
diff --git a/xfsettingsd/xsettings.c b/xfsettingsd/xsettings.c
|
||||
index 7657465..76bcea1 100644
|
||||
--- a/xfsettingsd/xsettings.c
|
||||
+++ b/xfsettingsd/xsettings.c
|
||||
@@ -73,6 +73,15 @@ typedef struct _XfceXSettingsNotify XfceXSettingsNotify;
|
||||
|
||||
|
||||
|
||||
+/* Property identifiers */
|
||||
+enum
|
||||
+{
|
||||
+ PROP_0,
|
||||
+ PROP_TOUCHSCREEN_POINTER,
|
||||
+};
|
||||
+
|
||||
+
|
||||
+
|
||||
static void xfce_xsettings_helper_finalize (GObject *object);
|
||||
static void xfce_xsettings_helper_fc_free (XfceXSettingsHelper *helper);
|
||||
static gboolean xfce_xsettings_helper_fc_init (gpointer data);
|
||||
@@ -86,6 +95,10 @@ static void xfce_xsettings_helper_load (XfceXSettingsHelper *helper)
|
||||
static void xfce_xsettings_helper_screen_free (XfceXSettingsScreen *screen);
|
||||
static void xfce_xsettings_helper_notify_xft (XfceXSettingsHelper *helper);
|
||||
static void xfce_xsettings_helper_notify (XfceXSettingsHelper *helper);
|
||||
+static void xfce_xsettings_helper_set_property (GObject *object,
|
||||
+ guint prop_id,
|
||||
+ const GValue *value,
|
||||
+ GParamSpec *pspec);
|
||||
|
||||
|
||||
|
||||
@@ -120,6 +133,13 @@ struct _XfceXSettingsHelper
|
||||
GPtrArray *fc_monitors;
|
||||
guint fc_notify_timeout_id;
|
||||
guint fc_init_id;
|
||||
+
|
||||
+ /* keeper for touchscreen cursor theme / last set */
|
||||
+ GValue *touchscreen_cursor_value;
|
||||
+ GValue *lastset_cursor_value;
|
||||
+
|
||||
+ /* properties */
|
||||
+ gboolean touchscreen_pointer;
|
||||
};
|
||||
|
||||
struct _XfceXSetting
|
||||
@@ -157,6 +177,16 @@ xfce_xsettings_helper_class_init (XfceXSettingsHelperClass *klass)
|
||||
|
||||
gobject_class = G_OBJECT_CLASS (klass);
|
||||
gobject_class->finalize = xfce_xsettings_helper_finalize;
|
||||
+ gobject_class->set_property = xfce_xsettings_helper_set_property;
|
||||
+
|
||||
+ g_object_class_install_property (gobject_class,
|
||||
+ PROP_TOUCHSCREEN_POINTER,
|
||||
+ g_param_spec_boolean ("touchscreen-pointer",
|
||||
+ "touchscreen-pointer",
|
||||
+ "touchscreen-pointer",
|
||||
+ FALSE,
|
||||
+ G_PARAM_WRITABLE |
|
||||
+ G_PARAM_STATIC_STRINGS));
|
||||
}
|
||||
|
||||
|
||||
@@ -169,6 +199,13 @@ xfce_xsettings_helper_init (XfceXSettingsHelper *helper)
|
||||
helper->settings = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
g_free, xfce_xsettings_helper_setting_free);
|
||||
|
||||
+ helper->lastset_cursor_value = g_new0 (GValue, 1);
|
||||
+ g_value_init(helper->lastset_cursor_value, G_TYPE_STRING);
|
||||
+ g_value_set_string (helper->lastset_cursor_value, "default");
|
||||
+ helper->touchscreen_cursor_value = g_new0 (GValue, 1);
|
||||
+ g_value_init(helper->touchscreen_cursor_value, G_TYPE_STRING);
|
||||
+ g_value_set_string (helper->touchscreen_cursor_value, "xfce-invisible");
|
||||
+
|
||||
xfce_xsettings_helper_load (helper);
|
||||
|
||||
g_signal_connect (G_OBJECT (helper->channel), "property-changed",
|
||||
@@ -202,6 +239,9 @@ xfce_xsettings_helper_finalize (GObject *object)
|
||||
|
||||
g_hash_table_destroy (helper->settings);
|
||||
|
||||
+ g_free (helper->lastset_cursor_value);
|
||||
+ g_free (helper->touchscreen_cursor_value);
|
||||
+
|
||||
(*G_OBJECT_CLASS (xfce_xsettings_helper_parent_class)->finalize) (object);
|
||||
}
|
||||
|
||||
@@ -387,6 +427,61 @@ xfce_xsettings_helper_notify_xft_idle (gpointer data)
|
||||
|
||||
|
||||
|
||||
+static void
|
||||
+xfce_xsettings_helper_set_property (GObject *object,
|
||||
+ guint prop_id,
|
||||
+ const GValue *value,
|
||||
+ GParamSpec *pspec)
|
||||
+{
|
||||
+ gboolean touchscreen_pointer;
|
||||
+ XfceXSetting *setting_theme, *setting_touchscreen;
|
||||
+ XfceXSettingsHelper *helper = XFCE_XSETTINGS_HELPER (object);
|
||||
+ GtkSettings *gtk_settings;
|
||||
+ GValue bool_val = { 0, };
|
||||
+
|
||||
+ switch (prop_id)
|
||||
+ {
|
||||
+ case PROP_TOUCHSCREEN_POINTER:
|
||||
+ touchscreen_pointer = g_value_get_boolean (value);
|
||||
+ if (helper->touchscreen_pointer != touchscreen_pointer)
|
||||
+ {
|
||||
+ helper->touchscreen_pointer = touchscreen_pointer;
|
||||
+ /* Update touchscreen-mode */
|
||||
+ xfconf_channel_set_bool (helper->channel, "/Gtk/TouchscreenMode", touchscreen_pointer);
|
||||
+ /* Update cursor */
|
||||
+ setting_theme = g_hash_table_lookup (helper->settings, "/Gtk/CursorThemeName");
|
||||
+ if (G_LIKELY (setting_theme != NULL))
|
||||
+ {
|
||||
+ /* update the serial */
|
||||
+ setting_theme->last_change_serial = helper->serial;
|
||||
+ /* update value */
|
||||
+ g_value_reset (setting_theme->value);
|
||||
+ g_value_copy (touchscreen_pointer ?
|
||||
+ helper->touchscreen_cursor_value :
|
||||
+ helper->lastset_cursor_value,
|
||||
+ setting_theme->value);
|
||||
+ }
|
||||
+ else
|
||||
+ g_critical("Setting not found for /Gtk/CursorThemeName");
|
||||
+
|
||||
+ if (G_LIKELY (setting_touchscreen != NULL || setting_theme != NULL))
|
||||
+ {
|
||||
+ /* schedule xsettings update */
|
||||
+ if (helper->notify_idle_id == 0)
|
||||
+ helper->notify_idle_id = g_idle_add (xfce_xsettings_helper_notify_idle, helper);
|
||||
+ if (helper->notify_xft_idle_id == 0)
|
||||
+ helper->notify_xft_idle_id = g_idle_add (xfce_xsettings_helper_notify_xft_idle, helper);
|
||||
+ }
|
||||
+ }
|
||||
+ break;
|
||||
+ default:
|
||||
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
+ break;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+
|
||||
+
|
||||
static gboolean
|
||||
xfce_xsettings_helper_prop_valid (const gchar *prop_name,
|
||||
const GValue *value)
|
||||
@@ -413,6 +508,28 @@ xfce_xsettings_helper_prop_valid (const gchar *prop_name,
|
||||
|
||||
|
||||
|
||||
+static void
|
||||
+xfce_xsettings_helper_check_cursor (const gchar *prop_name,
|
||||
+ GValue *value,
|
||||
+ XfceXSettingsHelper *helper)
|
||||
+{
|
||||
+ if (g_strcmp0 (prop_name, "/Gtk/CursorThemeName") == 0)
|
||||
+ {
|
||||
+ /* Keep last cursor theme set */
|
||||
+ g_value_reset (helper->lastset_cursor_value);
|
||||
+ g_value_copy (value, helper->lastset_cursor_value);
|
||||
+
|
||||
+ /* invisible replacement required ? */
|
||||
+ if (helper->touchscreen_pointer)
|
||||
+ {
|
||||
+ g_value_reset (value);
|
||||
+ g_value_copy (helper->touchscreen_cursor_value, value);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+
|
||||
+
|
||||
static gboolean
|
||||
xfce_xsettings_helper_prop_load (gchar *prop_name,
|
||||
GValue *value,
|
||||
@@ -426,6 +543,7 @@ xfce_xsettings_helper_prop_load (gchar *prop_name,
|
||||
|
||||
setting = g_slice_new0 (XfceXSetting);
|
||||
setting->value = value;
|
||||
+ xfce_xsettings_helper_check_cursor (prop_name, setting->value, helper);
|
||||
setting->last_change_serial = helper->serial;
|
||||
|
||||
xfsettings_dbg_filtered (XFSD_DEBUG_XSETTINGS, "prop \"%s\" loaded (type=%s)",
|
||||
@@ -462,6 +580,7 @@ xfce_xsettings_helper_prop_changed (XfconfChannel *channel,
|
||||
* it first */
|
||||
g_value_reset (setting->value);
|
||||
g_value_copy (value, setting->value);
|
||||
+ xfce_xsettings_helper_check_cursor (prop_name, setting->value, helper);
|
||||
|
||||
/* update the serial */
|
||||
setting->last_change_serial = helper->serial;
|
||||
@@ -475,6 +594,7 @@ xfce_xsettings_helper_prop_changed (XfconfChannel *channel,
|
||||
|
||||
g_value_init (setting->value, G_VALUE_TYPE (value));
|
||||
g_value_copy (value, setting->value);
|
||||
+ xfce_xsettings_helper_check_cursor (prop_name, setting->value, helper);
|
||||
|
||||
g_hash_table_insert (helper->settings, g_strdup (prop_name), setting);
|
||||
}
|
||||
@@ -649,6 +769,7 @@ xfce_xsettings_helper_notify_xft (XfceXSettingsHelper *helper)
|
||||
XfceXSetting *setting;
|
||||
guint i;
|
||||
GValue bool_val = { 0, };
|
||||
+
|
||||
const gchar *props[][2] =
|
||||
{
|
||||
/* { xfconf name}, { xft name } */
|
||||
@@ -700,7 +821,6 @@ xfce_xsettings_helper_notify_xft (XfceXSettingsHelper *helper)
|
||||
PropModeReplace,
|
||||
(guchar *) resource->str,
|
||||
resource->len);
|
||||
-
|
||||
XCloseDisplay (xdisplay);
|
||||
|
||||
if (gdk_error_trap_pop () != 0)
|
||||
diff --git a/xfsettingsd/xsettings.xml b/xfsettingsd/xsettings.xml
|
||||
index 0a579d6..baa413c 100644
|
||||
--- a/xfsettingsd/xsettings.xml
|
||||
+++ b/xfsettingsd/xsettings.xml
|
||||
@@ -41,5 +41,6 @@
|
||||
<property name="MenuBarAccel" type="string" value="F10"/>
|
||||
<property name="CursorThemeName" type="string" value=""/>
|
||||
<property name="CursorThemeSize" type="int" value="0"/>
|
||||
+ <property name="TouchscreenMode" type="bool" value="false"/>
|
||||
<property name="IMModule" type="string" value=""/>
|
||||
</property>
|
||||
</channel>--
|
||||
1.7.6.5
|
||||
|
||||
@ -0,0 +1,582 @@
|
||||
From 37f5e33511499d320c3035c5377425004657faa5 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@googlemail.com>
|
||||
Date: Thu, 20 Dec 2012 16:58:19 +0100
|
||||
Subject: [PATCH 5/5] pointers: detect a change of pointer-device used and set
|
||||
"touchscreen-pointer" as found in xfconf
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
To detect pointer device in use the DevicePresence-, DeviceMotionNotify- and
|
||||
DeviceButtonPress-events are handled. Tests showed that by repopenning and
|
||||
closing the pointer devices (e.g when another setting was modified), the events
|
||||
stopped working. Therefore all pointer devices are opened only once and managed
|
||||
in a hash table.
|
||||
|
||||
Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
|
||||
Upstream-Status: Submitted [1]
|
||||
[1] https://bugzilla.xfce.org/show_bug.cgi?id=9474
|
||||
---
|
||||
xfsettingsd/pointers.c | 337 +++++++++++++++++++++++++++++++----------------
|
||||
1 files changed, 222 insertions(+), 115 deletions(-)
|
||||
|
||||
diff --git a/xfsettingsd/pointers.c b/xfsettingsd/pointers.c
|
||||
index 62ebc60..32662cc 100644
|
||||
--- a/xfsettingsd/pointers.c
|
||||
+++ b/xfsettingsd/pointers.c
|
||||
@@ -66,11 +66,9 @@ static void xfce_pointers_helper_channel_property_changed (XfconfCha
|
||||
const gchar *property_name,
|
||||
const GValue *value,
|
||||
XfcePointersHelper *helper);
|
||||
-#ifdef DEVICE_HOTPLUGGING
|
||||
static GdkFilterReturn xfce_pointers_helper_event_filter (GdkXEvent *xevent,
|
||||
GdkEvent *gdk_event,
|
||||
gpointer user_data);
|
||||
-#endif
|
||||
static void xfce_pointers_helper_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
@@ -96,8 +94,11 @@ struct _XfcePointersHelper
|
||||
GPid syndaemon_pid;
|
||||
#endif
|
||||
|
||||
+ GHashTable *pointer_devices;
|
||||
+ XID last_pointer_active;
|
||||
+ gint device_motion_event_type;
|
||||
+ gint device_button_press_event_type;
|
||||
#ifdef DEVICE_HOTPLUGGING
|
||||
- /* device presence event type */
|
||||
gint device_presence_event_type;
|
||||
#endif
|
||||
};
|
||||
@@ -117,6 +118,15 @@ G_DEFINE_TYPE (XfcePointersHelper, xfce_pointers_helper, G_TYPE_OBJECT);
|
||||
|
||||
|
||||
|
||||
+typedef struct
|
||||
+{
|
||||
+ XDevice *device;
|
||||
+ gchar* name;
|
||||
+}
|
||||
+XfcePointerDeviceData;
|
||||
+
|
||||
+
|
||||
+
|
||||
static void
|
||||
xfce_pointers_helper_class_init (XfcePointersHelperClass *klass)
|
||||
{
|
||||
@@ -147,6 +157,18 @@ xfce_pointers_helper_init (XfcePointersHelper *helper)
|
||||
|
||||
|
||||
static void
|
||||
+xfce_pointers_device_close (gpointer data)
|
||||
+{
|
||||
+ XfcePointerDeviceData *device_data = data;
|
||||
+
|
||||
+ XCloseDevice (GDK_DISPLAY (), device_data->device);
|
||||
+ g_free (device_data->name);
|
||||
+ g_free (device_data);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+
|
||||
+static void
|
||||
xfce_pointers_helper_constructed (GObject *object)
|
||||
{
|
||||
XfcePointersHelper *helper = XFCE_POINTERS_HELPER (object);
|
||||
@@ -185,6 +207,10 @@ xfce_pointers_helper_constructed (GObject *object)
|
||||
helper->channel = xfconf_channel_get ("pointers");
|
||||
|
||||
/* restore the pointer devices */
|
||||
+ helper->pointer_devices = g_hash_table_new_full (g_int_hash,
|
||||
+ g_int_equal,
|
||||
+ g_free,
|
||||
+ xfce_pointers_device_close);
|
||||
xfce_pointers_helper_restore_devices (helper, NULL);
|
||||
|
||||
/* monitor the channel */
|
||||
@@ -194,21 +220,20 @@ xfce_pointers_helper_constructed (GObject *object)
|
||||
/* launch syndaemon if required */
|
||||
xfce_pointers_helper_syndaemon_check (helper);
|
||||
|
||||
-#ifdef DEVICE_HOTPLUGGING
|
||||
if (G_LIKELY (xdisplay != NULL))
|
||||
{
|
||||
+#ifdef DEVICE_HOTPLUGGING
|
||||
/* monitor device changes */
|
||||
gdk_error_trap_push ();
|
||||
DevicePresence (xdisplay, helper->device_presence_event_type, event_class);
|
||||
XSelectExtensionEvent (xdisplay, RootWindow (xdisplay, DefaultScreen (xdisplay)), &event_class, 1);
|
||||
|
||||
/* add an event filter */
|
||||
- if (gdk_error_trap_pop () == 0)
|
||||
- gdk_window_add_filter (NULL, xfce_pointers_helper_event_filter, helper);
|
||||
- else
|
||||
+ if (gdk_error_trap_pop () != 0)
|
||||
g_warning ("Failed to create device filter");
|
||||
- }
|
||||
#endif
|
||||
+ gdk_window_add_filter (NULL, xfce_pointers_helper_event_filter, helper);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,7 +263,10 @@ xfce_pointers_helper_set_property (GObject *object,
|
||||
static void
|
||||
xfce_pointers_helper_finalize (GObject *object)
|
||||
{
|
||||
- xfce_pointers_helper_syndaemon_stop (XFCE_POINTERS_HELPER (object));
|
||||
+ XfcePointersHelper* helper = XFCE_POINTERS_HELPER (object);
|
||||
+
|
||||
+ xfce_pointers_helper_syndaemon_stop (helper);
|
||||
+ g_hash_table_destroy (helper->pointer_devices);
|
||||
|
||||
(*G_OBJECT_CLASS (xfce_pointers_helper_parent_class)->finalize) (object);
|
||||
}
|
||||
@@ -267,17 +295,17 @@ static void
|
||||
xfce_pointers_helper_syndaemon_check (XfcePointersHelper *helper)
|
||||
{
|
||||
#ifdef DEVICE_PROPERTIES
|
||||
- Display *xdisplay = GDK_DISPLAY ();
|
||||
- XDeviceInfo *device_list;
|
||||
- XDevice *device;
|
||||
- gint n, ndevices;
|
||||
- Atom touchpad_type;
|
||||
- Atom touchpad_off_prop;
|
||||
- Atom *props;
|
||||
- gint i, nprops;
|
||||
- gboolean have_synaptics = FALSE;
|
||||
- gchar *args[] = { "syndaemon", "-i", "2.0", "-K", "-R", NULL };
|
||||
- GError *error = NULL;
|
||||
+ Display *xdisplay = GDK_DISPLAY ();
|
||||
+ XDeviceInfo *device_list;
|
||||
+ XfcePointerDeviceData *device_data;
|
||||
+ gint n, ndevices;
|
||||
+ Atom touchpad_type;
|
||||
+ Atom touchpad_off_prop;
|
||||
+ Atom *props;
|
||||
+ gint i, nprops;
|
||||
+ gboolean have_synaptics = FALSE;
|
||||
+ gchar *args[] = { "syndaemon", "-i", "2.0", "-K", "-R", NULL };
|
||||
+ GError *error = NULL;
|
||||
|
||||
/* only stop a running daemon */
|
||||
if (!xfconf_channel_get_bool (helper->channel, "/DisableTouchpadWhileTyping", FALSE))
|
||||
@@ -297,17 +325,16 @@ xfce_pointers_helper_syndaemon_check (XfcePointersHelper *helper)
|
||||
if (device_list[n].type != touchpad_type)
|
||||
continue;
|
||||
|
||||
- gdk_error_trap_push ();
|
||||
- device = XOpenDevice (xdisplay, device_list[n].id);
|
||||
- if (gdk_error_trap_pop () != 0 || device == NULL)
|
||||
+ device_data = g_hash_table_lookup (helper->pointer_devices, &device_list[n].id);
|
||||
+ if (device_data == NULL)
|
||||
{
|
||||
- g_critical ("Unable to open device %s", device_list[n].name);
|
||||
+ g_critical ("xfce_pointers_helper_syndaemon_check: Unable to find device %s / ID %i in hash table", device_list[n].name, device_list[n].id);
|
||||
break;
|
||||
}
|
||||
|
||||
/* look for the Synaptics Off property */
|
||||
gdk_error_trap_push ();
|
||||
- props = XListDeviceProperties (xdisplay, device, &nprops);
|
||||
+ props = XListDeviceProperties (xdisplay, device_data->device, &nprops);
|
||||
if (gdk_error_trap_pop () == 0
|
||||
&& props != NULL)
|
||||
{
|
||||
@@ -317,8 +344,6 @@ xfce_pointers_helper_syndaemon_check (XfcePointersHelper *helper)
|
||||
XFree (props);
|
||||
}
|
||||
|
||||
- XCloseDevice (xdisplay, device);
|
||||
-
|
||||
if (have_synaptics)
|
||||
break;
|
||||
}
|
||||
@@ -844,24 +869,56 @@ xfce_pointers_helper_change_properties (gpointer key,
|
||||
|
||||
|
||||
static void
|
||||
+xfce_pointers_helper_change_current_device (XfcePointersHelper *helper,
|
||||
+ XID *xid)
|
||||
+{
|
||||
+ XfcePointerDeviceData *device_data;
|
||||
+ gchar* prop;
|
||||
+ GValue bool_val = { 0, };
|
||||
+
|
||||
+ helper->last_pointer_active = *xid;
|
||||
+ device_data = g_hash_table_lookup (helper->pointer_devices, xid);
|
||||
+ if (device_data == NULL)
|
||||
+ {
|
||||
+ g_critical ("Unable to find device ID %i in hash table", *xid);
|
||||
+ return;
|
||||
+ }
|
||||
+ if (G_LIKELY (G_IS_OBJECT (helper->xsettings_helper)))
|
||||
+ {
|
||||
+ prop = g_strconcat ("/", device_data->name, "/TouchscreenPointer", NULL);
|
||||
+ g_value_init (&bool_val, G_TYPE_BOOLEAN);
|
||||
+ g_value_set_boolean (&bool_val,
|
||||
+ xfconf_channel_get_bool (helper->channel, prop, FALSE));
|
||||
+ g_object_set_property (helper->xsettings_helper, "touchscreen-pointer", &bool_val);
|
||||
+ g_value_unset (&bool_val);
|
||||
+ g_free (prop);
|
||||
+ }
|
||||
+ else
|
||||
+ g_critical ("xsettings_helper was not properly set");
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static void
|
||||
xfce_pointers_helper_restore_devices (XfcePointersHelper *helper,
|
||||
XID *xid)
|
||||
{
|
||||
- Display *xdisplay = GDK_DISPLAY ();
|
||||
- XDeviceInfo *device_list, *device_info;
|
||||
- gint n, ndevices;
|
||||
- XDevice *device;
|
||||
- gchar *device_name;
|
||||
- gchar prop[256];
|
||||
- gboolean right_handed;
|
||||
- gboolean reverse_scrolling;
|
||||
- gint threshold;
|
||||
- gdouble acceleration;
|
||||
+ Display *xdisplay = GDK_DISPLAY ();
|
||||
+ XDeviceInfo *device_list, *device_info;
|
||||
+ gint n, ndevices;
|
||||
+ XDevice *device;
|
||||
+ XfcePointerDeviceData *device_data;
|
||||
+ gchar *device_name;
|
||||
+ gchar prop[256];
|
||||
+ gboolean right_handed;
|
||||
+ gboolean reverse_scrolling;
|
||||
+ gint threshold;
|
||||
+ gdouble acceleration;
|
||||
+ XEventClass event_classes[2];
|
||||
#ifdef DEVICE_PROPERTIES
|
||||
- GHashTable *props;
|
||||
- XfcePointerData pointer_data;
|
||||
+ GHashTable *props;
|
||||
+ XfcePointerData pointer_data;
|
||||
#endif
|
||||
- const gchar *mode;
|
||||
+ const gchar *mode;
|
||||
|
||||
gdk_error_trap_push ();
|
||||
device_list = XListInputDevices (xdisplay, &ndevices);
|
||||
@@ -873,84 +930,107 @@ xfce_pointers_helper_restore_devices (XfcePointersHelper *helper,
|
||||
|
||||
for (n = 0; n < ndevices; n++)
|
||||
{
|
||||
- /* filter the pointer devices */
|
||||
+ /* filter the physical pointer devices */
|
||||
device_info = &device_list[n];
|
||||
if (device_info->use != IsXExtensionPointer
|
||||
- || device_info->name == NULL)
|
||||
+ || device_info->name == NULL
|
||||
+ || g_str_has_prefix (device_info->name, "Virtual core XTEST"))
|
||||
continue;
|
||||
|
||||
/* filter out the device if one is set */
|
||||
if (xid != NULL && device_info->id != *xid)
|
||||
continue;
|
||||
|
||||
- /* open the device */
|
||||
- gdk_error_trap_push ();
|
||||
- device = XOpenDevice (xdisplay, device_info->id);
|
||||
- if (gdk_error_trap_pop () != 0 || device == NULL)
|
||||
+ device_data = g_hash_table_lookup (helper->pointer_devices, &device_info->id);
|
||||
+ if (device_data == NULL)
|
||||
{
|
||||
- g_critical ("Unable to open device %s", device_info->name);
|
||||
- continue;
|
||||
- }
|
||||
+ /* open the device and insert to hash */
|
||||
+ gdk_error_trap_push ();
|
||||
+ device = XOpenDevice (xdisplay, device_info->id);
|
||||
+ if (G_UNLIKELY(gdk_error_trap_pop () != 0 || device == NULL))
|
||||
+ {
|
||||
+ g_critical ("Unable to open device %s / ID: %i", device_info->name, device_info->id);
|
||||
+ continue;
|
||||
+ }
|
||||
|
||||
- /* create a valid xfconf property name for the device */
|
||||
- device_name = xfce_pointers_helper_device_xfconf_name (device_info->name);
|
||||
+ /* create a valid xfconf property name for the device */
|
||||
+ device_name = xfce_pointers_helper_device_xfconf_name (device_info->name);
|
||||
|
||||
- /* read buttonmap properties */
|
||||
- g_snprintf (prop, sizeof (prop), "/%s/RightHanded", device_name);
|
||||
- right_handed = xfconf_channel_get_bool (helper->channel, prop, -1);
|
||||
+ /* add device to our list */
|
||||
+ device_data = g_new (XfcePointerDeviceData, 1);
|
||||
+ device_data->device = device;
|
||||
+ device_data->name = device_name;
|
||||
+ g_hash_table_insert (helper->pointer_devices, g_memdup (&device_info->id, sizeof(device_info->id)), device_data);
|
||||
|
||||
- g_snprintf (prop, sizeof (prop), "/%s/ReverseScrolling", device_name);
|
||||
- reverse_scrolling = xfconf_channel_get_bool (helper->channel, prop, -1);
|
||||
+ /* catch motion event / button-press for new device */
|
||||
+ gdk_error_trap_push ();
|
||||
+ DeviceMotionNotify (device, helper->device_motion_event_type, event_classes[0]);
|
||||
+ DeviceButtonPress (device, helper->device_button_press_event_type, event_classes[1]);
|
||||
+ XSelectExtensionEvent (xdisplay, RootWindow (xdisplay, DefaultScreen (xdisplay)), event_classes, 2);
|
||||
+ if (G_UNLIKELY (gdk_error_trap_pop () != 0))
|
||||
+ g_critical ("Unable to register DeviceButtonPress/DeviceMotionNotify for %i", device_info->id);
|
||||
|
||||
- if (right_handed != -1 || reverse_scrolling != -1)
|
||||
- {
|
||||
- xfce_pointers_helper_change_button_mapping (device_info, device, xdisplay,
|
||||
+
|
||||
+ /* read buttonmap properties */
|
||||
+ g_snprintf (prop, sizeof (prop), "/%s/RightHanded", device_name);
|
||||
+ right_handed = xfconf_channel_get_bool (helper->channel, prop, -1);
|
||||
+
|
||||
+ g_snprintf (prop, sizeof (prop), "/%s/ReverseScrolling", device_name);
|
||||
+ reverse_scrolling = xfconf_channel_get_bool (helper->channel, prop, -1);
|
||||
+
|
||||
+ if (right_handed != -1 || reverse_scrolling != -1)
|
||||
+ {
|
||||
+ xfce_pointers_helper_change_button_mapping (device_info, device, xdisplay,
|
||||
right_handed, reverse_scrolling);
|
||||
- }
|
||||
+ }
|
||||
|
||||
- /* read feedback settings */
|
||||
- g_snprintf (prop, sizeof (prop), "/%s/Threshold", device_name);
|
||||
- threshold = xfconf_channel_get_int (helper->channel, prop, -1);
|
||||
+ /* read feedback settings */
|
||||
+ g_snprintf (prop, sizeof (prop), "/%s/Threshold", device_name);
|
||||
+ threshold = xfconf_channel_get_int (helper->channel, prop, -1);
|
||||
|
||||
- g_snprintf (prop, sizeof (prop), "/%s/Acceleration", device_name);
|
||||
- acceleration = xfconf_channel_get_double (helper->channel, prop, -1.00);
|
||||
+ g_snprintf (prop, sizeof (prop), "/%s/Acceleration", device_name);
|
||||
+ acceleration = xfconf_channel_get_double (helper->channel, prop, -1.00);
|
||||
|
||||
- if (threshold != -1 || acceleration != -1.00)
|
||||
- {
|
||||
- xfce_pointers_helper_change_feedback (device_info, device, xdisplay,
|
||||
- threshold, acceleration);
|
||||
- }
|
||||
+ if (threshold != -1 || acceleration != -1.00)
|
||||
+ {
|
||||
+ xfce_pointers_helper_change_feedback (device_info, device, xdisplay,
|
||||
+ threshold, acceleration);
|
||||
+ }
|
||||
|
||||
- /* read mode settings */
|
||||
- g_snprintf (prop, sizeof (prop), "/%s/Mode", device_name);
|
||||
- mode = xfconf_channel_get_string (helper->channel, prop, NULL);
|
||||
+ /* read mode settings */
|
||||
+ g_snprintf (prop, sizeof (prop), "/%s/Mode", device_name);
|
||||
+ mode = xfconf_channel_get_string (helper->channel, prop, NULL);
|
||||
|
||||
- if (mode != NULL)
|
||||
- xfce_pointers_helper_change_mode (device_info, device, xdisplay, mode);
|
||||
+ if (mode != NULL)
|
||||
+ xfce_pointers_helper_change_mode (device_info, device, xdisplay, mode);
|
||||
|
||||
#ifdef DEVICE_PROPERTIES
|
||||
- /* set device properties */
|
||||
- g_snprintf (prop, sizeof (prop), "/%s/Properties", device_name);
|
||||
- props = xfconf_channel_get_properties (helper->channel, prop);
|
||||
+ /* set device properties */
|
||||
+ g_snprintf (prop, sizeof (prop), "/%s/Properties", device_name);
|
||||
+ props = xfconf_channel_get_properties (helper->channel, prop);
|
||||
|
||||
- if (props != NULL)
|
||||
- {
|
||||
- pointer_data.xdisplay = xdisplay;
|
||||
- pointer_data.device = device;
|
||||
- pointer_data.device_info = device_info;
|
||||
- pointer_data.prop_name_len = strlen (prop) + 1;
|
||||
+ if (props != NULL)
|
||||
+ {
|
||||
+ pointer_data.xdisplay = xdisplay;
|
||||
+ pointer_data.device = device;
|
||||
+ pointer_data.device_info = device_info;
|
||||
+ pointer_data.prop_name_len = strlen (prop) + 1;
|
||||
|
||||
- g_hash_table_foreach (props, xfce_pointers_helper_change_properties, &pointer_data);
|
||||
+ g_hash_table_foreach (props, xfce_pointers_helper_change_properties, &pointer_data);
|
||||
|
||||
- g_hash_table_destroy (props);
|
||||
- }
|
||||
+ g_hash_table_destroy (props);
|
||||
+ }
|
||||
#endif
|
||||
-
|
||||
- g_free (device_name);
|
||||
- XCloseDevice (xdisplay, device);
|
||||
+ }
|
||||
}
|
||||
-
|
||||
XFreeDeviceList (device_list);
|
||||
+ if (G_LIKELY (device_data != NULL))
|
||||
+ {
|
||||
+ if (helper->last_pointer_active != device_data->device->device_id)
|
||||
+ xfce_pointers_helper_change_current_device (helper, &device_data->device->device_id);
|
||||
+ }
|
||||
+ else
|
||||
+ g_critical("no device selected in xfce_pointers_helper_restore_devices");
|
||||
}
|
||||
|
||||
|
||||
@@ -961,12 +1041,12 @@ xfce_pointers_helper_channel_property_changed (XfconfChannel *channel,
|
||||
const GValue *value,
|
||||
XfcePointersHelper *helper)
|
||||
{
|
||||
- Display *xdisplay = GDK_DISPLAY ();
|
||||
- XDeviceInfo *device_list, *device_info;
|
||||
- XDevice *device;
|
||||
- gint n, ndevices;
|
||||
- gchar **names;
|
||||
- gchar *device_name;
|
||||
+ Display *xdisplay = GDK_DISPLAY ();
|
||||
+ XDeviceInfo *device_list, *device_info;
|
||||
+ XfcePointerDeviceData *device_data;
|
||||
+ gint n, ndevices;
|
||||
+ gchar **names;
|
||||
+ gchar *device_name;
|
||||
|
||||
if (G_UNLIKELY (property_name == NULL))
|
||||
return;
|
||||
@@ -996,63 +1076,72 @@ xfce_pointers_helper_channel_property_changed (XfconfChannel *channel,
|
||||
/* filter the pointer devices */
|
||||
device_info = &device_list[n];
|
||||
if (device_info->use != IsXExtensionPointer
|
||||
- || device_info->name == NULL)
|
||||
+ || device_info->name == NULL
|
||||
+ || g_str_has_prefix (device_info->name, "Virtual core XTEST"))
|
||||
continue;
|
||||
|
||||
/* search the device name */
|
||||
device_name = xfce_pointers_helper_device_xfconf_name (device_info->name);
|
||||
if (strcmp (names[0], device_name) == 0)
|
||||
{
|
||||
- /* open the device */
|
||||
- gdk_error_trap_push ();
|
||||
- device = XOpenDevice (xdisplay, device_info->id);
|
||||
- if (gdk_error_trap_pop () != 0 || device == NULL)
|
||||
+ /* find the device */
|
||||
+ device_data = g_hash_table_lookup (helper->pointer_devices, &device_info->id);
|
||||
+ if (device_data == NULL)
|
||||
{
|
||||
- g_critical ("Unable to open device %s", device_info->name);
|
||||
+ g_critical ("xfce_pointers_helper_channel_property_changed: Unable to find device %s / ID %i in hash table", device_info->name, device_info->id);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* check the property that requires updating */
|
||||
if (strcmp (names[1], "RightHanded") == 0)
|
||||
{
|
||||
- xfce_pointers_helper_change_button_mapping (device_info, device, xdisplay,
|
||||
+ xfce_pointers_helper_change_button_mapping (device_info, device_data->device, xdisplay,
|
||||
g_value_get_boolean (value), -1);
|
||||
}
|
||||
else if (strcmp (names[1], "ReverseScrolling") == 0)
|
||||
{
|
||||
- xfce_pointers_helper_change_button_mapping (device_info, device, xdisplay,
|
||||
+ xfce_pointers_helper_change_button_mapping (device_info, device_data->device, xdisplay,
|
||||
-1, g_value_get_boolean (value));
|
||||
}
|
||||
else if (strcmp (names[1], "Threshold") == 0)
|
||||
{
|
||||
- xfce_pointers_helper_change_feedback (device_info, device, xdisplay,
|
||||
+ xfce_pointers_helper_change_feedback (device_info, device_data->device, xdisplay,
|
||||
g_value_get_int (value), -2.00);
|
||||
}
|
||||
else if (strcmp (names[1], "Acceleration") == 0)
|
||||
{
|
||||
- xfce_pointers_helper_change_feedback (device_info, device, xdisplay,
|
||||
+ xfce_pointers_helper_change_feedback (device_info, device_data->device, xdisplay,
|
||||
-2, g_value_get_double (value));
|
||||
}
|
||||
#ifdef DEVICE_PROPERTIES
|
||||
else if (strcmp (names[1], "Properties") == 0)
|
||||
{
|
||||
- xfce_pointers_helper_change_property (device_info, device, xdisplay,
|
||||
+ xfce_pointers_helper_change_property (device_info, device_data->device, xdisplay,
|
||||
names[2], value);
|
||||
}
|
||||
#endif
|
||||
else if (strcmp (names[1], "Mode") == 0)
|
||||
{
|
||||
- xfce_pointers_helper_change_mode (device_info, device, xdisplay,
|
||||
+ xfce_pointers_helper_change_mode (device_info, device_data->device, xdisplay,
|
||||
g_value_get_string (value));
|
||||
}
|
||||
+ else if (strcmp (names[1], "TouchscreenPointer") == 0)
|
||||
+ {
|
||||
+ /* only hide if the current device's property was changed */
|
||||
+ if (device_info->id == helper->last_pointer_active)
|
||||
+ {
|
||||
+ if (G_LIKELY (G_IS_OBJECT (helper->xsettings_helper)))
|
||||
+ g_object_set_property (helper->xsettings_helper, "touchscreen-pointer", value);
|
||||
+ else
|
||||
+ g_critical ("xsettings_helper was not properly set");
|
||||
+ }
|
||||
+ }
|
||||
else
|
||||
{
|
||||
g_warning ("Unknown property %s set for device %s",
|
||||
property_name, device_info->name);
|
||||
}
|
||||
|
||||
- XCloseDevice (xdisplay, device);
|
||||
-
|
||||
/* stop searching */
|
||||
n = ndevices;
|
||||
}
|
||||
@@ -1068,26 +1157,44 @@ xfce_pointers_helper_channel_property_changed (XfconfChannel *channel,
|
||||
|
||||
|
||||
|
||||
-#ifdef DEVICE_HOTPLUGGING
|
||||
static GdkFilterReturn
|
||||
xfce_pointers_helper_event_filter (GdkXEvent *xevent,
|
||||
GdkEvent *gdk_event,
|
||||
gpointer user_data)
|
||||
{
|
||||
+ XDevicePresenceNotifyEvent *dpn_event;
|
||||
XEvent *event = xevent;
|
||||
- XDevicePresenceNotifyEvent *dpn_event = xevent;
|
||||
XfcePointersHelper *helper = XFCE_POINTERS_HELPER (user_data);
|
||||
|
||||
- if (event->type == helper->device_presence_event_type)
|
||||
+ /* Comparison for device changed is done here redundantly to prevent call
|
||||
+ * on every mouse move.
|
||||
+ */
|
||||
+ if (event->type == helper->device_motion_event_type
|
||||
+ && helper->last_pointer_active != ((XDeviceMotionEvent*)xevent)->deviceid)
|
||||
+ xfce_pointers_helper_change_current_device (helper, &((XDeviceMotionEvent*)xevent)->deviceid);
|
||||
+ else if (event->type == helper->device_button_press_event_type
|
||||
+ && helper->last_pointer_active != ((XDeviceButtonEvent*)xevent)->deviceid)
|
||||
+ xfce_pointers_helper_change_current_device (helper, &((XDeviceButtonEvent*)xevent)->deviceid);
|
||||
+
|
||||
+#ifdef DEVICE_HOTPLUGGING
|
||||
+ /* handle device add/remove */
|
||||
+ else if (event->type == helper->device_presence_event_type)
|
||||
{
|
||||
+ dpn_event = xevent;
|
||||
/* restore device settings */
|
||||
if (dpn_event->devchange == DeviceAdded)
|
||||
xfce_pointers_helper_restore_devices (helper, &dpn_event->deviceid);
|
||||
+ else if(dpn_event->devchange == DeviceRemoved)
|
||||
+ /* we could try to find a remaining pointer to set that as active
|
||||
+ * one but that might not fit and as soon as the user works with
|
||||
+ * another pointer we are changing to correct one.
|
||||
+ */
|
||||
+ g_hash_table_remove (helper->pointer_devices, &dpn_event->deviceid);
|
||||
|
||||
/* check if we need to launch syndaemon */
|
||||
xfce_pointers_helper_syndaemon_check (helper);
|
||||
}
|
||||
+#endif
|
||||
|
||||
return GDK_FILTER_CONTINUE;
|
||||
}
|
||||
-#endif
|
||||
--
|
||||
1.7.6.5
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@ -3,15 +3,29 @@ SECTION = "x11/wm"
|
||||
LICENSE = "GPLv2"
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
|
||||
DEPENDS = "exo garcon gtk+ libxfce4util libxfce4ui xfconf dbus-glib libxi virtual/libx11 xrandr libnotify libxcursor libxklavier"
|
||||
PR = "r1"
|
||||
PR = "r2"
|
||||
|
||||
inherit xfce
|
||||
|
||||
SRC_URI += "file://0001-xsettings.xml-remove-trouble-causing-comment.patch \
|
||||
file://0002-xsettings.xml-Set-default-themes.patch"
|
||||
file://0002-xsettings.xml-Set-default-themes.patch \
|
||||
file://touchscreen/invisible \
|
||||
file://touchscreen/wait \
|
||||
file://touchscreen/0001-add-cursor-theme-xfce-invisible.patch \
|
||||
file://touchscreen/0002-mouse-settings-dialog-add-touchscreen-pointer-option.patch \
|
||||
file://touchscreen/0003-XfcePointersHelper-gets-a-pointer-to-XfceXSettingsHe.patch \
|
||||
file://touchscreen/0004-XfceXSettingsHelper-gets-a-property-touchscreen-poin.patch \
|
||||
file://touchscreen/0005-pointers-detect-a-change-of-pointer-device-used-and-.patch \
|
||||
"
|
||||
SRC_URI[md5sum] = "cc4dd9179ead9046c056431f01a12000"
|
||||
SRC_URI[sha256sum] = "0843f09ba9673f1d1b5df8dce4a17b63c183a9ba3be75fb6ef99a67fc8c1f77e"
|
||||
|
||||
FILES_${PN} += "${libdir}/xfce4"
|
||||
|
||||
do_install_prepend() {
|
||||
# somehow binary files are not patched correctly by oe-patch - so copy them
|
||||
cp ${WORKDIR}/touchscreen/invisible ${S}/cursors
|
||||
cp ${WORKDIR}/touchscreen/wait ${S}/cursors
|
||||
}
|
||||
|
||||
RRECOMMENDS_${PN} += "gnome-icon-theme"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user