Module: wine Branch: master Commit: f48eb1581dfe176043cbca5c46400c0f86eb5552 URL: http://source.winehq.org/git/wine.git/?a=commit;h=f48eb1581dfe176043cbca5c46...
Author: Alexandre Julliard julliard@winehq.org Date: Mon Aug 20 22:06:50 2007 +0200
winex11: Force a window to managed mode when it is activated.
---
dlls/user32/tests/msg.c | 4 ++-- dlls/winex11.drv/window.c | 9 +++++---- dlls/winex11.drv/winpos.c | 8 +++++--- 3 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index a603252..af05f7b 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -3724,7 +3724,7 @@ static void test_showwindow(void) 100, 100, 200, 200, 0, 0, 0, NULL); ok (hwnd != 0, "Failed to create popup window\n"); ok(!IsZoomed(hwnd), "window should NOT be maximized\n"); - ok_sequence(WmCreatePopupSeq, "CreateWindow(WS_VISIBLE):popup", TRUE); + ok_sequence(WmCreatePopupSeq, "CreateWindow(WS_VISIBLE):popup", FALSE); trace("done\n");
trace("calling ShowWindow( SW_SHOWMAXIMIZE ) for visible popup window\n"); @@ -4065,7 +4065,7 @@ static void test_messages(void) ok_sequence(WmShowVisiblePopupSeq_2, "SetWindowPos:show_visible_popup_2", FALSE); flush_sequence(); SetWindowPos(hchild, 0,0,0,0,0, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE); - ok_sequence(WmShowVisiblePopupSeq_3, "SetWindowPos:show_visible_popup_3", FALSE); + ok_sequence(WmShowVisiblePopupSeq_3, "SetWindowPos:show_visible_popup_3", TRUE); DestroyWindow(hchild);
/* this time add WS_VISIBLE for CreateWindowEx, but this fact actually diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index ecc4c09..030989b 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -974,7 +974,7 @@ static void get_desktop_xwin( Display *display, struct x11drv_win_data *data ) SetPropA( data->hwnd, visual_id_prop, (HANDLE)visualid ); data->whole_window = root_window; X11DRV_SetWindowPos( data->hwnd, 0, &virtual_screen_rect, &virtual_screen_rect, - SWP_NOZORDER, NULL ); + SWP_NOZORDER | SWP_NOACTIVATE, NULL ); if (root_window != DefaultRootWindow( display )) { data->managed = TRUE; @@ -1039,7 +1039,7 @@ BOOL X11DRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode )
/* initialize the dimensions before sending WM_GETMINMAXINFO */ SetRect( &rect, cs->x, cs->y, cs->x + cs->cx, cs->y + cs->cy ); - X11DRV_SetWindowPos( hwnd, 0, &rect, &rect, SWP_NOZORDER, NULL ); + X11DRV_SetWindowPos( hwnd, 0, &rect, &rect, SWP_NOZORDER | SWP_NOACTIVATE, NULL );
/* create an X window if it's a top level window */ if (GetAncestor( hwnd, GA_PARENT ) == GetDesktopWindow()) @@ -1083,7 +1083,8 @@ BOOL X11DRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode ) if (cs->cy < 0) cs->cy = 0;
SetRect( &rect, cs->x, cs->y, cs->x + cs->cx, cs->y + cs->cy ); - if (!X11DRV_SetWindowPos( hwnd, 0, &rect, &rect, SWP_NOZORDER, NULL )) return FALSE; + if (!X11DRV_SetWindowPos( hwnd, 0, &rect, &rect, SWP_NOZORDER | SWP_NOACTIVATE, NULL )) + return FALSE; }
/* send WM_NCCREATE */ @@ -1111,7 +1112,7 @@ BOOL X11DRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode ) /* yes, even if the CBT hook was called with HWND_TOP */ insert_after = (wndPtr->dwStyle & WS_CHILD) ? HWND_BOTTOM : HWND_TOP;
- X11DRV_SetWindowPos( hwnd, insert_after, &wndPtr->rectWindow, &rect, 0, NULL ); + X11DRV_SetWindowPos( hwnd, insert_after, &wndPtr->rectWindow, &rect, SWP_NOACTIVATE, NULL );
TRACE( "win %p window %d,%d,%d,%d client %d,%d,%d,%d whole %d,%d,%d,%d X client %d,%d,%d,%d xwin %x\n", hwnd, wndPtr->rectWindow.left, wndPtr->rectWindow.top, diff --git a/dlls/winex11.drv/winpos.c b/dlls/winex11.drv/winpos.c index 25dabbb..eb615c6 100644 --- a/dlls/winex11.drv/winpos.c +++ b/dlls/winex11.drv/winpos.c @@ -252,7 +252,9 @@ BOOL X11DRV_SetWindowPos( HWND hwnd, HWND insert_after, const RECT *rectWindow, root_window == DefaultRootWindow( display ) && data->whole_window != root_window) { - if (is_window_managed( hwnd, rectWindow )) + if (!(swp_flags & (SWP_NOACTIVATE|SWP_HIDEWINDOW)) || + is_window_managed( hwnd, rectWindow ) || + hwnd == GetActiveWindow()) { TRACE( "making win %p/%lx managed\n", hwnd, data->whole_window ); make_managed = TRUE; @@ -787,7 +789,7 @@ void X11DRV_MapNotify( HWND hwnd, XEvent *event ) SendMessageW( hwnd, WM_SHOWWINDOW, SW_RESTORE, 0 ); data->lock_changes++; SetWindowPos( hwnd, 0, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, - SWP_NOZORDER | SWP_FRAMECHANGED | SWP_STATECHANGED ); + SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_STATECHANGED ); data->lock_changes--; } else WIN_ReleasePtr( win ); @@ -888,7 +890,7 @@ void X11DRV_handle_desktop_resize( unsigned int width, unsigned int height ) TRACE("desktop %p change to (%dx%d)\n", hwnd, width, height); data->lock_changes++; X11DRV_SetWindowPos( hwnd, 0, &virtual_screen_rect, &virtual_screen_rect, - SWP_NOZORDER|SWP_NOMOVE, NULL ); + SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE, NULL ); data->lock_changes--; ClipCursor(NULL); SendMessageTimeoutW( HWND_BROADCAST, WM_DISPLAYCHANGE, screen_depth,