[Xfce4-commits] r27068 - in xfce4-settings/trunk: dialogs/accessibility-settings xfce4-settings-helper

Stephan Arts stephan at xfce.org
Sun Jun 15 21:33:59 CEST 2008


Author: stephan
Date: 2008-06-15 19:33:59 +0000 (Sun, 15 Jun 2008)
New Revision: 27068

Modified:
   xfce4-settings/trunk/dialogs/accessibility-settings/accessibility-dialog.glade
   xfce4-settings/trunk/dialogs/accessibility-settings/main.c
   xfce4-settings/trunk/xfce4-settings-helper/accessx.c
Log:
Add mouse-keys support
Accessibility-dialog now sets the accessibility settings



Modified: xfce4-settings/trunk/dialogs/accessibility-settings/accessibility-dialog.glade
===================================================================
--- xfce4-settings/trunk/dialogs/accessibility-settings/accessibility-dialog.glade	2008-06-15 11:30:14 UTC (rev 27067)
+++ xfce4-settings/trunk/dialogs/accessibility-settings/accessibility-dialog.glade	2008-06-15 19:33:59 UTC (rev 27068)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
-<!--Generated with glade3 3.4.5 on Sat Jun 14 15:10:06 2008 -->
+<!--Generated with glade3 3.4.5 on Sun Jun 15 21:18:13 2008 -->
 <glade-interface>
   <requires lib="xfce4"/>
   <widget class="GtkDialog" id="accessibility-settings-dialog">
@@ -59,8 +59,9 @@
                                   </packing>
                                 </child>
                                 <child>
-                                  <widget class="GtkAlignment" id="alignment6">
+                                  <widget class="GtkAlignment" id="xkb_accessx_sticky_box">
                                     <property name="visible">True</property>
+                                    <property name="sensitive">False</property>
                                     <property name="left_padding">12</property>
                                     <child>
                                       <widget class="GtkVBox" id="vbox7">
@@ -174,8 +175,9 @@
                                   </packing>
                                 </child>
                                 <child>
-                                  <widget class="GtkAlignment" id="alignment7">
+                                  <widget class="GtkAlignment" id="xkb_accessx_slow_box">
                                     <property name="visible">True</property>
+                                    <property name="sensitive">False</property>
                                     <property name="left_padding">12</property>
                                     <child>
                                       <widget class="GtkVBox" id="vbox9">
@@ -186,7 +188,7 @@
                                             <property name="xalign">0</property>
                                             <property name="label" translatable="yes">Slow Keys _delay:</property>
                                             <property name="use_underline">True</property>
-                                            <property name="mnemonic_widget">hscale1</property>
+                                            <property name="mnemonic_widget">xkb_accessx_mouse_delay_scale</property>
                                           </widget>
                                           <packing>
                                             <property name="expand">False</property>
@@ -212,7 +214,7 @@
                                               <widget class="GtkHScale" id="xkb_accessx_slow_delay_scale">
                                                 <property name="visible">True</property>
                                                 <property name="can_focus">True</property>
-                                                <property name="adjustment">0 0 100 1 10 10</property>
+                                                <property name="adjustment">100 10 500 10 10 10</property>
                                                 <property name="draw_value">False</property>
                                                 <property name="value_pos">GTK_POS_RIGHT</property>
                                               </widget>
@@ -295,8 +297,9 @@
                                   </packing>
                                 </child>
                                 <child>
-                                  <widget class="GtkAlignment" id="alignment8">
+                                  <widget class="GtkAlignment" id="xkb_accessx_bounce_box">
                                     <property name="visible">True</property>
+                                    <property name="sensitive">False</property>
                                     <property name="left_padding">12</property>
                                     <child>
                                       <widget class="GtkVBox" id="vbox10">
@@ -333,7 +336,7 @@
                                               <widget class="GtkHScale" id="xkb_accessx_debounce_delay_scale">
                                                 <property name="visible">True</property>
                                                 <property name="can_focus">True</property>
-                                                <property name="adjustment">0 0 100 1 10 10</property>
+                                                <property name="adjustment">100 10 500 1 10 10</property>
                                                 <property name="draw_value">False</property>
                                                 <property name="value_pos">GTK_POS_RIGHT</property>
                                               </widget>
