Commit 89415925 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

winex11: Don't grab the cursor if another process is focused.

This might be the case when in virtual desktop mode for instance, where we don't change Wine foreground window when the virtual desktop is focused out. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55046
parent b3c1bd33
......@@ -746,6 +746,18 @@ static const char * const focus_modes[] =
"NotifyWhileGrabbed"
};
BOOL is_current_process_focused(void)
{
Display *display = x11drv_thread_data()->display;
Window focus;
int revert;
HWND hwnd;
XGetInputFocus( display, &focus, &revert );
if (focus && !XFindContext( display, focus, winContext, (char **)&hwnd )) return TRUE;
return FALSE;
}
/**********************************************************************
* X11DRV_FocusIn
*/
......@@ -799,10 +811,6 @@ static BOOL X11DRV_FocusIn( HWND hwnd, XEvent *xev )
*/
static void focus_out( Display *display , HWND hwnd )
{
HWND hwnd_tmp;
Window focus_win;
int revert;
if (xim_in_compose_mode()) return;
x11drv_thread_data()->last_focus = hwnd;
......@@ -820,14 +828,7 @@ static void focus_out( Display *display , HWND hwnd )
/* don't reset the foreground window, if the window which is
getting the focus is a Wine window */
XGetInputFocus( display, &focus_win, &revert );
if (focus_win)
{
if (XFindContext( display, focus_win, winContext, (char **)&hwnd_tmp ) != 0)
focus_win = 0;
}
if (!focus_win)
if (!is_current_process_focused())
{
/* Abey : 6-Oct-99. Check again if the focus out window is the
Foreground window, because in most cases the messages sent
......
......@@ -359,8 +359,10 @@ static BOOL grab_clipping_window( const RECT *clip )
HCURSOR cursor;
POINT pos;
if (NtUserGetWindowThread( NtUserGetDesktopWindow(), NULL ) == GetCurrentThreadId())
return TRUE; /* don't clip in the desktop process */
/* don't clip in the desktop process */
if (NtUserGetWindowThread( NtUserGetDesktopWindow(), NULL ) == GetCurrentThreadId()) return TRUE;
/* don't clip the cursor if the X input focus is on another process window */
if (!is_current_process_focused()) return TRUE;
if (!data) return FALSE;
if (!(clip_window = init_clip_window())) return TRUE;
......
......@@ -676,6 +676,7 @@ extern XContext winContext DECLSPEC_HIDDEN;
/* X context to associate an X cursor to a Win32 cursor handle */
extern XContext cursor_context DECLSPEC_HIDDEN;
extern BOOL is_current_process_focused(void) DECLSPEC_HIDDEN;
extern void X11DRV_SetFocus( HWND hwnd ) DECLSPEC_HIDDEN;
extern void set_window_cursor( Window window, HCURSOR handle ) DECLSPEC_HIDDEN;
extern void retry_grab_clipping_window(void) DECLSPEC_HIDDEN;
......
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