Alexandre Julliard : winex11: Allow changing the clipping rectangle while the mouse is grabbed.
Alexandre Julliard
julliard at winehq.org
Fri Apr 22 12:27:43 CDT 2011
Module: wine
Branch: master
Commit: 33c491eb84cf6907943d39b8a444ebfc1b642e99
URL: http://source.winehq.org/git/wine.git/?a=commit;h=33c491eb84cf6907943d39b8a444ebfc1b642e99
Author: Alexandre Julliard <julliard at winehq.org>
Date: Fri Apr 22 16:58:20 2011 +0200
winex11: Allow changing the clipping rectangle while the mouse is grabbed.
---
dlls/winex11.drv/mouse.c | 29 +++++++++++++++++++----------
dlls/winex11.drv/x11drv.h | 1 +
2 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
index 1b3c15f..b447b7e 100644
--- a/dlls/winex11.drv/mouse.c
+++ b/dlls/winex11.drv/mouse.c
@@ -376,6 +376,8 @@ static HWND create_clipping_msg_window(void)
*/
LRESULT clip_cursor_notify( HWND hwnd, HWND new_clip_hwnd )
{
+ struct x11drv_thread_data *data = x11drv_thread_data();
+
if (hwnd == GetDesktopWindow()) /* change the clip window stored in the desktop process */
{
static HWND clip_hwnd;
@@ -385,8 +387,9 @@ LRESULT clip_cursor_notify( HWND hwnd, HWND new_clip_hwnd )
if (prev || new_clip_hwnd) TRACE( "clip hwnd changed from %p to %p\n", prev, new_clip_hwnd );
if (prev) SendNotifyMessageW( prev, WM_X11DRV_CLIP_CURSOR, 0, 0 );
}
- else /* this is a notification that clipping has been reset */
+ else if (hwnd == data->clip_hwnd) /* this is a notification that clipping has been reset */
{
+ data->clip_hwnd = 0;
disable_xinput2();
DestroyWindow( hwnd );
}
@@ -402,19 +405,21 @@ static BOOL grab_clipping_window( const RECT *clip )
{
struct x11drv_thread_data *data = x11drv_init_thread_data();
Window clip_window = init_clip_window();
- HWND msg_hwnd;
+ HWND msg_hwnd = 0;
if (!clip_window) return TRUE;
- if (!(msg_hwnd = create_clipping_msg_window())) return TRUE;
+ /* create a clip message window unless we are already clipping */
+ if (!data->clip_hwnd && !(msg_hwnd = create_clipping_msg_window())) return TRUE;
TRACE( "clipping to %s\n", wine_dbgstr_rect(clip) );
+
wine_tsx11_lock();
- XUnmapWindow( data->display, clip_window );
+ if (msg_hwnd) XUnmapWindow( data->display, clip_window );
XMoveResizeWindow( data->display, clip_window,
clip->left - virtual_screen_rect.left, clip->top - virtual_screen_rect.top,
clip->right - clip->left, clip->bottom - clip->top );
- XMapWindow( data->display, clip_window );
+ if (msg_hwnd) XMapWindow( data->display, clip_window );
if (!XGrabPointer( data->display, clip_window, False,
PointerMotionMask | ButtonPressMask | ButtonReleaseMask,
GrabModeAsync, GrabModeAsync, clip_window, None, CurrentTime ))
@@ -423,13 +428,17 @@ static BOOL grab_clipping_window( const RECT *clip )
if (!clipping_cursor)
{
- DestroyWindow( msg_hwnd );
+ if (msg_hwnd) DestroyWindow( msg_hwnd );
return FALSE;
}
- enable_xinput2();
- sync_window_cursor( clip_window );
- clip_rect = *clip;
- SendMessageW( GetDesktopWindow(), WM_X11DRV_CLIP_CURSOR, 0, (LPARAM)msg_hwnd );
+ if (msg_hwnd)
+ {
+ data->clip_hwnd = msg_hwnd;
+ enable_xinput2();
+ sync_window_cursor( clip_window );
+ clip_rect = *clip;
+ SendMessageW( GetDesktopWindow(), WM_X11DRV_CLIP_CURSOR, 0, (LPARAM)msg_hwnd );
+ }
return TRUE;
}
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index 2187d72..48394ac 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -551,6 +551,7 @@ struct x11drv_thread_data
XFontSet font_set; /* international text drawing font set */
Window selection_wnd; /* window used for selection interactions */
Window clip_window; /* window used for cursor clipping */
+ HWND clip_hwnd; /* message window stored in desktop while clipping is active */
HKL kbd_layout; /* active keyboard layout */
enum { xi_unavailable = -1, xi_unknown, xi_disabled, xi_enabled } xi2_state; /* XInput2 state */
};
More information about the wine-cvs
mailing list