winex11: Switch windows to managed mode in SetWindowPos instead of at creation time.
This commit is contained in:
parent
f09bcc3eef
commit
ac98e0c075
|
@ -66,11 +66,10 @@ static const char visual_id_prop[] = "__wine_x11_visual_id";
|
|||
*
|
||||
* Check if a given window should be managed
|
||||
*/
|
||||
static inline BOOL is_window_managed( HWND hwnd )
|
||||
BOOL is_window_managed( HWND hwnd, const RECT *window_rect )
|
||||
{
|
||||
DWORD style, ex_style;
|
||||
|
||||
if (!managed_mode) return FALSE;
|
||||
/* tray window is always managed */
|
||||
ex_style = GetWindowLongW( hwnd, GWL_EXSTYLE );
|
||||
if (ex_style & WS_EX_TRAYWINDOW) return TRUE;
|
||||
|
@ -87,13 +86,11 @@ static inline BOOL is_window_managed( HWND hwnd )
|
|||
if (ex_style & WS_EX_APPWINDOW) return TRUE;
|
||||
if (style & WS_POPUP)
|
||||
{
|
||||
RECT rect;
|
||||
|
||||
/* popup with sysmenu == caption are managed */
|
||||
if (style & WS_SYSMENU) return TRUE;
|
||||
/* full-screen popup windows are managed */
|
||||
GetWindowRect( hwnd, &rect );
|
||||
if ((rect.right - rect.left) == screen_width && (rect.bottom - rect.top) == screen_height)
|
||||
if ((window_rect->right - window_rect->left) == screen_width &&
|
||||
(window_rect->bottom - window_rect->top) == screen_height)
|
||||
return TRUE;
|
||||
}
|
||||
/* default: not managed */
|
||||
|
@ -130,14 +127,6 @@ BOOL X11DRV_is_window_rect_mapped( const RECT *rect )
|
|||
static int get_window_attributes( Display *display, struct x11drv_win_data *data,
|
||||
XSetWindowAttributes *attr )
|
||||
{
|
||||
if (!data->managed &&
|
||||
root_window == DefaultRootWindow( display ) &&
|
||||
data->whole_window != root_window &&
|
||||
is_window_managed( data->hwnd ))
|
||||
{
|
||||
data->managed = TRUE;
|
||||
SetPropA( data->hwnd, managed_prop, (HANDLE)1 );
|
||||
}
|
||||
attr->override_redirect = !data->managed;
|
||||
attr->colormap = X11DRV_PALETTE_PaletteXColormap;
|
||||
attr->save_under = ((GetClassLongW( data->hwnd, GCL_STYLE ) & CS_SAVEBITS) != 0);
|
||||
|
@ -774,22 +763,18 @@ static Window create_whole_window( Display *display, struct x11drv_win_data *dat
|
|||
int cx, cy, mask;
|
||||
XSetWindowAttributes attr;
|
||||
XIM xim;
|
||||
RECT rect;
|
||||
|
||||
rect = data->window_rect;
|
||||
X11DRV_window_to_X_rect( data, &rect );
|
||||
|
||||
if (!(cx = rect.right - rect.left)) cx = 1;
|
||||
if (!(cy = rect.bottom - rect.top)) cy = 1;
|
||||
if (!(cx = data->window_rect.right - data->window_rect.left)) cx = 1;
|
||||
if (!(cy = data->window_rect.bottom - data->window_rect.top)) cy = 1;
|
||||
|
||||
mask = get_window_attributes( display, data, &attr );
|
||||
|
||||
wine_tsx11_lock();
|
||||
|
||||
data->whole_rect = rect;
|
||||
data->whole_rect = data->window_rect;
|
||||
data->whole_window = XCreateWindow( display, root_window,
|
||||
rect.left - virtual_screen_rect.left,
|
||||
rect.top - virtual_screen_rect.top,
|
||||
data->window_rect.left - virtual_screen_rect.left,
|
||||
data->window_rect.top - virtual_screen_rect.top,
|
||||
cx, cy, 0, screen_depth, InputOutput,
|
||||
visual, mask, &attr );
|
||||
|
||||
|
|
|
@ -79,6 +79,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(x11drv);
|
|||
#define _NET_WM_STATE_ADD 1
|
||||
#define _NET_WM_STATE_TOGGLE 2
|
||||
|
||||
static const char managed_prop[] = "__wine_x11_managed";
|
||||
|
||||
/***********************************************************************
|
||||
* X11DRV_Expose
|
||||
*/
|
||||
|
@ -236,14 +238,29 @@ static BOOL fullscreen_state_changed( const struct x11drv_win_data *data,
|
|||
BOOL X11DRV_SetWindowPos( HWND hwnd, HWND insert_after, const RECT *rectWindow,
|
||||
const RECT *rectClient, UINT swp_flags, const RECT *valid_rects )
|
||||
{
|
||||
Display *display = thread_display();
|
||||
struct x11drv_win_data *data;
|
||||
RECT new_whole_rect, old_client_rect, old_screen_rect;
|
||||
WND *win;
|
||||
DWORD old_style, new_style;
|
||||
BOOL ret;
|
||||
BOOL ret, make_managed = FALSE;
|
||||
|
||||
if (!(data = X11DRV_get_win_data( hwnd ))) return FALSE;
|
||||
|
||||
/* check if we need to switch the window to managed */
|
||||
if (!data->managed && data->whole_window && managed_mode &&
|
||||
root_window == DefaultRootWindow( display ) &&
|
||||
data->whole_window != root_window)
|
||||
{
|
||||
if (is_window_managed( hwnd, rectWindow ))
|
||||
{
|
||||
TRACE( "making win %p/%lx managed\n", hwnd, data->whole_window );
|
||||
make_managed = TRUE;
|
||||
data->managed = TRUE;
|
||||
SetPropA( hwnd, managed_prop, (HANDLE)1 );
|
||||
}
|
||||
}
|
||||
|
||||
new_whole_rect = *rectWindow;
|
||||
X11DRV_window_to_X_rect( data, &new_whole_rect );
|
||||
|
||||
|
@ -294,8 +311,6 @@ BOOL X11DRV_SetWindowPos( HWND hwnd, HWND insert_after, const RECT *rectWindow,
|
|||
|
||||
if (ret)
|
||||
{
|
||||
Display *display = thread_display();
|
||||
|
||||
/* invalidate DCEs */
|
||||
|
||||
if ((((swp_flags & SWP_AGG_NOPOSCHANGE) != SWP_AGG_NOPOSCHANGE) && (new_style & WS_VISIBLE)) ||
|
||||
|
@ -315,6 +330,14 @@ BOOL X11DRV_SetWindowPos( HWND hwnd, HWND insert_after, const RECT *rectWindow,
|
|||
TRACE( "win %p window %s client %s style %08x\n",
|
||||
hwnd, wine_dbgstr_rect(rectWindow), wine_dbgstr_rect(rectClient), new_style );
|
||||
|
||||
if (make_managed && (old_style & WS_VISIBLE))
|
||||
{
|
||||
wine_tsx11_lock();
|
||||
XUnmapWindow( display, data->whole_window );
|
||||
wine_tsx11_unlock();
|
||||
old_style &= ~WS_VISIBLE; /* force it to be mapped again below */
|
||||
}
|
||||
|
||||
if (!IsRectEmpty( &valid_rects[0] ))
|
||||
{
|
||||
int x_offset = 0, y_offset = 0;
|
||||
|
|
|
@ -684,6 +684,7 @@ typedef int (*x11drv_error_callback)( Display *display, XErrorEvent *event, void
|
|||
|
||||
extern void X11DRV_expect_error( Display *display, x11drv_error_callback callback, void *arg );
|
||||
extern int X11DRV_check_error(void);
|
||||
extern BOOL is_window_managed( HWND hwnd, const RECT *window_rect );
|
||||
extern void X11DRV_set_iconic_state( HWND hwnd );
|
||||
extern void X11DRV_window_to_X_rect( struct x11drv_win_data *data, RECT *rect );
|
||||
extern void X11DRV_X_to_window_rect( struct x11drv_win_data *data, RECT *rect );
|
||||
|
|
Loading…
Reference in New Issue