@@ -415,7 +418,7 @@
                               <widget class="GtkVBox" id="vbox8">
                                 <property name="visible">True</property>
                                 <child>
-                                  <widget class="GtkCheckButton" id="checkbutton5">
+                                  <widget class="GtkCheckButton" id="xkb_accessx_mouse_check">
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="label" translatable="yes">_Enable mouse emulation</property>
@@ -429,8 +432,9 @@
                                   </packing>
                                 </child>
                                 <child>
-                                  <widget class="GtkAlignment" id="alignment5">
+                                  <widget class="GtkAlignment" id="xkb_accessx_mouse_box">
                                     <property name="visible">True</property>
+                                    <property name="sensitive">False</property>
                                     <property name="left_padding">12</property>
                                     <child>
                                       <widget class="GtkVBox" id="vbox11">
@@ -445,7 +449,7 @@
                                                 <property name="xalign">0</property>
                                                 <property name="label" translatable="yes">_Delay:</property>
                                                 <property name="use_underline">True</property>
-                                                <property name="mnemonic_widget">hscale1</property>
+                                                <property name="mnemonic_widget">xkb_accessx_mouse_delay_scale</property>
                                               </widget>
                                               <packing>
                                                 <property name="expand">False</property>
@@ -468,10 +472,10 @@
                                                   </packing>
                                                 </child>
                                                 <child>
-                                                  <widget class="GtkHScale" id="hscale1">
+                                                  <widget class="GtkHScale" id="xkb_accessx_mouse_delay_scale">
                                                     <property name="visible">True</property>
                                                     <property name="can_focus">True</property>
-                                                    <property name="adjustment">0 0 100 1 10 10</property>
+                                                    <property name="adjustment">100 10 500 1 10 10</property>
                                                     <property name="draw_value">False</property>
                                                     <property name="value_pos">GTK_POS_RIGHT</property>
                                                   </widget>
@@ -514,7 +518,7 @@
                                                 <property name="xalign">0</property>
                                                 <property name="label" translatable="yes">_Interval:</property>
                                                 <property name="use_underline">True</property>
-                                                <property name="mnemonic_widget">hscale1</property>
+                                                <property name="mnemonic_widget">xkb_accessx_mouse_delay_scale</property>
                                               </widget>
                                               <packing>
                                                 <property name="expand">False</property>
@@ -537,10 +541,10 @@
                                                   </packing>
                                                 </child>
                                                 <child>
-                                                  <widget class="GtkHScale" id="hscale4">
+                                                  <widget class="GtkHScale" id="xkb_accessx_mouse_interval_scale">
                                                     <property name="visible">True</property>
                                                     <property name="can_focus">True</property>
-                                                    <property name="adjustment">0 0 100 1 10 10</property>
+                                                    <property name="adjustment">100 10 500 1 10 10</property>
                                                     <property name="draw_value">False</property>
                                                     <property name="value_pos">GTK_POS_RIGHT</property>
                                                   </widget>
@@ -584,7 +588,7 @@
                                                 <property name="xalign">0</property>
                                                 <property name="label" translatable="yes">Acceleration _delay:</property>
                                                 <property name="use_underline">True</property>
-                                                <property name="mnemonic_widget">hscale1</property>
+                                                <property name="mnemonic_widget">xkb_accessx_mouse_delay_scale</property>
                                               </widget>
                                               <packing>
                                                 <property name="expand">False</property>
@@ -607,10 +611,10 @@
                                                   </packing>
                                                 </child>
                                                 <child>
-                                                  <widget class="GtkHScale" id="hscale5">
+                                                  <widget class="GtkHScale" id="xkb_accessx_mouse_acceldelay_scale">
                                                     <property name="visible">True</property>
                                                     <property name="can_focus">True</property>
-                                                    <property name="adjustment">0 0 100 1 10 10</property>
+                                                    <property name="adjustment">100 10 500 1 10 10</property>
                                                     <property name="draw_value">False</property>
                                                     <property name="value_pos">GTK_POS_RIGHT</property>
                                                   </widget>
@@ -654,7 +658,7 @@
                                                 <property name="xalign">0</property>
                                                 <property name="label" translatable="yes">Maximum _Speed:</property>
                                                 <property name="use_underline">True</property>
