]> Pileus Git - wmpus/commitdiff
Reset focus after focus change event
authorAndy Spencer <andy753421@gmail.com>
Sun, 18 Sep 2011 08:20:15 +0000 (08:20 +0000)
committerAndy Spencer <andy753421@gmail.com>
Sun, 18 Sep 2011 08:20:15 +0000 (08:20 +0000)
.vimrc [new file with mode: 0644]
sys-x11.c
wm-wmii.c

diff --git a/.vimrc b/.vimrc
new file mode 100644 (file)
index 0000000..b24f8ee
--- /dev/null
+++ b/.vimrc
@@ -0,0 +1 @@
+set makeprg=make\ debug
index db711c94a3561e8d7bb6f9669b697939b5bf3fda..e60b97c7e94f4f47e1ef2a5e8f9751d74b9075ce 100644 (file)
--- a/sys-x11.c
+++ b/sys-x11.c
@@ -230,10 +230,10 @@ static void process_event(int type, XEvent *ev, win_t *root)
                        wm_handle_key(win, key, MOD(), PTR());
        }
        else if (type == ConfigureNotify) {
                        wm_handle_key(win, key, MOD(), PTR());
        }
        else if (type == ConfigureNotify) {
-               //printf("configure: %d\n", type);
+               printf("configure: %d\n", type);
        }
        else if (type == MapNotify) {
        }
        else if (type == MapNotify) {
-               //printf("map: %d\n", type);
+               printf("map: %d\n", type);
        }
        else if (type == UnmapNotify) {
                //printf("unmap: %d\n", type);
        }
        else if (type == UnmapNotify) {
                //printf("unmap: %d\n", type);
index c9ea15bb96c7a9d62bba0312610b0703463329b0..30ded07dc05dc186a1cae810cbc1ba9f91a7ef57 100644 (file)
--- a/wm-wmii.c
+++ b/wm-wmii.c
@@ -5,7 +5,7 @@
 #include "sys.h"
 #include "wm.h"
 
 #include "sys.h"
 #include "wm.h"
 
-#define MODKEY ctrl
+#define MODKEY alt
 #define MARGIN 10
 
 /* Loca types */
 #define MARGIN 10
 
 /* Loca types */
@@ -264,6 +264,12 @@ int wm_handle_key(win_t *win, Key_t key, mod_t mod, ptr_t ptr)
        if (key == key_enter)
                set_focus(win);
 
        if (key == key_enter)
                set_focus(win);
 
+       /* Reset focus after after focus change,
+        * not sure what is causing the focus change in the first place
+        * but preventing that would be a better solution */
+       if (key == key_focus)
+               set_focus(wm_focus);
+
        return 0;
 }
 
        return 0;
 }
 
@@ -316,6 +322,7 @@ void wm_insert(win_t *win)
        /* Initialize window */
        win->wm = new0(win_wm_t);
        sys_watch(win, key_enter, MOD());
        /* Initialize window */
        win->wm = new0(win_wm_t);
        sys_watch(win, key_enter, MOD());
+       sys_watch(win, key_focus, MOD());
 
        /* Add to screen */
        list_t *lcol = wm_focus && wm_focus->wm ?
 
        /* Add to screen */
        list_t *lcol = wm_focus && wm_focus->wm ?
@@ -324,6 +331,7 @@ void wm_insert(win_t *win)
 
        /* Arrange */
        arrange(wm_cols);
 
        /* Arrange */
        arrange(wm_cols);
+       sys_focus(wm_focus);
        print_txt(wm_cols);
 }
 
        print_txt(wm_cols);
 }
 
@@ -350,6 +358,7 @@ void wm_init(win_t *root)
        sys_watch(root, key_mouse1, MOD(.MODKEY=1));
        sys_watch(root, key_mouse3, MOD(.MODKEY=1));
        sys_watch(root, key_enter,  MOD());
        sys_watch(root, key_mouse1, MOD(.MODKEY=1));
        sys_watch(root, key_mouse3, MOD(.MODKEY=1));
        sys_watch(root, key_enter,  MOD());
+       sys_watch(root, key_focus,  MOD());
        Key_t keys[] = {'h', 'j', 'k', 'l'};
        for (int i = 0; i < countof(keys); i++) {
                sys_watch(root, keys[i], MOD(.MODKEY=1));
        Key_t keys[] = {'h', 'j', 'k', 'l'};
        for (int i = 0; i < countof(keys); i++) {
                sys_watch(root, keys[i], MOD(.MODKEY=1));