From d2452823db68a072489270a020a786b64c56fdb1 Mon Sep 17 00:00:00 2001 From: Andy Spencer Date: Thu, 6 Oct 2011 07:17:25 +0000 Subject: [PATCH] Arrange windows at startup for sys-win32 --- makefile | 2 +- sys-win32.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/makefile b/makefile index c020215..74e1278 100644 --- a/makefile +++ b/makefile @@ -10,7 +10,7 @@ endif ifeq ($(SYS),win32) CC = i686-pc-mingw32-gcc -CFLAGS += -D_MODE_T_ -DMARGIN=15 +CFLAGS += -D_MODE_T_ PROG = wmpus.exe endif diff --git a/sys-win32.c b/sys-win32.c index 5e9bae7..1562a5e 100644 --- a/sys-win32.c +++ b/sys-win32.c @@ -25,9 +25,13 @@ #include #include "util.h" +#include "conf.h" #include "sys.h" #include "wm.h" +/* Configuration */ +static int NO_CAPTURE = 0; + /* Internal structures */ struct win_sys { HWND hwnd; @@ -294,6 +298,14 @@ BOOL CALLBACK MonProc(HMONITOR mon, HDC dc, LPRECT rect, LPARAM _screens) return TRUE; } +BOOL CALLBACK LoopProc(HWND hwnd, LPARAM user) +{ + win_t *win; + if ((win = win_find(hwnd,1))) + wm_insert(win); + return TRUE; +} + /******************** * System functions * ********************/ @@ -375,6 +387,9 @@ win_t *sys_init(void) HINSTANCE hInst = GetModuleHandle(NULL); HWND hwnd = NULL; + /* Load configuration */ + NO_CAPTURE = conf_get_int("main.no-capture", NO_CAPTURE); + /* Setup window class */ WNDCLASSEX wc = { .cbSize = sizeof(WNDCLASSEX), @@ -421,6 +436,10 @@ win_t *sys_init(void) void sys_run(win_t *root) { MSG msg; + + if (!NO_CAPTURE) + EnumWindows(LoopProc, 0); + running = 1; while (running && GetMessage(&msg, NULL, 0, 0) > 0) { TranslateMessage(&msg); -- 2.43.2