From 65c2915543b2c5ce1fef295dbab583dd6534cbd5 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Thu, 17 Oct 2002 16:48:41 +0000 Subject: [PATCH] * ./modules/video_output/sdl.c: mouse coordinates support for SDL. * ./modules/video_output/x11/xcommon.c: we transmit the click only at release time. --- doc/fortunes.txt | 7 +++++++ modules/video_output/sdl.c | 23 ++++++++++++++++++++++- modules/video_output/x11/xcommon.c | 27 +++++++-------------------- 3 files changed, 36 insertions(+), 21 deletions(-) diff --git a/doc/fortunes.txt b/doc/fortunes.txt index fe67139b91..b0d551e586 100644 --- a/doc/fortunes.txt +++ b/doc/fortunes.txt @@ -321,3 +321,10 @@ the Boston strangler is to the woman home alone. -- #videolan % + you want to be in a porn movie with me ? + are we well paid for doing that ? + ali : no but they say you take a lot of pleasure in that job + Meuuh: i know + + -- #videolan +% diff --git a/modules/video_output/sdl.c b/modules/video_output/sdl.c index 6ab18f6ee0..70066870a6 100644 --- a/modules/video_output/sdl.c +++ b/modules/video_output/sdl.c @@ -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 * Pierre Baillet @@ -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; diff --git a/modules/video_output/x11/xcommon.c b/modules/video_output/x11/xcommon.c index e1585f5414..b3fffe4b8c 100644 --- a/modules/video_output/x11/xcommon.c +++ b/modules/video_output/x11/xcommon.c @@ -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 * Samuel Hocevar @@ -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; -- 2.39.5