]> Dogcows Code - chaz/openbox/blobdiff - plugins/keyboard/keyboard.c
change how rc parsing will work. a=b will be parsed in any [section] and given to...
[chaz/openbox] / plugins / keyboard / keyboard.c
index cf48b2e9290bf53edb062ec3d599c18c966b7eac..2233a04a3042899852eef8a47f4c496cf27f5fca 100644 (file)
@@ -1,18 +1,22 @@
-#include "../../kernel/focus.h"
-#include "../../kernel/dispatch.h"
-#include "../../kernel/openbox.h"
-#include "../../kernel/grab.h"
-#include "../../kernel/action.h"
+#include "kernel/focus.h"
+#include "kernel/dispatch.h"
+#include "kernel/openbox.h"
+#include "kernel/event.h"
+#include "kernel/grab.h"
+#include "kernel/action.h"
+#include "kernel/parse.h"
 #include "tree.h"
 #include "keyboard.h"
-#include "keysrc.h"
+#include "keyparse.h"
+#include "translate.h"
 #include <glib.h>
 
 void plugin_setup_config()
 {
+    parse_reg_section("keyboard", keyparse, NULL);
 }
 
-KeyBindingTree *firstnode;
+KeyBindingTree *firstnode = NULL;
 
 static KeyBindingTree *curpos;
 static guint reset_key, reset_state;
@@ -38,7 +42,8 @@ static void reset_chains()
     if (grabbed) {
        grabbed = FALSE;
         grab_keyboard(FALSE);
-    }
+    } else
+        XAllowEvents(ob_display, AsyncKeyboard, event_lasttime);
 }
 
 gboolean kbind(GList *keylist, Action *action)
@@ -53,12 +58,12 @@ gboolean kbind(GList *keylist, Action *action)
         return FALSE;
     if ((t = tree_find(tree, &conflict)) != NULL) {
        /* already bound to something */
-       g_warning("keychain is already bound");
+       g_message("keychain is already bound");
         tree_destroy(tree);
         return FALSE;
     }
     if (conflict) {
-        g_warning("conflict with binding");
+        g_message("conflict with binding");
         tree_destroy(tree);
         return FALSE;
     }
@@ -100,6 +105,8 @@ static void press(ObEvent *e, void *foo)
                     if (!grabbed) {
                         grab_keyboard(TRUE);
                         grabbed = TRUE;
+                        XAllowEvents(ob_display, AsyncKeyboard,
+                                     event_lasttime);
                     }
                     curpos = p;
                 } else {
@@ -119,16 +126,16 @@ static void press(ObEvent *e, void *foo)
             p = p->next_sibling;
         }
     }
-    XAllowEvents(ob_display, AsyncKeyboard, e->data.x.e->xkey.time);
 }
 
 void plugin_startup()
 {
+    curpos = NULL;
+    grabbed = FALSE;
+
     dispatch_register(Event_X_KeyPress, (EventHandler)press, NULL);
 
     translate_key("C-g", &reset_state, &reset_key);
-
-    keysrc_parse();
 }
 
 void plugin_shutdown()
This page took 0.02356 seconds and 4 git commands to generate.