]> Dogcows Code - chaz/openbox/commitdiff
add the chainQuitKey option to teh <keyboard> section of the rc3
authorDana Jansens <danakj@orodu.net>
Tue, 12 Aug 2003 18:05:40 +0000 (18:05 +0000)
committerDana Jansens <danakj@orodu.net>
Tue, 12 Aug 2003 18:05:40 +0000 (18:05 +0000)
data/rc3
openbox/config.c
openbox/config.h
openbox/keyboard.c

index c0126ff98120d93bb752b3281e9cfe02b48688f4..ae3263a034b2ddb53bc875893d1a94c915665e29 100644 (file)
--- a/data/rc3
+++ b/data/rc3
@@ -53,6 +53,8 @@
 </dock>
 
 <keyboard>
+  <chainQuitKey>C-g</chainQuitKey>
+
   <keybind key="A-F10">
     <action name="MaximizeFull"></action>
   </keybind>
index f051452348ee4531cdb042eceb4f316ca3ba610f..19b664032426135cddd4e6e54f73b65854c8966d 100644 (file)
@@ -2,6 +2,7 @@
 #include "keyboard.h"
 #include "mouse.h"
 #include "prop.h"
+#include "translate.h"
 #include "parser/parse.h"
 
 gboolean config_focus_new;
@@ -29,6 +30,9 @@ ObOrientation   config_dock_orient;
 gboolean        config_dock_hide;
 guint           config_dock_hide_timeout;
 
+guint config_keyboard_reset_keycode;
+guint config_keyboard_reset_state;
+
 gint config_mouse_threshold;
 gint config_mouse_dclicktime;
 
@@ -49,6 +53,12 @@ static void parse_key(xmlDocPtr doc, xmlNodePtr node, GList *keylist)
     xmlNodePtr n, nact;
     GList *it;
 
+    if ((n = parse_find_node("chainQuitKey", node))) {
+        key = parse_string(doc, n);
+        translate_key(key, &config_keyboard_reset_state,
+                      &config_keyboard_reset_keycode);
+    }
+
     n = parse_find_node("keybind", node);
     while (n) {
         if (parse_attr_string("key", n, &key)) {
@@ -343,6 +353,9 @@ void config_startup()
 
     parse_register("dock", parse_dock, NULL);
 
+    translate_key("C-g", &config_keyboard_reset_state,
+                  &config_keyboard_reset_keycode);
+
     parse_register("keyboard", parse_keyboard, NULL);
 
     config_mouse_threshold = 3;
index b025413557a76b616d6425b1de03f50f0ce0db02..fe4fb605107fb9c61d952f27ccf67ce977cf63a3 100644 (file)
@@ -54,6 +54,11 @@ extern int config_desktops_num;
 /*! Names for the desktops */
 extern GSList *config_desktops_names;
 
+/*! The keycode of the key combo which resets the keybaord chains */
+guint config_keyboard_reset_keycode;
+/*! The modifiers of the key combo which resets the keybaord chains */
+guint config_keyboard_reset_state;
+
 /*! Number of pixels a drag must go before being considered a drag */
 extern gint config_mouse_threshold;
 /*! Number of milliseconds within which 2 clicks must occur to be a
index 513b6e1e30785dd2a63f7d9a2ea531ad66fe81d2..0ba7c869d899fc70443ba38e062d5f853f862b6e 100644 (file)
@@ -8,6 +8,7 @@
 #include "action.h"
 #include "prop.h"
 #include "timer.h"
+#include "config.h"
 #include "keytree.h"
 #include "keyboard.h"
 #include "translate.h"
@@ -36,6 +37,10 @@ static void grab_for_window(Window win, gboolean grab)
             grab_key(p->key, p->state, win, GrabModeAsync);
             p = p->next_sibling;
         }
+        if (curpos)
+            grab_key(config_keyboard_reset_keycode,
+                     config_keyboard_reset_state,
+                     win, GrabModeAsync);
     }
 }
 
@@ -179,6 +184,13 @@ void keyboard_event(ObClient *client, const XEvent *e)
 
     g_assert(e->type == KeyPress);
 
+    if (e->xkey.keycode == config_keyboard_reset_keycode &&
+        e->xkey.state == config_keyboard_reset_state)
+    {
+        keyboard_reset_chains();
+        return;
+    }
+
     if (curpos == NULL)
         p = keyboard_firstnode;
     else
This page took 0.027104 seconds and 4 git commands to generate.