# HG changeset patch # User ib # Date 1317483124 0 # Node ID 0a44fc1d4e72e7b464dd356ee6d3b6f97074985f # Parent 9e90daeb37d4306614bfc6fe6babc1185762a699 Simplify wsAutohideCursor(). Use window pointer as the flag. This enables omitting the parameter to the function and doesn't require a special note on the usage, because misuse isn't possible any longer. diff -r 9e90daeb37d4 -r 0a44fc1d4e72 gui/interface.c --- a/gui/interface.c Sat Oct 01 15:12:54 2011 +0000 +++ b/gui/interface.c Sat Oct 01 15:32:04 2011 +0000 @@ -350,7 +350,7 @@ case GUI_HANDLE_EVENTS: if (!guiInfo.Playing || !guiInfo.VideoWindow) wsHandleEvents(); - wsAutohideCursor(&guiApp.subWindow); + wsAutohideCursor(); gtkEventHandling(); break; diff -r 9e90daeb37d4 -r 0a44fc1d4e72 gui/wm/ws.c --- a/gui/wm/ws.c Sat Oct 01 15:12:54 2011 +0000 +++ b/gui/wm/ws.c Sat Oct 01 15:32:04 2011 +0000 @@ -68,7 +68,7 @@ #define MOUSEHIDE_DELAY 1000 // in milliseconds -static Bool mouse_hide; +static wsTWindow *mouse_win; static unsigned int mouse_time; typedef struct { @@ -644,16 +644,12 @@ /** * @brief Handle automatic hiding of the cursor. - * - * @param win pointer to a ws window structure - * - * @note Only one window will be handled at a time. */ -void wsAutohideCursor(wsTWindow *win) +void wsAutohideCursor(void) { - if (mouse_hide && (GetTimerMS() - mouse_time >= MOUSEHIDE_DELAY)) { - wsVisibleMouse(win, wsHideMouseCursor); - mouse_hide = False; + if (mouse_win && (GetTimerMS() - mouse_time >= MOUSEHIDE_DELAY)) { + wsVisibleMouse(mouse_win, wsHideMouseCursor); + mouse_win = NULL; } } @@ -862,7 +858,7 @@ } if (wsWindowList[l]->wsCursor != None) { wsVisibleMouse(wsWindowList[l], wsShowMouseCursor); - mouse_hide = True; + mouse_win = wsWindowList[l]; mouse_time = GetTimerMS(); } goto buttonreleased; @@ -871,7 +867,7 @@ i = Event->xbutton.button + 128; if (wsWindowList[l]->wsCursor != None) { wsVisibleMouse(wsWindowList[l], wsShowMouseCursor); - mouse_hide = True; + mouse_win = wsWindowList[l]; mouse_time = GetTimerMS(); } goto buttonreleased; @@ -880,7 +876,7 @@ i = Event->xbutton.button; if (wsWindowList[l]->wsCursor != None) { wsVisibleMouse(wsWindowList[l], wsShowMouseCursor); - mouse_hide = True; + mouse_win = wsWindowList[l]; mouse_time = GetTimerMS(); } goto buttonreleased; diff -r 9e90daeb37d4 -r 0a44fc1d4e72 gui/wm/ws.h --- a/gui/wm/ws.h Sat Oct 01 15:12:54 2011 +0000 +++ b/gui/wm/ws.h Sat Oct 01 15:32:04 2011 +0000 @@ -216,7 +216,7 @@ void wsDoExit(void); void wsMainLoop(void); -void wsAutohideCursor(wsTWindow *win); +void wsAutohideCursor(void); Bool wsEvents(Display *display, XEvent *Event); void wsHandleEvents(void);