From c5d281c2e042c1153109dd46b74ef3d41fcacd93 Mon Sep 17 00:00:00 2001 From: Andy Spencer Date: Thu, 6 Oct 2011 07:45:45 +0000 Subject: [PATCH] Misc debugging - 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 | 5 +++-- sys-win32.c | 11 ++++------- wm-wmii.c | 4 ++-- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/conf.c b/conf.c index 6a13c44..ff4531f 100644 --- a/conf.c +++ b/conf.c @@ -256,8 +256,9 @@ void conf_init(int argc, char **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(); } diff --git a/sys-win32.c b/sys-win32.c index 1562a5e..afacdd2 100644 --- a/sys-win32.c +++ b/sys-win32.c @@ -44,7 +44,6 @@ typedef struct { } keymap_t; /* Global data */ -static int running; 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) { - MSG msg; - + MSG msg = {}; 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); } @@ -449,7 +446,7 @@ void sys_run(win_t *root) void sys_exit(void) { - running = 0; + PostQuitMessage(0); } void sys_free(win_t *root) diff --git a/wm-wmii.c b/wm-wmii.c index 6618adb..ad114eb 100644 --- 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) - return wm_update(), 0; + return set_focus(win), wm_update(), 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 */ - if (key == key_enter) + if (key == key_enter && win->h != STACK) return set_focus(win), 1; if (key_mouse0 <= key && key <= key_mouse7) -- 2.41.0