[PATCH v3 0/3] MR9830: Draft: fix toplevel icon protocol for Wayland
Fixes https://bugs.winehq.org/show_bug.cgi?id=59149 -- v3: add back original check part2 https://gitlab.winehq.org/wine/wine/-/merge_requests/9830
From: Alex Schwartz <alexschwartz01@gmail.com> --- dlls/win32u/driver.c | 7 +++++++ dlls/win32u/window.c | 2 +- dlls/winewayland.drv/waylanddrv.h | 1 + dlls/winewayland.drv/waylanddrv_main.c | 1 + dlls/winewayland.drv/window.c | 27 +++++++++++++++++++++----- dlls/winex11.drv/init.c | 1 + dlls/winex11.drv/window.c | 8 ++++++++ dlls/winex11.drv/x11drv.h | 1 + include/wine/gdi_driver.h | 3 ++- 9 files changed, 44 insertions(+), 7 deletions(-) diff --git a/dlls/win32u/driver.c b/dlls/win32u/driver.c index 60aba702d1a..6bab380417c 100644 --- a/dlls/win32u/driver.c +++ b/dlls/win32u/driver.c @@ -834,6 +834,11 @@ static void nulldrv_SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL redraw ) { } +static BOOL nulldrv_IsTopLevel( HWND hwnd ) +{ + return FALSE; +} + static void nulldrv_SetWindowIcons( HWND hwnd, HICON icon, const ICONINFO *ii, HICON icon_small, const ICONINFO *ii_small ) { } @@ -1293,6 +1298,7 @@ static const struct user_driver_funcs lazy_load_driver = loaderdrv_SetLayeredWindowAttributes, nulldrv_SetParent, loaderdrv_SetWindowRgn, + nulldrv_IsTopLevel, nulldrv_SetWindowIcons, nulldrv_SetWindowStyle, nulldrv_SetWindowText, @@ -1392,6 +1398,7 @@ void __wine_set_user_driver( const struct user_driver_funcs *funcs, UINT version SET_USER_FUNC(SetLayeredWindowAttributes); SET_USER_FUNC(SetParent); SET_USER_FUNC(SetWindowRgn); + SET_USER_FUNC(IsTopLevel); SET_USER_FUNC(SetWindowIcons); SET_USER_FUNC(SetWindowStyle); SET_USER_FUNC(SetWindowText); diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 1464d45697e..f4c79a011ae 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -2252,7 +2252,7 @@ static BOOL apply_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags, stru (swp_flags & (SWP_HIDEWINDOW | SWP_SHOWWINDOW | SWP_STATECHANGED | SWP_FRAMECHANGED))) invalidate_dce( win, &old_rects.window ); - if (win->dwStyle & WS_VISIBLE && !is_child && !win->has_icons) + if (win->dwStyle & WS_VISIBLE && !is_child && !win->has_icons && user_driver->pIsTopLevel(hwnd)) { icon = win->hIcon; icon_small = win->hIconSmall2 ? win->hIconSmall2 : win->hIconSmall; diff --git a/dlls/winewayland.drv/waylanddrv.h b/dlls/winewayland.drv/waylanddrv.h index 7ab1f58ba64..9e7fae3af84 100644 --- a/dlls/winewayland.drv/waylanddrv.h +++ b/dlls/winewayland.drv/waylanddrv.h @@ -445,6 +445,7 @@ BOOL WAYLAND_SetIMECompositionRect(HWND hwnd, RECT rect); void WAYLAND_SetCursor(HWND hwnd, HCURSOR hcursor); BOOL WAYLAND_SetCursorPos(INT x, INT y); void WAYLAND_SetLayeredWindowAttributes(HWND hwnd, COLORREF key, BYTE alpha, DWORD flags); +BOOL WAYLAND_IsTopLevel(HWND hwnd); void WAYLAND_SetWindowIcons(HWND hwnd, HICON icon, const ICONINFO *ii, HICON icon_small, const ICONINFO *ii_small); void WAYLAND_SetWindowStyle(HWND hwnd, INT offset, STYLESTRUCT *style); void WAYLAND_SetWindowText(HWND hwnd, LPCWSTR text); diff --git a/dlls/winewayland.drv/waylanddrv_main.c b/dlls/winewayland.drv/waylanddrv_main.c index cdb5dd8a956..e8e804a9341 100644 --- a/dlls/winewayland.drv/waylanddrv_main.c +++ b/dlls/winewayland.drv/waylanddrv_main.c @@ -45,6 +45,7 @@ static const struct user_driver_funcs waylanddrv_funcs = .pSetCursor = WAYLAND_SetCursor, .pSetCursorPos = WAYLAND_SetCursorPos, .pSetLayeredWindowAttributes = WAYLAND_SetLayeredWindowAttributes, + .pIsTopLevel = WAYLAND_IsTopLevel, .pSetWindowIcons = WAYLAND_SetWindowIcons, .pSetWindowStyle = WAYLAND_SetWindowStyle, .pSetWindowText = WAYLAND_SetWindowText, diff --git a/dlls/winewayland.drv/window.c b/dlls/winewayland.drv/window.c index b838fd84191..f6adc0b8edf 100644 --- a/dlls/winewayland.drv/window.c +++ b/dlls/winewayland.drv/window.c @@ -664,6 +664,25 @@ static enum xdg_toplevel_resize_edge hittest_to_resize_edge(WPARAM hittest) } } +/***************************************************************** + * WAYLAND_IsTopLevel + */ +BOOL WAYLAND_IsTopLevel(HWND hwnd) +{ + struct wayland_win_data *data; + + if ((data = wayland_win_data_get(hwnd))) + { + if (data->wayland_surface && wayland_surface_is_toplevel(data->wayland_surface)) + { + wayland_win_data_release(data); + return TRUE; + } + wayland_win_data_release(data); + } + return FALSE; +} + /***************************************************************** * WAYLAND_SetWindowIcons */ @@ -677,11 +696,9 @@ void WAYLAND_SetWindowIcons(HWND hwnd, HICON icon, const ICONINFO *ii, HICON ico { if ((data = wayland_win_data_get(hwnd))) { - if (data->wayland_surface && wayland_surface_is_toplevel(data->wayland_surface)) - { - wayland_surface_set_icon(data->wayland_surface, ICON_BIG, ii); - wayland_surface_set_icon(data->wayland_surface, ICON_SMALL, ii_small); - } + wayland_surface_set_icon(data->wayland_surface, ICON_BIG, ii); + wayland_surface_set_icon(data->wayland_surface, ICON_SMALL, ii_small); + wayland_win_data_release(data); } } diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c index 09ef2bf8664..d253b86a816 100644 --- a/dlls/winex11.drv/init.c +++ b/dlls/winex11.drv/init.c @@ -698,6 +698,7 @@ static const struct user_driver_funcs x11drv_funcs = .pActivateWindow = X11DRV_ActivateWindow, .pSetLayeredWindowAttributes = X11DRV_SetLayeredWindowAttributes, .pSetParent = X11DRV_SetParent, + .pIsTopLevel = X11DRV_IsTopLevel, .pSetWindowIcons = X11DRV_SetWindowIcons, .pSetWindowRgn = X11DRV_SetWindowRgn, .pSetWindowStyle = X11DRV_SetWindowStyle, diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index d256674c9c1..b40416cdc00 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -3393,6 +3393,14 @@ done: } +/********************************************************************** + * IsTopLevel (X11DRV.@) + */ +BOOL X11DRV_IsTopLevel(HWND hwnd) +{ + return TRUE; +} + /********************************************************************** * SetWindowIcons (X11DRV.@) */ diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 9232988c9c7..3d7ae00653d 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -238,6 +238,7 @@ extern void X11DRV_SetDesktopWindow( HWND hwnd ); extern void X11DRV_SetLayeredWindowAttributes( HWND hwnd, COLORREF key, BYTE alpha, DWORD flags ); extern void X11DRV_SetParent( HWND hwnd, HWND parent, HWND old_parent ); +extern BOOL X11DRV_IsTopLevel( HWND hwnd ); extern void X11DRV_SetWindowIcons( HWND hwnd, HICON icon, const ICONINFO *ii, HICON icon_small, const ICONINFO *ii_small ); extern void X11DRV_SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL redraw ); extern void X11DRV_SetWindowStyle( HWND hwnd, INT offset, STYLESTRUCT *style ); diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h index 81932436963..0c518eb2f7c 100644 --- a/include/wine/gdi_driver.h +++ b/include/wine/gdi_driver.h @@ -218,7 +218,7 @@ struct gdi_dc_funcs }; /* increment this when you change the DC function table */ -#define WINE_GDI_DRIVER_VERSION 108 +#define WINE_GDI_DRIVER_VERSION 109 #define GDI_PRIORITY_NULL_DRV 0 /* null driver */ #define GDI_PRIORITY_FONT_DRV 100 /* any font driver */ @@ -415,6 +415,7 @@ struct user_driver_funcs void (*pSetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD); void (*pSetParent)(HWND,HWND,HWND); void (*pSetWindowRgn)(HWND,HRGN,BOOL); + BOOL (*pIsTopLevel)(HWND); void (*pSetWindowIcons)(HWND,HICON,const ICONINFO*,HICON,const ICONINFO*); void (*pSetWindowStyle)(HWND,INT,STYLESTRUCT*); void (*pSetWindowText)(HWND,LPCWSTR); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9830
From: Alex Schwartz <alexschwartz01@gmail.com> --- dlls/winewayland.drv/window.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dlls/winewayland.drv/window.c b/dlls/winewayland.drv/window.c index f6adc0b8edf..1e85dd383b8 100644 --- a/dlls/winewayland.drv/window.c +++ b/dlls/winewayland.drv/window.c @@ -696,8 +696,11 @@ void WAYLAND_SetWindowIcons(HWND hwnd, HICON icon, const ICONINFO *ii, HICON ico { if ((data = wayland_win_data_get(hwnd))) { - wayland_surface_set_icon(data->wayland_surface, ICON_BIG, ii); - wayland_surface_set_icon(data->wayland_surface, ICON_SMALL, ii_small); + if (data->wayland_surface && wayland_surface_is_toplevel(data->wayland_surface)) + { + wayland_surface_set_icon(data->wayland_surface, ICON_BIG, ii); + wayland_surface_set_icon(data->wayland_surface, ICON_SMALL, ii_small); + } wayland_win_data_release(data); } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9830
From: Alex Schwartz <alexschwartz01@gmail.com> --- dlls/winewayland.drv/window.c | 1 - 1 file changed, 1 deletion(-) diff --git a/dlls/winewayland.drv/window.c b/dlls/winewayland.drv/window.c index 1e85dd383b8..afb5f4d3395 100644 --- a/dlls/winewayland.drv/window.c +++ b/dlls/winewayland.drv/window.c @@ -701,7 +701,6 @@ void WAYLAND_SetWindowIcons(HWND hwnd, HICON icon, const ICONINFO *ii, HICON ico wayland_surface_set_icon(data->wayland_surface, ICON_BIG, ii); wayland_surface_set_icon(data->wayland_surface, ICON_SMALL, ii_small); } - wayland_win_data_release(data); } } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9830
the default wine icon when ~/.wine doesn't exist is showing the default Wayland icon `DISPLAY= ./wine winecfg` is showing the default Wayland icon `DISPLAY= ./wine iexplore` is showing the default Wayland icon --- `DISPLAY= ./wine notepad` is showing the correct notepad icon `DISPLAY= ./wine explorer` is showing the correct explorer icon -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9830#note_126134
participants (2)
-
Alex Schwartz -
Alex Schwartz (@alexschwartz01)