This fixes window size being broken when dragged over multiple monitors with different scales and adds support for padded fullscreen windows when physical display mode aspect ratio doesn't match the emulated one.
From: Rémi Bernon rbernon@codeweavers.com
Fixes broken window sizes when dragging over to a monitor with a different DPI. --- dlls/winex11.drv/window.c | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-)
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 2beb0853c7d..2209b19c262 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -2878,17 +2878,13 @@ BOOL X11DRV_GetWindowStyleMasks( HWND hwnd, UINT style, UINT ex_style, UINT *sty void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, HWND owner_hint, UINT swp_flags, BOOL fullscreen, const struct window_rects *new_rects, struct window_surface *surface ) { - struct x11drv_thread_data *thread_data; struct x11drv_win_data *data; UINT new_style = NtUserGetWindowLongW( hwnd, GWL_STYLE ); struct window_rects old_rects; BOOL was_fullscreen; - int event_type;
if (!(data = get_win_data( hwnd ))) return;
- thread_data = x11drv_thread_data(); - old_rects = data->rects; was_fullscreen = data->is_fullscreen; data->rects = *new_rects; @@ -2911,23 +2907,10 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, HWND owner_hint, UIN return; }
- /* check if we are currently processing an event relevant to this window */ - event_type = 0; - if (thread_data && - thread_data->current_event && - thread_data->current_event->xany.window == data->whole_window) - { - event_type = thread_data->current_event->type; - if (event_type != ConfigureNotify && event_type != PropertyNotify && - event_type != GravityNotify && event_type != ReparentNotify) - event_type = 0; /* ignore other events */ - } - - if (data->mapped && event_type != ReparentNotify) + if (data->mapped) { if (((swp_flags & SWP_HIDEWINDOW) && !(new_style & WS_VISIBLE)) || - (!event_type && !(new_style & WS_MINIMIZE) && - !is_window_rect_mapped( &new_rects->window ) && is_window_rect_mapped( &old_rects.window ))) + (!(new_style & WS_MINIMIZE) && !is_window_rect_mapped( &new_rects->window ) && is_window_rect_mapped( &old_rects.window ))) { release_win_data( data ); unmap_window( hwnd ); @@ -2937,8 +2920,7 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, HWND owner_hint, UIN }
/* don't change position if we are about to minimize or maximize a managed window */ - if (!event_type && - !(data->managed && (swp_flags & SWP_STATECHANGED) && (new_style & (WS_MINIMIZE|WS_MAXIMIZE)))) + if (!(data->managed && (swp_flags & SWP_STATECHANGED) && (new_style & (WS_MINIMIZE|WS_MAXIMIZE)))) { sync_window_position( data, swp_flags ); #ifdef HAVE_LIBXSHAPE @@ -2983,7 +2965,7 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, HWND owner_hint, UIN else { if (swp_flags & (SWP_FRAMECHANGED|SWP_STATECHANGED)) set_wm_hints( data ); - if (!event_type) update_net_wm_states( data ); + update_net_wm_states( data ); } }
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winex11.drv/window.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 2209b19c262..e61dcd7b1d1 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -470,12 +470,13 @@ static int get_window_attributes( struct x11drv_win_data *data, XSetWindowAttrib attr->bit_gravity = NorthWestGravity; attr->backing_store = NotUseful; attr->border_pixel = 0; + attr->background_pixel = 0; attr->event_mask = (ExposureMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | KeyPressMask | KeyReleaseMask | FocusChangeMask | KeymapStateMask | StructureNotifyMask | PropertyChangeMask);
- return (CWOverrideRedirect | CWSaveUnder | CWColormap | CWBorderPixel | + return (CWOverrideRedirect | CWSaveUnder | CWColormap | CWBorderPixel | CWBackPixel | CWEventMask | CWBitGravity | CWBackingStore); }
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/sysparams.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index cc27f3dc7f2..5b17edbc022 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -2512,11 +2512,19 @@ RECT map_rect_virt_to_raw( RECT rect, UINT dpi_from ) struct window_rects map_window_rects_virt_to_raw( struct window_rects rects, UINT dpi_from ) { struct monitor *monitor; + RECT rect, monitor_rect; + BOOL is_fullscreen;
if (!lock_display_devices()) return rects; if ((monitor = get_monitor_from_rect( rects.window, MONITOR_DEFAULTTONEAREST, dpi_from, MDT_DEFAULT ))) { - rects.visible = map_monitor_rect( monitor, rects.visible, dpi_from, MDT_DEFAULT, 0, MDT_RAW_DPI ); + /* if the visible rect is fullscreen, make it cover the full raw monitor, regardless of aspect ratio */ + monitor_rect = monitor_get_rect( monitor, dpi_from, MDT_DEFAULT ); + + is_fullscreen = intersect_rect( &rect, &monitor_rect, &rects.visible ) && EqualRect( &rect, &monitor_rect ); + if (is_fullscreen) rects.visible = monitor_get_rect( monitor, 0, MDT_RAW_DPI ); + else rects.visible = map_monitor_rect( monitor, rects.visible, dpi_from, MDT_DEFAULT, 0, MDT_RAW_DPI ); + rects.window = map_monitor_rect( monitor, rects.window, dpi_from, MDT_DEFAULT, 0, MDT_RAW_DPI ); rects.client = map_monitor_rect( monitor, rects.client, dpi_from, MDT_DEFAULT, 0, MDT_RAW_DPI ); }