summaryrefslogtreecommitdiffstats
path: root/libvo/x11_common.c
diff options
context:
space:
mode:
authorStefano Pigozzi <stefano.pigozzi@gmail.com>2011-12-08 11:17:59 +0100
committerUoti Urpala <uau@mplayer2.org>2012-03-25 22:30:37 +0300
commit495dde4018e071f81462052d5b4c09c973f25f16 (patch)
tree9601e9ff288c8f4305c1dd16ce4aaa43ea596ac6 /libvo/x11_common.c
parentf30bf73bf22ed054233507d7277e3658e51d86bd (diff)
downloadmpv-495dde4018e071f81462052d5b4c09c973f25f16.tar.bz2
mpv-495dde4018e071f81462052d5b4c09c973f25f16.tar.xz
options, x11+cocoa: add option --cursor-autohide-delay
Add option --cursor-autohide-delay to control the number of milliseconds with no user interaction before the mouse cursor is hidden. There are two negative values with useful special meanings: * A value of -1 prevents the cursor from hiding (useful for users with multiple displays). * A value of -2 prevents the cursor from showing upon activity. The default is 1 second to keep the behaviour consistent with the past X11 backend implementation. Remove the vo_mouse_autohide field as it was always true.
Diffstat (limited to 'libvo/x11_common.c')
-rw-r--r--libvo/x11_common.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/libvo/x11_common.c b/libvo/x11_common.c
index d5af7a41ab..ee50ba5575 100644
--- a/libvo/x11_common.c
+++ b/libvo/x11_common.c
@@ -780,12 +780,13 @@ static int check_resize(struct vo *vo)
int vo_x11_check_events(struct vo *vo)
{
struct vo_x11_state *x11 = vo->x11;
+ struct MPOpts *opts = vo->opts;
Display *display = vo->x11->display;
int ret = 0;
XEvent Event;
- if (x11->vo_mouse_autohide && x11->mouse_waiting_hide &&
- (GetTimerMS() - x11->mouse_timer >= 1000)) {
+ if (x11->mouse_waiting_hide && opts->cursor_autohide_delay != -1 &&
+ (GetTimerMS() - x11->mouse_timer >= opts->cursor_autohide_delay)) {
vo_hidecursor(display, x11->window);
x11->mouse_waiting_hide = 0;
}
@@ -846,16 +847,14 @@ int vo_x11_check_events(struct vo *vo)
case MotionNotify:
vo_mouse_movement(vo, Event.xmotion.x, Event.xmotion.y);
- if (x11->vo_mouse_autohide)
- {
+ if (opts->cursor_autohide_delay > -2) {
vo_showcursor(display, x11->window);
x11->mouse_waiting_hide = 1;
x11->mouse_timer = GetTimerMS();
}
break;
case ButtonPress:
- if (x11->vo_mouse_autohide)
- {
+ if (opts->cursor_autohide_delay > -2) {
vo_showcursor(display, x11->window);
x11->mouse_waiting_hide = 1;
x11->mouse_timer = GetTimerMS();
@@ -865,8 +864,7 @@ int vo_x11_check_events(struct vo *vo)
| MP_KEY_DOWN);
break;
case ButtonRelease:
- if (x11->vo_mouse_autohide)
- {
+ if (opts->cursor_autohide_delay > -2) {
vo_showcursor(display, x11->window);
x11->mouse_waiting_hide = 1;
x11->mouse_timer = GetTimerMS();
@@ -1176,7 +1174,6 @@ final:
x11->vo_gc = XCreateGC(mDisplay, x11->window, 0, NULL);
XSync(mDisplay, False);
- x11->vo_mouse_autohide = 1;
vo->event_fd = ConnectionNumber(x11->display);
}