src/libvlc.c:

 * created a variable "key-pressed" in p_vlc that can be used to
   report or read key presses
 * allways try to start hotkeys interface in the background
configure.ac, modules/control/Modules.am, modules/control/hotkeys.c:
 * a new control module that reads keypresses from "key-pressed" and
   performs an action depending on what is asosiated with this key.
   Also uses nice on screen messages to indicate what action was performed
modules/video_filter/filter_common.h:
 * removed code to pass old style key reporting through filters
modules/video_output/x11/xcommon.c:
 * report key-presses through the new mechanism. Incomplete, I need help
   with this.
parent 4363f75a
dnl Autoconf settings for vlc
dnl $Id: configure.ac,v 1.94 2003/10/24 21:27:06 gbazin Exp $
dnl $Id: configure.ac,v 1.95 2003/10/26 12:46:55 sigmunau Exp $
AC_INIT(vlc,0.6.3-cvs)
......@@ -844,7 +844,7 @@ test "${enable_cprof}" != "yes" && enable_cprof="no"
dnl
dnl default modules
dnl
AX_ADD_PLUGINS([dummy rc logger gestures memcpy])
AX_ADD_PLUGINS([dummy rc logger gestures memcpy hotkeys])
AX_ADD_PLUGINS([es mpga m4v mpeg_system ps ts avi asf aac mp4 rawdv])
AX_ADD_PLUGINS([spudec mpeg_audio lpcm a52 dts cinepak])
AX_ADD_PLUGINS([deinterlace invert adjust wall transform distort clone crop motionblur])
......
......@@ -2,3 +2,4 @@ SOURCES_gestures = gestures.c
SOURCES_http = http.c
SOURCES_ntservice = ntservice.c
SOURCES_joystick = joystick.c
SOURCES_hotkeys = hotkeys.c
This diff is collapsed.
......@@ -2,7 +2,7 @@
* filter_common.h: Common filter functions
*****************************************************************************
* Copyright (C) 2001, 2002, 2003 VideoLAN
* $Id: filter_common.h,v 1.4 2003/10/24 21:27:06 gbazin Exp $
* $Id: filter_common.h,v 1.5 2003/10/26 12:46:55 sigmunau Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -78,16 +78,14 @@ static int SetParentVal( vlc_object_t *p_this, char const *psz_var,
var_AddCallback( newvout, "mouse-x", SendEvents, p_vout ); \
var_AddCallback( newvout, "mouse-y", SendEvents, p_vout ); \
var_AddCallback( newvout, "mouse-moved", SendEvents, p_vout ); \
var_AddCallback( newvout, "mouse-clicked", SendEvents, p_vout ); \
var_AddCallback( newvout, "key-pressed", SendEvents, p_vout )
var_AddCallback( newvout, "mouse-clicked", SendEvents, p_vout );
#define DEL_CALLBACKS( newvout, handler ) \
var_DelCallback( newvout, "fullscreen", SetParentVal, p_vout ); \
var_DelCallback( newvout, "mouse-x", SendEvents, p_vout ); \
var_DelCallback( newvout, "mouse-y", SendEvents, p_vout ); \
var_DelCallback( newvout, "mouse-moved", SendEvents, p_vout ); \
var_DelCallback( newvout, "mouse-clicked", SendEvents, p_vout ); \
var_DelCallback( newvout, "key-pressed", SendEvents, p_vout )
var_DelCallback( newvout, "mouse-clicked", SendEvents, p_vout );
#define ADD_PARENT_CALLBACKS( handler ) \
var_AddCallback( p_vout, "fullscreen", handler, NULL ); \
......
......@@ -2,7 +2,7 @@
* xcommon.c: Functions common to the X11 and XVideo plugins
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: xcommon.c,v 1.33 2003/10/24 21:27:06 gbazin Exp $
* $Id: xcommon.c,v 1.34 2003/10/26 12:46:55 sigmunau Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -34,6 +34,7 @@
#include <vlc/vlc.h>
#include <vlc/intf.h>
#include <vlc/vout.h>
#include <hotkeys.h>
#ifdef HAVE_MACHINE_PARAM_H
/* BSD */
......@@ -517,92 +518,49 @@ static int ManageVideo( vout_thread_t *p_vout )
/* Keyboard event */
else if( xevent.type == KeyPress )
{
vlc_value_t val;
val.i_int = 0;
/* We may have keys like F1 trough F12, ESC ... */
x_key_symbol = XKeycodeToKeysym( p_vout->p_sys->p_display,
xevent.xkey.keycode, 0 );
switch( (int)x_key_symbol )
{
case XK_Return:
case XK_KP_Enter:
val.i_int = KEY_ENTER;
break;
case XK_Escape:
if( p_vout->b_fullscreen )
{
p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
}
else
{
/* the user wants to close the window */
playlist_t * p_playlist =
(playlist_t *)vlc_object_find( p_vout,
VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist != NULL )
{
playlist_Stop( p_playlist );
vlc_object_release( p_playlist );
}
}
val.i_int = KEY_ESC;
break;
case XK_Menu:
{
intf_thread_t *p_intf;
playlist_t * p_playlist;
p_intf = vlc_object_find( p_vout, VLC_OBJECT_INTF,
FIND_ANYWHERE );
if( p_intf )
{
p_intf->b_menu_change = 1;
vlc_object_release( p_intf );
}
p_playlist = vlc_object_find( p_vout, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist != NULL )
{
vlc_value_t val;
var_Set( p_playlist, "intf-popupmenu", val );
vlc_object_release( p_playlist );
}
}
val.i_int = KEY_MENU;
break;
case XK_Left:
/* input_Seek( p_vout, -5, INPUT_SEEK_SECONDS | INPUT_SEEK_CUR ); */
val.psz_string = "LEFT";
var_Set( p_vout, "key-pressed", val );
val.i_int = KEY_LEFT;
break;
case XK_Right:
/* input_Seek( p_vout, 5, INPUT_SEEK_SECONDS | INPUT_SEEK_CUR ); */
val.psz_string = "RIGHT";
var_Set( p_vout, "key-pressed", val );
val.i_int = KEY_RIGHT;
break;
case XK_Up:
/* input_Seek( p_vout, 60, INPUT_SEEK_SECONDS | INPUT_SEEK_CUR ); */
val.psz_string = "UP";
var_Set( p_vout, "key-pressed", val );
val.i_int = KEY_UP;
break;
case XK_Down:
/* input_Seek( p_vout, -60, INPUT_SEEK_SECONDS | INPUT_SEEK_CUR ); */
val.psz_string = "DOWN";
var_Set( p_vout, "key-pressed", val );
break;
case XK_Return:
case XK_KP_Enter:
val.psz_string = "ENTER";
var_Set( p_vout, "key-pressed", val );
val.i_int = KEY_DOWN;
break;
case XK_Home:
input_Seek( p_vout, 0, INPUT_SEEK_BYTES | INPUT_SEEK_SET );
val.i_int = KEY_HOME;
break;
case XK_End:
input_Seek( p_vout, 0, INPUT_SEEK_BYTES | INPUT_SEEK_END );
val.i_int = KEY_END;
break;
case XK_Page_Up:
input_Seek( p_vout, 10, INPUT_SEEK_SECONDS | INPUT_SEEK_CUR );
val.i_int = KEY_PAGEUP;
break;
case XK_Page_Down:
input_Seek( p_vout, -10, INPUT_SEEK_SECONDS | INPUT_SEEK_CUR );
val.i_int = KEY_PAGEDOWN;
break;
case XK_space:
input_SetStatus( p_vout, INPUT_STATUS_PAUSE );
val.i_int = KEY_SPACE;
break;
default:
......@@ -614,23 +572,34 @@ static int ManageVideo( vout_thread_t *p_vout )
if( XLookupString( &xevent.xkey, &i_key, 1, NULL, NULL ) )
{
/* FIXME: handle stuff here */
switch( i_key )
{
case 'q':
case 'Q':
p_vout->p_vlc->b_die = 1;
break;
case 'f':
case 'F':
p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
break;
default:
break;
}
val.i_int = i_key;
}
break;
}
if ( val.i_int )
{
if ( xevent.xkey.state & ShiftMask )
{
val.i_int |= KEY_MODIFIER_SHIFT;
}
if ( xevent.xkey.state & ControlMask )
{
msg_Dbg( p_vout, "control pressed, key value is %x", val.i_int );
val.i_int |= KEY_MODIFIER_CTRL;
}
if ( xevent.xkey.state & Mod1Mask )
{
val.i_int |= KEY_MODIFIER_ALT;
}
if ( val.i_int == config_GetInt( p_vout, "fullscreen-key" ) )
{
p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
}
else
{
var_Set( p_vout->p_vlc, "key-pressed", val );
}
}
}
/* Mouse click */
else if( xevent.type == ButtonPress )
......
......@@ -2,7 +2,7 @@
* libvlc.c: main libvlc source
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
* $Id: libvlc.c,v 1.98 2003/10/23 16:43:37 sam Exp $
* $Id: libvlc.c,v 1.99 2003/10/26 12:46:55 sigmunau Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -564,6 +564,10 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
p_vlc->pf_memset = memset;
}
/*
* Initialize hotkey handling
*/
var_Create( p_vlc, "key-pressed", VLC_VAR_INTEGER );
/*
* Initialize playlist and get commandline files
*/
......@@ -608,6 +612,11 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
free( psz_modules );
}
/*
* Allways load the hotkeys interface if it exists
*/
VLC_AddIntf( 0, "hotkeys,none", VLC_FALSE );
/*
* FIXME: kludge to use a p_vlc-local variable for the Mozilla plugin
*/
......
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