From: Olaf Wintermann Date: Sun, 16 Jan 2022 10:25:15 +0000 (+0100) Subject: enable/disable fullscreen with double click X-Git-Url: https://uap-core.de/gitweb/?a=commitdiff_plain;h=dc6deecb9155cc8e90d28bb90c66d58c8ae2b93e;p=uwplayer.git enable/disable fullscreen with double click --- diff --git a/application/window.c b/application/window.c index fe81481..17bda64 100644 --- a/application/window.c +++ b/application/window.c @@ -168,6 +168,8 @@ static void playerEH(Widget widget, XtPointer data, XEvent *event, Boolean *disp #define IGNORE_MOTION_THRESHOLD_MS 1000 #define MOTION_POS_THRESHOLD_PIX 5 +#define DOUBLE_CLICK_TIME_MS 500 + void WindowHandlePlayerEvent(MainWindow *win, XEvent *event) { // event handler for intercepted player mouse events // win->player is not NULL @@ -191,7 +193,14 @@ void WindowHandlePlayerEvent(MainWindow *win, XEvent *event) { win->player_event_time = cur_motion_time; win->motion_playback_time = win->player->playback_time; } else if(etype == ButtonPress) { - win->player_event_time = event->xbutton.time; + Time t = event->xbutton.time; + if(t - win->button_press_time < DOUBLE_CLICK_TIME_MS) { + // double click + WindowFullscreen(main_window, !win->fullscreen); + win->button_press_time = 0; + } else { + win->button_press_time = t; + } } else if(etype == ButtonRelease) { win->player_event_time = event->xbutton.time; } @@ -533,7 +542,7 @@ void WindowHidePlayerCursor(MainWindow *win) { void WindowShowPlayerCursor(MainWindow *win) { if(win->cursorhidden && win->player && win->player->window != 0) { XDefineCursor(XtDisplay(win->player_widget), XtWindow(win->player_widget), None); - win->cursorhidden = False; XFlush(XtDisplay(win->player_widget)); } + win->cursorhidden = False; }