Commit a29960e7 authored by Alexandre Julliard's avatar Alexandre Julliard

Make sure to always set X focus on the top-level window, not on

child windows.
parent 97f6f600
...@@ -399,6 +399,7 @@ static void set_focus( HWND hwnd, Time time ) ...@@ -399,6 +399,7 @@ static void set_focus( HWND hwnd, Time time )
SetForegroundWindow( hwnd ); SetForegroundWindow( hwnd );
focus = GetFocus(); focus = GetFocus();
if (focus) focus = GetAncestor( focus, GA_ROOT );
win = X11DRV_get_whole_window(focus); win = X11DRV_get_whole_window(focus);
if (win) if (win)
...@@ -451,6 +452,7 @@ static void handle_wm_protocols_message( HWND hwnd, XClientMessageEvent *event ) ...@@ -451,6 +452,7 @@ static void handle_wm_protocols_message( HWND hwnd, XClientMessageEvent *event )
else else
{ {
hwnd = GetFocus(); hwnd = GetFocus();
if (hwnd) hwnd = GetAncestor( hwnd, GA_ROOT );
if (!hwnd) hwnd = GetActiveWindow(); if (!hwnd) hwnd = GetActiveWindow();
if (!hwnd) hwnd = last_focus; if (!hwnd) hwnd = last_focus;
if (hwnd && can_activate_window(hwnd)) set_focus( hwnd, event_time ); if (hwnd && can_activate_window(hwnd)) set_focus( hwnd, event_time );
...@@ -486,6 +488,7 @@ static void EVENT_FocusIn( HWND hwnd, XFocusChangeEvent *event ) ...@@ -486,6 +488,7 @@ static void EVENT_FocusIn( HWND hwnd, XFocusChangeEvent *event )
if (!can_activate_window(hwnd)) if (!can_activate_window(hwnd))
{ {
HWND hwnd = GetFocus(); HWND hwnd = GetFocus();
if (hwnd) hwnd = GetAncestor( hwnd, GA_ROOT );
if (!hwnd) hwnd = GetActiveWindow(); if (!hwnd) hwnd = GetActiveWindow();
if (!hwnd) hwnd = x11drv_thread_data()->last_focus; if (!hwnd) hwnd = x11drv_thread_data()->last_focus;
if (hwnd && can_activate_window(hwnd)) set_focus( hwnd, CurrentTime ); if (hwnd && can_activate_window(hwnd)) set_focus( hwnd, CurrentTime );
......
...@@ -116,11 +116,12 @@ static int get_window_attributes( Display *display, WND *win, XSetWindowAttribut ...@@ -116,11 +116,12 @@ static int get_window_attributes( Display *display, WND *win, XSetWindowAttribut
attr->colormap = X11DRV_PALETTE_PaletteXColormap; attr->colormap = X11DRV_PALETTE_PaletteXColormap;
attr->save_under = ((win->clsStyle & CS_SAVEBITS) != 0); attr->save_under = ((win->clsStyle & CS_SAVEBITS) != 0);
attr->cursor = x11drv_thread_data()->cursor; attr->cursor = x11drv_thread_data()->cursor;
attr->event_mask = (ExposureMask | KeyPressMask | KeyReleaseMask | PointerMotionMask | attr->event_mask = (ExposureMask | PointerMotionMask |
ButtonPressMask | ButtonReleaseMask | EnterWindowMask); ButtonPressMask | ButtonReleaseMask | EnterWindowMask);
if (is_window_top_level( win )) if (is_window_top_level( win ))
attr->event_mask |= StructureNotifyMask | FocusChangeMask | KeymapStateMask; attr->event_mask |= (KeyPressMask | KeyReleaseMask | StructureNotifyMask |
FocusChangeMask | KeymapStateMask);
return (CWOverrideRedirect | CWSaveUnder | CWEventMask | CWColormap | CWCursor); return (CWOverrideRedirect | CWSaveUnder | CWEventMask | CWColormap | CWCursor);
} }
...@@ -717,7 +718,7 @@ static Window create_client_window( Display *display, WND *win ) ...@@ -717,7 +718,7 @@ static Window create_client_window( Display *display, WND *win )
OffsetRect( &rect, -data->whole_rect.left, -data->whole_rect.top ); OffsetRect( &rect, -data->whole_rect.left, -data->whole_rect.top );
data->client_rect = rect; data->client_rect = rect;
attr.event_mask = (ExposureMask | KeyPressMask | KeyReleaseMask | PointerMotionMask | attr.event_mask = (ExposureMask | PointerMotionMask |
ButtonPressMask | ButtonReleaseMask | EnterWindowMask); ButtonPressMask | ButtonReleaseMask | EnterWindowMask);
attr.bit_gravity = (win->clsStyle & (CS_VREDRAW | CS_HREDRAW)) ? attr.bit_gravity = (win->clsStyle & (CS_VREDRAW | CS_HREDRAW)) ?
ForgetGravity : NorthWestGravity; ForgetGravity : NorthWestGravity;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment