From: Rémi Bernon rbernon@codeweavers.com
The Win32 state might not have been updated with the latest X11 state, and we want to take future updates into account when deciding to accept focus or not.
At this point, and because we ignore WM_TAKE_FOCUS when a state change is pending, all the states are the same, this uses current_state as the logic is to accept focus, or not, according to our current knwledge of the X state. --- dlls/winex11.drv/event.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index 428dcb7b8b7..cc11285d0c6 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -595,8 +595,18 @@ DWORD EVENT_x11_time_to_win32_time(Time time) static inline BOOL can_activate_window( HWND hwnd ) { LONG style = NtUserGetWindowLongW( hwnd, GWL_STYLE ); + struct x11drv_win_data *data; RECT rect;
+ if ((data = get_win_data( hwnd ))) + { + style = style & ~(WS_VISIBLE | WS_MINIMIZE | WS_MAXIMIZE); + if (data->current_state.wm_state != WithdrawnState) style |= WS_VISIBLE; + if (data->current_state.wm_state == IconicState) style |= WS_MINIMIZE; + if (data->current_state.net_wm_state & (1 << NET_WM_STATE_MAXIMIZED)) style |= WS_MAXIMIZE; + release_win_data( data ); + } + if (!(style & WS_VISIBLE)) return FALSE; if ((style & (WS_POPUP|WS_CHILD)) == WS_CHILD) return FALSE; if (style & WS_MINIMIZE) return FALSE;