-                                                <property name="mnemonic_widget">hscale1</property>
+                                                <property name="mnemonic_widget">xkb_accessx_mouse_delay_scale</property>
                                               </widget>
                                               <packing>
                                                 <property name="expand">False</property>
@@ -677,10 +681,10 @@
                                                   </packing>
                                                 </child>
                                                 <child>
-                                                  <widget class="GtkHScale" id="hscale6">
+                                                  <widget class="GtkHScale" id="xkb_accessx_mouse_speed_scale">
                                                     <property name="visible">True</property>
                                                     <property name="can_focus">True</property>
-                                                    <property name="adjustment">0 0 100 1 10 10</property>
+                                                    <property name="adjustment">100 10 500 1 10 10</property>
                                                     <property name="draw_value">False</property>
                                                     <property name="value_pos">GTK_POS_RIGHT</property>
                                                   </widget>

Modified: xfce4-settings/trunk/dialogs/accessibility-settings/main.c
===================================================================
--- xfce4-settings/trunk/dialogs/accessibility-settings/main.c	2008-06-15 11:30:14 UTC (rev 27067)
+++ xfce4-settings/trunk/dialogs/accessibility-settings/main.c	2008-06-15 19:33:59 UTC (rev 27068)
@@ -50,34 +50,116 @@
     { NULL }
 };
 
