summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Gui/mplayer/mw.c3
-rw-r--r--libvo/video_out.h1
-rw-r--r--libvo/x11_common.c18
-rw-r--r--libvo/x11_common.h1
-rw-r--r--mplayer.c18
-rw-r--r--mplayer.h2
6 files changed, 22 insertions, 21 deletions
diff --git a/Gui/mplayer/mw.c b/Gui/mplayer/mw.c
index 77f30c4c9c..9c2062116e 100644
--- a/Gui/mplayer/mw.c
+++ b/Gui/mplayer/mw.c
@@ -78,7 +78,6 @@ void mplMainDraw( void )
extern void exit_player(char* how);
extern int vcd_track;
-extern int osd_visible;
static unsigned last_redraw_time = 0;
void mplEventHandling( int msg,float param )
@@ -271,7 +270,7 @@ set_volume:
#ifdef USE_OSD
if ( osd_level )
{
- osd_visible=vo_mouse_timer_const;
+ osd_visible=(GetTimerMS() + 1000) | 1;
vo_osd_progbar_type=OSD_VOLUME;
vo_osd_progbar_value=( ( guiIntfStruct.Volume ) * 256.0 ) / 100.0;
vo_osd_changed( OSDTYPE_PROGBAR );
diff --git a/libvo/video_out.h b/libvo/video_out.h
index 49f5e2af75..369aa32fc8 100644
--- a/libvo/video_out.h
+++ b/libvo/video_out.h
@@ -217,7 +217,6 @@ extern int vo_gamma_red_intensity;
extern int vo_gamma_green_intensity;
extern int vo_gamma_blue_intensity;
-extern int vo_mouse_timer_const;
extern int vo_nomouse_input;
extern int vo_pts;
diff --git a/libvo/x11_common.c b/libvo/x11_common.c
index 19e9a43596..96cdc05b39 100644
--- a/libvo/x11_common.c
+++ b/libvo/x11_common.c
@@ -1001,8 +1001,8 @@ void vo_x11_uninit(void)
}
}
-int vo_mouse_timer_const = 30;
-static int vo_mouse_counter = 30;
+static unsigned int mouse_timer;
+static int mouse_waiting_hide;
int vo_x11_check_events(Display * mydisplay)
{
@@ -1014,8 +1014,11 @@ int vo_x11_check_events(Display * mydisplay)
// unsigned long vo_KeyTable[512];
- if ((vo_mouse_autohide) && (--vo_mouse_counter == 0))
+ if ((vo_mouse_autohide) && mouse_waiting_hide &&
+ (GetTimerMS() - mouse_timer >= 1000)) {
vo_hidecursor(mydisplay, vo_window);
+ mouse_waiting_hide = 0;
+ }
while (XPending(mydisplay))
{
@@ -1084,14 +1087,16 @@ int vo_x11_check_events(Display * mydisplay)
if (vo_mouse_autohide)
{
vo_showcursor(mydisplay, vo_window);
- vo_mouse_counter = vo_mouse_timer_const;
+ mouse_waiting_hide = 1;
+ mouse_timer = GetTimerMS();
}
break;
case ButtonPress:
if (vo_mouse_autohide)
{
vo_showcursor(mydisplay, vo_window);
- vo_mouse_counter = vo_mouse_timer_const;
+ mouse_waiting_hide = 1;
+ mouse_timer = GetTimerMS();
}
// Ignore mouse whell press event
if (Event.xbutton.button > 3)
@@ -1112,7 +1117,8 @@ int vo_x11_check_events(Display * mydisplay)
if (vo_mouse_autohide)
{
vo_showcursor(mydisplay, vo_window);
- vo_mouse_counter = vo_mouse_timer_const;
+ mouse_waiting_hide = 1;
+ mouse_timer = GetTimerMS();
}
#ifdef HAVE_NEW_GUI
// Ignor mouse button 1 - 3 under gui
diff --git a/libvo/x11_common.h b/libvo/x11_common.h
index a8e0310045..2e9e575486 100644
--- a/libvo/x11_common.h
+++ b/libvo/x11_common.h
@@ -33,7 +33,6 @@ extern Window mRootWin;
extern int mScreen;
extern int mLocalDisplay;
-extern int vo_mouse_timer_const;
extern int vo_mouse_autohide;
extern int vo_init( void );
diff --git a/mplayer.c b/mplayer.c
index 79dc6079f0..62a15a2b87 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -239,7 +239,8 @@ static int list_properties = 0;
int osd_level=1;
int osd_level_saved=-1;
-int osd_visible=100;
+// if nonzero, hide current OSD contents when GetTimerMS() reaches this
+unsigned int osd_visible;
static int osd_function=OSD_PLAY;
static int osd_show_percentage = 0;
static int osd_duration = 1000;
@@ -1229,7 +1230,7 @@ void set_osd_bar(int type,char* name,double min,double max,double val) {
#ifdef USE_OSD
if(sh_video) {
- osd_visible = sh_video->fps;
+ osd_visible = (GetTimerMS() + 1000) | 1;
vo_osd_progbar_type = type;
vo_osd_progbar_value = 256*(val-min)/(max-min);
vo_osd_changed(OSDTYPE_PROGBAR);
@@ -3195,9 +3196,6 @@ if(sh_video){
sh_video->frametime=1.0f/sh_video->fps;
}
vo_fps = sh_video->fps;
-#ifdef HAVE_X11
- vo_mouse_timer_const=(int)sh_video->fps;
-#endif
if(!sh_video->fps && !force_fps){
mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_FPSnotspecified);
@@ -3725,9 +3723,6 @@ if(!sh_video) {
time_frame+=frame_time; // for nosound
// video_read_frame can change fps (e.g. for asf video)
vo_fps = sh_video->fps;
-#ifdef HAVE_X11
- vo_mouse_timer_const = (int)sh_video->fps;
-#endif
// check for frame-drop:
current_module="check_framedrop";
if(sh_audio && !d_audio->eof){
@@ -4056,7 +4051,10 @@ if(auto_quality>0){
#ifdef USE_OSD
if(osd_visible){
- if (!--osd_visible){
+ // 36000000 means max timed visibility is 1 hour into the future, if
+ // the difference is greater assume it's wrapped around from below 0
+ if (osd_visible - GetTimerMS() > 36000000) {
+ osd_visible = 0;
vo_osd_progbar_type=-1; // disable
vo_osd_changed(OSDTYPE_PROGBAR);
if (osd_function != OSD_PAUSE)
@@ -4929,7 +4927,7 @@ if(rel_seek_secs || abs_seek_pos){
if(sh_video) {
c_total=0;
max_pts_correction=0.1;
- osd_visible=sh_video->fps; // to rewert to PLAY pointer after 1 sec
+ osd_visible=(GetTimerMS() + 1000) | 1; // to revert to PLAY pointer after 1 sec
audio_time_usage=0; video_time_usage=0; vout_time_usage=0;
drop_frame_cnt=0;
too_slow_frame_cnt=0;
diff --git a/mplayer.h b/mplayer.h
index 3719e0efc9..2f2bc86495 100644
--- a/mplayer.h
+++ b/mplayer.h
@@ -20,7 +20,7 @@ extern char * audio_driver;
extern float audio_delay;
extern int osd_level;
-extern int osd_visible;
+extern unsigned int osd_visible;
extern char * font_name;
extern float font_factor;