[Xfce4-commits] <xfce4-settings:bluesabre/display-settings> Make touchpad type delay configurable (bug #8948).

Nick Schermer noreply at xfce.org
Mon Dec 9 13:00:30 CET 2013


Updating branch refs/heads/bluesabre/display-settings
         to 1e5662d9c5b5a50de011c5324902824ca905ba23 (commit)
       from c1ed2d22da004f475f1e240803859ab0ac7335ca (commit)

commit 1e5662d9c5b5a50de011c5324902824ca905ba23
Author: Philipp Matthias Schafer <philipp.schaefer at gmail.com>
Date:   Sun Mar 17 17:54:51 2013 +0100

    Make touchpad type delay configurable (bug #8948).

 dialogs/mouse-settings/main.c             |   32 +++++++-
 dialogs/mouse-settings/mouse-dialog.glade |  121 +++++++++++++++++++++--------
 xfsettingsd/pointers.c                    |   38 +++++----
 3 files changed, 139 insertions(+), 52 deletions(-)

diff --git a/dialogs/mouse-settings/main.c b/dialogs/mouse-settings/main.c
index f4b475b..46168e7 100644
--- a/dialogs/mouse-settings/main.c
+++ b/dialogs/mouse-settings/main.c
@@ -136,6 +136,18 @@ mouse_settings_format_value_ms (GtkScale *scale,
 
 
 
+#ifdef DEVICE_PROPERTIES
+static gchar *
+mouse_settings_format_value_s (GtkScale *scale,
+                               gdouble   value)
+{
+   /* seconds value for some of the scales in the dialog */
+   return g_strdup_printf (_("%.1f s"), value);
+}
+#endif
+
+
+
 
 #ifdef HAVE_XCURSOR
 static GdkPixbuf *
@@ -1582,6 +1594,8 @@ main (gint argc, gchar **argv)
     XExtensionVersion *version = NULL;
 #ifdef DEVICE_PROPERTIES
     gchar             *syndaemon;
+    GObject           *synaptics_disable_while_type;
+    GObject           *synaptics_disable_duration_table;
 #endif
 
     /* setup translation domain */
@@ -1703,12 +1717,26 @@ main (gint argc, gchar **argv)
                               G_CALLBACK (mouse_settings_device_reset), builder);
 
 #ifdef DEVICE_PROPERTIES
-            object = gtk_builder_get_object (builder, "synaptics-disable-while-type");
+            synaptics_disable_while_type = gtk_builder_get_object (builder, "synaptics-disable-while-type");
             syndaemon = g_find_program_in_path ("syndaemon");
             gtk_widget_set_sensitive (GTK_WIDGET (object), syndaemon != NULL);
             g_free (syndaemon);
             xfconf_g_property_bind (pointers_channel, "/DisableTouchpadWhileTyping",
-                                    G_TYPE_BOOLEAN, G_OBJECT (object), "active");
+                                    G_TYPE_BOOLEAN, G_OBJECT (synaptics_disable_while_type), "active");
+
+            synaptics_disable_duration_table = gtk_builder_get_object (builder, "synaptics-disable-duration-box");
+
+            g_object_bind_property (G_OBJECT (synaptics_disable_while_type), "active",
+                                    G_OBJECT (synaptics_disable_duration_table), "sensitive",
+                                    G_BINDING_SYNC_CREATE);
+
+            object = gtk_builder_get_object (builder, "synaptics-disable-duration-scale");
+            g_signal_connect (G_OBJECT (object), "format-value",
+                              G_CALLBACK (mouse_settings_format_value_s), NULL);
+
+            object = gtk_builder_get_object (builder, "synaptics-disable-duration");
+            xfconf_g_property_bind (pointers_channel, "/DisableTouchpadDuration",
+                                    G_TYPE_DOUBLE, G_OBJECT (object), "value");
 
             object = gtk_builder_get_object (builder, "synaptics-tap-to-click");
             g_signal_connect_swapped (G_OBJECT (object), "toggled",
diff --git a/dialogs/mouse-settings/mouse-dialog.glade b/dialogs/mouse-settings/mouse-dialog.glade
index d3aab0d..dc1f208 100644
--- a/dialogs/mouse-settings/mouse-dialog.glade
+++ b/dialogs/mouse-settings/mouse-dialog.glade
@@ -42,6 +42,13 @@
     <property name="can_focus">False</property>
     <property name="stock">gtk-revert-to-saved</property>
   </object>
+  <object class="GtkAdjustment" id="synaptics-disable-duration">
+    <property name="lower">0.10000000000000001</property>
+    <property name="upper">4</property>
+    <property name="value">2</property>
+    <property name="step_increment">0.10000000000000001</property>
+    <property name="page_increment">1</property>
+  </object>
   <object class="GtkListStore" id="synaptics-scroll-store">
     <columns>
       <!-- column-name title -->
@@ -75,6 +82,32 @@
     <property name="step_increment">1</property>
     <property name="page_increment">11</property>
   </object>
+  <object class="GtkListStore" id="wacom-rotation-store">
+    <columns>
+      <!-- column-name rotation -->
+      <column type="gint"/>
+      <!-- column-name title -->
+      <column type="gchararray"/>
+    </columns>
+    <data>
+      <row>
+        <col id="0">0</col>
+        <col id="1" translatable="yes">None (right-handed)</col>
+      </row>
+      <row>
+        <col id="0">3</col>
+        <col id="1" translatable="yes">Half (left-handed)</col>
+      </row>
+      <row>
+        <col id="0">1</col>
+        <col id="1" translatable="yes">Clockwise</col>
+      </row>
+      <row>
+        <col id="0">2</col>
+        <col id="1" translatable="yes">Counterclockwise</col>
+      </row>
+    </data>
+  </object>
   <object class="XfceTitledDialog" id="mouse-dialog">
     <property name="can_focus">False</property>
     <property name="title" translatable="yes">Mouse and Touchpad</property>
@@ -93,8 +126,8 @@
             <property name="can_focus">False</property>
             <property name="layout_style">end</property>
             <child>
-              <object class="GtkButton" id="button2">
-                <property name="label">gtk-help</property>
+              <object class="GtkButton" id="button1">
+                <property name="label">gtk-close</property>
                 <property name="use_action_appearance">False</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
@@ -105,12 +138,11 @@
                 <property name="expand">False</property>
                 <property name="fill">False</property>
                 <property name="position">0</property>
-                <property name="secondary">True</property>
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="button1">
-                <property name="label">gtk-close</property>
+              <object class="GtkButton" id="button2">
+                <property name="label">gtk-help</property>
                 <property name="use_action_appearance">False</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
@@ -121,6 +153,7 @@
                 <property name="expand">False</property>
                 <property name="fill">False</property>
                 <property name="position">0</property>
+                <property name="secondary">True</property>
               </packing>
             </child>
           </object>
@@ -490,6 +523,54 @@
                                       </packing>
                                     </child>
                                     <child>
+                                      <object class="GtkAlignment" id="alignment8">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                        <property name="left_padding">18</property>
+                                        <child>
+                                          <object class="GtkHBox" id="synaptics-disable-duration-box">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="spacing">12</property>
+                                            <child>
+                                              <object class="GtkLabel" id="label5">
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">False</property>
+                                                <property name="label" translatable="yes">Duratio_n:</property>
+                                                <property name="use_underline">True</property>
+                                                <property name="mnemonic_widget">synaptics-disable-duration-scale</property>
+                                              </object>
+                                              <packing>
+                                                <property name="expand">False</property>
+                                                <property name="fill">True</property>
+                                                <property name="position">0</property>
+                                              </packing>
+                                            </child>
+                                            <child>
+                                              <object class="GtkHScale" id="synaptics-disable-duration-scale">
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">True</property>
+                                                <property name="update_policy">delayed</property>
+                                                <property name="adjustment">synaptics-disable-duration</property>
+                                                <property name="round_digits">1</property>
+                                                <property name="value_pos">right</property>
+                                              </object>
+                                              <packing>
+                                                <property name="expand">True</property>
+                                                <property name="fill">True</property>
+                                                <property name="position">1</property>
+                                              </packing>
+                                            </child>
+                                          </object>
+                                        </child>
+                                      </object>
+                                      <packing>
+                                        <property name="expand">True</property>
+                                        <property name="fill">True</property>
+                                        <property name="position">1</property>
+                                      </packing>
+                                    </child>
+                                    <child>
                                       <object class="GtkCheckButton" id="synaptics-tap-to-click">
                                         <property name="label" translatable="yes">Tap touchpad to clic_k</property>
                                         <property name="use_action_appearance">False</property>
@@ -502,7 +583,7 @@
                                       <packing>
                                         <property name="expand">True</property>
                                         <property name="fill">True</property>
-                                        <property name="position">1</property>
+                                        <property name="position">2</property>
                                       </packing>
                                     </child>
                                   </object>
@@ -1168,8 +1249,8 @@
       </object>
     </child>
     <action-widgets>
-      <action-widget response="-11">button2</action-widget>
       <action-widget response="0">button1</action-widget>
+      <action-widget response="-11">button2</action-widget>
     </action-widgets>
   </object>
   <object class="GtkListStore" id="wacom-mode-store">
@@ -1190,30 +1271,4 @@
       </row>
     </data>
   </object>
-  <object class="GtkListStore" id="wacom-rotation-store">
-    <columns>
-      <!-- column-name rotation -->
-      <column type="gint"/>
-      <!-- column-name title -->
-      <column type="gchararray"/>
-    </columns>
-    <data>
-      <row>
-        <col id="0">0</col>
-        <col id="1" translatable="yes">None (right-handed)</col>
-      </row>
-      <row>
-        <col id="0">3</col>
-        <col id="1" translatable="yes">Half (left-handed)</col>
-      </row>
-      <row>
-        <col id="0">1</col>
-        <col id="1" translatable="yes">Clockwise</col>
-      </row>
-      <row>
-        <col id="0">2</col>
-        <col id="1" translatable="yes">Counterclockwise</col>
-      </row>
-    </data>
-  </object>
 </interface>
diff --git a/xfsettingsd/pointers.c b/xfsettingsd/pointers.c
index e7192e7..d081c0d 100644
--- a/xfsettingsd/pointers.c
+++ b/xfsettingsd/pointers.c
@@ -221,7 +221,9 @@ xfce_pointers_helper_syndaemon_check (XfcePointersHelper *helper)
     Atom        *props;
     gint         i, nprops;
     gboolean     have_synaptics = FALSE;
-    gchar       *args[] = { "syndaemon", "-i", "2.0", "-K", "-R", NULL };
+    gdouble      disable_duration;
+    gchar        disable_duration_string[64];
+    gchar       *args[] = { "syndaemon", "-i", disable_duration_string, "-K", "-R", NULL };
     GError      *error = NULL;
 
     /* only stop a running daemon */
@@ -272,25 +274,26 @@ xfce_pointers_helper_syndaemon_check (XfcePointersHelper *helper)
 
     start_stop_daemon:
 
+    /* stop the daemon in any case */
+    xfce_pointers_helper_syndaemon_stop (helper);
+
     if (have_synaptics)
     {
-        if (helper->syndaemon_pid == 0)
+        disable_duration = xfconf_channel_get_double (helper->channel,
+                                                      "/DisableTouchpadDuration",
+                                                      2.0);
+        g_snprintf (disable_duration_string, sizeof (disable_duration_string),
+                    "%.1f", disable_duration);
+
+        if (!g_spawn_async (NULL, args, NULL, G_SPAWN_SEARCH_PATH,
+                            NULL, NULL, &helper->syndaemon_pid, &error))
         {
-            if (!g_spawn_async (NULL, args, NULL, G_SPAWN_SEARCH_PATH,
-                                NULL, NULL, &helper->syndaemon_pid, &error))
-            {
-                g_critical ("Spawning syndaemon failed: %s", error->message);
-                g_error_free (error);
-            }
-
-            xfsettings_dbg (XFSD_DEBUG_POINTERS, "Started syndaemon with pid %d",
-                            helper->syndaemon_pid);
+            g_critical ("Spawning syndaemon failed: %s", error->message);
+            g_error_free (error);
         }
-    }
-    else
-    {
-        /* stop the daemon */
-        xfce_pointers_helper_syndaemon_stop (helper);
+
+        xfsettings_dbg (XFSD_DEBUG_POINTERS, "Started syndaemon with pid %d",
+                        helper->syndaemon_pid);
     }
 #endif
 }
@@ -917,7 +920,8 @@ xfce_pointers_helper_channel_property_changed (XfconfChannel      *channel,
          return;
 
     /* check the daemon status */
-    if (strcmp (property_name, "/DisableTouchpadWhileTyping") == 0)
+    if ((strcmp (property_name, "/DisableTouchpadWhileTyping") == 0) ||
+        (strcmp (property_name, "/DisableTouchpadDuration") == 0))
     {
         xfce_pointers_helper_syndaemon_check (helper);
         return;


More information about the Xfce4-commits mailing list