Commit f4fd4afc authored by Sam Hocevar's avatar Sam Hocevar

* Mouse motion and mouse click support in the libcaca vout.

parent b0966945
...@@ -299,22 +299,19 @@ static int Manage( vout_thread_t *p_vout ) ...@@ -299,22 +299,19 @@ static int Manage( vout_thread_t *p_vout )
#else #else
int ev; int ev;
#endif #endif
vlc_value_t val;
while( caca_get_event(p_vout->p_sys->p_dp, while( caca_get_event(p_vout->p_sys->p_dp, CACA_EVENT_ANY, &ev, 0) )
CACA_EVENT_KEY_PRESS | CACA_EVENT_RESIZE, &ev, 0) )
{ {
/* Acknowledge the resize */ playlist_t *p_playlist;
vlc_value_t val;
#ifdef CACA_API_VERSION_1 #ifdef CACA_API_VERSION_1
if( ev.type == CACA_EVENT_RESIZE ) switch( ev.type )
#else #else
if( ev == CACA_EVENT_RESIZE ) switch( ev )
#endif #endif
{ {
caca_refresh_display( p_vout->p_sys->p_dp ); case CACA_EVENT_KEY_RELEASE:
continue;
}
#ifdef CACA_API_VERSION_1 #ifdef CACA_API_VERSION_1
switch( ev.data.key.ch ) switch( ev.data.key.ch )
#else #else
...@@ -332,6 +329,42 @@ static int Manage( vout_thread_t *p_vout ) ...@@ -332,6 +329,42 @@ static int Manage( vout_thread_t *p_vout )
} }
var_Set( p_vout->p_libvlc, "key-pressed", val ); var_Set( p_vout->p_libvlc, "key-pressed", val );
break;
case CACA_EVENT_RESIZE:
/* Acknowledge the resize */
caca_refresh_display( p_vout->p_sys->p_dp );
break;
#ifdef CACA_API_VERSION_1
case CACA_EVENT_MOUSE_MOTION:
val.i_int = ev.data.mouse.x * p_vout->render.i_width
/ cucul_get_canvas_width( p_vout->p_sys->p_cv );
var_Set( p_vout, "mouse-x", val );
val.i_int = ev.data.mouse.y * p_vout->render.i_height
/ cucul_get_canvas_height( p_vout->p_sys->p_cv );
var_Set( p_vout, "mouse-y", val );
val.b_bool = VLC_TRUE;
var_Set( p_vout, "mouse-moved", val );
break;
case CACA_EVENT_MOUSE_RELEASE:
val.b_bool = VLC_TRUE;
var_Set( p_vout, "mouse-clicked", val );
break;
case CACA_EVENT_QUIT:
{
p_playlist = vlc_object_find( p_vout,
VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
if( p_playlist )
{
playlist_Stop( p_playlist );
vlc_object_release( p_playlist );
}
p_vout->p_libvlc->b_die = VLC_TRUE;
break;
}
#endif
default:
break;
}
} }
return VLC_SUCCESS; return VLC_SUCCESS;
......
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