]> git.sesse.net Git - vlc/commitdiff
* ./modules/video_output/sdl.c: mouse coordinates support for SDL.
authorSam Hocevar <sam@videolan.org>
Thu, 17 Oct 2002 16:48:41 +0000 (16:48 +0000)
committerSam Hocevar <sam@videolan.org>
Thu, 17 Oct 2002 16:48:41 +0000 (16:48 +0000)
  * ./modules/video_output/x11/xcommon.c: we transmit the click only at
    release time.

doc/fortunes.txt
modules/video_output/sdl.c
modules/video_output/x11/xcommon.c

index fe67139b91743bbecd8da9421359de98ccfc5198..b0d551e586267bf484c1c80654bca16761c36a87 100644 (file)
@@ -321,3 +321,10 @@ the Boston strangler is to the woman home alone.
 
   -- #videolan
 %
+<Meuuh> you want to be in a porn movie with me ?
+<ali> are we well paid for doing that ?
+<Meuuh> ali : no but they say you take a lot of pleasure in that job
+<ali> Meuuh: i know
+
+  -- #videolan
+%
index 6ab18f6ee0d01886508609121ff129213ff36117..70066870a6debac8a1248047e4444dc2cf6fbedf 100644 (file)
@@ -2,7 +2,7 @@
  * sdl.c: SDL video output display method
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: sdl.c,v 1.3 2002/09/30 11:05:40 sam Exp $
+ * $Id: sdl.c,v 1.4 2002/10/17 16:48:41 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          Pierre Baillet <oct@zoy.org>
@@ -307,6 +307,8 @@ static void Close ( vlc_object_t *p_this )
 static int Manage( vout_thread_t *p_vout )
 {
     SDL_Event event;                                            /* SDL event */
+    vlc_value_t val;
+    int i_width, i_height, i_x, i_y;
 
     /* Process events */
     while( SDL_PollEvent(&event) )
@@ -321,6 +323,20 @@ static int Manage( vout_thread_t *p_vout )
             break;
 
         case SDL_MOUSEMOTION:
+            vout_PlacePicture( p_vout, p_vout->p_sys->i_width,
+                               p_vout->p_sys->i_height,
+                               &i_x, &i_y, &i_width, &i_height );
+
+            val.i_int = ( event.motion.x - i_x )
+                         * p_vout->render.i_width / i_width;
+            var_Set( p_vout, "mouse-x", val );
+            val.i_int = ( event.motion.y - i_y )
+                         * p_vout->render.i_height / i_height;
+            var_Set( p_vout, "mouse-y", val );
+
+            val.b_bool = VLC_TRUE;
+            var_Set( p_vout, "mouse-moved", val );
+
             if( p_vout->p_sys->b_cursor &&
                 (abs(event.motion.xrel) > 2 || abs(event.motion.yrel) > 2) )
             {
@@ -339,6 +355,11 @@ static int Manage( vout_thread_t *p_vout )
         case SDL_MOUSEBUTTONUP:
             switch( event.button.button )
             {
+            case SDL_BUTTON_LEFT:
+                val.b_bool = VLC_TRUE;
+                var_Set( p_vout, "mouse-clicked", val );
+                break;
+
             case SDL_BUTTON_RIGHT:
                 {
                     intf_thread_t *p_intf;
index e1585f5414796131e44e7821470eaf8db85370ea..b3fffe4b8caaada29e73b2a9093c4bca25f4cabc 100644 (file)
@@ -2,7 +2,7 @@
  * xcommon.c: Functions common to the X11 and XVideo plugins
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: xcommon.c,v 1.5 2002/10/17 16:03:18 sam Exp $
+ * $Id: xcommon.c,v 1.6 2002/10/17 16:48:41 sam Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -480,6 +480,7 @@ static int ManageVideo( vout_thread_t *p_vout )
     XEvent      xevent;                                         /* X11 event */
     char        i_key;                                    /* ISO Latin-1 key */
     KeySym      x_key_symbol;
+    vlc_value_t val;
 
     /* Handle X11 events: ConfigureNotify events are parsed to know if the
      * output window's size changed, MapNotify and UnmapNotify to know if the
@@ -606,28 +607,9 @@ static int ManageVideo( vout_thread_t *p_vout )
         /* Mouse click */
         else if( xevent.type == ButtonPress )
         {
-            int i_width, i_height, i_x, i_y;
-            vlc_value_t val;
-
-            vout_PlacePicture( p_vout, p_vout->p_sys->p_win->i_width,
-                               p_vout->p_sys->p_win->i_height,
-                               &i_x, &i_y, &i_width, &i_height );
-
-            val.i_int = ( xevent.xmotion.x - i_x )
-                         * p_vout->render.i_width / i_width;
-            var_Set( p_vout, "mouse-x", val );
-            val.i_int = ( xevent.xmotion.y - i_y )
-                         * p_vout->render.i_height / i_height;
-            var_Set( p_vout, "mouse-y", val );
-
-            val.b_bool = VLC_TRUE;
-            var_Set( p_vout, "mouse-clicked", val );
-
             switch( ((XButtonEvent *)&xevent)->button )
             {
                 case Button1:
-                    /* In this part we will eventually manage
-                     * clicks for DVD navigation for instance. */
 
                     /* detect double-clicks */
                     if( ( ((XButtonEvent *)&xevent)->time -
@@ -654,6 +636,11 @@ static int ManageVideo( vout_thread_t *p_vout )
         {
             switch( ((XButtonEvent *)&xevent)->button )
             {
+                case Button1:
+                    val.b_bool = VLC_TRUE;
+                    var_Set( p_vout, "mouse-clicked", val );
+                    break;
+
                 case Button3:
                     {
                         intf_thread_t *p_intf;