This fixes various problems I've run into while trying to use Fusion 360 in wine. - stacking issues in unmanaged mode - I also attempted to apply the same fix for managed mode, but it looks difficult to do this in a way that plays well with window managers; I think it's best left up to them to keep override_redirect windows at the top of the stack) - when the window manager sets our state to withdrawn, tell the window that it's been minimized, since the semantics are very similar - the last one is a hack because I don't really know what to do about it, when clicking on the floating popups, they gain focus, which causes wine to incorrectly make them managed and that breaks everything
From: novenary streetwalkermc@gmail.com
This fixes Z ordering issues in the virtual desktop. For example, Fusion 360's floating menus tend to disappear behind the main window. --- dlls/winex11.drv/event.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index 1ae39eb9edf..19126cecaf8 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -539,6 +539,34 @@ static inline BOOL can_activate_window( HWND hwnd ) }
+/*********************************************************************** + * restack_owned_popups + * + * Restack a window's owned popups above it. + */ +static void restack_owned_popups( struct x11drv_win_data *data ) +{ + HWND *list; + UINT i; + struct x11drv_win_data *owned_data; + XWindowChanges changes = {.stack_mode = Above, .sibling = data->whole_window}; + + if (!(list = build_hwnd_list())) return; + + for (i = 0; list[i] != HWND_BOTTOM; i++) + { + if (NtUserGetWindowRelative( list[i], GW_OWNER ) != data->hwnd) continue; + owned_data = get_win_data( list[i] ); + if (owned_data && !owned_data->managed) + XConfigureWindow( data->display, owned_data->whole_window, CWSibling | CWStackMode, &changes ); + release_win_data( owned_data ); + } + + free( list ); + return; +} + + /********************************************************************** * set_input_focus * @@ -561,6 +589,7 @@ static void set_input_focus( struct x11drv_win_data *data ) /* Set X focus and install colormap */ changes.stack_mode = Above; XConfigureWindow( data->display, data->whole_window, CWStackMode, &changes ); + restack_owned_popups( data );
if (data->embedder) xembed_request_focus( data->display, data->embedder, timestamp );
From: novenary streetwalkermc@gmail.com
A window is withdrawn when neither it nor its "taskbar" icon is visible, e.g. when switching workspaces.
This fixes issues with unmanaged popups showing on all workspaces. --- dlls/winex11.drv/event.c | 2 +- dlls/winex11.drv/window.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index 19126cecaf8..93a78151d92 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -1342,7 +1342,7 @@ static void handle_wm_state_notify( HWND hwnd, XPropertyEvent *event, BOOL updat TRACE( "not restoring win %p/%lx style %08x\n", data->hwnd, data->whole_window, style ); } } - else if (!data->iconic && data->wm_state == IconicState) + else if (!data->iconic && (data->wm_state == IconicState || data->wm_state == WithdrawnState)) { data->iconic = TRUE; if ((style & WS_MINIMIZEBOX) && !(style & WS_DISABLED)) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index cb9e07599c4..fcbdad97d16 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -2721,7 +2721,10 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, data->iconic = (new_style & WS_MINIMIZE) != 0; TRACE( "changing win %p iconic state to %u\n", data->hwnd, data->iconic ); if (data->iconic) - XIconifyWindow( data->display, data->whole_window, data->vis.screen ); + { + if (data->wm_state != WithdrawnState) + XIconifyWindow( data->display, data->whole_window, data->vis.screen ); + } else if (is_window_rect_mapped( rectWindow )) XMapWindow( data->display, data->whole_window ); update_net_wm_states( data );
From: novenary streetwalkermc@gmail.com
This causes Fusion 360's popups to become managed on the first click, which breaks them in several ways on top of being incorrect.
I have no idea what a proper fix for this would look like. --- 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 fcbdad97d16..8284557f227 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -250,7 +250,8 @@ static BOOL is_window_managed( HWND hwnd, UINT swp_flags, const RECT *window_rec if ((style & (WS_CHILD|WS_POPUP)) == WS_CHILD) return FALSE; /* activated windows are managed */ if (!(swp_flags & (SWP_NOACTIVATE|SWP_HIDEWINDOW))) return TRUE; - if (hwnd == get_active_window()) return TRUE; + /* I don't really know what to do here */ + //if (hwnd == get_active_window()) return TRUE; /* windows with caption are managed */ if ((style & WS_CAPTION) == WS_CAPTION) return TRUE; /* windows with thick frame are managed */