]> Pileus Git - wmpus/commitdiff
Win32 updates
authorAndy Spencer <andy753421@gmail.com>
Mon, 3 Oct 2011 08:55:21 +0000 (08:55 +0000)
committerAndy Spencer <andy753421@gmail.com>
Wed, 26 Oct 2011 05:19:31 +0000 (05:19 +0000)
- Force sys_raise
- Reset stacking order for sys_focus

sys-win32.c
wm-wmii.c

index 0e52935832df55bde60cefb551af5fa93210e4c7..463b6ffb315e425d80edab9c8ce41f58c4df9a7a 100644 (file)
@@ -325,12 +325,15 @@ void sys_move(win_t *win, int x, int y, int w, int h)
 void sys_raise(win_t *win)
 {
        printf("sys_raise: %p\n", win);
-       SetForegroundWindow(win->sys->hwnd);
 
-       //HWND hwnd = win->sys->hwnd;
-       //HWND top  = GetAncestor(hwnd,GA_ROOT);
-       //SetWindowPos(top, HWND_TOPMOST, 0, 0, 0, 0,
-       //              SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
+       /* See note in sys_focus */
+       DWORD oldId = GetWindowThreadProcessId(GetForegroundWindow(), NULL);
+       DWORD newId = GetCurrentThreadId();
+       AttachThreadInput(oldId, newId, TRUE);
+
+       SetWindowPos(win->sys->hwnd, NULL, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
+
+       AttachThreadInput(oldId, newId, FALSE);
 }
 
 void sys_focus(win_t *win)
@@ -344,9 +347,10 @@ void sys_focus(win_t *win)
        DWORD newId = GetCurrentThreadId();
        AttachThreadInput(oldId, newId, TRUE);
 
-       BringWindowToTop(win->sys->hwnd);
-       SetForegroundWindow(win->sys->hwnd);
-       SetFocus(win->sys->hwnd);
+       HWND next = GetWindow(win->sys->hwnd, GW_HWNDNEXT);
+       SetWindowPos(win->sys->hwnd, NULL, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
+       if (next)
+               SetWindowPos(win->sys->hwnd, next, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
 
        AttachThreadInput(oldId, newId, FALSE);
 }
index ad114ebe49ccd5f218dcee3d30e9c2ff6d519cfd..df88527fccb137dc057f4a4b991d3078f445088e 100644 (file)
--- a/wm-wmii.c
+++ b/wm-wmii.c
@@ -657,10 +657,10 @@ static void wm_update_cols(dpy_t *dpy)
                        case tab:
                                sys_move(win, x+MARGIN, 0+MARGIN,
                                        col->width, dpy->geom->h-2*MARGIN);
-                               if (focus == win)
-                                       sys_raise(win);
                                break;
                        }
+                       if (focus == win)
+                               sys_raise(win);
                        ROW(lrow)->height = win->h;
                }
                x += col->width + MARGIN;