diff options
Diffstat (limited to 'meta-xfce/recipes-xfce/xfce4-settings/xfce4-settings/touchscreen/0004-XfceXSettingsHelper-gets-a-property-touchscreen-poin.patch')
-rw-r--r-- | meta-xfce/recipes-xfce/xfce4-settings/xfce4-settings/touchscreen/0004-XfceXSettingsHelper-gets-a-property-touchscreen-poin.patch | 249 |
1 files changed, 249 insertions, 0 deletions
diff --git a/meta-xfce/recipes-xfce/xfce4-settings/xfce4-settings/touchscreen/0004-XfceXSettingsHelper-gets-a-property-touchscreen-poin.patch b/meta-xfce/recipes-xfce/xfce4-settings/xfce4-settings/touchscreen/0004-XfceXSettingsHelper-gets-a-property-touchscreen-poin.patch new file mode 100644 index 000000000..cacb5c3a1 --- /dev/null +++ b/meta-xfce/recipes-xfce/xfce4-settings/xfce4-settings/touchscreen/0004-XfceXSettingsHelper-gets-a-property-touchscreen-poin.patch | |||
@@ -0,0 +1,249 @@ | |||
1 | From 878fe1287a4c73f67dd2b51d1d7c450097aeffa7 Mon Sep 17 00:00:00 2001 | ||
2 | From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@googlemail.com> | ||
3 | Date: Thu, 20 Dec 2012 16:49:18 +0100 | ||
4 | Subject: [PATCH 4/5] XfceXSettingsHelper gets a property | ||
5 | "touchscreen-pointer" | ||
6 | MIME-Version: 1.0 | ||
7 | Content-Type: text/plain; charset=UTF-8 | ||
8 | Content-Transfer-Encoding: 8bit | ||
9 | |||
10 | When this property is set, it overrides overrides cursor theme to | ||
11 | "xfce-invisible" and sets /Gtk/TouchscreenMode. | ||
12 | |||
13 | Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com> | ||
14 | Upstream-Status: Submitted [1] | ||
15 | [1] https://bugzilla.xfce.org/show_bug.cgi?id=9474 | ||
16 | --- | ||
17 | xfsettingsd/xsettings.c | 122 ++++++++++++++++++++++++++++++++++++++++++++- | ||
18 | xfsettingsd/xsettings.xml | 1 + | ||
19 | 2 files changed, 122 insertions(+), 1 deletions(-) | ||
20 | |||
21 | diff --git a/xfsettingsd/xsettings.c b/xfsettingsd/xsettings.c | ||
22 | index 7657465..76bcea1 100644 | ||
23 | --- a/xfsettingsd/xsettings.c | ||
24 | +++ b/xfsettingsd/xsettings.c | ||
25 | @@ -73,6 +73,15 @@ typedef struct _XfceXSettingsNotify XfceXSettingsNotify; | ||
26 | |||
27 | |||
28 | |||
29 | +/* Property identifiers */ | ||
30 | +enum | ||
31 | +{ | ||
32 | + PROP_0, | ||
33 | + PROP_TOUCHSCREEN_POINTER, | ||
34 | +}; | ||
35 | + | ||
36 | + | ||
37 | + | ||
38 | static void xfce_xsettings_helper_finalize (GObject *object); | ||
39 | static void xfce_xsettings_helper_fc_free (XfceXSettingsHelper *helper); | ||
40 | static gboolean xfce_xsettings_helper_fc_init (gpointer data); | ||
41 | @@ -86,6 +95,10 @@ static void xfce_xsettings_helper_load (XfceXSettingsHelper *helper) | ||
42 | static void xfce_xsettings_helper_screen_free (XfceXSettingsScreen *screen); | ||
43 | static void xfce_xsettings_helper_notify_xft (XfceXSettingsHelper *helper); | ||
44 | static void xfce_xsettings_helper_notify (XfceXSettingsHelper *helper); | ||
45 | +static void xfce_xsettings_helper_set_property (GObject *object, | ||
46 | + guint prop_id, | ||
47 | + const GValue *value, | ||
48 | + GParamSpec *pspec); | ||
49 | |||
50 | |||
51 | |||
52 | @@ -120,6 +133,13 @@ struct _XfceXSettingsHelper | ||
53 | GPtrArray *fc_monitors; | ||
54 | guint fc_notify_timeout_id; | ||
55 | guint fc_init_id; | ||
56 | + | ||
57 | + /* keeper for touchscreen cursor theme / last set */ | ||
58 | + GValue *touchscreen_cursor_value; | ||
59 | + GValue *lastset_cursor_value; | ||
60 | + | ||
61 | + /* properties */ | ||
62 | + gboolean touchscreen_pointer; | ||
63 | }; | ||
64 | |||
65 | struct _XfceXSetting | ||
66 | @@ -157,6 +177,16 @@ xfce_xsettings_helper_class_init (XfceXSettingsHelperClass *klass) | ||
67 | |||
68 | gobject_class = G_OBJECT_CLASS (klass); | ||
69 | gobject_class->finalize = xfce_xsettings_helper_finalize; | ||
70 | + gobject_class->set_property = xfce_xsettings_helper_set_property; | ||
71 | + | ||
72 | + g_object_class_install_property (gobject_class, | ||
73 | + PROP_TOUCHSCREEN_POINTER, | ||
74 | + g_param_spec_boolean ("touchscreen-pointer", | ||
75 | + "touchscreen-pointer", | ||
76 | + "touchscreen-pointer", | ||
77 | + FALSE, | ||
78 | + G_PARAM_WRITABLE | | ||
79 | + G_PARAM_STATIC_STRINGS)); | ||
80 | } | ||
81 | |||
82 | |||
83 | @@ -169,6 +199,13 @@ xfce_xsettings_helper_init (XfceXSettingsHelper *helper) | ||
84 | helper->settings = g_hash_table_new_full (g_str_hash, g_str_equal, | ||
85 | g_free, xfce_xsettings_helper_setting_free); | ||
86 | |||
87 | + helper->lastset_cursor_value = g_new0 (GValue, 1); | ||
88 | + g_value_init(helper->lastset_cursor_value, G_TYPE_STRING); | ||
89 | + g_value_set_string (helper->lastset_cursor_value, "default"); | ||
90 | + helper->touchscreen_cursor_value = g_new0 (GValue, 1); | ||
91 | + g_value_init(helper->touchscreen_cursor_value, G_TYPE_STRING); | ||
92 | + g_value_set_string (helper->touchscreen_cursor_value, "xfce-invisible"); | ||
93 | + | ||
94 | xfce_xsettings_helper_load (helper); | ||
95 | |||
96 | g_signal_connect (G_OBJECT (helper->channel), "property-changed", | ||
97 | @@ -202,6 +239,9 @@ xfce_xsettings_helper_finalize (GObject *object) | ||
98 | |||
99 | g_hash_table_destroy (helper->settings); | ||
100 | |||
101 | + g_free (helper->lastset_cursor_value); | ||
102 | + g_free (helper->touchscreen_cursor_value); | ||
103 | + | ||
104 | (*G_OBJECT_CLASS (xfce_xsettings_helper_parent_class)->finalize) (object); | ||
105 | } | ||
106 | |||
107 | @@ -387,6 +427,61 @@ xfce_xsettings_helper_notify_xft_idle (gpointer data) | ||
108 | |||
109 | |||
110 | |||
111 | +static void | ||
112 | +xfce_xsettings_helper_set_property (GObject *object, | ||
113 | + guint prop_id, | ||
114 | + const GValue *value, | ||
115 | + GParamSpec *pspec) | ||
116 | +{ | ||
117 | + gboolean touchscreen_pointer; | ||
118 | + XfceXSetting *setting_theme, *setting_touchscreen; | ||
119 | + XfceXSettingsHelper *helper = XFCE_XSETTINGS_HELPER (object); | ||
120 | + GtkSettings *gtk_settings; | ||
121 | + GValue bool_val = { 0, }; | ||
122 | + | ||
123 | + switch (prop_id) | ||
124 | + { | ||
125 | + case PROP_TOUCHSCREEN_POINTER: | ||
126 | + touchscreen_pointer = g_value_get_boolean (value); | ||
127 | + if (helper->touchscreen_pointer != touchscreen_pointer) | ||
128 | + { | ||
129 | + helper->touchscreen_pointer = touchscreen_pointer; | ||
130 | + /* Update touchscreen-mode */ | ||
131 | + xfconf_channel_set_bool (helper->channel, "/Gtk/TouchscreenMode", touchscreen_pointer); | ||
132 | + /* Update cursor */ | ||
133 | + setting_theme = g_hash_table_lookup (helper->settings, "/Gtk/CursorThemeName"); | ||
134 | + if (G_LIKELY (setting_theme != NULL)) | ||
135 | + { | ||
136 | + /* update the serial */ | ||
137 | + setting_theme->last_change_serial = helper->serial; | ||
138 | + /* update value */ | ||
139 | + g_value_reset (setting_theme->value); | ||
140 | + g_value_copy (touchscreen_pointer ? | ||
141 | + helper->touchscreen_cursor_value : | ||
142 | + helper->lastset_cursor_value, | ||
143 | + setting_theme->value); | ||
144 | + } | ||
145 | + else | ||
146 | + g_critical("Setting not found for /Gtk/CursorThemeName"); | ||
147 | + | ||
148 | + if (G_LIKELY (setting_touchscreen != NULL || setting_theme != NULL)) | ||
149 | + { | ||
150 | + /* schedule xsettings update */ | ||
151 | + if (helper->notify_idle_id == 0) | ||
152 | + helper->notify_idle_id = g_idle_add (xfce_xsettings_helper_notify_idle, helper); | ||
153 | + if (helper->notify_xft_idle_id == 0) | ||
154 | + helper->notify_xft_idle_id = g_idle_add (xfce_xsettings_helper_notify_xft_idle, helper); | ||
155 | + } | ||
156 | + } | ||
157 | + break; | ||
158 | + default: | ||
159 | + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | ||
160 | + break; | ||
161 | + } | ||
162 | +} | ||
163 | + | ||
164 | + | ||
165 | + | ||
166 | static gboolean | ||
167 | xfce_xsettings_helper_prop_valid (const gchar *prop_name, | ||
168 | const GValue *value) | ||
169 | @@ -413,6 +508,28 @@ xfce_xsettings_helper_prop_valid (const gchar *prop_name, | ||
170 | |||
171 | |||
172 | |||
173 | +static void | ||
174 | +xfce_xsettings_helper_check_cursor (const gchar *prop_name, | ||
175 | + GValue *value, | ||
176 | + XfceXSettingsHelper *helper) | ||
177 | +{ | ||
178 | + if (g_strcmp0 (prop_name, "/Gtk/CursorThemeName") == 0) | ||
179 | + { | ||
180 | + /* Keep last cursor theme set */ | ||
181 | + g_value_reset (helper->lastset_cursor_value); | ||
182 | + g_value_copy (value, helper->lastset_cursor_value); | ||
183 | + | ||
184 | + /* invisible replacement required ? */ | ||
185 | + if (helper->touchscreen_pointer) | ||
186 | + { | ||
187 | + g_value_reset (value); | ||
188 | + g_value_copy (helper->touchscreen_cursor_value, value); | ||
189 | + } | ||
190 | + } | ||
191 | +} | ||
192 | + | ||
193 | + | ||
194 | + | ||
195 | static gboolean | ||
196 | xfce_xsettings_helper_prop_load (gchar *prop_name, | ||
197 | GValue *value, | ||
198 | @@ -426,6 +543,7 @@ xfce_xsettings_helper_prop_load (gchar *prop_name, | ||
199 | |||
200 | setting = g_slice_new0 (XfceXSetting); | ||
201 | setting->value = value; | ||
202 | + xfce_xsettings_helper_check_cursor (prop_name, setting->value, helper); | ||
203 | setting->last_change_serial = helper->serial; | ||
204 | |||
205 | xfsettings_dbg_filtered (XFSD_DEBUG_XSETTINGS, "prop \"%s\" loaded (type=%s)", | ||
206 | @@ -462,6 +580,7 @@ xfce_xsettings_helper_prop_changed (XfconfChannel *channel, | ||
207 | * it first */ | ||
208 | g_value_reset (setting->value); | ||
209 | g_value_copy (value, setting->value); | ||
210 | + xfce_xsettings_helper_check_cursor (prop_name, setting->value, helper); | ||
211 | |||
212 | /* update the serial */ | ||
213 | setting->last_change_serial = helper->serial; | ||
214 | @@ -475,6 +594,7 @@ xfce_xsettings_helper_prop_changed (XfconfChannel *channel, | ||
215 | |||
216 | g_value_init (setting->value, G_VALUE_TYPE (value)); | ||
217 | g_value_copy (value, setting->value); | ||
218 | + xfce_xsettings_helper_check_cursor (prop_name, setting->value, helper); | ||
219 | |||
220 | g_hash_table_insert (helper->settings, g_strdup (prop_name), setting); | ||
221 | } | ||
222 | @@ -649,6 +769,7 @@ xfce_xsettings_helper_notify_xft (XfceXSettingsHelper *helper) | ||
223 | XfceXSetting *setting; | ||
224 | guint i; | ||
225 | GValue bool_val = { 0, }; | ||
226 | + | ||
227 | const gchar *props[][2] = | ||
228 | { | ||
229 | /* { xfconf name}, { xft name } */ | ||
230 | @@ -700,7 +821,6 @@ xfce_xsettings_helper_notify_xft (XfceXSettingsHelper *helper) | ||
231 | PropModeReplace, | ||
232 | (guchar *) resource->str, | ||
233 | resource->len); | ||
234 | - | ||
235 | XCloseDisplay (xdisplay); | ||
236 | |||
237 | if (gdk_error_trap_pop () != 0) | ||
238 | --- a/xfsettingsd/xsettings.xml | ||
239 | +++ b/xfsettingsd/xsettings.xml | ||
240 | @@ -36,5 +36,6 @@ | ||
241 | <property name="MenuBarAccel" type="string" value="F10"/> | ||
242 | <property name="CursorThemeName" type="string" value=""/> | ||
243 | <property name="CursorThemeSize" type="int" value="0"/> | ||
244 | + <property name="TouchscreenMode" type="bool" value="false"/> | ||
245 | </property> | ||
246 | </channel> | ||
247 | -- | ||
248 | 1.7.6.5 | ||
249 | |||