Turns out I broke the non virtual desktop case in some cases. Sorry about that.
This basically uses previous behavior for such (`enable_taskbar` is what's used to also determine layered changes in rest of code) while keeping the fix for virtual desktops (i.e. our own taskbar).
Works correctly for me, but let me know if I did something wrong again (welp).
-- v2: explorer: Set layered style on systray icons before calling into the driver.
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Fixes a regression introduced by b5c57b9a62c396068d18237bd6e82b37c169fdc5, which broke the systray integration outside of virtual desktops on some DEs like XFCE.
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- programs/explorer/systray.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/programs/explorer/systray.c b/programs/explorer/systray.c index c76ebdd0c92..a157018d7cc 100644 --- a/programs/explorer/systray.c +++ b/programs/explorer/systray.c @@ -619,13 +619,22 @@ static BOOL show_icon(struct icon *icon)
if (icon->display != ICON_DISPLAY_HIDDEN) return TRUE; /* already displayed */
- if (!enable_taskbar && NtUserMessageCall( icon->window, WINE_SYSTRAY_DOCK_INSERT, icon_cx, icon_cy, - icon, NtUserSystemTrayCall, FALSE )) + if (!enable_taskbar) { - icon->display = ICON_DISPLAY_DOCKED; - icon->layered = TRUE; - SetWindowLongW( icon->window, GWL_EXSTYLE, GetWindowLongW( icon->window, GWL_EXSTYLE ) | WS_EX_LAYERED ); - SendMessageW( icon->window, WM_SIZE, SIZE_RESTORED, MAKELONG( icon_cx, icon_cy ) ); + DWORD old_exstyle = GetWindowLongW( icon->window, GWL_EXSTYLE ); + + /* make sure it is layered before calling into the driver */ + SetWindowLongW( icon->window, GWL_EXSTYLE, old_exstyle | WS_EX_LAYERED ); + + if (NtUserMessageCall( icon->window, WINE_SYSTRAY_DOCK_INSERT, icon_cx, icon_cy, + icon, NtUserSystemTrayCall, FALSE )) + { + icon->display = ICON_DISPLAY_DOCKED; + icon->layered = TRUE; + SendMessageW( icon->window, WM_SIZE, SIZE_RESTORED, MAKELONG( icon_cx, icon_cy ) ); + } + else + SetWindowLongW( icon->window, GWL_EXSTYLE, old_exstyle ); } systray_add_icon( icon );
Rémi Bernon (@rbernon) commented about programs/explorer/systray.c:
if (icon->display != ICON_DISPLAY_HIDDEN) return TRUE; /* already displayed */
- if (!enable_taskbar && NtUserMessageCall( icon->window, WINE_SYSTRAY_DOCK_INSERT, icon_cx, icon_cy,
- if (!enable_taskbar)
- {
DWORD old_exstyle = GetWindowLongW( icon->window, GWL_EXSTYLE );
/* make sure it is layered before calling into the driver */
SetWindowLongW( icon->window, GWL_EXSTYLE, old_exstyle | WS_EX_LAYERED );
You need to paint it once to make sure it's fully layered, otherwise it's still broken on LXDE.
```suggestion:-0+0 SetWindowLongW( icon->window, GWL_EXSTYLE, old_exstyle | WS_EX_LAYERED ); paint_layered_icon( icon ); ```
Rémi Bernon (@rbernon) commented about programs/explorer/systray.c:
if (icon->display != ICON_DISPLAY_HIDDEN) return TRUE; /* already displayed */
- if (!enable_taskbar && NtUserMessageCall( icon->window, WINE_SYSTRAY_DOCK_INSERT, icon_cx, icon_cy,
- if (!enable_taskbar)
- {
DWORD old_exstyle = GetWindowLongW( icon->window, GWL_EXSTYLE );
/* make sure it is layered before calling into the driver */
SetWindowLongW( icon->window, GWL_EXSTYLE, old_exstyle | WS_EX_LAYERED );
if (NtUserMessageCall( icon->window, WINE_SYSTRAY_DOCK_INSERT, icon_cx, icon_cy, icon, NtUserSystemTrayCall, FALSE )) {
Nit, but I find it much more readable to keep short cases near the beginning of if/else blocks.
```suggestion:-2+0 if (!NtUserMessageCall( icon->window, WINE_SYSTRAY_DOCK_INSERT, icon_cx, icon_cy, icon, NtUserSystemTrayCall, FALSE )) SetWindowLongW( icon->window, GWL_EXSTYLE, old_exstyle ); else { ```
It avoids having to skip far down to some unknown else location, see if something else is done in the other case, and at the same time forget about the context of the if. In this case it's not too bad, but it's a good habit IMO.