gpointing-device-settings r276 - in trunk: . data modules



Author: hiikezoe
Date: Thu Mar 26 03:21:12 2009
New Revision: 276
URL: http://svn.gnome.org/viewvc/gpointing-device-settings?rev=276&view=rev

Log:
palm detection width and depth support.
Not test yet.

Modified:
   trunk/TODO
   trunk/data/touchpad.ui
   trunk/modules/gpds-touchpad-ui.c

Modified: trunk/TODO
==============================================================================
--- trunk/TODO	(original)
+++ trunk/TODO	Thu Mar 26 03:21:12 2009
@@ -4,7 +4,6 @@
   - move speed min, max, accel, trackstick. What is "trackstick"? 
   - finger
   - edges
-  - palm dimensions
  * Tapping
   - durations
   - tap actions

Modified: trunk/data/touchpad.ui
==============================================================================
--- trunk/data/touchpad.ui	(original)
+++ trunk/data/touchpad.ui	Thu Mar 26 03:21:12 2009
@@ -40,13 +40,12 @@
     <property name="page_size">0</property>
     <property name="value">5</property>
   </object>
-  <object class="GtkAdjustment" id="adjustment5">
-    <property name="upper">-30</property>
-    <property name="lower">-330</property>
-    <property name="page_increment">60</property>
-    <property name="step_increment">60</property>
+  <object class="GtkAdjustment" id="palm_detection_width_scale_adjustment">
+    <property name="upper">550</property>
+    <property name="lower">10</property>
+    <property name="page_increment">50</property>
+    <property name="step_increment">50</property>
     <property name="page_size">0</property>
-    <property name="value">-30</property>
   </object>
   <object class="GtkAdjustment" id="adjustment6">
     <property name="upper">200</property>
@@ -212,6 +211,209 @@
                           </packing>
                         </child>
                         <child>
