From: Rémi Bernon rbernon@codeweavers.com
Using a new GetWindowStyleMasks driver entry to get the style masks to be used to mask out non-client decorations which are hidden by the host decorations. --- dlls/win32u/driver.c | 9 ++- dlls/win32u/window.c | 30 ++++++- dlls/wineandroid.drv/android.h | 2 +- dlls/wineandroid.drv/window.c | 2 +- dlls/winemac.drv/gdi.c | 1 + dlls/winemac.drv/macdrv.h | 3 +- dlls/winemac.drv/window.c | 125 +++++++++++------------------- dlls/winewayland.drv/waylanddrv.h | 2 +- dlls/winewayland.drv/window.c | 2 +- dlls/winex11.drv/init.c | 1 + dlls/winex11.drv/window.c | 107 ++++++++++--------------- dlls/winex11.drv/x11drv.h | 3 +- include/wine/gdi_driver.h | 5 +- 13 files changed, 135 insertions(+), 157 deletions(-)
diff --git a/dlls/win32u/driver.c b/dlls/win32u/driver.c index c56bf89d069..3e094264d15 100644 --- a/dlls/win32u/driver.c +++ b/dlls/win32u/driver.c @@ -881,11 +881,16 @@ static LRESULT nulldrv_WindowMessage( HWND hwnd, UINT msg, WPARAM wparam, LPARAM return 0; }
-static BOOL nulldrv_WindowPosChanging( HWND hwnd, UINT swp_flags, BOOL shaped, struct window_rects *rects ) +static BOOL nulldrv_WindowPosChanging( HWND hwnd, UINT swp_flags, BOOL shaped, const struct window_rects *rects ) { return TRUE; }
+extern BOOL nulldrv_GetWindowStyleMasks( HWND hwnd, UINT style, UINT ex_style, UINT *style_mask, UINT *ex_style_mask ) +{ + return FALSE; +} + static BOOL nulldrv_CreateWindowSurface( HWND hwnd, BOOL layered, const RECT *surface_rect, struct window_surface **surface ) { return FALSE; @@ -1294,6 +1299,7 @@ static const struct user_driver_funcs lazy_load_driver = loaderdrv_UpdateLayeredWindow, nulldrv_WindowMessage, nulldrv_WindowPosChanging, + nulldrv_GetWindowStyleMasks, nulldrv_CreateWindowSurface, nulldrv_MoveWindowBits, nulldrv_WindowPosChanged, @@ -1383,6 +1389,7 @@ void __wine_set_user_driver( const struct user_driver_funcs *funcs, UINT version SET_USER_FUNC(UpdateLayeredWindow); SET_USER_FUNC(WindowMessage); SET_USER_FUNC(WindowPosChanging); + SET_USER_FUNC(GetWindowStyleMasks); SET_USER_FUNC(CreateWindowSurface); SET_USER_FUNC(MoveWindowBits); SET_USER_FUNC(WindowPosChanged); diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 7ad3e1d50ff..d2b33089582 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -1818,6 +1818,29 @@ done: }
+static RECT get_visible_rect( HWND hwnd, BOOL shaped, UINT style, UINT ex_style, const struct window_rects *rects ) +{ + UINT dpi = get_dpi_for_window( hwnd ), style_mask, ex_style_mask; + RECT visible_rect, rect = {0}; + + if (IsRectEmpty( &rects->window ) || EqualRect( &rects->window, &rects->client ) || shaped) return rects->window; + if (!user_driver->pGetWindowStyleMasks( hwnd, style, ex_style, &style_mask, &ex_style_mask )) return rects->window; + if (!NtUserAdjustWindowRect( &rect, style & style_mask, FALSE, ex_style & ex_style_mask, dpi )) return rects->window; + + visible_rect = rects->window; + visible_rect.left -= rect.left; + visible_rect.right -= rect.right; + visible_rect.top -= rect.top; + visible_rect.bottom -= rect.bottom; + if (visible_rect.top >= visible_rect.bottom) visible_rect.bottom = visible_rect.top + 1; + if (visible_rect.left >= visible_rect.right) visible_rect.right = visible_rect.left + 1; + + TRACE( "hwnd %p, rects %s, style %#x, ex_style %#x -> visible_rect %s\n", hwnd, + debugstr_window_rects( rects ), style, ex_style, wine_dbgstr_rect( &visible_rect ) ); + return visible_rect; +} + + static BOOL get_surface_rect( const RECT *visible_rect, RECT *surface_rect ) { RECT virtual_rect = NtUserGetVirtualScreenRect(); @@ -1874,9 +1897,13 @@ static struct window_surface *create_window_surface( HWND hwnd, UINT swp_flags, BOOL shaped, needs_surface, create_opaque, is_layered; HWND parent = NtUserGetAncestor( hwnd, GA_PARENT ); struct window_surface *new_surface; + UINT style, ex_style; RECT dummy; HRGN shape;
+ style = NtUserGetWindowLongW( hwnd, GWL_STYLE ); + ex_style = NtUserGetWindowLongW( hwnd, GWL_EXSTYLE ); + if (get_window_region( hwnd, FALSE, &shape, &dummy )) shaped = FALSE; else if ((shaped = !!shape)) NtGdiDeleteObjectApp( shape );
@@ -1885,8 +1912,9 @@ static struct window_surface *create_window_surface( HWND hwnd, UINT swp_flags, else if (parent && parent != NtUserGetDesktopWindow()) needs_surface = FALSE; else if (swp_flags & SWP_HIDEWINDOW) needs_surface = FALSE; else if (swp_flags & SWP_SHOWWINDOW) needs_surface = TRUE; - else needs_surface = !!(NtUserGetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE); + else needs_surface = !!(style & WS_VISIBLE);
+ rects->visible = get_visible_rect( hwnd, shaped, style, ex_style, rects ); if (!get_surface_rect( &rects->visible, surface_rect )) needs_surface = FALSE; if (!get_default_window_surface( hwnd, surface_rect, &new_surface )) return NULL;
diff --git a/dlls/wineandroid.drv/android.h b/dlls/wineandroid.drv/android.h index f438deb714e..850b235f3a1 100644 --- a/dlls/wineandroid.drv/android.h +++ b/dlls/wineandroid.drv/android.h @@ -95,7 +95,7 @@ extern void ANDROID_SetParent( HWND hwnd, HWND parent, HWND old_parent ); extern void ANDROID_SetCapture( HWND hwnd, UINT flags ); extern UINT ANDROID_ShowWindow( HWND hwnd, INT cmd, RECT *rect, UINT swp ); extern LRESULT ANDROID_WindowMessage( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ); -extern BOOL ANDROID_WindowPosChanging( HWND hwnd, UINT swp_flags, BOOL shaped, struct window_rects *rects ); +extern BOOL ANDROID_WindowPosChanging( HWND hwnd, UINT swp_flags, BOOL shaped, const struct window_rects *rects ); extern BOOL ANDROID_CreateWindowSurface( HWND hwnd, BOOL layered, const RECT *surface_rect, struct window_surface **surface ); extern void ANDROID_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, const struct window_rects *new_rects, struct window_surface *surface ); diff --git a/dlls/wineandroid.drv/window.c b/dlls/wineandroid.drv/window.c index 8018ee1a567..537aae456e7 100644 --- a/dlls/wineandroid.drv/window.c +++ b/dlls/wineandroid.drv/window.c @@ -1023,7 +1023,7 @@ static struct android_win_data *create_win_data( HWND hwnd, const struct window_ /*********************************************************************** * ANDROID_WindowPosChanging */ -BOOL ANDROID_WindowPosChanging( HWND hwnd, UINT swp_flags, BOOL shaped, struct window_rects *rects ) +BOOL ANDROID_WindowPosChanging( HWND hwnd, UINT swp_flags, BOOL shaped, const struct window_rects *rects ) { struct android_win_data *data = get_win_data( hwnd );
diff --git a/dlls/winemac.drv/gdi.c b/dlls/winemac.drv/gdi.c index 0505938a822..8492b0030c0 100644 --- a/dlls/winemac.drv/gdi.c +++ b/dlls/winemac.drv/gdi.c @@ -309,6 +309,7 @@ static const struct user_driver_funcs macdrv_funcs = .pMoveWindowBits = macdrv_MoveWindowBits, .pWindowPosChanged = macdrv_WindowPosChanged, .pWindowPosChanging = macdrv_WindowPosChanging, + .pGetWindowStyleMasks = macdrv_GetWindowStyleMasks, .pCreateWindowSurface = macdrv_CreateWindowSurface, .pVulkanInit = macdrv_VulkanInit, .pwine_get_wgl_driver = macdrv_wine_get_wgl_driver, diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index b417c0e2344..6e506514164 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -147,7 +147,8 @@ extern void macdrv_SetLayeredWindowAttributes(HWND hwnd, COLORREF key, BYTE alph extern LRESULT macdrv_SysCommand(HWND hwnd, WPARAM wparam, LPARAM lparam); extern void macdrv_UpdateLayeredWindow(HWND hwnd, UINT flags); extern LRESULT macdrv_WindowMessage(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp); -extern BOOL macdrv_WindowPosChanging(HWND hwnd, UINT swp_flags, BOOL shaped, struct window_rects *rects); +extern BOOL macdrv_WindowPosChanging(HWND hwnd, UINT swp_flags, BOOL shaped, const struct window_rects *rects); +extern BOOL macdrv_GetWindowStyleMasks(HWND hwnd, UINT style, UINT ex_style, UINT *style_mask, UINT *ex_style_mask); extern BOOL macdrv_CreateWindowSurface(HWND hwnd, BOOL layered, const RECT *surface_rect, struct window_surface **surface); extern void macdrv_MoveWindowBits(HWND hwnd, const struct window_rects *new_rects, const RECT *valid_rects); extern void macdrv_WindowPosChanged(HWND hwnd, HWND insert_after, UINT swp_flags, const struct window_rects *new_rects, diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c index b1fe58d4269..48b4fa64dee 100644 --- a/dlls/winemac.drv/window.c +++ b/dlls/winemac.drv/window.c @@ -74,24 +74,16 @@ static void set_internal_window_pos(HWND hwnd, UINT cmd, RECT *rect, POINT *pt) }
-/*********************************************************************** - * get_cocoa_window_features - */ -static struct macdrv_window_features get_cocoa_window_features(struct macdrv_win_data *data, DWORD style, DWORD ex_style, - const RECT *window_rect, const RECT *client_rect) +static struct macdrv_window_features get_window_features_for_style(DWORD style, DWORD ex_style, BOOL shaped) { struct macdrv_window_features wf = {0};
if (ex_style & WS_EX_NOACTIVATE) wf.prevents_app_activation = TRUE;
- if (disable_window_decorations) return wf; - if (IsRectEmpty(window_rect)) return wf; - if (EqualRect(window_rect, client_rect)) return wf; - if ((style & WS_CAPTION) == WS_CAPTION && !(ex_style & WS_EX_LAYERED)) { wf.shadow = TRUE; - if (!data->shaped) + if (!shaped) { wf.title_bar = TRUE; if (style & WS_SYSMENU) wf.close_button = TRUE; @@ -103,7 +95,7 @@ static struct macdrv_window_features get_cocoa_window_features(struct macdrv_win if (style & WS_THICKFRAME) { wf.shadow = TRUE; - if (!data->shaped) wf.resizable = TRUE; + if (!shaped) wf.resizable = TRUE; } else if (ex_style & WS_EX_DLGMODALFRAME) wf.shadow = TRUE; else if ((style & (WS_DLGFRAME|WS_BORDER)) == WS_DLGFRAME) wf.shadow = TRUE; @@ -111,6 +103,19 @@ static struct macdrv_window_features get_cocoa_window_features(struct macdrv_win return wf; }
+/*********************************************************************** + * get_cocoa_window_features + */ +static struct macdrv_window_features get_cocoa_window_features(struct macdrv_win_data *data, DWORD style, DWORD ex_style) +{ + struct macdrv_window_features wf = {0}; + + if (ex_style & WS_EX_NOACTIVATE) wf.prevents_app_activation = TRUE; + if (EqualRect(&data->rects.window, &data->rects.visible)) return wf; + + return get_window_features_for_style(style, ex_style, data->shaped); +} +
/******************************************************************* * can_window_become_foreground @@ -151,69 +156,6 @@ static void get_cocoa_window_state(struct macdrv_win_data *data, }
-/*********************************************************************** - * get_mac_rect_offset - * - * Helper for macdrv_window_to_mac_rect. - */ -static void get_mac_rect_offset(struct macdrv_win_data *data, unsigned int style, RECT *rect, - const RECT *window_rect, const RECT *client_rect) -{ - unsigned int ex_style, style_mask = 0, ex_style_mask = 0; - UINT dpi = get_win_monitor_dpi(data->hwnd); - - rect->top = rect->bottom = rect->left = rect->right = 0; - - ex_style = NtUserGetWindowLongW(data->hwnd, GWL_EXSTYLE); - - if (!data->shaped) - { - struct macdrv_window_features wf; - wf = get_cocoa_window_features(data, style, ex_style, window_rect, client_rect); - - if (wf.title_bar) - { - style_mask |= WS_CAPTION; - ex_style_mask |= WS_EX_TOOLWINDOW; - } - if (wf.shadow) - { - style_mask |= WS_DLGFRAME | WS_THICKFRAME; - ex_style_mask |= WS_EX_DLGMODALFRAME; - } - } - - NtUserAdjustWindowRect(rect, style & style_mask, FALSE, ex_style & ex_style_mask, dpi); - - TRACE("%p/%p style %08x ex_style %08x shaped %d -> %s\n", data->hwnd, data->cocoa_window, - style, ex_style, data->shaped, wine_dbgstr_rect(rect)); -} - - -/*********************************************************************** - * macdrv_window_to_mac_rect - * - * Convert a rect from client to Mac window coordinates - */ -static void macdrv_window_to_mac_rect(struct macdrv_win_data *data, DWORD style, RECT *rect, - const RECT *window_rect, const RECT *client_rect) -{ - RECT rc; - - if ((style & (WS_POPUP|WS_CHILD)) == WS_CHILD) return; - if (IsRectEmpty(rect)) return; - - get_mac_rect_offset(data, style, &rc, window_rect, client_rect); - - rect->left -= rc.left; - rect->right -= rc.right; - rect->top -= rc.top; - rect->bottom -= rc.bottom; - if (rect->top >= rect->bottom) rect->bottom = rect->top + 1; - if (rect->left >= rect->right) rect->right = rect->left + 1; -} - - /*********************************************************************** * constrain_window_frame * @@ -361,7 +303,7 @@ static void set_cocoa_window_properties(struct macdrv_win_data *data) owner_win = macdrv_get_cocoa_window(owner, TRUE); macdrv_set_cocoa_parent_window(data->cocoa_window, owner_win);
- wf = get_cocoa_window_features(data, style, ex_style, &data->rects.window, &data->rects.client); + wf = get_cocoa_window_features(data, style, ex_style); macdrv_set_cocoa_window_features(data->cocoa_window, &wf);
get_cocoa_window_state(data, style, ex_style, &state); @@ -600,7 +542,7 @@ static void create_cocoa_window(struct macdrv_win_data *data) style = NtUserGetWindowLongW(data->hwnd, GWL_STYLE); ex_style = NtUserGetWindowLongW(data->hwnd, GWL_EXSTYLE);
- wf = get_cocoa_window_features(data, style, ex_style, &data->rects.window, &data->rects.client); + wf = get_cocoa_window_features(data, style, ex_style);
frame = cgrect_from_rect(data->rects.visible); constrain_window_frame(&frame.origin, &frame.size); @@ -1803,10 +1745,9 @@ LRESULT macdrv_WindowMessage(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) /*********************************************************************** * WindowPosChanging (MACDRV.@) */ -BOOL macdrv_WindowPosChanging(HWND hwnd, UINT swp_flags, BOOL shaped, struct window_rects *rects) +BOOL macdrv_WindowPosChanging(HWND hwnd, UINT swp_flags, BOOL shaped, const struct window_rects *rects) { struct macdrv_win_data *data = get_win_data(hwnd); - DWORD style = NtUserGetWindowLongW(hwnd, GWL_STYLE); BOOL ret = FALSE;
TRACE("hwnd %p, swp_flags %04x, shaped %u, rects %s\n", hwnd, swp_flags, shaped, debugstr_window_rects(rects)); @@ -1814,9 +1755,6 @@ BOOL macdrv_WindowPosChanging(HWND hwnd, UINT swp_flags, BOOL shaped, struct win if (!data && !(data = macdrv_create_win_data(hwnd, rects))) return FALSE; /* use default surface */ data->shaped = shaped;
- macdrv_window_to_mac_rect(data, style, &rects->visible, &rects->window, &rects->client); - TRACE("-> %s\n", debugstr_window_rects(rects)); - ret = !!data->cocoa_window; /* use default surface if we don't have a window */ release_win_data(data);
@@ -1853,6 +1791,31 @@ void macdrv_MoveWindowBits(HWND hwnd, const struct window_rects *new_rects, cons } }
+/*********************************************************************** + * GetWindowStyleMasks (X11DRV.@) + */ +BOOL macdrv_GetWindowStyleMasks(HWND hwnd, UINT style, UINT ex_style, UINT *style_mask, UINT *ex_style_mask) +{ + struct macdrv_window_features wf = get_window_features_for_style(style, ex_style, FALSE); + + if (disable_window_decorations) return FALSE; + + *style_mask = ex_style = 0; + if (wf.title_bar) + { + *style_mask |= WS_CAPTION; + *ex_style_mask |= WS_EX_TOOLWINDOW; + } + if (wf.shadow) + { + *style_mask |= WS_DLGFRAME | WS_THICKFRAME; + *ex_style_mask |= WS_EX_DLGMODALFRAME; + } + + return TRUE; +} + + /*********************************************************************** * WindowPosChanged (MACDRV.@) */ diff --git a/dlls/winewayland.drv/waylanddrv.h b/dlls/winewayland.drv/waylanddrv.h index 4e3841d8cf9..40f86526cd2 100644 --- a/dlls/winewayland.drv/waylanddrv.h +++ b/dlls/winewayland.drv/waylanddrv.h @@ -355,7 +355,7 @@ UINT WAYLAND_UpdateDisplayDevices(const struct gdi_device_manager *device_manage LRESULT WAYLAND_WindowMessage(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp); void WAYLAND_WindowPosChanged(HWND hwnd, HWND insert_after, UINT swp_flags, const struct window_rects *new_rects, struct window_surface *surface); -BOOL WAYLAND_WindowPosChanging(HWND hwnd, UINT swp_flags, BOOL shaped, struct window_rects *rects); +BOOL WAYLAND_WindowPosChanging(HWND hwnd, UINT swp_flags, BOOL shaped, const struct window_rects *rects); BOOL WAYLAND_CreateWindowSurface(HWND hwnd, BOOL layered, const RECT *surface_rect, struct window_surface **surface); UINT WAYLAND_VulkanInit(UINT version, void *vulkan_handle, const struct vulkan_driver_funcs **driver_funcs); struct opengl_funcs *WAYLAND_wine_get_wgl_driver(UINT version); diff --git a/dlls/winewayland.drv/window.c b/dlls/winewayland.drv/window.c index 355894f6137..73a8de37f77 100644 --- a/dlls/winewayland.drv/window.c +++ b/dlls/winewayland.drv/window.c @@ -425,7 +425,7 @@ void WAYLAND_DestroyWindow(HWND hwnd) /*********************************************************************** * WAYLAND_WindowPosChanging */ -BOOL WAYLAND_WindowPosChanging(HWND hwnd, UINT swp_flags, BOOL shaped, struct window_rects *rects) +BOOL WAYLAND_WindowPosChanging(HWND hwnd, UINT swp_flags, BOOL shaped, const struct window_rects *rects) { struct wayland_win_data *data = wayland_win_data_get(hwnd);
diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c index 1fa07d38e13..fa477a4de6b 100644 --- a/dlls/winex11.drv/init.c +++ b/dlls/winex11.drv/init.c @@ -424,6 +424,7 @@ static const struct user_driver_funcs x11drv_funcs = .pUpdateLayeredWindow = X11DRV_UpdateLayeredWindow, .pWindowMessage = X11DRV_WindowMessage, .pWindowPosChanging = X11DRV_WindowPosChanging, + .pGetWindowStyleMasks = X11DRV_GetWindowStyleMasks, .pCreateWindowSurface = X11DRV_CreateWindowSurface, .pMoveWindowBits = X11DRV_MoveWindowBits, .pWindowPosChanged = X11DRV_WindowPosChanged, diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 24389323e97..6f183d1e853 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -303,19 +303,10 @@ static inline BOOL is_window_resizable( struct x11drv_win_data *data, DWORD styl /*********************************************************************** * get_mwm_decorations */ -static unsigned long get_mwm_decorations( struct x11drv_win_data *data, - DWORD style, DWORD ex_style, - const RECT *window_rect, - const RECT *client_rect ) +static unsigned long get_mwm_decorations_for_style( DWORD style, DWORD ex_style ) { unsigned long ret = 0;
- if (!decorated_mode) return 0; - - if (EqualRect( window_rect, client_rect )) return 0; - if (IsRectEmpty( window_rect )) return 0; - if (data->shaped) return 0; - if (ex_style & WS_EX_TOOLWINDOW) return 0; if (ex_style & WS_EX_LAYERED) return 0;
@@ -333,6 +324,16 @@ static unsigned long get_mwm_decorations( struct x11drv_win_data *data, }
+/*********************************************************************** + * get_mwm_decorations + */ +static unsigned long get_mwm_decorations( struct x11drv_win_data *data, DWORD style, DWORD ex_style ) +{ + if (EqualRect( &data->rects.window, &data->rects.visible )) return 0; + return get_mwm_decorations_for_style( style, ex_style ); +} + + /*********************************************************************** * get_window_attributes * @@ -776,7 +777,7 @@ static void set_mwm_hints( struct x11drv_win_data *data, UINT style, UINT ex_sty } else { - mwm_hints.decorations = get_mwm_decorations( data, style, ex_style, &data->rects.window, &data->rects.client ); + mwm_hints.decorations = get_mwm_decorations( data, style, ex_style ); mwm_hints.functions = MWM_FUNC_MOVE; if (is_window_resizable( data, style )) mwm_hints.functions |= MWM_FUNC_RESIZE; if (!(style & WS_DISABLED)) @@ -1308,57 +1309,6 @@ void make_window_embedded( struct x11drv_win_data *data ) }
-/*********************************************************************** - * get_decoration_rect - */ -static void get_decoration_rect( struct x11drv_win_data *data, RECT *rect, - const RECT *window_rect, const RECT *client_rect ) -{ - DWORD style, ex_style, style_mask = 0, ex_style_mask = 0; - unsigned long decor; - UINT dpi; - - SetRectEmpty( rect ); - if (!data->managed) return; - - dpi = get_win_monitor_dpi( data->hwnd ); - style = NtUserGetWindowLongW( data->hwnd, GWL_STYLE ); - ex_style = NtUserGetWindowLongW( data->hwnd, GWL_EXSTYLE ); - decor = get_mwm_decorations( data, style, ex_style, window_rect, client_rect ); - - if (decor & MWM_DECOR_TITLE) style_mask |= WS_CAPTION; - if (decor & MWM_DECOR_BORDER) - { - style_mask |= WS_DLGFRAME | WS_THICKFRAME; - ex_style_mask |= WS_EX_DLGMODALFRAME; - } - - NtUserAdjustWindowRect( rect, style & style_mask, FALSE, ex_style & ex_style_mask, dpi ); -} - - -/*********************************************************************** - * X11DRV_window_to_X_rect - * - * Convert a rect from client to X window coordinates - */ -static void X11DRV_window_to_X_rect( struct x11drv_win_data *data, RECT *rect, - const RECT *window_rect, const RECT *client_rect ) -{ - RECT rc; - - if (IsRectEmpty( rect )) return; - - get_decoration_rect( data, &rc, window_rect, client_rect ); - rect->left -= rc.left; - rect->right -= rc.right; - rect->top -= rc.top; - rect->bottom -= rc.bottom; - if (rect->top >= rect->bottom) rect->bottom = rect->top + 1; - if (rect->left >= rect->right) rect->right = rect->left + 1; -} - - /*********************************************************************** * sync_window_position * @@ -2543,7 +2493,7 @@ done: /*********************************************************************** * WindowPosChanging (X11DRV.@) */ -BOOL X11DRV_WindowPosChanging( HWND hwnd, UINT swp_flags, BOOL shaped, struct window_rects *rects ) +BOOL X11DRV_WindowPosChanging( HWND hwnd, UINT swp_flags, BOOL shaped, const struct window_rects *rects ) { struct x11drv_win_data *data = get_win_data( hwnd ); BOOL ret = FALSE; @@ -2563,9 +2513,6 @@ BOOL X11DRV_WindowPosChanging( HWND hwnd, UINT swp_flags, BOOL shaped, struct wi data->managed = TRUE; }
- X11DRV_window_to_X_rect( data, &rects->visible, &rects->window, &rects->client ); - TRACE( "-> %s\n", debugstr_window_rects(rects) ); - ret = !!data->whole_window; /* use default surface if we don't have a window */ release_win_data( data );
@@ -2602,6 +2549,34 @@ void X11DRV_MoveWindowBits( HWND hwnd, const struct window_rects *new_rects, con } }
+/*********************************************************************** + * GetWindowStyleMasks (X11DRV.@) + */ +BOOL X11DRV_GetWindowStyleMasks( HWND hwnd, UINT style, UINT ex_style, UINT *style_mask, UINT *ex_style_mask ) +{ + unsigned long decor = get_mwm_decorations_for_style( style, ex_style ); + struct x11drv_win_data *data; + + if (!decorated_mode) return FALSE; + + if ((data = get_win_data( hwnd ))) + { + if (!data->managed) decor = 0; + release_win_data( data ); + } + + *style_mask = ex_style = 0; + if (decor & MWM_DECOR_TITLE) *style_mask |= WS_CAPTION; + if (decor & MWM_DECOR_BORDER) + { + *style_mask |= WS_DLGFRAME | WS_THICKFRAME; + *ex_style_mask |= WS_EX_DLGMODALFRAME; + } + + return TRUE; +} + + /*********************************************************************** * WindowPosChanged (X11DRV.@) */ diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 3bf94db3e78..b87d6a87932 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -243,7 +243,8 @@ extern LRESULT X11DRV_ClipboardWindowProc( HWND hwnd, UINT msg, WPARAM wp, LPARA extern void X11DRV_UpdateClipboard(void); extern void X11DRV_UpdateLayeredWindow( HWND hwnd, UINT flags ); extern LRESULT X11DRV_WindowMessage( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ); -extern BOOL X11DRV_WindowPosChanging( HWND hwnd, UINT swp_flags, BOOL shaped, struct window_rects *rects ); +extern BOOL X11DRV_WindowPosChanging( HWND hwnd, UINT swp_flags, BOOL shaped, const struct window_rects *rects ); +extern BOOL X11DRV_GetWindowStyleMasks( HWND hwnd, UINT style, UINT ex_style, UINT *style_mask, UINT *ex_style_mask ); extern BOOL X11DRV_CreateWindowSurface( HWND hwnd, BOOL layered, const RECT *surface_rect, struct window_surface **surface ); extern void X11DRV_MoveWindowBits( HWND hwnd, const struct window_rects *new_rects, const RECT *valid_rects ); extern void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, const struct window_rects *new_rects, diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h index a2497a39d7b..fee065af71b 100644 --- a/include/wine/gdi_driver.h +++ b/include/wine/gdi_driver.h @@ -219,7 +219,7 @@ struct gdi_dc_funcs };
/* increment this when you change the DC function table */ -#define WINE_GDI_DRIVER_VERSION 95 +#define WINE_GDI_DRIVER_VERSION 96
#define GDI_PRIORITY_NULL_DRV 0 /* null driver */ #define GDI_PRIORITY_FONT_DRV 100 /* any font driver */ @@ -385,7 +385,8 @@ struct user_driver_funcs LRESULT (*pSysCommand)(HWND,WPARAM,LPARAM); void (*pUpdateLayeredWindow)(HWND,UINT); LRESULT (*pWindowMessage)(HWND,UINT,WPARAM,LPARAM); - BOOL (*pWindowPosChanging)(HWND,UINT,BOOL,struct window_rects *); + BOOL (*pWindowPosChanging)(HWND,UINT,BOOL,const struct window_rects *); + BOOL (*pGetWindowStyleMasks)(HWND,UINT,UINT,UINT*,UINT*); BOOL (*pCreateWindowSurface)(HWND,BOOL,const RECT *,struct window_surface**); void (*pMoveWindowBits)(HWND,const struct window_rects *,const RECT *); void (*pWindowPosChanged)(HWND,HWND,UINT,const struct window_rects*,struct window_surface*);