# HG changeset patch # User pontscho # Date 1018978889 0 # Node ID b8d8d72776f2b41144b5e20aeaac1a9656828f0b # Parent 71f221e98fa4c8a9d9b278a7dab2326b0772ec04 fix playlist bug with gui and rewrite mousecursor show/hide code diff -r 71f221e98fa4 -r b8d8d72776f2 Gui/mplayer/mplayer.c --- a/Gui/mplayer/mplayer.c Tue Apr 16 17:29:04 2002 +0000 +++ b/Gui/mplayer/mplayer.c Tue Apr 16 17:41:29 2002 +0000 @@ -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 mplTimerHandler( void ) { mplTimer++; - mplMouseTimer--; mplRedrawTimer--; - if ( mplMouseTimer == 0 ) mplEventHandling( evHideMouseCursor,0 ); if ( mplRedrawTimer == 0 ) mplEventHandling( evRedraw,0 ); } diff -r 71f221e98fa4 -r b8d8d72776f2 Gui/mplayer/mw.h --- a/Gui/mplayer/mw.h Tue Apr 16 17:29:04 2002 +0000 +++ b/Gui/mplayer/mw.h Tue Apr 16 17:41:29 2002 +0000 @@ -387,9 +387,6 @@ break; // --- timer events - case evHideMouseCursor: - wsVisibleMouse( &appMPlayer.subWindow,wsHideMouseCursor ); - break; case evRedraw: mplMainRender=1; wsPostRedisplay( &appMPlayer.mainWindow ); @@ -419,8 +416,6 @@ 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 -r 71f221e98fa4 -r b8d8d72776f2 Gui/mplayer/sw.h --- a/Gui/mplayer/sw.h Tue Apr 16 17:29:04 2002 +0000 +++ b/Gui/mplayer/sw.h Tue Apr 16 17:41:29 2002 +0000 @@ -26,10 +26,6 @@ static int mplSubMoved = 0; static int msButton = 0; - mplMouseTimer=mplMouseTimerConst; - wsVisibleMouse( &appMPlayer.subWindow,wsShowMouseCursor ); - - switch( Button ) { case wsPMMouseButton: @@ -67,7 +63,6 @@ break; case wsPRMouseButton: mplMenuMouseHandle( X,Y,RX,RY ); - mplMouseTimer=mplMouseTimerConst; break; } break; diff -r 71f221e98fa4 -r b8d8d72776f2 libvo/video_out.h --- a/libvo/video_out.h Tue Apr 16 17:29:04 2002 +0000 +++ b/libvo/video_out.h Tue Apr 16 17:41:29 2002 +0000 @@ -216,6 +216,8 @@ extern int vo_fs; extern int vo_fsmode; +extern int vo_mouse_timer_const; + extern int vo_pts; extern float vo_fps; diff -r 71f221e98fa4 -r b8d8d72776f2 libvo/vo_gl.c --- a/libvo/vo_gl.c Tue Apr 16 17:29:04 2002 +0000 +++ b/libvo/vo_gl.c Tue Apr 16 17:41:29 2002 +0000 @@ -208,7 +208,7 @@ // 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 -r 71f221e98fa4 -r b8d8d72776f2 libvo/vo_gl2.c --- a/libvo/vo_gl2.c Tue Apr 16 17:29:04 2002 +0000 +++ b/libvo/vo_gl2.c Tue Apr 16 17:41:29 2002 +0000 @@ -712,7 +712,7 @@ 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 -r 71f221e98fa4 -r b8d8d72776f2 libvo/vo_x11.c --- a/libvo/vo_x11.c Tue Apr 16 17:29:04 2002 +0000 +++ b/libvo/vo_x11.c Tue Apr 16 17:41:29 2002 +0000 @@ -359,7 +359,7 @@ 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 -r 71f221e98fa4 -r b8d8d72776f2 libvo/vo_xmga.c --- a/libvo/vo_xmga.c Tue Apr 16 17:29:04 2002 +0000 +++ b/libvo/vo_xmga.c Tue Apr 16 17:41:29 2002 +0000 @@ -278,7 +278,7 @@ 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 @@ { 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 -r 71f221e98fa4 -r b8d8d72776f2 libvo/vo_xv.c --- a/libvo/vo_xv.c Tue Apr 16 17:29:04 2002 +0000 +++ b/libvo/vo_xv.c Tue Apr 16 17:41:29 2002 +0000 @@ -417,7 +417,7 @@ 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 -r 71f221e98fa4 -r b8d8d72776f2 libvo/vo_xvidix.c --- a/libvo/vo_xvidix.c Tue Apr 16 17:29:04 2002 +0000 +++ b/libvo/vo_xvidix.c Tue Apr 16 17:41:29 2002 +0000 @@ -290,7 +290,7 @@ 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 -r 71f221e98fa4 -r b8d8d72776f2 libvo/x11_common.c --- a/libvo/x11_common.c Tue Apr 16 17:29:04 2002 +0000 +++ b/libvo/x11_common.c Tue Apr 16 17:41:29 2002 +0000 @@ -86,8 +86,11 @@ 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 @@ 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 @@ 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 @@ 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 -r 71f221e98fa4 -r b8d8d72776f2 libvo/x11_common.h --- a/libvo/x11_common.h Tue Apr 16 17:29:04 2002 +0000 +++ b/libvo/x11_common.h Tue Apr 16 17:41:29 2002 +0000 @@ -21,8 +21,11 @@ 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 -r 71f221e98fa4 -r b8d8d72776f2 mplayer.c --- a/mplayer.c Tue Apr 16 17:29:04 2002 +0000 +++ b/mplayer.c Tue Apr 16 17:41:29 2002 +0000 @@ -1223,6 +1223,7 @@ 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 @@ } -#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 @@ 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 -r 71f221e98fa4 -r b8d8d72776f2 playtree.c --- a/playtree.c Tue Apr 16 17:29:04 2002 +0000 +++ b/playtree.c Tue Apr 16 17:41:29 2002 +0000 @@ -477,6 +477,9 @@ 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);