+void
+cb_xkb_accessx_mouse_toggled (GtkToggleButton *button, gpointer user_data)
+{
+    GladeXML *gxml = GLADE_XML(user_data);
+    GtkWidget *box = glade_xml_get_widget (gxml, "xkb_accessx_mouse_box");
+    gtk_widget_set_sensitive (box, gtk_toggle_button_get_active (button));
+}
+
+void
+cb_xkb_accessx_sticky_toggled (GtkToggleButton *button, gpointer user_data)
+{
+    GladeXML *gxml = GLADE_XML(user_data);
+    GtkWidget *box = glade_xml_get_widget (gxml, "xkb_accessx_sticky_box");
+    gtk_widget_set_sensitive (box, gtk_toggle_button_get_active (button));
+}
+
+void
+cb_xkb_accessx_slow_toggled (GtkToggleButton *button, gpointer user_data)
+{
+    GladeXML *gxml = GLADE_XML(user_data);
+    GtkWidget *box = glade_xml_get_widget (gxml, "xkb_accessx_slow_box");
+    gtk_widget_set_sensitive (box, gtk_toggle_button_get_active (button));
+}
+
+void
+cb_xkb_accessx_bounce_toggled (GtkToggleButton *button, gpointer user_data)
+{
+    GladeXML *gxml = GLADE_XML(user_data);
+    GtkWidget *box = glade_xml_get_widget (gxml, "xkb_accessx_bounce_box");
+    gtk_widget_set_sensitive (box, gtk_toggle_button_get_active (button));
+}
+
 GtkWidget *
 accessibility_settings_dialog_new_from_xml (GladeXML *gxml)
 {
     XfconfChannel *xsettings_channel = xfconf_channel_new("xsettings");
     XfconfChannel *accessx_channel = xfconf_channel_new("accessx");
 
+    GtkWidget *xkb_accessx_mouse_check = glade_xml_get_widget (gxml, "xkb_accessx_mouse_check");
+    GtkWidget *xkb_accessx_mouse_speed_scale =(GtkWidget *)gtk_range_get_adjustment(GTK_RANGE(glade_xml_get_widget (gxml, "xkb_accessx_mouse_speed_scale")));
+    GtkWidget *xkb_accessx_mouse_delay_scale =(GtkWidget *)gtk_range_get_adjustment(GTK_RANGE(glade_xml_get_widget (gxml, "xkb_accessx_mouse_delay_scale")));
+    GtkWidget *xkb_accessx_mouse_acceldelay_scale =(GtkWidget *)gtk_range_get_adjustment(GTK_RANGE(glade_xml_get_widget (gxml, "xkb_accessx_mouse_acceldelay_scale")));
+    GtkWidget *xkb_accessx_mouse_interval_scale =(GtkWidget *)gtk_range_get_adjustment(GTK_RANGE(glade_xml_get_widget (gxml, "xkb_accessx_mouse_interval_scale")));
+
     GtkWidget *xkb_accessx_sticky_check = glade_xml_get_widget (gxml, "xkb_accessx_sticky_check");
-    GtkWidget *xkb_accessx_sticky_latch_mode = glade_xml_get_widget (gxml, "xkb_accessx_sticky_latch_mode");
+    GtkWidget *xkb_accessx_sticky_lock_mode = glade_xml_get_widget (gxml, "xkb_accessx_sticky_lock_mode");
     GtkWidget *xkb_accessx_sticky_two_keys_disable_check = glade_xml_get_widget (gxml, "xkb_accessx_sticky_two_keys_disable_check");
     GtkWidget *xkb_accessx_slow_check = glade_xml_get_widget (gxml, "xkb_accessx_slow_check");
-    GtkWidget *xkb_accessx_slow_delay_scale = glade_xml_get_widget (gxml, "xkb_accessx_slow_delay_scale");
+    GtkWidget *xkb_accessx_slow_delay_scale = (GtkWidget *)gtk_range_get_adjustment(GTK_RANGE(glade_xml_get_widget (gxml, "xkb_accessx_slow_delay_scale")));
     GtkWidget *xkb_accessx_bounce_check = glade_xml_get_widget (gxml, "xkb_accessx_bounce_check");
-    GtkWidget *xkb_accessx_debounce_delay_scale = glade_xml_get_widget (gxml, "xkb_accessx_debounce_delay_scale");
+    GtkWidget *xkb_accessx_debounce_delay_scale =(GtkWidget *)gtk_range_get_adjustment(GTK_RANGE(glade_xml_get_widget (gxml, "xkb_accessx_debounce_delay_scale")));
 
+    g_signal_connect (G_OBJECT(xkb_accessx_mouse_check), "toggled", (GCallback)cb_xkb_accessx_mouse_toggled, gxml);
+    g_signal_connect (G_OBJECT(xkb_accessx_sticky_check), "toggled", (GCallback)cb_xkb_accessx_sticky_toggled, gxml);
+    g_signal_connect (G_OBJECT(xkb_accessx_slow_check), "toggled", (GCallback)cb_xkb_accessx_slow_toggled, gxml);
+    g_signal_connect (G_OBJECT(xkb_accessx_bounce_check), "toggled", (GCallback)cb_xkb_accessx_bounce_toggled, gxml);
 
+
     /* Bind easy properties */
+    /* Mouse settings */
     xfconf_g_property_bind (accessx_channel, 
+                            "/AccessX/MouseKeys",
+                            G_TYPE_BOOLEAN,
+                            (GObject *)xkb_accessx_mouse_check, "active");
+    xfconf_g_property_bind (accessx_channel, 
+                            "/AccessX/MouseKeys/Speed",
+                            G_TYPE_INT,
+                            (GObject *)xkb_accessx_mouse_speed_scale, "value");
+    xfconf_g_property_bind (accessx_channel, 
+                            "/AccessX/MouseKeys/Delay",
+                            G_TYPE_INT,
+                            (GObject *)xkb_accessx_mouse_delay_scale, "value");
+    xfconf_g_property_bind (accessx_channel, 
+                            "/AccessX/MouseKeys/Interval",
+                            G_TYPE_INT,
+                            (GObject *)xkb_accessx_mouse_interval_scale, "value");
+    xfconf_g_property_bind (accessx_channel, 
+                            "/AccessX/MouseKeys/TimeToMax",
+                            G_TYPE_INT,
+                            (GObject *)xkb_accessx_mouse_acceldelay_scale, "value");
+
+    /* Keyboard settings */
+    xfconf_g_property_bind (accessx_channel, 
                             "/AccessX/StickyKeys",
                             G_TYPE_BOOLEAN,
                             (GObject *)xkb_accessx_sticky_check, "active");
     xfconf_g_property_bind (accessx_channel, 
                             "/AccessX/StickyKeys/LatchToLock",
                             G_TYPE_BOOLEAN,
-                            (GObject *)xkb_accessx_sticky_latch_mode, "active");
+                            (GObject *)xkb_accessx_sticky_lock_mode, "active");
     xfconf_g_property_bind (accessx_channel, 
                             "/AccessX/StickyKeys/TwoKeysDisable",
                             G_TYPE_BOOLEAN,
                             (GObject *)xkb_accessx_sticky_two_keys_disable_check, "active");
