[gpointing-device-settings] added a checkbox to disable/enable tapping.
- From: Hiroyuki Ikezoe <hiikezoe src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gpointing-device-settings] added a checkbox to disable/enable tapping.
- Date: Tue, 26 Jan 2010 10:10:19 +0000 (UTC)
commit 6e7b9ce55d103d279aeb9adbfcb4932d5673903b
Author: Hiroyuki Ikezoe <poincare ikezoe net>
Date: Tue Jan 26 19:08:05 2010 +0900
added a checkbox to disable/enable tapping.
Fix for bug #590917.
data/touchpad.ui | 11 +++
modules/common/gpds-touchpad-definitions.h | 1 +
.../gsd-touchpad-manager.c | 65 ++++++++++++++-
modules/gpds-touchpad-ui.c | 90 +++++++++++++++++++-
4 files changed, 165 insertions(+), 2 deletions(-)
---
diff --git a/data/touchpad.ui b/data/touchpad.ui
index 81e932c..872abbd 100644
--- a/data/touchpad.ui
+++ b/data/touchpad.ui
@@ -570,6 +570,17 @@
<property name="homogeneous">False</property>
<property name="spacing">12</property>
<child>
+ <object class="GtkCheckButton" id="disable_tapping">
+ <property name="label" translatable="yes">Disable _tapping</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkFrame" id="tapping_frame">
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
diff --git a/modules/common/gpds-touchpad-definitions.h b/modules/common/gpds-touchpad-definitions.h
index 12e6910..cfdde00 100644
--- a/modules/common/gpds-touchpad-definitions.h
+++ b/modules/common/gpds-touchpad-definitions.h
@@ -24,6 +24,7 @@
#define GPDS_TOUCHPAD_DISABLE_WHILE_OTHER_DEVICE_EXISTS_KEY \
"disable_while_other_device_exists"
#define GPDS_TOUCHPAD_GUEST_MOUSE_OFF_KEY "guest_mouse"
+#define GPDS_TOUCHPAD_DISABLE_TAPPING_KEY "disable_tapping"
#define GPDS_TOUCHPAD_TAP_TIME_KEY "tap_time"
#define GPDS_TOUCHPAD_TAP_MOVE_KEY "tap_move"
#define GPDS_TOUCHPAD_TAP_FAST_TAP_KEY "tap_fast_tap"
diff --git a/modules/gnome-settings-daemon-plugins/gsd-touchpad-manager.c b/modules/gnome-settings-daemon-plugins/gsd-touchpad-manager.c
index 28be88e..f85b42d 100644
--- a/modules/gnome-settings-daemon-plugins/gsd-touchpad-manager.c
+++ b/modules/gnome-settings-daemon-plugins/gsd-touchpad-manager.c
@@ -66,7 +66,6 @@ DEFINE_SET_BOOLEAN_FUNCTION (tap_fast_tap, GPDS_TOUCHPAD_TAP_FAST_TAP)
DEFINE_SET_BOOLEAN_FUNCTION (circular_scrolling, GPDS_TOUCHPAD_CIRCULAR_SCROLLING)
DEFINE_SET_INT_FUNCTION (touchpad_off, GPDS_TOUCHPAD_OFF)
DEFINE_SET_INT_FUNCTION (locked_drags_timeout, GPDS_TOUCHPAD_LOCKED_DRAGS_TIMEOUT)
-DEFINE_SET_INT_FUNCTION (tap_time, GPDS_TOUCHPAD_TAP_TIME)
DEFINE_SET_INT_FUNCTION (tap_move, GPDS_TOUCHPAD_TAP_MOVE)
DEFINE_SET_INT_FUNCTION (circular_scrolling_trigger, GPDS_TOUCHPAD_CIRCULAR_SCROLLING_TRIGGER)
DEFINE_SET_BOOLEAN_PAIR_FUNCTION (two_finger_scrolling,
@@ -83,6 +82,69 @@ DEFINE_SET_INT_PAIR_FUNCTION (palm_dimensions,
GPDS_TOUCHPAD_PALM_DETECTION_DEPTH_KEY)
static void
+set_tap_time (GsdPointingDeviceManager *manager,
+ GpdsXInput *xinput,
+ GConfClient *gconf)
+{
+ gboolean disable_tapping = FALSE;
+ gint tap_time;
+ gint properties[1];
+
+ if (!gsd_pointing_device_manager_get_gconf_int(manager,
+ gconf,
+ GPDS_TOUCHPAD_TAP_TIME_KEY,
+ &tap_time)) {
+ return;
+ }
+
+ gsd_pointing_device_manager_get_gconf_boolean(manager,
+ gconf,
+ GPDS_TOUCHPAD_DISABLE_TAPPING_KEY,
+ &disable_tapping);
+ /*
+ * If disable tapping is TRUE, do not change tapping time here
+ * since tap_time is already zero (i.e. disable tapping).
+ */
+ if (disable_tapping)
+ return;
+
+ properties[0] = tap_time;
+ gpds_xinput_set_int_properties(xinput,
+ GPDS_TOUCHPAD_TAP_TIME,
+ NULL,
+ properties,
+ 1);
+}
+
+static void
+set_disable_tapping (GsdPointingDeviceManager *manager,
+ GpdsXInput *xinput,
+ GConfClient *gconf)
+{
+ gboolean disable_tapping;
+ gint tap_time = 50;
+ gint properties[1];
+
+ if (!gsd_pointing_device_manager_get_gconf_boolean(manager,
+ gconf,
+ GPDS_TOUCHPAD_DISABLE_TAPPING_KEY,
+ &disable_tapping)) {
+ return;
+ }
+
+ gsd_pointing_device_manager_get_gconf_int(manager,
+ gconf,
+ GPDS_TOUCHPAD_DISABLE_TAPPING_KEY,
+ &tap_time);
+ properties[0] = disable_tapping ? 0 : tap_time;
+ gpds_xinput_set_int_properties(xinput,
+ GPDS_TOUCHPAD_TAP_TIME,
+ NULL,
+ properties,
+ 1);
+}
+
+static void
set_edge_scrolling (GsdPointingDeviceManager *manager,
GpdsXInput *xinput,
GConfClient *gconf)
@@ -317,6 +379,7 @@ start_manager (GsdPointingDeviceManager *manager)
set_locked_drags(manager, xinput, gconf);
set_locked_drags_timeout(manager, xinput, gconf);
set_tap_fast_tap(manager, xinput, gconf);
+ set_disable_tapping(manager, xinput, gconf);
set_tap_time(manager, xinput, gconf);
set_tap_move(manager, xinput, gconf);
set_edge_scrolling(manager, xinput, gconf);
diff --git a/modules/gpds-touchpad-ui.c b/modules/gpds-touchpad-ui.c
index 922bbfd..581b27c 100644
--- a/modules/gpds-touchpad-ui.c
+++ b/modules/gpds-touchpad-ui.c
@@ -561,6 +561,46 @@ cb_disable_while_other_device_exists_toggled (GtkToggleButton *button, gpointer
}
static void
+cb_disable_tapping_toggled (GtkToggleButton *button, gpointer user_data)
+{
+ GtkBuilder *builder;
+ GObject *object;
+ GpdsUI *ui = GPDS_UI(user_data);
+ GpdsXInput *xinput;
+ gint properties[1];
+ gboolean disable_tapping;
+ gint tap_time;
+ GError *error = NULL;
+
+ disable_tapping = gtk_toggle_button_get_active(button);
+
+ gpds_ui_set_gconf_bool(ui,
+ GPDS_TOUCHPAD_DISABLE_TAPPING_KEY,
+ disable_tapping);
+
+ xinput = gpds_xinput_ui_get_xinput(GPDS_XINPUT_UI(ui));
+ if (!xinput)
+ return;
+
+ builder = gpds_ui_get_builder(ui);
+ object = gtk_builder_get_object(builder, "tapping_time_scale");
+ tap_time = gtk_range_get_value(GTK_RANGE(object));
+ properties[0] = disable_tapping ? 0 : tap_time;
+ if (!gpds_xinput_set_int_properties(xinput,
+ GPDS_TOUCHPAD_TAP_TIME,
+ &error,
+ properties,
+ 1)) {
+ if (error) {
+ show_error(error);
+ g_error_free(error);
+ }
+ }
+
+ set_widget_sensitivity(builder, "tapping_frame", !disable_tapping);
+}
+
+static void
set_move_speed_property (GpdsXInput *xinput, GtkBuilder *builder)
{
GError *error = NULL;
@@ -652,6 +692,7 @@ setup_signals (GpdsUI *ui, GtkBuilder *builder)
CONNECT(palm_detection_depth_scale, value_changed);
CONNECT(locked_drags, toggled);
CONNECT(locked_drags_timeout_scale, value_changed);
+ CONNECT(disable_tapping, toggled);
CONNECT(tapping_time_scale, value_changed);
CONNECT(tapping_move_scale, value_changed);
CONNECT(faster_tapping_check, toggled);
@@ -860,6 +901,20 @@ set_click_action (GpdsUI *ui)
}
static void
+set_disable_tapping_from_preference (GpdsUI *ui, GtkBuilder *builder)
+{
+ gboolean disable_tapping = FALSE;
+ GObject *button;
+
+ gpds_ui_get_gconf_bool(ui, GPDS_TOUCHPAD_DISABLE_TAPPING_KEY, &disable_tapping);
+
+ button = gpds_ui_get_ui_object_by_name(ui, "disable_tapping");
+
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), disable_tapping);
+ set_widget_sensitivity(builder, "tapping_frame", !disable_tapping);
+}
+
+static void
set_move_speed_properties_from_preference (GpdsUI *ui, GtkBuilder *builder)
{
GObject *object;
@@ -890,6 +945,38 @@ set_move_speed_properties_from_preference (GpdsUI *ui, GtkBuilder *builder)
}
static void
+set_tapping_time_from_preference (GpdsUI *ui, GtkBuilder *builder)
+{
+ GObject *object;
+ gint *values = NULL;
+ gulong n_values;
+ gint value;
+ gdouble double_value;
+ gboolean disable_tapping;
+
+ g_return_if_fail(GPDS_IS_XINPUT_UI(ui));
+
+ if (!gpds_ui_get_gconf_bool(ui, GPDS_TOUCHPAD_DISABLE_TAPPING_KEY, &disable_tapping) ||
+ !disable_tapping) {
+ if (!gpds_xinput_ui_get_xinput_int_property(GPDS_XINPUT_UI(ui),
+ GPDS_TOUCHPAD_TAP_TIME,
+ &values, &n_values)) {
+ return;
+ }
+ }
+
+ if (!gpds_ui_get_gconf_int(ui, GPDS_TOUCHPAD_TAP_TIME_KEY, &value))
+ value = values[0];
+
+ double_value = value;
+ object = gpds_ui_get_ui_object_by_name(GPDS_UI(ui), "tapping_time_scale");
+ if (GTK_IS_RANGE(object))
+ object = G_OBJECT(gtk_range_get_adjustment(GTK_RANGE(object)));
+ g_object_set(object, "value", double_value, NULL);
+ g_free(values);
+}
+
+static void
setup_current_values (GpdsUI *ui, GtkBuilder *builder)
{
GpdsXInputUI *xinput_ui = GPDS_XINPUT_UI(ui);
@@ -907,7 +994,6 @@ setup_current_values (GpdsUI *ui, GtkBuilder *builder)
PROP_NAME ## _KEY, \
widget_name);
- SET_INT_VALUE(GPDS_TOUCHPAD_TAP_TIME, "tapping_time_scale");
SET_INT_VALUE(GPDS_TOUCHPAD_TAP_MOVE, "tapping_move_scale");
SET_BOOLEAN_VALUE(GPDS_TOUCHPAD_TAP_FAST_TAP, "faster_tapping_check");
SET_BOOLEAN_VALUE(GPDS_TOUCHPAD_GUEST_MOUSE_OFF, "guest_mouse_off");
@@ -916,6 +1002,7 @@ setup_current_values (GpdsUI *ui, GtkBuilder *builder)
SET_INT_VALUE(GPDS_TOUCHPAD_LOCKED_DRAGS_TIMEOUT, "locked_drags_timeout_scale");
SET_BOOLEAN_VALUE(GPDS_TOUCHPAD_CIRCULAR_SCROLLING, "circular_scrolling");
+ set_tapping_time_from_preference(ui, builder);
set_edge_scrolling_property_from_preference(ui, builder);
set_palm_dimensions_property_from_preference(ui, builder);
set_scrolling_distance_property_from_preference(ui, builder);
@@ -923,6 +1010,7 @@ setup_current_values (GpdsUI *ui, GtkBuilder *builder)
set_touchpad_use_type_property_from_preference(ui);
set_circular_scrolling_trigger_property_from_preference(ui);
set_move_speed_properties_from_preference(ui, builder);
+ set_disable_tapping_from_preference(ui, builder);
set_click_action(ui);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]