* intf.c: interface for DVD video manager
*****************************************************************************
* Copyright (C) 2002 VideoLAN
- * $Id: intf.c,v 1.7 2003/08/13 01:45:13 gbazin Exp $
+ * $Id: intf.c,v 1.9 2003/10/29 01:33:27 gbazin Exp $
*
* Authors: Stéphane Borel <stef@via.ecp.fr>
*
#include "input_ext-intf.h"
#include "input_ext-dec.h"
+#include "vlc_keys.h"
+
#include "dvd.h"
/*****************************************************************************
};
p_intf->pf_run = RunIntf;
-
+
+ var_AddCallback( p_intf->p_vlc, "key-pressed", KeyEvent, p_intf );
p_intf->p_sys->m_still_time = 0;
p_intf->p_sys->b_inf_still = 0;
p_intf->p_sys->b_still = 0;
void E_(CloseIntf) ( vlc_object_t *p_this )
{
intf_thread_t *p_intf = (intf_thread_t *)p_this;
-
+ var_DelCallback( p_intf->p_vlc, "key-pressed", KeyEvent, p_intf );
/* Destroy structure */
free( p_intf->p_sys );
}
/*
* keyboard event
*/
- if( p_vout && p_intf->p_sys->b_key_pressed )
+ if( p_intf->p_sys->b_key_pressed )
{
vlc_value_t val;
- int i_activate;
+ int i, i_activate, i_action = -1;
+ struct hotkey *p_hotkeys = p_intf->p_vlc->p_hotkeys;
p_intf->p_sys->b_key_pressed = VLC_FALSE;
- var_Get( p_vout, "key-pressed", &val );
- if ( val.psz_string )
+ /* Find action triggered by hotkey (if any) */
+ var_Get( p_intf->p_vlc, "key-pressed", &val );
+ for( i = 0; p_hotkeys[i].psz_action != NULL; i++ )
+ {
+ if( p_hotkeys[i].i_key == val.i_int )
+ {
+ i_action = p_hotkeys[i].i_action;
+ }
+ }
+
+ if( i_action )
{
- if( !strcmp( val.psz_string, "LEFT" ) )
+ if( i_action == ACTIONID_NAV_LEFT )
{
p_intf->p_sys->control.type = DVDCtrlLeftButtonSelect;
}
- else if( !strcmp( val.psz_string, "RIGHT" ) )
+ else if( i_action == ACTIONID_NAV_RIGHT )
{
p_intf->p_sys->control.type = DVDCtrlRightButtonSelect;
}
- else if( !strcmp( val.psz_string, "UP" ) )
+ else if( i_action == ACTIONID_NAV_UP )
{
p_intf->p_sys->control.type = DVDCtrlUpperButtonSelect;
}
- else if( !strcmp( val.psz_string, "DOWN" ) )
+ else if( i_action == ACTIONID_NAV_DOWN )
{
p_intf->p_sys->control.type = DVDCtrlLowerButtonSelect;
}
- else if( !strcmp( val.psz_string, "ENTER" ) )
+ else if( i_action == ACTIONID_NAV_ACTIVATE )
{
p_intf->p_sys->control.type = DVDCtrlButtonActivate;
}
{
var_DelCallback( p_vout, "mouse-moved", MouseEvent, p_intf );
var_DelCallback( p_vout, "mouse-clicked", MouseEvent, p_intf );
- var_DelCallback( p_vout, "key-pressed", KeyEvent, p_intf );
vlc_object_release( p_vout );
p_vout = NULL;
}
{
var_AddCallback( p_vout, "mouse-moved", MouseEvent, p_intf );
var_AddCallback( p_vout, "mouse-clicked", MouseEvent, p_intf );
- var_AddCallback( p_vout, "key-pressed", KeyEvent, p_intf );
}
}
{
var_DelCallback( p_vout, "mouse-moved", MouseEvent, p_intf );
var_DelCallback( p_vout, "mouse-clicked", MouseEvent, p_intf );
- var_DelCallback( p_vout, "key-pressed", KeyEvent, p_intf );
vlc_object_release( p_vout );
}