From da6135b983a530787ac61b8ff01a6aab54918fcb Mon Sep 17 00:00:00 2001 From: pontscho Date: Tue, 16 Apr 2002 17:41:29 +0000 Subject: 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 --- libvo/video_out.h | 2 ++ libvo/vo_gl.c | 2 +- libvo/vo_gl2.c | 2 +- libvo/vo_x11.c | 2 +- libvo/vo_xmga.c | 4 +++- libvo/vo_xv.c | 2 +- libvo/vo_xvidix.c | 2 +- libvo/x11_common.c | 14 ++++++++++++++ libvo/x11_common.h | 3 +++ 9 files changed, 27 insertions(+), 6 deletions(-) (limited to 'libvo') 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 ); -- cgit v1.2.3