89 |
return toplevel; |
return toplevel; |
90 |
} |
} |
91 |
|
|
92 |
|
/* Returns true if a window is a menu window. */ |
93 |
|
static BOOL |
94 |
|
is_menu(HWND hwnd) |
95 |
|
{ |
96 |
|
HWND owner = GetWindow(hwnd, GW_OWNER); |
97 |
|
LONG exstyle = GetWindowLong(hwnd, GWL_EXSTYLE); |
98 |
|
return (exstyle & (WS_EX_TOOLWINDOW | WS_EX_TOPMOST)) && owner; |
99 |
|
|
100 |
|
} |
101 |
|
|
102 |
/* Determine the "parent" field for the CREATE response. */ |
/* Determine the "parent" field for the CREATE response. */ |
103 |
static HWND |
static HWND |
104 |
get_parent(HWND hwnd) |
get_parent(HWND hwnd) |
599 |
|
|
600 |
if (msg == g_wm_seamless_focus) |
if (msg == g_wm_seamless_focus) |
601 |
{ |
{ |
602 |
/* FIXME: SetForegroundWindow() kills menus. Need to find a |
/* For some reason, SetForegroundWindow() on menus |
603 |
clean way to solve this. */ |
closes them. Ignore focus requests for menu windows. */ |
604 |
if ((GetForegroundWindow() != hwnd) && !get_parent(hwnd)) |
if ((GetForegroundWindow() != hwnd) && !is_menu(hwnd)) |
605 |
SetForegroundWindow(hwnd); |
SetForegroundWindow(hwnd); |
606 |
|
|
607 |
vchannel_write("ACK", "%u", g_blocked_focus_serial); |
vchannel_write("ACK", "%u", g_blocked_focus_serial); |