{
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();
}
} keymap_t;
/* Global data */
-static int running;
static int shellhookid;
static void *cache;
static win_t *root;
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);
}
void sys_exit(void)
{
- running = 0;
+ PostQuitMessage(0);
}
void sys_free(win_t *root)
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;
}
}
/* 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)