Commit 65c29155 authored by Sam Hocevar's avatar Sam Hocevar

* ./modules/video_output/sdl.c: mouse coordinates support for SDL.

  * ./modules/video_output/x11/xcommon.c: we transmit the click only at
    release time.
parent 0a47ec01
...@@ -321,3 +321,10 @@ the Boston strangler is to the woman home alone. ...@@ -321,3 +321,10 @@ the Boston strangler is to the woman home alone.
-- #videolan -- #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
%
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* sdl.c: SDL video output display method * sdl.c: SDL video output display method
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * 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> * Authors: Samuel Hocevar <sam@zoy.org>
* Pierre Baillet <oct@zoy.org> * Pierre Baillet <oct@zoy.org>
...@@ -307,6 +307,8 @@ static void Close ( vlc_object_t *p_this ) ...@@ -307,6 +307,8 @@ static void Close ( vlc_object_t *p_this )
static int Manage( vout_thread_t *p_vout ) static int Manage( vout_thread_t *p_vout )
{ {
SDL_Event event; /* SDL event */ SDL_Event event; /* SDL event */
vlc_value_t val;
int i_width, i_height, i_x, i_y;
/* Process events */ /* Process events */
while( SDL_PollEvent(&event) ) while( SDL_PollEvent(&event) )
...@@ -321,6 +323,20 @@ static int Manage( vout_thread_t *p_vout ) ...@@ -321,6 +323,20 @@ static int Manage( vout_thread_t *p_vout )
break; break;
case SDL_MOUSEMOTION: 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 && if( p_vout->p_sys->b_cursor &&
(abs(event.motion.xrel) > 2 || abs(event.motion.yrel) > 2) ) (abs(event.motion.xrel) > 2 || abs(event.motion.yrel) > 2) )
{ {
...@@ -339,6 +355,11 @@ static int Manage( vout_thread_t *p_vout ) ...@@ -339,6 +355,11 @@ static int Manage( vout_thread_t *p_vout )
case SDL_MOUSEBUTTONUP: case SDL_MOUSEBUTTONUP:
switch( event.button.button ) 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: case SDL_BUTTON_RIGHT:
{ {
intf_thread_t *p_intf; intf_thread_t *p_intf;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* xcommon.c: Functions common to the X11 and XVideo plugins * xcommon.c: Functions common to the X11 and XVideo plugins
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * 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> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -480,6 +480,7 @@ static int ManageVideo( vout_thread_t *p_vout ) ...@@ -480,6 +480,7 @@ static int ManageVideo( vout_thread_t *p_vout )
XEvent xevent; /* X11 event */ XEvent xevent; /* X11 event */
char i_key; /* ISO Latin-1 key */ char i_key; /* ISO Latin-1 key */
KeySym x_key_symbol; KeySym x_key_symbol;
vlc_value_t val;
/* Handle X11 events: ConfigureNotify events are parsed to know if the /* Handle X11 events: ConfigureNotify events are parsed to know if the
* output window's size changed, MapNotify and UnmapNotify 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 ) ...@@ -606,28 +607,9 @@ static int ManageVideo( vout_thread_t *p_vout )
/* Mouse click */ /* Mouse click */
else if( xevent.type == ButtonPress ) 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 ) switch( ((XButtonEvent *)&xevent)->button )
{ {
case Button1: case Button1:
/* In this part we will eventually manage
* clicks for DVD navigation for instance. */
/* detect double-clicks */ /* detect double-clicks */
if( ( ((XButtonEvent *)&xevent)->time - if( ( ((XButtonEvent *)&xevent)->time -
...@@ -654,6 +636,11 @@ static int ManageVideo( vout_thread_t *p_vout ) ...@@ -654,6 +636,11 @@ static int ManageVideo( vout_thread_t *p_vout )
{ {
switch( ((XButtonEvent *)&xevent)->button ) switch( ((XButtonEvent *)&xevent)->button )
{ {
case Button1:
val.b_bool = VLC_TRUE;
var_Set( p_vout, "mouse-clicked", val );
break;
case Button3: case Button3:
{ {
intf_thread_t *p_intf; intf_thread_t *p_intf;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment