# HG changeset patch # User ib # Date 1316611562 0 # Node ID 395a736cd07581b3ba98116f94115a02ec4f5ab8 # Parent afb361a00e1f521987e73b0fdf8099945ee52282 Add cursor autohide functionality to the GUI. Utilize the code from x11_common. diff -r afb361a00e1f -r 395a736cd075 gui/wm/ws.c --- a/gui/wm/ws.c Wed Sep 21 13:20:12 2011 +0000 +++ b/gui/wm/ws.c Wed Sep 21 13:26:02 2011 +0000 @@ -46,6 +46,7 @@ #include "help_mp.h" #include "mplayer.h" #include "mpbswap.h" +#include "osdep/timer.h" #include "ws.h" #include "wsxdnd.h" @@ -642,6 +643,8 @@ Bool wsEvents(Display *display, XEvent *Event) { + static Bool mouse_hide; + static unsigned int mouse_time; unsigned long i = 0; int l; int x, y; @@ -654,6 +657,11 @@ wsWindowList[l]->State = 0; + if (mouse_hide && (GetTimerMS() - mouse_time >= 1000)) { + wsVisibleMouse(wsWindowList[l], wsHideMouseCursor); + mouse_hide = False; + } + switch (Event->type) { case ClientMessage: @@ -839,14 +847,23 @@ } } } + wsVisibleMouse(wsWindowList[l], wsShowMouseCursor); + mouse_hide = True; + mouse_time = GetTimerMS(); goto buttonreleased; case ButtonRelease: i = Event->xbutton.button + 128; + wsVisibleMouse(wsWindowList[l], wsShowMouseCursor); + mouse_hide = True; + mouse_time = GetTimerMS(); goto buttonreleased; case ButtonPress: i = Event->xbutton.button; + wsVisibleMouse(wsWindowList[l], wsShowMouseCursor); + mouse_hide = True; + mouse_time = GetTimerMS(); goto buttonreleased; case EnterNotify: