Support turning off keyboard beep.
authorHong Jen Yee (PCMan) <pcman.tw@gmail.com>
Sun, 10 May 2009 06:56:50 +0000 (06:56 +0000)
committerHong Jen Yee (PCMan) <pcman.tw@gmail.com>
Sun, 10 May 2009 06:56:50 +0000 (06:56 +0000)
configure.in
data/lxinput.glade
src/lxinput.c

index cc0f663..a4c9546 100644 (file)
@@ -1,7 +1,7 @@
 dnl Process this file with autoconf to produce a configure script.
 
 AC_INIT(configure.in)
-AM_INIT_AUTOMAKE(lxinput, 0.1)
+AM_INIT_AUTOMAKE(lxinput, 0.1.1)
 AM_CONFIG_HEADER(config.h)
 AM_MAINTAINER_MODE
 
index 5ff1d77..bcf86ac 100644 (file)
                 <child>
                   <object class="GtkCheckButton" id="beep">
                     <property name="label" translatable="yes">Beep when there is an error of keyboard input</property>
+                    <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
                     <property name="draw_indicator">True</property>
                 <property name="use_stock">True</property>
               </object>
               <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
                 <property name="position">0</property>
               </packing>
             </child>
                 <property name="use_stock">True</property>
               </object>
               <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
                 <property name="position">1</property>
               </packing>
             </child>
index e1cd5c5..ea86f10 100644 (file)
@@ -115,8 +115,10 @@ static void on_left_handed_toggle(GtkToggleButton* btn, gpointer user_data)
 
 static void on_kb_beep_toggle(GtkToggleButton* btn, gpointer user_data)
 {
+    XKeyboardControl values;
     beep = gtk_toggle_button_get_active(btn);
-
+    values.bell_percent = beep ? -1 : 0;
+    XChangeKeyboardControl(GDK_DISPLAY(), KBBellPercent, &values);
 }
 
 static gboolean on_change_val(GtkRange *range, GtkScrollType scroll,
@@ -228,11 +230,11 @@ int main(int argc, char** argv)
 
         g_key_file_set_integer(kf, "Mouse", "AccFactor", accel);
         g_key_file_set_integer(kf, "Mouse", "AccThreshold", threshold);
-        g_key_file_set_boolean(kf, "Mouse", "LeftHanded", left_handed);
+        g_key_file_set_integer(kf, "Mouse", "LeftHanded", !!left_handed);
 
         g_key_file_set_integer(kf, "Keyboard", "Delay", delay);
         g_key_file_set_integer(kf, "Keyboard", "Interval", interval);
-        g_key_file_set_boolean(kf, "Keyboard", "Beep", beep);
+        g_key_file_set_integer(kf, "Keyboard", "Beep", !!beep);
 
         if( str = g_key_file_to_data( kf, &len, NULL ) )
         {