]> Dogcows Code - chaz/openbox/blobdiff - openbox/keyboard.c
Move the main loop out into the libobt
[chaz/openbox] / openbox / keyboard.c
index ac92f5f93ddc9290fc1a86ed92b76e224f54213a..077262a6e787243075eebce04327e8cf4e1f835a 100644 (file)
@@ -17,7 +17,6 @@
    See the COPYING file for a copy of the GNU General Public License.
 */
 
-#include "mainloop.h"
 #include "focus.h"
 #include "screen.h"
 #include "frame.h"
@@ -51,8 +50,9 @@ static void grab_keys(gboolean grab)
     if (grab) {
         p = curpos ? curpos->first_child : keyboard_firstnode;
         while (p) {
-            grab_key(p->key, p->state, RootWindow(ob_display, ob_screen),
-                     GrabModeAsync);
+            if (p->key)
+                grab_key(p->key, p->state, RootWindow(ob_display, ob_screen),
+                         GrabModeAsync);
             p = p->next_sibling;
         }
         if (curpos)
@@ -115,7 +115,7 @@ void keyboard_reset_chains(gint break_chroots)
     set_curpos(p);
 }
 
-void keyboard_unbind_all()
+void keyboard_unbind_all(void)
 {
     tree_destroy(keyboard_firstnode);
     keyboard_firstnode = NULL;
@@ -220,7 +220,7 @@ void keyboard_event(ObClient *client, const XEvent *e)
     if (e->xkey.keycode == config_keyboard_reset_keycode &&
         e->xkey.state == config_keyboard_reset_state)
     {
-        ob_main_loop_timeout_remove(ob_main_loop, chain_timeout);
+        obt_main_loop_timeout_remove(ob_main_loop, chain_timeout);
         keyboard_reset_chains(-1);
         return;
     }
@@ -238,11 +238,11 @@ void keyboard_event(ObClient *client, const XEvent *e)
                 menu_frame_hide_all();
 
             if (p->first_child != NULL) { /* part of a chain */
-                ob_main_loop_timeout_remove(ob_main_loop, chain_timeout);
+                obt_main_loop_timeout_remove(ob_main_loop, chain_timeout);
                 /* 3 second timeout for chains */
-                ob_main_loop_timeout_add(ob_main_loop, 3 * G_USEC_PER_SEC,
-                                         chain_timeout, NULL,
-                                         g_direct_equal, NULL);
+                obt_main_loop_timeout_add(ob_main_loop, 3 * G_USEC_PER_SEC,
+                                          chain_timeout, NULL,
+                                          g_direct_equal, NULL);
                 set_curpos(p);
             } else if (p->chroot)         /* an empty chroot */
                 set_curpos(p);
@@ -255,9 +255,8 @@ void keyboard_event(ObClient *client, const XEvent *e)
                     keyboard_reset_chains(0);
 
                 actions_run_acts(p->actions, OB_USER_ACTION_KEYBOARD_KEY,
-                                 e->xkey.time, e->xkey.state,
-                                 e->xkey.x_root, e->xkey.y_root,
-                                 OB_FRAME_CONTEXT_NONE, client);
+                                 e->xkey.state, e->xkey.x_root, e->xkey.y_root,
+                                 0, OB_FRAME_CONTEXT_NONE, client);
             }
             break;
         }
@@ -265,16 +264,22 @@ void keyboard_event(ObClient *client, const XEvent *e)
     }
 }
 
+void keyboard_rebind(void)
+{
+    tree_rebind(keyboard_firstnode);
+    grab_keys(TRUE);
+}
+
 void keyboard_startup(gboolean reconfig)
 {
     grab_keys(TRUE);
-    popup = popup_new(FALSE);
+    popup = popup_new();
     popup_set_text_align(popup, RR_JUSTIFY_CENTER);
 }
 
 void keyboard_shutdown(gboolean reconfig)
 {
-    ob_main_loop_timeout_remove(ob_main_loop, chain_timeout);
+    obt_main_loop_timeout_remove(ob_main_loop, chain_timeout);
 
     keyboard_unbind_all();
     set_curpos(NULL);
This page took 0.024491 seconds and 4 git commands to generate.