Commit 8bc1b7ed authored by Olivier Teulière's avatar Olivier Teulière

* include/vlc_keys.h: mouse wheel events now considered as hotkeys

 * modules/video_output/directx/events.c: mouse wheel support
 * modules/gui/skins2/src/generic_window.cpp: mouse wheel events are
   treated as hotkeys, but only if they are not intercepted by a control
   (such as a slider)
parent a3a165ed
......@@ -2,7 +2,7 @@
* hotkeys.h: keycode defines
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: vlc_keys.h,v 1.13 2004/01/25 18:17:08 zorglub Exp $
* $Id$
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
*
......@@ -55,6 +55,8 @@
#define KEY_PAGEDOWN 0x00180000
#define KEY_TAB 0x00190000
#define KEY_BACKSPACE 0x001A0000
#define KEY_MOUSEWHEELUP 0x001B0000
#define KEY_MOUSEWHEELDOWN 0x001C0000
#define KEY_ASCII 0x0000007F
#define KEY_UNSET 0
......@@ -105,6 +107,8 @@ static const struct key_descriptor_s vlc_keys[] =
{ "Page Down", KEY_PAGEDOWN },
{ "Tab", KEY_TAB },
{ "Backspace", KEY_BACKSPACE },
{ "Mouse Wheel Up", KEY_MOUSEWHEELUP },
{ "Mouse Wheel Down", KEY_MOUSEWHEELDOWN },
{ "a", 'a' },
{ "b", 'b' },
{ "c", 'c' },
......
......@@ -53,7 +53,8 @@ GenericWindow::GenericWindow( intf_thread_t *pIntf, int left, int top,
SkinObject( pIntf ), m_rWindowManager( rWindowManager ),
m_left( left ), m_top( top ), m_width( 0 ), m_height( 0 ),
m_pActiveLayout( NULL ), m_pLastHitControl( NULL ),
m_pCapturingControl( NULL ), m_pFocusControl( NULL ), m_varVisible( pIntf )
m_pCapturingControl( NULL ), m_pFocusControl( NULL ), m_varVisible( pIntf ),
m_currModifier( 0 )
{
// Register as a moving window
m_rWindowManager.registerWindow( *this );
......@@ -192,10 +193,11 @@ void GenericWindow::processEvent( EvtKey &rEvtKey )
if( m_pFocusControl )
{
m_pFocusControl->handleEvent( rEvtKey );
return;
}
// Only do the action when the key is down
else if( rEvtKey.getAsString().find( "key:down") != string::npos )
if( rEvtKey.getAsString().find( "key:down") != string::npos )
{
//XXX not to be hardcoded !
// Ctrl-S = Change skin
......@@ -239,6 +241,9 @@ void GenericWindow::processEvent( EvtKey &rEvtKey )
var_Set( getIntf()->p_vlc, "key-pressed", val );
}
// Always store the modifier, which can be needed for scroll events
m_currModifier = rEvtKey.getMod();
}
......@@ -258,7 +263,6 @@ void GenericWindow::processEvent( EvtScroll &rEvtScroll )
// Get the control hit by the mouse
CtrlGeneric *pNewHitControl = findHitControl( rEvtScroll.getXPos(),
rEvtScroll.getYPos());
setLastHit( pNewHitControl );
// Send a mouse event to the hit control, or to the control
......@@ -273,6 +277,23 @@ void GenericWindow::processEvent( EvtScroll &rEvtScroll )
{
pActiveControl->handleEvent( rEvtScroll );
}
else
{
// Treat the scroll event as a hotkey
vlc_value_t val;
if( rEvtScroll.getDirection() == EvtScroll::kUp )
{
val.i_int = KEY_MOUSEWHEELUP;
}
else
{
val.i_int = KEY_MOUSEWHEELDOWN;
}
// Add the modifiers
val.i_int |= m_currModifier;
var_Set( getIntf()->p_vlc, "key-pressed", val );
}
}
......
......@@ -140,6 +140,8 @@ class GenericWindow: public SkinObject, public Observer<VarBool>
list<Anchor*> m_anchorList;
/// Variable for the visibility of the window
VarBoolImpl m_varVisible;
/// Current key modifier (also used for mouse)
int m_currModifier;
/// Method called when the observed variable is modified
virtual void onUpdate( Subject<VarBool> &rVariable );
......
......@@ -2,7 +2,7 @@
* preferences_widgets.cpp : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2004 VideoLAN
* $Id: preferences_widgets.cpp,v 1.23 2004/01/29 17:04:01 gbazin Exp $
* $Id$
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
* Sigmund Augdal <sigmunau@idi.ntnu.no>
......@@ -187,6 +187,8 @@ static wxString KeysList[] =
wxT("Page Down"),
wxT("Tab"),
wxT("Backspace"),
wxT("Mouse Wheel Up"),
wxT("Mouse Wheel Down"),
wxT("a"),
wxT("b"),
wxT("c"),
......
......@@ -237,6 +237,34 @@ void DirectXEventThread( event_thread_t *p_event )
}
break;
case WM_MOUSEWHEEL:
if( GET_WHEEL_DELTA_WPARAM( msg.wParam ) > 0 )
{
val.i_int = KEY_MOUSEWHEELUP;
}
else
{
val.i_int = KEY_MOUSEWHEELDOWN;
}
if( val.i_int )
{
if( GetKeyState(VK_CONTROL) & 0x8000 )
{
val.i_int |= KEY_MODIFIER_CTRL;
}
if( GetKeyState(VK_SHIFT) & 0x8000 )
{
val.i_int |= KEY_MODIFIER_SHIFT;
}
if( GetKeyState(VK_MENU) & 0x8000 )
{
val.i_int |= KEY_MODIFIER_ALT;
}
var_Set( p_event->p_vlc, "key-pressed", val );
}
break;
case WM_VLC_CHANGE_TEXT:
if( p_event->p_vout->p_sys->b_using_overlay )
SetWindowText( p_event->p_vout->p_sys->hwnd,
......
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