[MPlayer-dev-eng] [PATCH] mousewheel support for vo_sdl.c
Wojtek Kaniewski
wojtekka at bydg.pdi.net
Thu Feb 7 19:24:10 CET 2002
it's a simple and probably stupid patch which allows seeking with
mousewheel. with no buttons pressed while moving the wheel, it seeks
+/- 1 minute, with left button pressed +/- 10 seconds, with right
button +/- 10 minutes and with mousewheel pressed it changes the
volume.
btw, there's no information how to signup for mplayer-dev-eng in
DOCS/tech/patches.txt. it can be a little confusing :/
regards,
wojtek
-------------- next part --------------
--- libvo/vo_sdl.c.orig Thu Feb 7 19:19:13 2002
+++ libvo/vo_sdl.c Thu Feb 7 02:14:08 2002
@@ -430,7 +430,7 @@
#ifndef BUGGY_SDL
SDL_EventState(SDL_ACTIVEEVENT, SDL_IGNORE);
SDL_EventState(SDL_MOUSEMOTION, SDL_IGNORE);
- SDL_EventState(SDL_MOUSEBUTTONDOWN, 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);
@@ -1025,7 +1025,7 @@
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 +1043,42 @@
if(verbose > 2) printf("SDL: Window resize\n");
break;
-
+ case SDL_MOUSEBUTTONDOWN:
+ 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;
+ }
+ break;
+
+ case SDL_MOUSEBUTTONUP:
+ switch(event.button.button) {
+ case 1: modifiers &= ~1; break;
+ case 2: modifiers &= ~2; break;
+ case 3: modifiers &= ~4; break;
+ }
+ break;
+
/* graphics mode selection shortcuts */
#ifdef BUGGY_SDL
case SDL_KEYDOWN:
More information about the MPlayer-dev-eng
mailing list