+                          <object class="GtkHBox" id="palm_detection_box">
+                            <property name="visible">True</property>
+                            <property name="border-width">5</property>
+                            <child>
+                              <object class="GtkHBox" id="palm_detection_width_box">
+                                <property name="visible">True</property>
+                                <property name="border-width">5</property>
+                                <child>
+                                  <object class="GtkLabel" id="palm_detection_width_label">
+                                    <property name="visible">True</property>
+                                    <property name="label" translatable="yes">_width:</property>
+                                    <property name="mnemonic-widget">palm_detection_width_scale</property>
+                                    <property name="use_underline">True</property>
+                                    <property name="use_markup">False</property>
+                                    <property name="justify">GTK_JUSTIFY_LEFT</property>
+                                    <property name="wrap">False</property>
+                                    <property name="selectable">False</property>
+                                    <property name="xalign">0.5</property>
+                                    <property name="yalign">0.5</property>
+                                    <property name="xpad">0</property>
+                                    <property name="ypad">0</property>
+                                    <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                                    <property name="width_chars">-1</property>
+                                    <property name="single_line_mode">False</property>
+                                    <property name="angle">0</property>
+                                  </object>
+                                  <packing>
+                                    <property name="padding">0</property>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkLabel" id="palm_detection_width_left_label">
+                                    <property name="visible">True</property>
+                                    <property name="label" translatable="yes">&lt;i&gt;Narrow&lt;/i&gt;</property>
+                                    <property name="use_underline">False</property>
+                                    <property name="use_markup">True</property>
+                                    <property name="justify">GTK_JUSTIFY_LEFT</property>
+                                    <property name="wrap">False</property>
+                                    <property name="selectable">False</property>
+                                    <property name="xalign">0.5</property>
+                                    <property name="yalign">0.5</property>
+                                    <property name="xpad">0</property>
+                                    <property name="ypad">0</property>
+                                    <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                                    <property name="width_chars">-1</property>
+                                    <property name="single_line_mode">False</property>
+                                    <property name="angle">0</property>
+                                  </object>
+                                  <packing>
+                                    <property name="padding">0</property>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkHScale" id="palm_detection_width_scale">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="draw_value">False</property>
+                                    <property name="value_pos">GTK_POS_TOP</property>
+                                    <property name="digits">0</property>
+                                    <property name="update_policy">GTK_UPDATE_DISCONTINUOUS</property>
+                                    <property name="inverted">False</property>
+                                    <property name="adjustment">palm_detection_width_scale_adjustment</property>
+                                  </object>
+                                  <packing>
+                                    <property name="padding">0</property>
+                                    <property name="expand">True</property>
+                                    <property name="fill">True</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkLabel" id="palm_detection_width_right_label">
+                                    <property name="visible">True</property>
+                                    <property name="label" translatable="yes">&lt;i&gt;Wide&lt;/i&gt;</property>
+                                    <property name="use_underline">False</property>
+                                    <property name="use_markup">True</property>
+                                    <property name="justify">GTK_JUSTIFY_LEFT</property>
+                                    <property name="wrap">False</property>
+                                    <property name="selectable">False</property>
+                                    <property name="xalign">0.5</property>
+                                    <property name="yalign">0.5</property>
+                                    <property name="xpad">0</property>
+                                    <property name="ypad">0</property>
+                                    <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                                    <property name="width_chars">-1</property>
+                                    <property name="single_line_mode">False</property>
+                                    <property name="angle">0</property>
+                                  </object>
+                                  <packing>
+                                    <property name="padding">0</property>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                  </packing>
+                                </child>
+                              </object>
+			    </child>
+                            <child>
+                              <object class="GtkHBox" id="palm_detection_depth_box">
+                                <property name="visible">True</property>
+                                <property name="border-width">5</property>
+                                <child>
+                                  <object class="GtkLabel" id="palm_detection_depth_label">
+                                    <property name="visible">True</property>
+                                    <property name="label" translatable="yes">_depth:</property>
+                                    <property name="mnemonic-widget">palm_detection_depth_scale</property>
+                                    <property name="use_underline">True</property>
+                                    <property name="use_markup">False</property>
+                                    <property name="justify">GTK_JUSTIFY_LEFT</property>
+                                    <property name="wrap">False</property>
+                                    <property name="selectable">False</property>
+                                    <property name="xalign">0.5</property>
+                                    <property name="yalign">0.5</property>
+                                    <property name="xpad">0</property>
+                                    <property name="ypad">0</property>
+                                    <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                                    <property name="width_chars">-1</property>
+                                    <property name="single_line_mode">False</property>
+                                    <property name="angle">0</property>
+                                  </object>
+                                  <packing>
+                                    <property name="padding">0</property>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkLabel" id="palm_detection_depth_left_label">
+                                    <property name="visible">True</property>
+                                    <property name="label" translatable="yes">&lt;i&gt;Light&lt;/i&gt;</property>
+                                    <property name="use_underline">False</property>
+                                    <property name="use_markup">True</property>
+                                    <property name="justify">GTK_JUSTIFY_LEFT</property>
+                                    <property name="wrap">False</property>
+                                    <property name="selectable">False</property>
+                                    <property name="xalign">0.5</property>
+                                    <property name="yalign">0.5</property>
+                                    <property name="xpad">0</property>
+                                    <property name="ypad">0</property>
+                                    <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                                    <property name="width_chars">-1</property>
+                                    <property name="single_line_mode">False</property>
+                                    <property name="angle">0</property>
+                                  </object>
+                                  <packing>
+                                    <property name="padding">0</property>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkHScale" id="palm_detection_depth_scale">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="draw_value">False</property>
+                                    <property name="value_pos">GTK_POS_TOP</property>
+                                    <property name="digits">0</property>
+                                    <property name="update_policy">GTK_UPDATE_DISCONTINUOUS</property>
+                                    <property name="inverted">False</property>
+                                    <property name="adjustment">palm_detection_depth_scale_adjustment</property>
+                                  </object>
+                                  <packing>
+                                    <property name="padding">0</property>
+                                    <property name="expand">True</property>
+                                    <property name="fill">True</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkLabel" id="palm_detection_depth_right_label">
+                                    <property name="visible">True</property>
+                                    <property name="label" translatable="yes">&lt;i&gt;Heavy&lt;/i&gt;</property>
+                                    <property name="use_underline">False</property>
+                                    <property name="use_markup">True</property>
+                                    <property name="justify">GTK_JUSTIFY_LEFT</property>
+                                    <property name="wrap">False</property>
+                                    <property name="selectable">False</property>
+                                    <property name="xalign">0.5</property>
+                                    <property name="yalign">0.5</property>
+                                    <property name="xpad">0</property>
+                                    <property name="ypad">0</property>
+                                    <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                                    <property name="width_chars">-1</property>
+                                    <property name="single_line_mode">False</property>
+                                    <property name="angle">0</property>
+                                  </object>
+                                  <packing>
+                                    <property name="padding">0</property>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                  </packing>
+                                </child>
+                              </object>
+			    </child>
+			  </object>
+                          <packing>
+                            <property name="padding">0</property>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                          </packing>
+                        </child>
+                        <child>
                           <object class="GtkLabel" id="locked_drags_label">
                             <property name="visible">True</property>
                             <property name="label" translatable="yes">&lt;b&gt;Locked Drags&lt;/b&gt;</property>

Modified: trunk/modules/gpds-touchpad-ui.c
==============================================================================
--- trunk/modules/gpds-touchpad-ui.c	(original)
+++ trunk/modules/gpds-touchpad-ui.c	Thu Mar 26 03:21:12 2009
@@ -170,7 +170,7 @@
                                              NULL)
 GPDS_XINPUT_UI_DEFINE_TOGGLE_BUTTON_CALLBACK(palm_detection,
                                              GPDS_TOUCHPAD_PALM_DETECTION,
-                                             NULL)
+                                             "palm_detection_box")
 GPDS_XINPUT_UI_DEFINE_TOGGLE_BUTTON_CALLBACK(locked_drags,
                                              GPDS_TOUCHPAD_LOCKED_DRAGS,
                                              "locked_drags_box")
@@ -217,6 +217,31 @@
 }
 
 static void
