Module: wine Branch: master Commit: e20625e5c95a1852c6ce9e38334f2a187114d602 URL: http://source.winehq.org/git/wine.git/?a=commit;h=e20625e5c95a1852c6ce9e3833...
Author: Lei Zhang thestig@google.com Date: Thu Jun 21 15:38:00 2007 -0700
winex11.drv: Reset focus if application does not want to be activated.
---
dlls/winex11.drv/event.c | 21 +++++++++++---------- 1 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index f13e079..aad09c6 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -445,17 +445,18 @@ static void handle_wm_protocols( HWND hwnd, XClientMessageEvent *event ) LRESULT ma = SendMessageW( hwnd, WM_MOUSEACTIVATE, (WPARAM)GetAncestor( hwnd, GA_ROOT ), MAKELONG(HTCAPTION,WM_LBUTTONDOWN) ); - if (ma != MA_NOACTIVATEANDEAT && ma != MA_NOACTIVATE) set_focus( hwnd, event_time ); - else TRACE( "not setting focus to %p (%lx), ma=%ld\n", hwnd, event->window, ma ); - } - else - { - hwnd = GetFocus(); - if (hwnd) hwnd = GetAncestor( hwnd, GA_ROOT ); - if (!hwnd) hwnd = GetActiveWindow(); - if (!hwnd) hwnd = last_focus; - if (hwnd && can_activate_window(hwnd)) set_focus( hwnd, event_time ); + if (ma != MA_NOACTIVATEANDEAT && ma != MA_NOACTIVATE) + { + set_focus( hwnd, event_time ); + return; + } } + /* try to find some other window to give the focus to */ + hwnd = GetFocus(); + if (hwnd) hwnd = GetAncestor( hwnd, GA_ROOT ); + if (!hwnd) hwnd = GetActiveWindow(); + if (!hwnd) hwnd = last_focus; + if (hwnd && can_activate_window(hwnd)) set_focus( hwnd, event_time ); } else if (protocol == x11drv_atom(_NET_WM_PING)) {