changeset 4658:93d562ad1c22

Added new input mouse support in x11 vo
author albeu
date Mon, 11 Feb 2002 11:44:50 +0000
parents 610a11e4db36
children 31265995cc3a
files libvo/vo_gl.c libvo/vo_gl2.c libvo/vo_x11.c libvo/vo_xv.c libvo/x11_common.c
diffstat 5 files changed, 36 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_gl.c	Mon Feb 11 11:42:08 2002 +0000
+++ b/libvo/vo_gl.c	Mon Feb 11 11:44:50 2002 +0000
@@ -207,7 +207,11 @@
 //	bpp = myximage->bits_per_pixel;
 
 	//XSelectInput(mDisplay, mywindow, StructureNotifyMask); // !!!!
-        XSelectInput(mDisplay, mywindow, StructureNotifyMask | KeyPressMask );
+        XSelectInput(mDisplay, mywindow, StructureNotifyMask | KeyPressMask 
+#ifdef HAVE_NEW_INPUT
+		     | ButtonPressMask | ButtonReleaseMask
+#endif
+        );
 
 //  printf("Window setup ok\n");
 
--- a/libvo/vo_gl2.c	Mon Feb 11 11:42:08 2002 +0000
+++ b/libvo/vo_gl2.c	Mon Feb 11 11:44:50 2002 +0000
@@ -711,7 +711,11 @@
 	XSync(mDisplay, False);
 
 	//XSelectInput(mDisplay, mywindow, StructureNotifyMask); // !!!!
-        XSelectInput(mDisplay, mywindow, StructureNotifyMask | KeyPressMask );
+        XSelectInput(mDisplay, mywindow, StructureNotifyMask | KeyPressMask
+#ifdef HAVE_NEW_INPUT
+		 | ButtonPressMask | ButtonReleaseMask
+#endif
+        );
 
   glVersion = glGetString(GL_VERSION);
 
--- a/libvo/vo_x11.c	Mon Feb 11 11:42:08 2002 +0000
+++ b/libvo/vo_x11.c	Mon Feb 11 11:44:50 2002 +0000
@@ -421,7 +421,11 @@
  if ( vo_window == None ) 
 #endif 
   {
-   XSelectInput( mDisplay,mywindow,StructureNotifyMask | KeyPressMask );
+   XSelectInput( mDisplay,mywindow,StructureNotifyMask | KeyPressMask 
+#ifdef HAVE_NEW_INPUT
+		 | ButtonPressMask | ButtonReleaseMask
+#endif
+    );
   }
  saver_off(mDisplay);
  return 0;
--- a/libvo/vo_xv.c	Mon Feb 11 11:42:08 2002 +0000
+++ b/libvo/vo_xv.c	Mon Feb 11 11:44:50 2002 +0000
@@ -417,7 +417,11 @@
    vo_x11_classhint( mDisplay,mywindow,"xv" );
    vo_hidecursor(mDisplay,mywindow);
 
-   XSelectInput(mDisplay, mywindow, StructureNotifyMask | KeyPressMask );
+   XSelectInput(mDisplay, mywindow, StructureNotifyMask | KeyPressMask 
+#ifdef HAVE_NEW_INPUT
+		| ButtonPressMask | ButtonReleaseMask
+#endif
+   );
    XSetStandardProperties(mDisplay, mywindow, hello, hello, None, NULL, 0, &hint);
    if ( mFullscreen ) vo_x11_decoration( mDisplay,mywindow,0 );
    XMapWindow(mDisplay, mywindow);
--- a/libvo/x11_common.c	Mon Feb 11 11:42:08 2002 +0000
+++ b/libvo/x11_common.c	Mon Feb 11 11:44:50 2002 +0000
@@ -29,6 +29,11 @@
 #include <X11/extensions/xf86vmode.h>
 #endif
 
+#ifdef HAVE_NEW_INPUT
+#include "../input/input.h"
+#include "../input/mouse.h"
+#endif
+
 /*
  * If SCAN_VISUALS is defined, vo_init() scans all available TrueColor
  * visuals for the 'best' visual for MPlayer video display.  Note that
@@ -425,6 +430,17 @@
                vo_x11_putkey( ( (keySym&0xff00) != 0?( (keySym&0x00ff) + 256 ):( keySym ) ) );
 	       ret|=VO_EVENT_KEYPRESS;
                break;
+#ifdef HAVE_NEW_INPUT
+          case ButtonPress:
+               // Ignore mouse whell press event
+               if(Event.xbutton.button == 4 || Event.xbutton.button == 5)
+                    break;
+               mplayer_put_key((MOUSE_BTN0+Event.xbutton.button-1)|MP_KEY_DOWN);
+               break;
+          case ButtonRelease:
+               mplayer_put_key(MOUSE_BTN0+Event.xbutton.button-1);
+               break;
+#endif
          }
       }
 #ifdef HAVE_NEW_GUI