summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpontscho <pontscho@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-04-16 17:41:29 +0000
committerpontscho <pontscho@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-04-16 17:41:29 +0000
commitda6135b983a530787ac61b8ff01a6aab54918fcb (patch)
tree82c61b32480be6302fbb6fbd86671c868bbc3f32
parentf974b8e83f90d1288d47ff4e0317abcc3a4fc31b (diff)
downloadmpv-da6135b983a530787ac61b8ff01a6aab54918fcb.tar.bz2
mpv-da6135b983a530787ac61b8ff01a6aab54918fcb.tar.xz
fix playlist bug with gui and rewrite mousecursor show/hide code
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@5652 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--Gui/mplayer/mplayer.c4
-rw-r--r--Gui/mplayer/mw.h5
-rw-r--r--Gui/mplayer/sw.h5
-rw-r--r--libvo/video_out.h2
-rw-r--r--libvo/vo_gl.c2
-rw-r--r--libvo/vo_gl2.c2
-rw-r--r--libvo/vo_x11.c2
-rw-r--r--libvo/vo_xmga.c4
-rw-r--r--libvo/vo_xv.c2
-rw-r--r--libvo/vo_xvidix.c2
-rw-r--r--libvo/x11_common.c14
-rw-r--r--libvo/x11_common.h3
-rw-r--r--mplayer.c23
-rw-r--r--playtree.c3
14 files changed, 41 insertions, 32 deletions
diff --git a/Gui/mplayer/mplayer.c b/Gui/mplayer/mplayer.c
index 0cecbc3b4f..64ef18bca9 100644
--- a/Gui/mplayer/mplayer.c
+++ b/Gui/mplayer/mplayer.c
@@ -21,10 +21,8 @@
#include "../../libmpdemux/stream.h"
#include "../../mp_msg.h"
-#define mplMouseTimerConst 10
#define mplRedrawTimerConst 5
-int mplMouseTimer = mplMouseTimerConst;
int mplRedrawTimer = mplRedrawTimerConst;
int mplTimer = 0;
@@ -40,9 +38,7 @@ void mplEventHandling( int msg,float param );
void mplTimerHandler( void )
{
mplTimer++;
- mplMouseTimer--;
mplRedrawTimer--;
- if ( mplMouseTimer == 0 ) mplEventHandling( evHideMouseCursor,0 );
if ( mplRedrawTimer == 0 ) mplEventHandling( evRedraw,0 );
}
diff --git a/Gui/mplayer/mw.h b/Gui/mplayer/mw.h
index c57e812e50..9f334dd2a2 100644
--- a/Gui/mplayer/mw.h
+++ b/Gui/mplayer/mw.h
@@ -387,9 +387,6 @@ NoPause:
break;
// --- timer events
- case evHideMouseCursor:
- wsVisibleMouse( &appMPlayer.subWindow,wsHideMouseCursor );
- break;
case evRedraw:
mplMainRender=1;
wsPostRedisplay( &appMPlayer.mainWindow );
@@ -419,8 +416,6 @@ void mplMainMouseHandle( int Button,int X,int Y,int RX,int RY )
static int SelectedItem = -1;
int currentselected = -1;
- wsVisibleMouse( &appMPlayer.subWindow,wsShowMouseCursor );
-
for ( i=0;i < appMPlayer.NumberOfItems + 1;i++ )
if ( ( appMPlayer.Items[i].pressed != btnDisabled )&&
( wgIsRect( X,Y,appMPlayer.Items[i].x,appMPlayer.Items[i].y,appMPlayer.Items[i].x+appMPlayer.Items[i].width,appMPlayer.Items[i].y+appMPlayer.Items[i].height ) ) )
diff --git a/Gui/mplayer/sw.h b/Gui/mplayer/sw.h
index fd73bce199..95848a9cb7 100644
--- a/Gui/mplayer/sw.h
+++ b/Gui/mplayer/sw.h
@@ -26,10 +26,6 @@ void mplSubMouseHandle( int Button,int X,int Y,int RX,int RY )
static int mplSubMoved = 0;
static int msButton = 0;
- mplMouseTimer=mplMouseTimerConst;
- wsVisibleMouse( &appMPlayer.subWindow,wsShowMouseCursor );
-
-
switch( Button )
{
case wsPMMouseButton:
@@ -67,7 +63,6 @@ void mplSubMouseHandle( int Button,int X,int Y,int RX,int RY )
break;
case wsPRMouseButton:
mplMenuMouseHandle( X,Y,RX,RY );
- mplMouseTimer=mplMouseTimerConst;
break;
}
break;
diff --git a/libvo/video_out.h b/libvo/video_out.h
index 5aee045e20..62b20a3a60 100644
--- a/libvo/video_out.h
+++ b/libvo/video_out.h
@@ -216,6 +216,8 @@ extern int vo_vsync;
extern int vo_fs;
extern int vo_fsmode;
+extern int vo_mouse_timer_const;
+
extern int vo_pts;
extern float vo_fps;
diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c
index 11706d2bf9..037aff9fce 100644
--- a/libvo/vo_gl.c
+++ b/libvo/vo_gl.c
@@ -208,7 +208,7 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
// bpp = myximage->bits_per_pixel;
//XSelectInput(mDisplay, mywindow, StructureNotifyMask); // !!!!
- XSelectInput(mDisplay, mywindow, StructureNotifyMask | KeyPressMask
+ XSelectInput(mDisplay, mywindow, StructureNotifyMask | KeyPressMask | PointerMotionMask
#ifdef HAVE_NEW_INPUT
| ButtonPressMask | ButtonReleaseMask
#endif
diff --git a/libvo/vo_gl2.c b/libvo/vo_gl2.c
index f1afcb03c3..c7e5294456 100644
--- a/libvo/vo_gl2.c
+++ b/libvo/vo_gl2.c
@@ -712,7 +712,7 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
XSync(mDisplay, False);
//XSelectInput(mDisplay, mywindow, StructureNotifyMask); // !!!!
- XSelectInput(mDisplay, mywindow, StructureNotifyMask | KeyPressMask
+ XSelectInput(mDisplay, mywindow, StructureNotifyMask | KeyPressMask | PointerMotionMask
#ifdef HAVE_NEW_INPUT
| ButtonPressMask | ButtonReleaseMask
#endif
diff --git a/libvo/vo_x11.c b/libvo/vo_x11.c
index 73b44f8ca8..c132f0cce2 100644
--- a/libvo/vo_x11.c
+++ b/libvo/vo_x11.c
@@ -359,7 +359,7 @@ static uint32_t config( uint32_t width,uint32_t height,uint32_t d_width,uint32_t
XSync( mDisplay,False );
vo_gc=XCreateGC( mDisplay,vo_window,0L,&xgcv );
- XSelectInput( mDisplay,vo_window,StructureNotifyMask | KeyPressMask | ButtonPressMask | ButtonReleaseMask);
+ XSelectInput( mDisplay,vo_window,StructureNotifyMask | KeyPressMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask);
#ifdef HAVE_XF86VM
if ( vm )
diff --git a/libvo/vo_xmga.c b/libvo/vo_xmga.c
index 68a8c89ac0..28e8efee5f 100644
--- a/libvo/vo_xmga.c
+++ b/libvo/vo_xmga.c
@@ -278,7 +278,7 @@ static uint32_t config( uint32_t width, uint32_t height, uint32_t d_width, uint3
xWAttribs.colormap=XCreateColormap( mDisplay,RootWindow( mDisplay,mScreen ),vinfo.visual,AllocNone );
xWAttribs.background_pixel=0;
xWAttribs.border_pixel=0;
- xWAttribs.event_mask=StructureNotifyMask | ExposureMask | KeyPressMask | ButtonPressMask | ButtonReleaseMask;
+ xWAttribs.event_mask=StructureNotifyMask | ExposureMask | KeyPressMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask;
xswamask=CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
if ( WinID>=0 ){
@@ -341,6 +341,8 @@ uninit(void)
{
if(!inited) return;
inited=0;
+ XSetBackground( mDisplay,vo_gc,0 );
+ XClearWindow( mDisplay,vo_window );
mga_uninit();
saver_on(mDisplay);
vo_x11_uninit(mDisplay, vo_window);
diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c
index 019413e9cb..541bd24c46 100644
--- a/libvo/vo_xv.c
+++ b/libvo/vo_xv.c
@@ -417,7 +417,7 @@ static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width, uint32
vo_x11_classhint( mDisplay,vo_window,"xv" );
vo_hidecursor(mDisplay,vo_window);
- XSelectInput(mDisplay, vo_window, StructureNotifyMask | KeyPressMask
+ XSelectInput(mDisplay, vo_window, StructureNotifyMask | KeyPressMask | PointerMotionMask
#ifdef HAVE_NEW_INPUT
| ButtonPressMask | ButtonReleaseMask
#endif
diff --git a/libvo/vo_xvidix.c b/libvo/vo_xvidix.c
index 3e352f072c..0587b26a48 100644
--- a/libvo/vo_xvidix.c
+++ b/libvo/vo_xvidix.c
@@ -290,7 +290,7 @@ if (vo_window == None)
xswa.border_pixel = 0;
xswa.colormap = XCreateColormap(mDisplay, RootWindow(mDisplay, mScreen),
vinfo.visual, AllocNone);
- xswa.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask | ButtonPressMask | ButtonReleaseMask;
+ xswa.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask;
xswamask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
if (WinID >= 0)
diff --git a/libvo/x11_common.c b/libvo/x11_common.c
index 473af1504d..bd2f2e8705 100644
--- a/libvo/x11_common.c
+++ b/libvo/x11_common.c
@@ -86,8 +86,11 @@ void vo_hidecursor ( Display *disp , Window win )
bm_no = XCreateBitmapFromData(disp, win, bm_no_data, 8,8);
no_ptr=XCreatePixmapCursor(disp, bm_no, bm_no,&black, &black,0, 0);
XDefineCursor(disp,win,no_ptr);
+ XFreeCursor( disp,no_ptr );
}
+void vo_showcursor( Display *disp, Window win )
+{ XDefineCursor( disp,win,0 ); }
#ifdef SCAN_VISUALS
/*
@@ -447,14 +450,20 @@ int vo_x11_uninit(Display *display, Window window)
return(1);
}
+ int vo_mouse_timer_const = 30;
+static int vo_mouse_counter = 30;
+
int vo_x11_check_events(Display *mydisplay){
int ret=0;
XEvent Event;
char buf[100];
KeySym keySym;
static XComposeStatus stat;
+
// unsigned long vo_KeyTable[512];
+ if ( --vo_mouse_counter == 0 ) vo_hidecursor( mydisplay,vo_window );
+
while ( XPending( mydisplay ) )
{
XNextEvent( mydisplay,&Event );
@@ -503,8 +512,12 @@ int vo_x11_check_events(Display *mydisplay){
ret|=VO_EVENT_KEYPRESS;
}
break;
+ case MotionNotify:
+ vo_showcursor( mydisplay,vo_window ); vo_mouse_counter=vo_mouse_timer_const;
+ break;
#ifdef HAVE_NEW_INPUT
case ButtonPress:
+ vo_showcursor( mydisplay,vo_window ); vo_mouse_counter=vo_mouse_timer_const;
// Ignore mouse whell press event
if(Event.xbutton.button == 4 || Event.xbutton.button == 5) break;
#ifdef HAVE_NEW_GUI
@@ -514,6 +527,7 @@ int vo_x11_check_events(Display *mydisplay){
mplayer_put_key((MOUSE_BTN0+Event.xbutton.button-1)|MP_KEY_DOWN);
break;
case ButtonRelease:
+ vo_showcursor( mydisplay,vo_window ); vo_mouse_counter=vo_mouse_timer_const;
#ifdef HAVE_NEW_GUI
// Ignor mouse button 1 - 3 under gui
if ( use_gui && ( Event.xbutton.button >= 1 )&&( Event.xbutton.button <= 3 ) ) break;
diff --git a/libvo/x11_common.h b/libvo/x11_common.h
index a9687b08f6..0f7d7f9ef8 100644
--- a/libvo/x11_common.h
+++ b/libvo/x11_common.h
@@ -21,8 +21,11 @@ extern int mScreen;
extern int mLocalDisplay;
extern int WinID;
+extern int vo_mouse_timer_const;
+
int vo_init( void );
int vo_hidecursor ( Display* , Window );
+extern void vo_showcursor( Display *disp, Window win );
void vo_x11_decoration( Display * vo_Display,Window w,int d );
void vo_x11_classhint( Display * display,Window window,char *name );
void vo_x11_sizehint( int x, int y, int width, int height );
diff --git a/mplayer.c b/mplayer.c
index 0f95c30b30..d8cec203b7 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -1223,6 +1223,7 @@ if((video_out->preinit(vo_subdevice))!=0){
mp_msg(MSGT_CPLAYER,MSGL_FATAL,"Error opening/initializing the selected video_out (-vo) device!\n");
goto goto_next_file; // exit_player(MSGTR_Exit_error);
}
+vo_mouse_timer_const=(int)sh_video->fps;
sh_video->video_out=video_out;
inited_flags|=INITED_VO;
@@ -2902,18 +2903,6 @@ if(benchmark){
}
-#ifdef HAVE_NEW_GUI
- if( use_gui )
- {
-#ifdef USE_DVDREAD
- if ( !guiIntfStruct.DVDChanged )
-#endif
- mplStop();
-#warning workaround for kiba playtree with gui ... if i dont play the prev/next file, then playtree sig6 (assert)
-// eof=0;
- }
-#endif
-
uninit_player(INITED_VO|INITED_AO);
if(eof == PT_NEXT_ENTRY || eof == PT_PREV_ENTRY) {
@@ -2939,6 +2928,16 @@ if(eof == PT_NEXT_ENTRY || eof == PT_PREV_ENTRY) {
eof = eof == PT_PREV_SRC ? -1 : 1;
}
+#ifdef HAVE_NEW_GUI
+ if( use_gui && !playtree_iter )
+ {
+#ifdef USE_DVDREAD
+ if ( !guiIntfStruct.DVDChanged )
+#endif
+ mplStop();
+ }
+#endif
+
if(eof == 0) eof = 1;
while(playtree_iter != NULL) {
diff --git a/playtree.c b/playtree.c
index f9dc4f2d74..7662ce0439 100644
--- a/playtree.c
+++ b/playtree.c
@@ -477,6 +477,9 @@ int
play_tree_iter_step(play_tree_iter_t* iter, int d,int with_nodes) {
play_tree_t* pt;
+ if ( !iter ) return PLAY_TREE_ITER_ENTRY;
+ if ( !iter->root ) return PLAY_TREE_ITER_ENTRY;
+
#ifdef MP_DEBUG
assert(iter != NULL);
assert(iter->root != NULL);