+    xfconf_g_property_bind (accessx_channel, 
+                            "/AccessX/BounceKeys",
+                            G_TYPE_BOOLEAN,
+                            (GObject *)xkb_accessx_bounce_check, "active");
+    xfconf_g_property_bind (accessx_channel, 
+                            "/AccessX/BounceKeys/Delay",
+                            G_TYPE_INT,
+                            (GObject *)xkb_accessx_debounce_delay_scale, "value");
+    xfconf_g_property_bind (accessx_channel, 
+                            "/AccessX/SlowKeys",
+                            G_TYPE_BOOLEAN,
+                            (GObject *)xkb_accessx_slow_check, "active");
+    xfconf_g_property_bind (accessx_channel, 
+                            "/AccessX/SlowKeys/Delay",
+                            G_TYPE_INT,
+                            (GObject *)xkb_accessx_slow_delay_scale, "value");
 
 
 

Modified: xfce4-settings/trunk/xfce4-settings-helper/accessx.c
===================================================================
--- xfce4-settings/trunk/xfce4-settings-helper/accessx.c	2008-06-15 11:30:14 UTC (rev 27067)
+++ xfce4-settings/trunk/xfce4-settings-helper/accessx.c	2008-06-15 19:33:59 UTC (rev 27068)
@@ -143,11 +143,19 @@
 static void
 toggle_accessx (XfconfChannel *channel)
 {
+    gboolean mouse_keys = xfconf_channel_get_bool (channel, "/AccessX/MouseKeys", FALSE);
+    gint mouse_keys_delay = xfconf_channel_get_int (channel, "/AccessX/MouseKeys/Delay", 100);
+    gint mouse_keys_interval = xfconf_channel_get_int (channel, "/AccessX/MouseKeys/Interval", 100);
+    gint mouse_keys_ttm = xfconf_channel_get_int (channel, "/AccessX/MouseKeys/TimeToMax", 100);
+    gint mouse_keys_max_speed = xfconf_channel_get_int (channel, "/AccessX/MouseKeys/Speed", 100);
+
     gboolean slow_keys = xfconf_channel_get_bool (channel, "/AccessX/SlowKeys", FALSE);
+    gint slow_keys_delay = xfconf_channel_get_int (channel, "/AccessX/SlowKeys/Delay", 100);
+
+    gboolean bounce_keys = xfconf_channel_get_bool (channel, "/AccessX/BounceKeys", FALSE);
+    gint debounce_delay = xfconf_channel_get_int (channel, "/AccessX/BounceKeys/Delay", 100);
+
     gboolean sticky_keys = xfconf_channel_get_bool (channel, "/AccessX/StickyKeys", FALSE);
-    gboolean bounce_keys = xfconf_channel_get_bool (channel, "/AccessX/BounceKeys", FALSE);
-    gint slow_keys_delay = xfconf_channel_get_int (channel, "/AccessX/SlowKeysDelay", 100);
-    gint debounce_delay = xfconf_channel_get_int (channel, "/AccessX/DeBounceDelay", 100);
     gboolean sticky_keys_ltl = xfconf_channel_get_bool (channel, "/AccessX/StickyKeys/LatchToLock", FALSE);
     gboolean sticky_keys_tk = xfconf_channel_get_bool (channel, "/AccessX/StickyKeys/TwoKeysDisable", FALSE);
 
@@ -159,6 +167,19 @@
             gdk_error_trap_push ();
             XkbGetControls (GDK_DISPLAY (), XkbAllControlsMask, xkb);
 
+            /* Mouse keys */
+            if (mouse_keys)
+            {
+                xkb->ctrls->enabled_ctrls |= XkbMouseKeysMask;
+                xkb->ctrls->mk_delay = mouse_keys_delay;
+                xkb->ctrls->mk_interval = 1000 / mouse_keys_interval;
+                xkb->ctrls->mk_time_to_max = mouse_keys_ttm;
+                xkb->ctrls->mk_max_speed = mouse_keys_max_speed;
+
+            }
+            else
+                xkb->ctrls->enabled_ctrls &= XkbMouseKeysMask;
+
             /* Slow keys */
             if(slow_keys)
             {



More information about the Xfce4-commits mailing list