summaryrefslogtreecommitdiffstats
path: root/libvo/vo_sdl.c
diff options
context:
space:
mode:
authoralbeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-02-08 20:03:36 +0000
committeralbeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-02-08 20:03:36 +0000
commitf50ce8c728ccbda7e229446c5595798d8da28842 (patch)
tree00885a49b865016720b1a781b3c7b31b87d982b4 /libvo/vo_sdl.c
parentce2367725e43124f8be5ef43650cd9514ae1c335 (diff)
downloadmpv-f50ce8c728ccbda7e229446c5595798d8da28842.tar.bz2
mpv-f50ce8c728ccbda7e229446c5595798d8da28842.tar.xz
Applied patch mouse whell patch from Wojtek Kaniewski <wojtekka@bydg.pdi.net>
and added mouse support for new input git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4591 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo/vo_sdl.c')
-rw-r--r--libvo/vo_sdl.c57
1 files changed, 53 insertions, 4 deletions
diff --git a/libvo/vo_sdl.c b/libvo/vo_sdl.c
index 7b36ef6a8b..44787f71b0 100644
--- a/libvo/vo_sdl.c
+++ b/libvo/vo_sdl.c
@@ -120,6 +120,11 @@
#include "x11_common.h"
#endif
+#ifdef HAVE_NEW_INPUT
+#include "../input/input.h"
+#include "../input/mouse.h"
+#endif
+
LIBVO_EXTERN(sdl)
extern int verbose;
@@ -430,8 +435,6 @@ increase your display's color depth, if possible.\n", priv->bpp);
#ifndef BUGGY_SDL
SDL_EventState(SDL_ACTIVEEVENT, SDL_IGNORE);
SDL_EventState(SDL_MOUSEMOTION, SDL_IGNORE);
- SDL_EventState(SDL_MOUSEBUTTONDOWN, SDL_IGNORE);
- SDL_EventState(SDL_MOUSEBUTTONUP, SDL_IGNORE);
// SDL_EventState(SDL_QUIT, SDL_IGNORE);
SDL_EventState(SDL_SYSWMEVENT, SDL_IGNORE);
SDL_EventState(SDL_USEREVENT, SDL_IGNORE);
@@ -1025,7 +1028,7 @@ static void check_events (void)
struct sdl_priv_s *priv = &sdl_priv;
SDL_Event event;
SDLKey keypressed = 0;
- static int firstcheck = 0;
+ static int firstcheck = 0, modifiers = 0;
/* Poll the waiting SDL Events */
while ( SDL_PollEvent(&event) ) {
@@ -1043,7 +1046,53 @@ static void check_events (void)
if(verbose > 2) printf("SDL: Window resize\n");
break;
-
+ case SDL_MOUSEBUTTONDOWN:
+#ifdef HAVE_NEW_INPUT
+ if(event.button.button == 4 || event.button.button == 5)
+ mplayer_put_key(MOUSE_BASE+event.button.button-1);
+ else
+ mplayer_put_key((MOUSE_BASE+event.button.button-1) | MP_KEY_DOWN);
+#else
+ switch(event.button.button) {
+ case 1: modifiers |= 1; break;
+ case 2: modifiers |= 2; break;
+ case 3: modifiers |= 4; break;
+ case 4: /* wheel up */
+ if ((modifiers & 1))
+ mplayer_put_key(KEY_LEFT);
+ else if ((modifiers & 2))
+ mplayer_put_key('/');
+ else if ((modifiers & 4))
+ mplayer_put_key(KEY_PAGE_DOWN);
+ else
+ mplayer_put_key(KEY_DOWN);
+ break;
+ case 5: /* wheel down */
+ if ((modifiers & 1))
+ mplayer_put_key(KEY_RIGHT);
+ else if ((modifiers & 2))
+ mplayer_put_key('*');
+ else if ((modifiers & 4))
+ mplayer_put_key(KEY_PAGE_UP);
+ else
+ mplayer_put_key(KEY_UP);
+ break;
+ }
+#endif
+ break;
+
+ case SDL_MOUSEBUTTONUP:
+#ifdef HAVE_NEW_INPUT
+ mplayer_put_key(MOUSE_BASE+event.button.button-1);
+#else
+ switch(event.button.button) {
+ case 1: modifiers &= ~1; break;
+ case 2: modifiers &= ~2; break;
+ case 3: modifiers &= ~4; break;
+ }
+#endif
+ break;
+
/* graphics mode selection shortcuts */
#ifdef BUGGY_SDL
case SDL_KEYDOWN: