diff --git a/patches/wine/0005-osu/0001-winex11-upstream-alt-tab-fix.patch b/patches/wine/0005-osu/0001-winex11-upstream-alt-tab-fix.patch new file mode 100644 index 0000000..e95f174 --- /dev/null +++ b/patches/wine/0005-osu/0001-winex11-upstream-alt-tab-fix.patch @@ -0,0 +1,97 @@ +## Fixes alt-tab with both windowed/fullscreen on osu! with Proton +diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c +index 2dcc3e20d3e..2aed9232232 100644 +--- a/dlls/win32u/window.c ++++ b/dlls/win32u/window.c +@@ -4288,7 +4288,7 @@ static BOOL show_window( HWND hwnd, INT cmd ) + WND *win; + HWND parent; + DPI_AWARENESS_CONTEXT context; +- LONG style = get_window_long( hwnd, GWL_STYLE ); ++ LONG style = get_window_long( hwnd, GWL_STYLE ), new_style; + BOOL was_visible = (style & WS_VISIBLE) != 0; + BOOL show_flag = TRUE; + RECT newPos = {0, 0, 0, 0}; +@@ -4391,6 +4391,15 @@ static BOOL show_window( HWND hwnd, INT cmd ) + NtUserSetWindowPos( hwnd, HWND_TOP, newPos.left, newPos.top, + newPos.right - newPos.left, newPos.bottom - newPos.top, swp ); + ++ new_style = get_window_long( hwnd, GWL_STYLE ); ++ if (((style ^ new_style) & WS_MINIMIZE) != 0) ++ { ++ if ((new_style & WS_MINIMIZE) != 0) ++ NtUserNotifyWinEvent( EVENT_SYSTEM_MINIMIZESTART, hwnd, OBJID_WINDOW, 0 ); ++ else ++ NtUserNotifyWinEvent( EVENT_SYSTEM_MINIMIZEEND, hwnd, OBJID_WINDOW, 0 ); ++ } ++ + if (cmd == SW_HIDE) + { + HWND hFocus; +diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c +index 48903cd5623..199b601d005 100644 +--- a/dlls/winex11.drv/event.c ++++ b/dlls/winex11.drv/event.c +@@ -991,24 +991,9 @@ static BOOL X11DRV_Expose( HWND hwnd, XEvent *xev ) + rect.right = pos.x + event->width; + rect.bottom = pos.y + event->height; + +- if (layered_window_client_hack && event->window == data->client_window) +- OffsetRect( &rect, data->client_rect.left - data->whole_rect.left, +- data->client_rect.top - data->whole_rect.top ); +- if (layered_window_client_hack || event->window != data->client_window) +- { +- if (data->surface) +- { +- surface_region = expose_surface( data->surface, &rect ); +- if (!surface_region) flags = 0; +- else NtGdiOffsetRgn( surface_region, data->whole_rect.left - data->client_rect.left, +- data->whole_rect.top - data->client_rect.top ); +- +- if (data->vis.visualid != default_visual.visualid) +- data->surface->funcs->flush( data->surface ); +- } ++ if (event->window != data->client_window) + OffsetRect( &rect, data->whole_rect.left - data->client_rect.left, + data->whole_rect.top - data->client_rect.top ); +- } + + if (event->window != root_window) + { +diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c +index 98723a302ed..ab68807f8f9 100644 +--- a/dlls/winex11.drv/window.c ++++ b/dlls/winex11.drv/window.c +@@ -1325,15 +1325,7 @@ void update_net_wm_states( struct x11drv_win_data *data ) + if ((style & WS_MAXIMIZE) && (style & WS_CAPTION) == WS_CAPTION) + new_state |= (1 << NET_WM_STATE_MAXIMIZED); + else if (!(style & WS_MINIMIZE)) +- { +- if (!wm_is_steamcompmgr( data->display ) || !fs_hack_enabled( monitor )) +- { +- /* when fs hack is enabled, we don't want steamcompmgr to resize the window to be fullscreened */ +- if (is_window_rect_full_virtual_screen( &data->whole_rect )) +- net_wm_bypass_compositor = 1; +- new_state |= (1 << NET_WM_STATE_FULLSCREEN); +- } +- } ++ new_state |= (1 << NET_WM_STATE_FULLSCREEN); + } + else if (style & WS_MAXIMIZE) + new_state |= (1 << NET_WM_STATE_MAXIMIZED); +@@ -3764,7 +3756,6 @@ static void handle_window_desktop_resize( struct x11drv_win_data *data, UINT old + } + + /* update the full screen state */ +- update_net_wm_states( data ); + + if (data->whole_window) + { +@@ -3807,6 +3798,7 @@ LRESULT X11DRV_WindowMessage( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) + case WM_X11DRV_DESKTOP_RESIZED: + if ((data = get_win_data( hwnd ))) + { ++ update_net_wm_states( data ); + handle_window_desktop_resize( data, wp, lp ); + release_win_data( data ); + } diff --git a/patches/wine/0005-osu/0017-ps0128-p0001-HACK-Fix-osu-alt-tab-on-certain-window-managers.patch b/patches/wine/0005-osu/0017-ps0128-p0001-HACK-Fix-osu-alt-tab-on-certain-window-managers.patch deleted file mode 100644 index c4a3332..0000000 --- a/patches/wine/0005-osu/0017-ps0128-p0001-HACK-Fix-osu-alt-tab-on-certain-window-managers.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 5c8c060fc9d1d20eebe12da2e6dacddd88c07d82 Mon Sep 17 00:00:00 2001 -From: Torge Matthies -Date: Sun, 26 Nov 2023 18:29:53 +0100 -Subject: [PATCH 1/2] HACK: Fix osu! alt-tab. - ---- - dlls/win32u/window.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c -index 11111111111..11111111111 100644 ---- a/dlls/win32u/window.c -+++ b/dlls/win32u/window.c -@@ -3514,6 +3514,11 @@ BOOL set_window_pos( WINDOWPOS *winpos, int parent_x, int parent_y ) - - orig_flags = winpos->flags; - -+ /* HACK: fix osu! taking back focus immediately when it is unfocused. */ -+ if (winpos->hwndInsertAfter == HWND_NOTOPMOST && -+ (get_window_long( winpos->hwnd, GWL_EXSTYLE ) & WS_EX_TOPMOST)) -+ winpos->flags |= SWP_NOACTIVATE | SWP_NOZORDER; -+ - /* First, check z-order arguments. */ - if (!(winpos->flags & SWP_NOZORDER)) - { --- -0.0.0 - diff --git a/patches/wine/0005-osu/0017-ps0128-p0002-HACK-Add-WM-specific-flags-for-osu-alt-tab-fix.patch b/patches/wine/0005-osu/0017-ps0128-p0002-HACK-Add-WM-specific-flags-for-osu-alt-tab-fix.patch deleted file mode 100644 index 327385d..0000000 --- a/patches/wine/0005-osu/0017-ps0128-p0002-HACK-Add-WM-specific-flags-for-osu-alt-tab-fix.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 719056116394fc694ed307352d0ed877aca6ceae Mon Sep 17 00:00:00 2001 -From: NelloKudo -Date: Tue, 11 Jun 2024 17:33:35 +0200 -Subject: [PATCH 2/2] HACK: Add WM specific flags for osu alt tab fix. - -Edit of the original patch from openglfreak that fixed focus-in when running osu! as fullscreen: -adding such flags breaks alt-tabbing in Windowed mode on GNOME and KDE, forcing osu! to stay on top of other apps. -This depends on Proton's WM detection function. ---- - dlls/win32u/window.c | 19 ++++++++++++++++--- - 1 file changed, 16 insertions(+), 3 deletions(-) - -diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c -index 11111111111..11111111111 100644 ---- a/dlls/win32u/window.c -+++ b/dlls/win32u/window.c -@@ -3447,10 +3447,23 @@ BOOL set_window_pos( WINDOWPOS *winpos, int parent_x, int parent_y ) - - orig_flags = winpos->flags; - -- /* HACK: fix osu! taking back focus immediately when it is unfocused. */ -+ LONG_PTR wm = __wine_get_window_manager(); -+ -+ /* HACK: fix osu! taking back focus immediately when it is unfocused depending on WM */ - if (winpos->hwndInsertAfter == HWND_NOTOPMOST && -- (get_window_long( winpos->hwnd, GWL_EXSTYLE ) & WS_EX_TOPMOST)) -- winpos->flags |= SWP_NOACTIVATE | SWP_NOZORDER; -+ (get_window_long(winpos->hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST)) -+ { -+ /* If on KDE or GNOME, alt-tab on Fullscreen AND Windowed only works without the SWP_NOZORDER flag. */ -+ if (wm == WINE_WM_X11_KDE || wm == WINE_WM_X11_MUTTER) -+ { -+ winpos->flags |= SWP_NOACTIVATE | SWP_NOOWNERZORDER; -+ } -+ /* In any other case, SWP_NOZORDER is enough to get the game working fine and not take focus on other apps when windowed. */ -+ else -+ { -+ winpos->flags |= SWP_NOACTIVATE | SWP_NOZORDER; -+ } -+ } - - /* First, check z-order arguments. */ - if (!(winpos->flags & SWP_NOZORDER)) --- -0.0.0 \ No newline at end of file