winex11: Directly use win32u for user functions in event.c.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2022-04-15 14:52:02 +02:00 committed by Alexandre Julliard
parent dddb844332
commit 21c37e8f95
2 changed files with 92 additions and 84 deletions

View File

@ -388,7 +388,7 @@ static inline BOOL call_event_handler( Display *display, XEvent *event )
#endif
if (XFindContext( display, event->xany.window, winContext, (char **)&hwnd ) != 0)
hwnd = 0; /* not for a registered window */
if (!hwnd && event->xany.window == root_window) hwnd = GetDesktopWindow();
if (!hwnd && event->xany.window == root_window) hwnd = NtUserGetDesktopWindow();
TRACE( "%lu %s for hwnd/window %p/%lx\n",
event->xany.serial, dbgstr_event( event->type ), hwnd, event->xany.window );
@ -544,15 +544,15 @@ DWORD EVENT_x11_time_to_win32_time(Time time)
*/
static inline BOOL can_activate_window( HWND hwnd )
{
LONG style = GetWindowLongW( hwnd, GWL_STYLE );
LONG style = NtUserGetWindowLongW( hwnd, GWL_STYLE );
RECT rect;
if (!(style & WS_VISIBLE)) return FALSE;
if ((style & (WS_POPUP|WS_CHILD)) == WS_CHILD) return FALSE;
if (style & WS_MINIMIZE) return FALSE;
if (GetWindowLongW( hwnd, GWL_EXSTYLE ) & WS_EX_NOACTIVATE) return FALSE;
if (hwnd == GetDesktopWindow()) return FALSE;
if (GetWindowRect( hwnd, &rect ) && IsRectEmpty( &rect )) return FALSE;
if (NtUserGetWindowLongW( hwnd, GWL_EXSTYLE ) & WS_EX_NOACTIVATE) return FALSE;
if (hwnd == NtUserGetDesktopWindow()) return FALSE;
if (NtUserGetWindowRect( hwnd, &rect ) && IsRectEmpty( &rect )) return FALSE;
return !(style & WS_DISABLED);
}
@ -597,13 +597,13 @@ static void set_focus( Display *display, HWND hwnd, Time time )
GUITHREADINFO threadinfo;
TRACE( "setting foreground window to %p\n", hwnd );
SetForegroundWindow( hwnd );
NtUserSetForegroundWindow( hwnd, FALSE );
threadinfo.cbSize = sizeof(threadinfo);
GetGUIThreadInfo(0, &threadinfo);
NtUserGetGUIThreadInfo( 0, &threadinfo );
focus = threadinfo.hwndFocus;
if (!focus) focus = threadinfo.hwndActive;
if (focus) focus = GetAncestor( focus, GA_ROOT );
if (focus) focus = NtUserGetAncestor( focus, GA_ROOT );
win = X11DRV_get_whole_window(focus);
if (win)
@ -619,7 +619,7 @@ static void set_focus( Display *display, HWND hwnd, Time time )
*/
static void handle_manager_message( HWND hwnd, XClientMessageEvent *event )
{
if (hwnd != GetDesktopWindow()) return;
if (hwnd != NtUserGetDesktopWindow()) return;
if (systray_atom && event->data.l[1] == systray_atom)
change_systray_owner( event->display, event->data.l[2] );
}
@ -639,11 +639,11 @@ static void handle_wm_protocols( HWND hwnd, XClientMessageEvent *event )
{
update_user_time( event_time );
if (hwnd == GetDesktopWindow())
if (hwnd == NtUserGetDesktopWindow())
{
/* The desktop window does not have a close button that we can
* pretend to click. Therefore, we simply send it a close command. */
SendMessageW(hwnd, WM_SYSCOMMAND, SC_CLOSE, 0);
send_message( hwnd, WM_SYSCOMMAND, SC_CLOSE, 0 );
return;
}
@ -651,11 +651,11 @@ static void handle_wm_protocols( HWND hwnd, XClientMessageEvent *event )
* and we are in managed mode. This is to disallow applications from
* being closed by the window manager while in a modal state.
*/
if (IsWindowEnabled(hwnd))
if (NtUserIsWindowEnabled( hwnd ))
{
HMENU hSysMenu;
if (GetClassLongW(hwnd, GCL_STYLE) & CS_NOCLOSE) return;
if (NtUserGetClassLongW( hwnd, GCL_STYLE ) & CS_NOCLOSE) return;
hSysMenu = GetSystemMenu(hwnd, FALSE);
if (hSysMenu)
{
@ -663,10 +663,10 @@ static void handle_wm_protocols( HWND hwnd, XClientMessageEvent *event )
if (state == 0xFFFFFFFF || (state & (MF_DISABLED | MF_GRAYED)))
return;
}
if (GetActiveWindow() != hwnd)
if (get_active_window() != hwnd)
{
LRESULT ma = SendMessageW( hwnd, WM_MOUSEACTIVATE,
(WPARAM)GetAncestor( hwnd, GA_ROOT ),
LRESULT ma = send_message( hwnd, WM_MOUSEACTIVATE,
(WPARAM)NtUserGetAncestor( hwnd, GA_ROOT ),
MAKELPARAM( HTCLOSE, WM_NCLBUTTONDOWN ) );
switch(ma)
{
@ -677,7 +677,7 @@ static void handle_wm_protocols( HWND hwnd, XClientMessageEvent *event )
break;
case MA_ACTIVATE:
case 0:
SetActiveWindow(hwnd);
NtUserSetActiveWindow( hwnd );
break;
default:
WARN( "unknown WM_MOUSEACTIVATE code %d\n", (int) ma );
@ -685,7 +685,7 @@ static void handle_wm_protocols( HWND hwnd, XClientMessageEvent *event )
}
}
PostMessageW( hwnd, WM_SYSCOMMAND, SC_CLOSE, 0 );
NtUserPostMessage( hwnd, WM_SYSCOMMAND, SC_CLOSE, 0 );
}
}
else if (protocol == x11drv_atom(WM_TAKE_FOCUS))
@ -693,15 +693,15 @@ static void handle_wm_protocols( HWND hwnd, XClientMessageEvent *event )
HWND last_focus = x11drv_thread_data()->last_focus;
TRACE( "got take focus msg for %p, enabled=%d, visible=%d (style %08x), focus=%p, active=%p, fg=%p, last=%p\n",
hwnd, IsWindowEnabled(hwnd), IsWindowVisible(hwnd), GetWindowLongW(hwnd, GWL_STYLE),
GetFocus(), GetActiveWindow(), GetForegroundWindow(), last_focus );
hwnd, NtUserIsWindowEnabled(hwnd), NtUserIsWindowVisible(hwnd), NtUserGetWindowLongW(hwnd, GWL_STYLE),
get_focus(), get_active_window(), NtUserGetForegroundWindow(), last_focus );
if (can_activate_window(hwnd))
{
/* simulate a mouse click on the menu to find out
* whether the window wants to be activated */
LRESULT ma = SendMessageW( hwnd, WM_MOUSEACTIVATE,
(WPARAM)GetAncestor( hwnd, GA_ROOT ),
LRESULT ma = send_message( hwnd, WM_MOUSEACTIVATE,
(WPARAM)NtUserGetAncestor( hwnd, GA_ROOT ),
MAKELONG( HTMENU, WM_LBUTTONDOWN ) );
if (ma != MA_NOACTIVATEANDEAT && ma != MA_NOACTIVATE)
{
@ -709,18 +709,18 @@ static void handle_wm_protocols( HWND hwnd, XClientMessageEvent *event )
return;
}
}
else if (hwnd == GetDesktopWindow())
else if (hwnd == NtUserGetDesktopWindow())
{
hwnd = GetForegroundWindow();
hwnd = NtUserGetForegroundWindow();
if (!hwnd) hwnd = last_focus;
if (!hwnd) hwnd = GetDesktopWindow();
if (!hwnd) hwnd = NtUserGetDesktopWindow();
set_focus( event->display, 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();
hwnd = get_focus();
if (hwnd) hwnd = NtUserGetAncestor( hwnd, GA_ROOT );
if (!hwnd) hwnd = get_active_window();
if (!hwnd) hwnd = last_focus;
if (hwnd && can_activate_window(hwnd)) set_focus( event->display, hwnd, event_time );
}
@ -769,7 +769,7 @@ static BOOL X11DRV_FocusIn( HWND hwnd, XEvent *xev )
TRACE( "win %p xwin %lx detail=%s mode=%s\n", hwnd, event->window, focus_details[event->detail], focus_modes[event->mode] );
if (event->detail == NotifyPointer) return FALSE;
if (hwnd == GetDesktopWindow()) return FALSE;
if (hwnd == NtUserGetDesktopWindow()) return FALSE;
switch (event->mode)
{
@ -792,19 +792,19 @@ static BOOL X11DRV_FocusIn( HWND hwnd, XEvent *xev )
if ((xic = X11DRV_get_ic( hwnd ))) XSetICFocus( xic );
if (use_take_focus)
{
if (hwnd == GetForegroundWindow()) clip_fullscreen_window( hwnd, FALSE );
if (hwnd == NtUserGetForegroundWindow()) clip_fullscreen_window( hwnd, FALSE );
return TRUE;
}
if (!can_activate_window(hwnd))
{
HWND hwnd = GetFocus();
if (hwnd) hwnd = GetAncestor( hwnd, GA_ROOT );
if (!hwnd) hwnd = GetActiveWindow();
HWND hwnd = get_focus();
if (hwnd) hwnd = NtUserGetAncestor( hwnd, GA_ROOT );
if (!hwnd) hwnd = get_active_window();
if (!hwnd) hwnd = x11drv_thread_data()->last_focus;
if (hwnd && can_activate_window(hwnd)) set_focus( event->display, hwnd, CurrentTime );
}
else SetForegroundWindow( hwnd );
else NtUserSetForegroundWindow( hwnd, FALSE );
return TRUE;
}
@ -825,11 +825,11 @@ static void focus_out( Display *display , HWND hwnd )
if (is_virtual_desktop())
{
if (hwnd == GetDesktopWindow()) reset_clipping_window();
if (hwnd == NtUserGetDesktopWindow()) reset_clipping_window();
return;
}
if (hwnd != GetForegroundWindow()) return;
SendMessageW( hwnd, WM_CANCELMODE, 0, 0 );
if (hwnd != NtUserGetForegroundWindow()) return;
send_message( hwnd, WM_CANCELMODE, 0, 0 );
/* don't reset the foreground window, if the window which is
getting the focus is a Wine window */
@ -847,10 +847,10 @@ static void focus_out( Display *display , HWND hwnd )
Foreground window, because in most cases the messages sent
above must have already changed the foreground window, in which
case we don't have to change the foreground window to 0 */
if (hwnd == GetForegroundWindow())
if (hwnd == NtUserGetForegroundWindow())
{
TRACE( "lost focus, setting fg to desktop\n" );
SetForegroundWindow( GetDesktopWindow() );
NtUserSetForegroundWindow( NtUserGetDesktopWindow(), FALSE );
}
}
}
@ -949,10 +949,10 @@ static BOOL X11DRV_Expose( HWND hwnd, XEvent *xev )
if (event->window != root_window)
{
if (GetWindowLongW( data->hwnd, GWL_EXSTYLE ) & WS_EX_LAYOUTRTL)
if (NtUserGetWindowLongW( data->hwnd, GWL_EXSTYLE ) & WS_EX_LAYOUTRTL)
mirror_rect( &data->client_rect, &rect );
abs_rect = rect;
MapWindowPoints( hwnd, 0, (POINT *)&abs_rect, 2 );
NtUserMapWindowPoints( hwnd, 0, (POINT *)&abs_rect, 2 );
SERVER_START_REQ( update_window_zorder )
{
@ -969,8 +969,8 @@ static BOOL X11DRV_Expose( HWND hwnd, XEvent *xev )
release_win_data( data );
if (flags) RedrawWindow( hwnd, &rect, surface_region, flags );
if (surface_region) DeleteObject( surface_region );
if (flags) NtUserRedrawWindow( hwnd, &rect, surface_region, flags );
if (surface_region) NtGdiDeleteObjectApp( surface_region );
return TRUE;
}
@ -988,8 +988,8 @@ static BOOL X11DRV_MapNotify( HWND hwnd, XEvent *event )
if (!data->managed && !data->embedded && data->mapped)
{
HWND hwndFocus = GetFocus();
if (hwndFocus && IsChild( hwnd, hwndFocus ))
HWND hwndFocus = get_focus();
if (hwndFocus && NtUserIsChild( hwnd, hwndFocus ))
set_input_focus( data );
}
release_win_data( data );
@ -1014,10 +1014,10 @@ static void reparent_notify( Display *display, HWND hwnd, Window xparent, int x,
HWND parent, old_parent;
DWORD style;
style = GetWindowLongW( hwnd, GWL_STYLE );
style = NtUserGetWindowLongW( hwnd, GWL_STYLE );
if (xparent == root_window)
{
parent = GetDesktopWindow();
parent = NtUserGetDesktopWindow();
style = (style & ~WS_CHILD) | WS_POPUP;
}
else
@ -1026,15 +1026,15 @@ static void reparent_notify( Display *display, HWND hwnd, Window xparent, int x,
style = (style & ~WS_POPUP) | WS_CHILD;
}
ShowWindow( hwnd, SW_HIDE );
old_parent = SetParent( hwnd, parent );
SetWindowLongW( hwnd, GWL_STYLE, style );
SetWindowPos( hwnd, HWND_TOP, x, y, 0, 0,
SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOCOPYBITS |
((style & WS_VISIBLE) ? SWP_SHOWWINDOW : 0) );
NtUserShowWindow( hwnd, SW_HIDE );
old_parent = NtUserSetParent( hwnd, parent );
NtUserSetWindowLong( hwnd, GWL_STYLE, style, FALSE );
NtUserSetWindowPos( hwnd, HWND_TOP, x, y, 0, 0,
SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOCOPYBITS |
((style & WS_VISIBLE) ? SWP_SHOWWINDOW : 0) );
/* make old parent destroy itself if it no longer has children */
if (old_parent != GetDesktopWindow()) PostMessageW( old_parent, WM_CLOSE, 0, 0 );
if (old_parent != NtUserGetDesktopWindow()) NtUserPostMessage( old_parent, WM_CLOSE, 0, 0 );
}
@ -1061,7 +1061,7 @@ static BOOL X11DRV_ReparentNotify( HWND hwnd, XEvent *xev )
TRACE( "%p/%lx reparented to root\n", hwnd, data->whole_window );
data->embedder = 0;
release_win_data( data );
SendMessageW( hwnd, WM_CLOSE, 0, 0 );
send_message( hwnd, WM_CLOSE, 0, 0 );
return TRUE;
}
data->embedder = event->parent;
@ -1106,10 +1106,10 @@ static BOOL X11DRV_ConfigureNotify( HWND hwnd, XEvent *xev )
/* Get geometry */
parent = GetAncestor( hwnd, GA_PARENT );
parent = NtUserGetAncestor( hwnd, GA_PARENT );
root_coords = event->send_event; /* synthetic events are always in root coords */
if (!root_coords && parent == GetDesktopWindow()) /* normal event, map coordinates to the root */
if (!root_coords && parent == NtUserGetDesktopWindow()) /* normal event, map coordinates to the root */
{
Window child;
XTranslateCoordinates( event->display, event->window, root_window,
@ -1125,7 +1125,7 @@ static BOOL X11DRV_ConfigureNotify( HWND hwnd, XEvent *xev )
else pos = root_to_virtual_screen( x, y );
X11DRV_X_to_window_rect( data, &rect, pos.x, pos.y, event->width, event->height );
if (root_coords) MapWindowPoints( 0, parent, (POINT *)&rect, 2 );
if (root_coords) NtUserMapWindowPoints( 0, parent, (POINT *)&rect, 2 );
TRACE( "win %p/%lx new X rect %d,%d,%dx%d (event %d,%d,%dx%d)\n",
hwnd, data->whole_window, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top,
@ -1155,7 +1155,7 @@ static BOOL X11DRV_ConfigureNotify( HWND hwnd, XEvent *xev )
hwnd, data->window_rect.right - data->window_rect.left,
data->window_rect.bottom - data->window_rect.top, cx, cy );
style = GetWindowLongW( data->hwnd, GWL_STYLE );
style = NtUserGetWindowLongW( data->hwnd, GWL_STYLE );
if ((style & WS_CAPTION) == WS_CAPTION || !is_window_rect_full_screen( &data->whole_rect ))
{
read_net_wm_states( event->display, data );
@ -1165,7 +1165,7 @@ static BOOL X11DRV_ConfigureNotify( HWND hwnd, XEvent *xev )
{
TRACE( "win %p/%lx is maximized\n", data->hwnd, data->whole_window );
release_win_data( data );
SendMessageW( data->hwnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0 );
send_message( data->hwnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0 );
return TRUE;
}
}
@ -1173,7 +1173,7 @@ static BOOL X11DRV_ConfigureNotify( HWND hwnd, XEvent *xev )
{
TRACE( "window %p/%lx is no longer maximized\n", data->hwnd, data->whole_window );
release_win_data( data );
SendMessageW( data->hwnd, WM_SYSCOMMAND, SC_RESTORE, 0 );
send_message( data->hwnd, WM_SYSCOMMAND, SC_RESTORE, 0 );
return TRUE;
}
}
@ -1181,7 +1181,7 @@ static BOOL X11DRV_ConfigureNotify( HWND hwnd, XEvent *xev )
if ((flags & (SWP_NOSIZE | SWP_NOMOVE)) != (SWP_NOSIZE | SWP_NOMOVE))
{
release_win_data( data );
SetWindowPos( hwnd, 0, x, y, cx, cy, flags );
NtUserSetWindowPos( hwnd, 0, x, y, cx, cy, flags );
return TRUE;
}
@ -1219,7 +1219,7 @@ static BOOL X11DRV_GravityNotify( HWND hwnd, XEvent *xev )
release_win_data( data );
if (window_rect.left != x || window_rect.top != y)
SetWindowPos( hwnd, 0, x, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOCOPYBITS );
NtUserSetWindowPos( hwnd, 0, x, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOCOPYBITS );
return TRUE;
}
@ -1288,7 +1288,7 @@ static void handle_wm_state_notify( HWND hwnd, XPropertyEvent *event, BOOL updat
if (!update_window || !data->managed || !data->mapped) goto done;
style = GetWindowLongW( data->hwnd, GWL_STYLE );
style = NtUserGetWindowLongW( data->hwnd, GWL_STYLE );
if (data->iconic && data->wm_state == NormalState) /* restore window */
{
@ -1300,7 +1300,7 @@ static void handle_wm_state_notify( HWND hwnd, XPropertyEvent *event, BOOL updat
{
TRACE( "restoring to max %p/%lx\n", data->hwnd, data->whole_window );
release_win_data( data );
SendMessageW( hwnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0 );
send_message( hwnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0 );
return;
}
TRACE( "not restoring to max win %p/%lx style %08x\n", data->hwnd, data->whole_window, style );
@ -1312,8 +1312,8 @@ static void handle_wm_state_notify( HWND hwnd, XPropertyEvent *event, BOOL updat
TRACE( "restoring win %p/%lx\n", data->hwnd, data->whole_window );
release_win_data( data );
if ((style & (WS_MINIMIZE | WS_VISIBLE)) == (WS_MINIMIZE | WS_VISIBLE))
SetActiveWindow( hwnd );
SendMessageW( hwnd, WM_SYSCOMMAND, SC_RESTORE, 0 );
NtUserSetActiveWindow( hwnd );
send_message( hwnd, WM_SYSCOMMAND, SC_RESTORE, 0 );
return;
}
TRACE( "not restoring win %p/%lx style %08x\n", data->hwnd, data->whole_window, style );
@ -1326,7 +1326,7 @@ static void handle_wm_state_notify( HWND hwnd, XPropertyEvent *event, BOOL updat
{
TRACE( "minimizing win %p/%lx\n", data->hwnd, data->whole_window );
release_win_data( data );
SendMessageW( hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 0 );
send_message( hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 0 );
return;
}
TRACE( "not minimizing win %p/%lx style %08x\n", data->hwnd, data->whole_window, style );
@ -1430,8 +1430,8 @@ void X11DRV_SetFocus( HWND hwnd )
{
if (!(data = get_win_data( hwnd ))) return;
if (data->embedded) break;
parent = GetAncestor( hwnd, GA_PARENT );
if (!parent || parent == GetDesktopWindow()) break;
parent = NtUserGetAncestor( hwnd, GA_PARENT );
if (!parent || parent == NtUserGetDesktopWindow()) break;
release_win_data( data );
hwnd = parent;
}
@ -1444,21 +1444,22 @@ static HWND find_drop_window( HWND hQueryWnd, LPPOINT lpPt )
{
RECT tempRect;
if (!IsWindowEnabled(hQueryWnd)) return 0;
if (!NtUserIsWindowEnabled(hQueryWnd)) return 0;
GetWindowRect(hQueryWnd, &tempRect);
NtUserGetWindowRect(hQueryWnd, &tempRect);
if(!PtInRect(&tempRect, *lpPt)) return 0;
if (!IsIconic( hQueryWnd ))
if (!(NtUserGetWindowLongW( hQueryWnd, GWL_STYLE ) & WS_MINIMIZE))
{
POINT pt = *lpPt;
ScreenToClient( hQueryWnd, &pt );
GetClientRect( hQueryWnd, &tempRect );
NtUserScreenToClient( hQueryWnd, &pt );
NtUserGetClientRect( hQueryWnd, &tempRect );
if (PtInRect( &tempRect, pt))
{
HWND ret = ChildWindowFromPointEx( hQueryWnd, pt, CWP_SKIPINVISIBLE|CWP_SKIPDISABLED );
HWND ret = NtUserChildWindowFromPointEx( hQueryWnd, pt.x, pt.y,
CWP_SKIPINVISIBLE|CWP_SKIPDISABLED );
if (ret && ret != hQueryWnd)
{
ret = find_drop_window( ret, lpPt );
@ -1467,9 +1468,9 @@ static HWND find_drop_window( HWND hQueryWnd, LPPOINT lpPt )
}
}
if(!(GetWindowLongA( hQueryWnd, GWL_EXSTYLE ) & WS_EX_ACCEPTFILES)) return 0;
if(!(NtUserGetWindowLongW( hQueryWnd, GWL_EXSTYLE ) & WS_EX_ACCEPTFILES)) return 0;
ScreenToClient(hQueryWnd, lpPt);
NtUserScreenToClient( hQueryWnd, lpPt );
return hQueryWnd;
}
@ -1503,7 +1504,7 @@ static void EVENT_DropFromOffiX( HWND hWnd, XClientMessageEvent *event )
/* find out drop point and drop window */
if (pt.x < 0 || pt.y < 0 || pt.x > cx || pt.y > cy)
{
if (!(GetWindowLongW( hWnd, GWL_EXSTYLE ) & WS_EX_ACCEPTFILES)) return;
if (!(NtUserGetWindowLongW( hWnd, GWL_EXSTYLE ) & WS_EX_ACCEPTFILES)) return;
pt.x = pt.y = 0;
}
else
@ -1586,7 +1587,7 @@ static void EVENT_DropURLs( HWND hWnd, XClientMessageEvent *event )
unsigned int u;
} u; /* unused */
if (!(GetWindowLongW( hWnd, GWL_EXSTYLE ) & WS_EX_ACCEPTFILES)) return;
if (!(NtUserGetWindowLongW( hWnd, GWL_EXSTYLE ) & WS_EX_ACCEPTFILES)) return;
XGetWindowProperty( event->display, DefaultRootWindow(event->display),
x11drv_atom(DndSelection), 0, 65535, FALSE,
@ -1704,22 +1705,22 @@ static void handle_xembed_protocol( HWND hwnd, XClientMessageEvent *event )
case XEMBED_WINDOW_DEACTIVATE:
TRACE( "win %p/%lx XEMBED_WINDOW_DEACTIVATE message\n", hwnd, event->window );
focus_out( event->display, GetAncestor( hwnd, GA_ROOT ) );
focus_out( event->display, NtUserGetAncestor( hwnd, GA_ROOT ) );
break;
case XEMBED_FOCUS_OUT:
TRACE( "win %p/%lx XEMBED_FOCUS_OUT message\n", hwnd, event->window );
focus_out( event->display, GetAncestor( hwnd, GA_ROOT ) );
focus_out( event->display, NtUserGetAncestor( hwnd, GA_ROOT ) );
break;
case XEMBED_MODALITY_ON:
TRACE( "win %p/%lx XEMBED_MODALITY_ON message\n", hwnd, event->window );
EnableWindow( hwnd, FALSE );
NtUserEnableWindow( hwnd, FALSE );
break;
case XEMBED_MODALITY_OFF:
TRACE( "win %p/%lx XEMBED_MODALITY_OFF message\n", hwnd, event->window );
EnableWindow( hwnd, TRUE );
NtUserEnableWindow( hwnd, TRUE );
break;
default:

View File

@ -862,6 +862,13 @@ static inline BOOL send_notify_message( HWND hwnd, UINT msg, WPARAM wparam, LPAR
return NtUserMessageCall( hwnd, msg, wparam, lparam, 0, NtUserSendNotifyMessage, FALSE );
}
static inline HWND get_focus(void)
{
GUITHREADINFO info;
info.cbSize = sizeof(info);
return NtUserGetGUIThreadInfo( GetCurrentThreadId(), &info ) ? info.hwndFocus : 0;
}
static inline HWND get_active_window(void)
{
GUITHREADINFO info;