Alexandre Julliard : winex11: Update the cursor on the clipping window while it's mapped.
Alexandre Julliard
julliard at winehq.org
Tue Apr 5 11:23:31 CDT 2011
Module: wine
Branch: master
Commit: ecf217bbe4617cec454e055fa6b163bc9cc64563
URL: http://source.winehq.org/git/wine.git/?a=commit;h=ecf217bbe4617cec454e055fa6b163bc9cc64563
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Apr 4 15:20:14 2011 +0200
winex11: Update the cursor on the clipping window while it's mapped.
---
dlls/winex11.drv/event.c | 17 ++++++++++++++++-
dlls/winex11.drv/mouse.c | 10 +++++++---
dlls/winex11.drv/window.c | 1 +
dlls/winex11.drv/x11drv.h | 1 +
4 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c
index 6e4225c..ba5cdff 100644
--- a/dlls/winex11.drv/event.c
+++ b/dlls/winex11.drv/event.c
@@ -91,6 +91,7 @@ static void X11DRV_FocusIn( HWND hwnd, XEvent *event );
static void X11DRV_FocusOut( HWND hwnd, XEvent *event );
static void X11DRV_Expose( HWND hwnd, XEvent *event );
static void X11DRV_MapNotify( HWND hwnd, XEvent *event );
+static void X11DRV_UnmapNotify( HWND hwnd, XEvent *event );
static void X11DRV_ReparentNotify( HWND hwnd, XEvent *event );
static void X11DRV_ConfigureNotify( HWND hwnd, XEvent *event );
static void X11DRV_PropertyNotify( HWND hwnd, XEvent *event );
@@ -124,7 +125,7 @@ static struct event_handler handlers[MAX_EVENT_HANDLERS] =
/* VisibilityNotify */
/* CreateNotify */
{ DestroyNotify, X11DRV_DestroyNotify },
- /* UnmapNotify */
+ { UnmapNotify, X11DRV_UnmapNotify },
{ MapNotify, X11DRV_MapNotify },
/* MapRequest */
{ ReparentNotify, X11DRV_ReparentNotify },
@@ -801,6 +802,11 @@ static void X11DRV_MapNotify( HWND hwnd, XEvent *event )
{
struct x11drv_win_data *data;
+ if (event->xany.window == clip_window)
+ {
+ clipping_cursor = 1;
+ return;
+ }
if (!(data = X11DRV_get_win_data( hwnd ))) return;
if (!data->mapped || data->embedded) return;
@@ -812,6 +818,15 @@ static void X11DRV_MapNotify( HWND hwnd, XEvent *event )
}
+/**********************************************************************
+ * X11DRV_UnmapNotify
+ */
+static void X11DRV_UnmapNotify( HWND hwnd, XEvent *event )
+{
+ if (event->xany.window == clip_window) clipping_cursor = 0;
+}
+
+
/***********************************************************************
* is_net_wm_state_maximized
*/
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
index 63773ce..e7e8d62 100644
--- a/dlls/winex11.drv/mouse.c
+++ b/dlls/winex11.drv/mouse.c
@@ -884,7 +884,8 @@ void CDECL X11DRV_SetCursor( HCURSOR handle )
GetTickCount() - last_cursor_change > 100)
{
last_cursor_change = GetTickCount();
- if (cursor_window) SendNotifyMessageW( cursor_window, WM_X11DRV_SET_CURSOR, 0, (LPARAM)handle );
+ if (clipping_cursor) set_window_cursor( clip_window, handle );
+ else if (cursor_window) SendNotifyMessageW( cursor_window, WM_X11DRV_SET_CURSOR, 0, (LPARAM)handle );
}
}
@@ -958,12 +959,14 @@ BOOL CDECL X11DRV_ClipCursor( LPCRECT clip )
if (!XGrabPointer( display, clip_window, False,
PointerMotionMask | ButtonPressMask | ButtonReleaseMask,
GrabModeAsync, GrabModeAsync, clip_window, None, CurrentTime ))
+ clipping_cursor = 1;
+ wine_tsx11_unlock();
+
+ if (clipping_cursor)
{
- wine_tsx11_unlock();
clip_rect = *clip;
return TRUE;
}
- wine_tsx11_unlock();
}
}
@@ -972,6 +975,7 @@ BOOL CDECL X11DRV_ClipCursor( LPCRECT clip )
wine_tsx11_lock();
XUnmapWindow( display, clip_window );
wine_tsx11_unlock();
+ clipping_cursor = 0;
return TRUE;
}
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index 21c8352..e35547a 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -70,6 +70,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(x11drv);
/* cursor clipping window */
Window clip_window = 0;
+int clipping_cursor = 0;
/* X context to associate a hwnd to an X window */
XContext winContext = 0;
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index 26375fd..986d03a 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -586,6 +586,7 @@ static inline size_t get_property_size( int format, unsigned long count )
extern Visual *visual;
extern Window root_window;
extern Window clip_window;
+extern int clipping_cursor;
extern unsigned int screen_width;
extern unsigned int screen_height;
extern unsigned int screen_bpp;
More information about the wine-cvs
mailing list