+set_palm_dimensions_property (GpdsXInput *xinput, GtkBuilder *builder)
+{
+    GError *error = NULL;
+    GObject *object;
+    gint properties[2];
+
+    object = gtk_builder_get_object(builder, "palm_detection_width_scale");
+    properties[0] = (gint)gtk_range_get_value(GTK_RANGE(object));
+
+    object = gtk_builder_get_object(builder, "palm_detection_depth_scale");
+    properties[1] = (gint)gtk_range_get_value(GTK_RANGE(object));
+
+    if (!gpds_xinput_set_int_properties(xinput,
+                                        GPDS_TOUCHPAD_PALM_DIMENSIONS,
+                                        &error,
+                                        properties,
+                                        2)) {
+        if (error) {
+            show_error(error);
+            g_error_free(error);
+        }
+    }
+}
+
+static void
 set_scrolling_distance_range_property (GpdsXInput *xinput, GtkBuilder *builder)
 {
     GError *error = NULL;
@@ -266,6 +291,25 @@
     }
 }
 
+#define DEFINE_PALM_DIMENSIONS_SCALE_VALUE_CHANGED_CALLBACK(type, TYPE)                                             \
+static void                                                                                                         \
+cb_palm_detection_ ## type ## _scale_value_changed (GtkRange *range, gpointer user_data)                            \
+{                                                                                                                   \
+    GtkBuilder *builder;                                                                                            \
+    gdouble distance;                                                                                               \
+    GpdsXInput *xinput;                                                                                             \
+    xinput = gpds_xinput_ui_get_xinput(GPDS_XINPUT_UI(user_data));                                                  \
+    if (!xinput)                                                                                                    \
+        return;                                                                                                     \
+    builder = gpds_ui_get_builder(GPDS_UI(user_data));                                                              \
+    set_palm_dimensions_property(xinput, builder);                                                                  \
+    distance = gtk_range_get_value(range);                                                                          \
+    gpds_ui_set_gconf_bool(GPDS_UI(user_data), GPDS_TOUCHPAD_PALM_DETECTION_ ## TYPE ## _KEY, (gint)distance);      \
+}
+
+DEFINE_PALM_DIMENSIONS_SCALE_VALUE_CHANGED_CALLBACK(width, WIDTH)
+DEFINE_PALM_DIMENSIONS_SCALE_VALUE_CHANGED_CALLBACK(depth, DEPTH)
+
 #define DEFINE_SCROLLING_SCALE_VALUE_CHANGED_CALLBACK(type, TYPE)                                                   \
 static void                                                                                                         \
 cb_ ## type ## _scrolling_scale_value_changed (GtkRange *range, gpointer user_data)                                 \
@@ -486,6 +530,8 @@
     CONNECT(touchpad_use_type, changed);
     CONNECT(guest_mouse_off, toggled);
     CONNECT(palm_detection, toggled);
+    CONNECT(palm_detection_width_scale, value_changed);
+    CONNECT(palm_detection_depth_scale, value_changed);
     CONNECT(locked_drags, toggled);
     CONNECT(locked_drags_timeout_scale, value_changed);
     CONNECT(tapping_time_scale, value_changed);
@@ -588,6 +634,39 @@
 }
 
 static void
+set_palm_dimensions_property_from_preference (GpdsUI *ui,
+                                              GtkBuilder *builder)
+{
+    GObject *object;
+    gint *values;
+    gulong n_values;
+    gint distance;
+
+    if (!gpds_xinput_ui_get_xinput_int_property(GPDS_XINPUT_UI(ui),
+                                                GPDS_TOUCHPAD_PALM_DIMENSIONS,
+                                                &values, &n_values)) {
+        return;
+    }
+
+    if (n_values != 2) {
+        g_free(values);
+        return;
+    }
+
+    if (!gpds_ui_get_gconf_int(ui, GPDS_TOUCHPAD_PALM_DETECTION_WIDTH_KEY, &distance))
+        distance = values[0];
+    object = gtk_builder_get_object(builder, "palm_detection_width_scale");
+    gtk_range_set_value(GTK_RANGE(object), distance);
+
+    if (!gpds_ui_get_gconf_int(ui, GPDS_TOUCHPAD_PALM_DETECTION_DEPTH_KEY, &distance))
+        distance = values[1];
+    object = gtk_builder_get_object(builder, "palm_detection_depth_scale");
+    gtk_range_set_value(GTK_RANGE(object), distance);
+
+    g_free(values);
+}
+
+static void
 set_scroll_distance_property_from_preference (GpdsUI *ui,
                                               GtkBuilder *builder)
 {
@@ -689,6 +768,7 @@
     SET_BOOLEAN_VALUE(GPDS_TOUCHPAD_CIRCULAR_SCROLLING, "circular_scrolling");
 
     set_edge_scrolling_property_from_preference(ui, builder);
+    set_palm_dimensions_property_from_preference(ui, builder);
     set_scroll_distance_property_from_preference(ui, builder);
     set_circular_scrolling_trigger_property_from_preference(ui, builder);
     set_two_finger_scrolling_property_from_preference(ui, builder);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]