[MPlayer-dev-eng] [PATCH] GUI cursor control
Alexander Strasser
eclipse7 at gmx.net
Thu Sep 8 19:25:53 CEST 2011
Hi
Ingo Brückl wrote:
> Reimar Döffinger wrote on Wed, 7 Sep 2011 18:11:43 +0200:
[...]
> > Otherwise that seems like a fine solution to me...
>
> I revised it and post it again for final approval.
> Index: libvo/x11_common.c
> ===================================================================
> --- libvo/x11_common.c (revision 34077)
> +++ libvo/x11_common.c (working copy)
> @@ -790,9 +790,6 @@
> }
> }
>
> -static unsigned int mouse_timer;
> -static int mouse_waiting_hide;
> -
> static int check_resize(void)
> {
> int old_w = vo_dwidth, old_h = vo_dheight;
> @@ -806,6 +803,22 @@
> return rc;
> }
>
> +void vo_x11_handle_autohide_cursor(Display * mydisplay, int show)
> +{
> + static unsigned int mouse_timer;
> + static int mouse_waiting_hide;
> +
> + if (show) {
> + vo_showcursor(mydisplay, vo_window);
> + mouse_waiting_hide = 1;
> + mouse_timer = GetTimerMS();
> + }
> + else if (mouse_waiting_hide && (GetTimerMS() - mouse_timer >= 1000)) {
> + vo_hidecursor(mydisplay, vo_window);
> + mouse_waiting_hide = 0;
> + }
> +}
It could probably be made to not actually hide/show the cursor and
instead leave that to the calling code. But if you don't need that
level of control I am in favor of this solution.
[...]
> +void vo_x11_handle_autohide_cursor(Display * mydisplay, int show);
Small nit: I generally don't like parameter names like mysomething,
so if you could name it dpy I would be thankful.
The patch looks good otherwise.
[...]
Greetings,
Alexander
More information about the MPlayer-dev-eng
mailing list