]> Pileus Git - wmpus/commitdiff
Arrange windows at startup for sys-win32
authorAndy Spencer <andy753421@gmail.com>
Thu, 6 Oct 2011 07:17:25 +0000 (07:17 +0000)
committerAndy Spencer <andy753421@gmail.com>
Thu, 6 Oct 2011 07:26:00 +0000 (07:26 +0000)
makefile
sys-win32.c

index c020215e22fd6107d224707da1457c1971ec779f..74e1278fcd3c92481788667fb614f1d5c105efd3 100644 (file)
--- 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
 
index 5e9bae7b9eb631136ccf1b618d8d6ece56c71c69..1562a5e044f1946a62b5c6f4b368e7991201d99f 100644 (file)
 #include <winuser.h>
 
 #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);