]> Pileus Git - wmpus/commitdiff
Misc debugging
authorAndy Spencer <andy753421@gmail.com>
Thu, 6 Oct 2011 07:45:45 +0000 (07:45 +0000)
committerAndy Spencer <andy753421@gmail.com>
Thu, 6 Oct 2011 07:45:45 +0000 (07:45 +0000)
- Support HOMEPATH for config file for win32
- Fix sys_exit on win32 (remove running flag and use WM_QUIT)
- Don't auto-focus windows that are shaded

conf.c
sys-win32.c
wm-wmii.c

diff --git a/conf.c b/conf.c
index 6a13c4489a83dd561e7b65a980c97f65e8e0621a..ff4531fda49669f3fe9bd10b23f6ea7054aad5b6 100644 (file)
--- a/conf.c
+++ b/conf.c
@@ -256,8 +256,9 @@ void conf_init(int argc, char **argv)
 {
        conf_argc = argc;
        conf_argv = argv;
 {
        conf_argc = argc;
        conf_argv = argv;
-       snprintf(conf_path, sizeof(conf_path),
-               "%s/%s", getenv("HOME"), ".wmpus");
+       snprintf(conf_path, sizeof(conf_path), "%s/%s",
+                       getenv("HOME") ?: getenv("HOMEPATH") ?: ".",
+                       ".wmpus");
        conf_reload();
 }
 
        conf_reload();
 }
 
index 1562a5e044f1946a62b5c6f4b368e7991201d99f..afacdd2ba99ec8d3b3ab83b923d1462a5e5d44fc 100644 (file)
@@ -44,7 +44,6 @@ typedef struct {
 } keymap_t;
 
 /* Global data */
 } keymap_t;
 
 /* Global data */
-static int     running;
 static int     shellhookid;
 static void   *cache;
 static win_t  *root;
 static int     shellhookid;
 static void   *cache;
 static win_t  *root;
@@ -435,13 +434,11 @@ win_t *sys_init(void)
 
 void sys_run(win_t *root)
 {
 
 void sys_run(win_t *root)
 {
-       MSG msg;
-
+       MSG msg = {};
        if (!NO_CAPTURE)
                EnumWindows(LoopProc, 0);
        if (!NO_CAPTURE)
                EnumWindows(LoopProc, 0);
-
-       running = 1;
-       while (running && GetMessage(&msg, NULL, 0, 0) > 0) {
+       while (GetMessage(&msg, NULL, 0, 0) > 0 &&
+              msg.message != WM_QUIT) {
                TranslateMessage(&msg);
                DispatchMessage(&msg);
        }
                TranslateMessage(&msg);
                DispatchMessage(&msg);
        }
@@ -449,7 +446,7 @@ void sys_run(win_t *root)
 
 void sys_exit(void)
 {
 
 void sys_exit(void)
 {
-       running = 0;
+       PostQuitMessage(0);
 }
 
 void sys_free(win_t *root)
 }
 
 void sys_free(win_t *root)
index 6618adb38b62695f9c969004491af74c51d53ce8..ad114ebe49ccd5f218dcee3d30e9c2ff6d519cfd 100644 (file)
--- a/wm-wmii.c
+++ b/wm-wmii.c
@@ -718,7 +718,7 @@ int wm_handle_key(win_t *win, Key_t key, mod_t mod, ptr_t ptr)
                if (move_mode != none && mod.up)
                        return set_move(win,ptr,none),   1;
                if (key == key_mouse1 && !mod.up && win->h == STACK)
                if (move_mode != none && mod.up)
                        return set_move(win,ptr,none),   1;
                if (key == key_mouse1 && !mod.up && win->h == STACK)
-                       return wm_update(),              0;
+                       return set_focus(win), wm_update(), 0;
                return 0;
        }
 
                return 0;
        }
 
@@ -789,7 +789,7 @@ int wm_handle_key(win_t *win, Key_t key, mod_t mod, ptr_t ptr)
        }
 
        /* Focus change */
        }
 
        /* Focus change */
-       if (key == key_enter)
+       if (key == key_enter && win->h != STACK)
                return set_focus(win), 1;
 
        if (key_mouse0 <= key && key <= key_mouse7)
                return set_focus(win), 1;
 
        if (key_mouse0 <= key && key <= key_mouse7)