Commit 52f79869 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Patch to enable/disable key and mouse handling at vout level:

- x11-event option is renamed vout-event and become global
(libvlc-module.c)
- var_CreateGetInteger is called once at x11 initialization

Patch by Joseph Tulou
parent 6f1a7b41
...@@ -66,16 +66,6 @@ extern void Deactivate ( vlc_object_t * ); ...@@ -66,16 +66,6 @@ extern void Deactivate ( vlc_object_t * );
"Screen to use in fullscreen mode. For instance " \ "Screen to use in fullscreen mode. For instance " \
"set it to 0 for first screen, 1 for the second.") "set it to 0 for first screen, 1 for the second.")
#define X11_EVENT_TEXT N_("key and mouse event handling at X11 plugin level.")
#define X11_EVENT_LONGTEXT N_( \
"This parameter accepts values : 1 (full event handling support), " \
"2 (event handling only for fullscreen) or 3 (No event handling). " \
"Full event handling support is the default value.")
static const int pi_x11_event_values[] = { 1, 2, 3 };
static const char *const ppsz_x11_event_descriptions[] =
{ N_("FullSupport"), N_("Fullscreen-Only"), N_("None") };
vlc_module_begin () vlc_module_begin ()
set_shortname( "X11" ) set_shortname( "X11" )
set_category( CAT_VIDEO ) set_category( CAT_VIDEO )
...@@ -88,8 +78,6 @@ vlc_module_begin () ...@@ -88,8 +78,6 @@ vlc_module_begin ()
#ifdef HAVE_XINERAMA #ifdef HAVE_XINERAMA
add_integer ( "x11-xineramascreen", -1, NULL, SCREEN_TEXT, SCREEN_LONGTEXT, true ) add_integer ( "x11-xineramascreen", -1, NULL, SCREEN_TEXT, SCREEN_LONGTEXT, true )
#endif #endif
add_integer( "x11-event", 1, NULL, X11_EVENT_TEXT, X11_EVENT_LONGTEXT, true )
change_integer_list( pi_x11_event_values, ppsz_x11_event_descriptions, NULL )
set_description( N_("X11 video output") ) set_description( N_("X11 video output") )
set_capability( "video output", 70 ) set_capability( "video output", 70 )
set_callbacks( Activate, Deactivate ) set_callbacks( Activate, Deactivate )
......
...@@ -210,6 +210,9 @@ int Activate ( vlc_object_t *p_this ) ...@@ -210,6 +210,9 @@ int Activate ( vlc_object_t *p_this )
vlc_mutex_init( &p_vout->p_sys->lock ); vlc_mutex_init( &p_vout->p_sys->lock );
/* key and mouse event handling */
p_vout->p_sys->i_vout_event = var_CreateGetInteger( p_vout, "vout-event" );
/* Open display, using the "display" config variable or the DISPLAY /* Open display, using the "display" config variable or the DISPLAY
* environment variable */ * environment variable */
psz_display = config_GetPsz( p_vout, MODULE_STRING "-display" ); psz_display = config_GetPsz( p_vout, MODULE_STRING "-display" );
...@@ -1529,14 +1532,13 @@ static int ManageVideo( vout_thread_t *p_vout ) ...@@ -1529,14 +1532,13 @@ static int ManageVideo( vout_thread_t *p_vout )
i_x, i_y, i_width, i_height ); i_x, i_y, i_width, i_height );
} }
/* cursor hiding depending on --x11-event option /* cursor hiding depending on --vout-event option
* activated if: * activated if:
* value = 1 (Fullsupport) (default value) * value = 1 (Fullsupport) (default value)
* or value = 2 (Fullscreen-Only) and condition met * or value = 2 (Fullscreen-Only) and condition met
*/ */
int i_x11_event = var_CreateGetInteger( p_vout, "x11-event" ); bool b_vout_event = ( ( p_vout->p_sys->i_vout_event == 1 )
bool b_x11_event = ( ( i_x11_event == 1 ) || ( p_vout->p_sys->i_vout_event == 2 && p_vout->b_fullscreen )
|| ( i_x11_event == 2 && p_vout->b_fullscreen )
); );
/* Autohide Cursour */ /* Autohide Cursour */
...@@ -1544,7 +1546,7 @@ static int ManageVideo( vout_thread_t *p_vout ) ...@@ -1544,7 +1546,7 @@ static int ManageVideo( vout_thread_t *p_vout )
p_vout->p_sys->i_mouse_hide_timeout ) p_vout->p_sys->i_mouse_hide_timeout )
{ {
/* Hide the mouse automatically */ /* Hide the mouse automatically */
if( b_x11_event && p_vout->p_sys->b_mouse_pointer_visible ) if( b_vout_event && p_vout->p_sys->b_mouse_pointer_visible )
{ {
ToggleCursor( p_vout ); ToggleCursor( p_vout );
} }
...@@ -1800,17 +1802,15 @@ static int CreateWindow( vout_thread_t *p_vout, x11_window_t *p_win ) ...@@ -1800,17 +1802,15 @@ static int CreateWindow( vout_thread_t *p_vout, x11_window_t *p_win )
} }
} while( !( b_expose && b_configure_notify && b_map_notify ) ); } while( !( b_expose && b_configure_notify && b_map_notify ) );
/* key and mouse events handling depending on --x11-event option /* key and mouse events handling depending on --vout-event option
* activated if: * activated if:
* value = 1 (Fullsupport) (default value) * value = 1 (Fullsupport) (default value)
* or value = 2 (Fullscreen-Only) and condition met * or value = 2 (Fullscreen-Only) and condition met
*/ */
int i_x11_event = var_CreateGetInteger( p_vout, "x11-event" ); bool b_vout_event = ( ( p_vout->p_sys->i_vout_event == 1 )
bool b_x11_event = ( ( i_x11_event == 1 ) || ( p_vout->p_sys->i_vout_event == 2 && p_vout->b_fullscreen )
|| ( i_x11_event == 2 && p_vout->b_fullscreen )
); );
if ( b_vout_event )
if ( b_x11_event )
XSelectInput( p_vout->p_sys->p_display, p_win->base_window, XSelectInput( p_vout->p_sys->p_display, p_win->base_window,
StructureNotifyMask | KeyPressMask | StructureNotifyMask | KeyPressMask |
ButtonPressMask | ButtonReleaseMask | ButtonPressMask | ButtonReleaseMask |
......
...@@ -222,6 +222,9 @@ struct vout_sys_t ...@@ -222,6 +222,9 @@ struct vout_sys_t
x11_window_t original_window; x11_window_t original_window;
x11_window_t fullscreen_window; x11_window_t fullscreen_window;
/* key and mouse event handling */
int i_vout_event; /* 1(Fullsupport), 2(FullscreenOnly), 3(none) */
/* X11 generic properties */ /* X11 generic properties */
bool b_altfullscreen; /* which fullscreen method */ bool b_altfullscreen; /* which fullscreen method */
#ifdef HAVE_SYS_SHM_H #ifdef HAVE_SYS_SHM_H
......
...@@ -548,6 +548,16 @@ static const char *const ppsz_pos_descriptions[] = ...@@ -548,6 +548,16 @@ static const char *const ppsz_pos_descriptions[] =
"This avoids flooding the message log with debug output from the " \ "This avoids flooding the message log with debug output from the " \
"video output synchronization mechanism.") "video output synchronization mechanism.")
#define VOUT_EVENT_TEXT N_("key and mouse event handling at vout level.")
#define VOUT_EVENT_LONGTEXT N_( \
"This parameter accepts values : 1 (full event handling support), " \
"2 (event handling only for fullscreen) or 3 (No event handling). " \
"Full event handling support is the default value.")
static const int pi_vout_event_values[] = { 1, 2, 3 };
static const char *const ppsz_vout_event_descriptions[] =
{ N_("FullSupport"), N_("Fullscreen-Only"), N_("None") };
/***************************************************************************** /*****************************************************************************
* Input * Input
****************************************************************************/ ****************************************************************************/
...@@ -1523,6 +1533,8 @@ vlc_module_begin () ...@@ -1523,6 +1533,8 @@ vlc_module_begin ()
SKIP_FRAMES_LONGTEXT, true ); SKIP_FRAMES_LONGTEXT, true );
add_bool( "quiet-synchro", 0, NULL, QUIET_SYNCHRO_TEXT, add_bool( "quiet-synchro", 0, NULL, QUIET_SYNCHRO_TEXT,
QUIET_SYNCHRO_LONGTEXT, true ); QUIET_SYNCHRO_LONGTEXT, true );
add_integer( "vout-event", 1, NULL, VOUT_EVENT_TEXT, VOUT_EVENT_LONGTEXT, true )
change_integer_list( pi_vout_event_values, ppsz_vout_event_descriptions, NULL )
#ifndef __APPLE__ #ifndef __APPLE__
add_bool( "overlay", 1, NULL, OVERLAY_TEXT, OVERLAY_LONGTEXT, false ) add_bool( "overlay", 1, NULL, OVERLAY_TEXT, OVERLAY_LONGTEXT, false )
#endif #endif
......
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