From a7617a05d1d01772c9024768a5d4da6640c61d3d Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Sun, 13 Jun 1999 08:35:26 +0000 Subject: [PATCH] Bugfix: DISPLAY_SetCursor should not use USER-internals, as it is also used with native USER ... --- windows/x11drv/mouse.c | 59 +++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/windows/x11drv/mouse.c b/windows/x11drv/mouse.c index 27093df2443..51953eb516f 100644 --- a/windows/x11drv/mouse.c +++ b/windows/x11drv/mouse.c @@ -33,7 +33,6 @@ static BOOL X11DRV_MOUSE_DoSetCursor( CURSORICONINFO *ptr ) Pixmap pixmapBits, pixmapMask, pixmapAll; XColor fg, bg; Cursor cursor = None; - BOOL DesktopWinExists = FALSE; if (!ptr) /* Create an empty cursor */ { @@ -144,32 +143,6 @@ static BOOL X11DRV_MOUSE_DoSetCursor( CURSORICONINFO *ptr ) if (X11DRV_MOUSE_XCursor != None) XFreeCursor( display, X11DRV_MOUSE_XCursor ); X11DRV_MOUSE_XCursor = cursor; - if (WIN_GetDesktop() != NULL) - { - DesktopWinExists = TRUE; - WIN_ReleaseDesktop(); - } - if (X11DRV_GetXRootWindow() != DefaultRootWindow(display) || !DesktopWinExists) - { - /* Set the cursor on the desktop window */ - XDefineCursor( display, X11DRV_GetXRootWindow(), cursor ); - } - else - { - /* FIXME: this won't work correctly with native USER !*/ - - /* Set the same cursor for all top-level windows */ - HWND hwnd = GetWindow( GetDesktopWindow(), GW_CHILD ); - while(hwnd) - { - WND *tmpWnd = WIN_FindWndPtr(hwnd); - Window win = X11DRV_WND_FindXWindow(tmpWnd ); - if (win && win!=DefaultRootWindow(display)) - XDefineCursor( display, win, cursor ); - hwnd = GetWindow( hwnd, GW_HWNDNEXT ); - WIN_ReleaseWndPtr(tmpWnd); - } - } return TRUE; } @@ -178,11 +151,37 @@ static BOOL X11DRV_MOUSE_DoSetCursor( CURSORICONINFO *ptr ) */ void X11DRV_MOUSE_SetCursor( CURSORICONINFO *lpCursor ) { - WIN_LockWnds(); + BOOL success; + EnterCriticalSection( &X11DRV_CritSection ); - CALL_LARGE_STACK( X11DRV_MOUSE_DoSetCursor, lpCursor ); + success = CALL_LARGE_STACK( X11DRV_MOUSE_DoSetCursor, lpCursor ); LeaveCriticalSection( &X11DRV_CritSection ); - WIN_UnlockWnds(); + if ( !success ) return; + + if (X11DRV_GetXRootWindow() != DefaultRootWindow(display)) + { + /* If in desktop mode, set the cursor on the desktop window */ + + XDefineCursor( display, X11DRV_GetXRootWindow(), X11DRV_MOUSE_XCursor ); + } + else + { + /* Else, set the same cursor for all top-level windows */ + + /* FIXME: we should not reference USER internals here, but native USER + works only in desktop mode anyway, so this should not matter */ + + HWND hwnd = GetWindow( GetDesktopWindow(), GW_CHILD ); + while(hwnd) + { + WND *tmpWnd = WIN_FindWndPtr(hwnd); + Window win = X11DRV_WND_FindXWindow(tmpWnd ); + if (win && win!=DefaultRootWindow(display)) + XDefineCursor( display, win, X11DRV_MOUSE_XCursor ); + hwnd = GetWindow( hwnd, GW_HWNDNEXT ); + WIN_ReleaseWndPtr(tmpWnd); + } + } } /***********************************************************************