Commit cd2c272c authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* the OSX vout has support for the new hotkeys now. no prefs for it yet.

  And this is no final solution, i think it should be handled in VLCApplication.
parent 90973854
......@@ -2,7 +2,7 @@
* hotkeys.c: Hotkey handling for vlc
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: hotkeys.c,v 1.2 2003/10/29 01:33:27 gbazin Exp $
* $Id: hotkeys.c,v 1.3 2003/10/29 02:13:04 hartman Exp $
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
*
......@@ -205,7 +205,7 @@ static void Run( intf_thread_t *p_intf )
audio_volume_t i_newvol;
char string[9];
aout_VolumeUp( p_intf, 1, &i_newvol );
sprintf( string, "Vol %%%d", i_newvol*100/AOUT_VOLUME_MAX );
sprintf( string, "Vol %d%%", i_newvol*100/AOUT_VOLUME_MAX );
Feedback( p_intf, string );
}
else if( i_action == ACTIONID_VOL_DOWN )
......@@ -213,7 +213,7 @@ static void Run( intf_thread_t *p_intf )
audio_volume_t i_newvol;
char string[9];
aout_VolumeDown( p_intf, 1, &i_newvol );
sprintf( string, "Vol %%%d", i_newvol*100/AOUT_VOLUME_MAX );
sprintf( string, "Vol %d%%", i_newvol*100/AOUT_VOLUME_MAX );
Feedback( p_intf, string );
}
else if( i_action == ACTIONID_FULLSCREEN )
......@@ -302,11 +302,13 @@ static void Run( intf_thread_t *p_intf )
}
else if( i_action == ACTIONID_FASTER )
{
input_SetStatus( p_input, INPUT_STATUS_FASTER );
vlc_value_t val; val.b_bool = VLC_TRUE;
var_Set( p_input, "rate-faster", val );
}
else if( i_action == ACTIONID_FASTER )
{
input_SetStatus( p_input, INPUT_STATUS_SLOWER );
vlc_value_t val; val.b_bool = VLC_TRUE;
var_Set( p_input, "rate-slower", val );
}
}
......
......@@ -2,7 +2,7 @@
* intf.h: MacOS X interface plugin
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* $Id: intf.h,v 1.45 2003/09/20 19:37:53 hartman Exp $
* $Id: intf.h,v 1.46 2003/10/29 02:13:04 hartman Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr>
......@@ -56,6 +56,7 @@
int ExecuteOnMainThread( id target, SEL sel, void * p_arg );
int PlaylistChanged( vlc_object_t *p_this, const char *psz_variable,
vlc_value_t old_val, vlc_value_t new_val, void *param );
int CocoaConvertKey( unichar i_key);
/*****************************************************************************
* intf_sys_t: description and status of the interface
......
......@@ -2,7 +2,7 @@
* intf.m: MacOS X interface plugin
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* $Id: intf.m,v 1.96 2003/09/20 19:37:53 hartman Exp $
* $Id: intf.m,v 1.97 2003/10/29 02:13:04 hartman Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr>
......@@ -29,6 +29,7 @@
#include <stdlib.h> /* malloc(), free() */
#include <sys/param.h> /* for MAXPATHLEN */
#include <string.h>
#include <vlc_keys.h>
#include "intf.h"
#include "vout.h"
......@@ -289,6 +290,55 @@ int PlaylistChanged( vlc_object_t *p_this, const char *psz_variable,
return VLC_SUCCESS;
}
static struct
{
unichar i_nskey;
int i_vlckey;
} nskeys_to_vlckeys[] =
{
{ NSUpArrowFunctionKey, KEY_UP },
{ NSDownArrowFunctionKey, KEY_DOWN },
{ NSLeftArrowFunctionKey, KEY_LEFT },
{ NSRightArrowFunctionKey, KEY_RIGHT },
{ NSF1FunctionKey, KEY_F1 },
{ NSF2FunctionKey, KEY_F2 },
{ NSF3FunctionKey, KEY_F3 },
{ NSF4FunctionKey, KEY_F4 },
{ NSF5FunctionKey, KEY_F5 },
{ NSF6FunctionKey, KEY_F6 },
{ NSF7FunctionKey, KEY_F7 },
{ NSF8FunctionKey, KEY_F8 },
{ NSF9FunctionKey, KEY_F9 },
{ NSF10FunctionKey, KEY_F10 },
{ NSF11FunctionKey, KEY_F11 },
{ NSF12FunctionKey, KEY_F12 },
{ NSHomeFunctionKey, KEY_HOME },
{ NSEndFunctionKey, KEY_END },
{ NSPageUpFunctionKey, KEY_PAGEUP },
{ NSPageDownFunctionKey, KEY_PAGEDOWN },
{ NSTabCharacter, KEY_TAB },
{ NSCarriageReturnCharacter, KEY_ENTER },
{ NSEnterCharacter, KEY_ENTER },
{ NSBackspaceCharacter, KEY_BACKSPACE },
{ (unichar) ' ', KEY_SPACE },
{ (unichar) 0x1b, KEY_ESC },
{0,0}
};
int CocoaConvertKey( unichar i_key )
{
int i;
for( i = 0; nskeys_to_vlckeys[i].i_nskey != 0; i++ )
{
if( nskeys_to_vlckeys[i].i_nskey == i_key )
{
return nskeys_to_vlckeys[i].i_vlckey;
}
}
return (int)i_key;
}
/*****************************************************************************
* VLCMain implementation
*****************************************************************************/
......
......@@ -3,7 +3,7 @@
* vout.m: MacOS X video output plugin
*****************************************************************************
* Copyright (C) 2001-2003 VideoLAN
* $Id: vout.m,v 1.57 2003/09/20 19:37:53 hartman Exp $
* $Id: vout.m,v 1.58 2003/10/29 02:13:04 hartman Exp $
*
* Authors: Colin Delacroix <colin@zoy.org>
* Florian G. Pflug <fgp@phlo.org>
......@@ -34,6 +34,8 @@
#include <QuickTime/QuickTime.h>
#include <vlc_keys.h>
#include "intf.h"
#include "vout.h"
......@@ -357,7 +359,7 @@ void E_(CloseVideo) ( vlc_object_t *p_this )
{
vout_thread_t * p_vout = (vout_thread_t *)p_this;
if ( p_vout->p_sys->isplugin == 0)
if ( !p_vout->p_sys->isplugin )
{
if( CoDestroyWindow( p_vout ) )
{
......@@ -397,16 +399,18 @@ static int vout_Manage( vout_thread_t *p_vout )
p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
}
if( (p_vout->i_changes & VOUT_SIZE_CHANGE) || (val1.i_int == 1))
if( (p_vout->i_changes & VOUT_SIZE_CHANGE) ||
( p_vout->p_sys->isplugin && val1.i_int == 1) )
{
if (val1.i_int == 1)
if( p_vout->p_sys->isplugin )
{
val1.i_int = 0;
var_Set( p_vout->p_vlc, "drawableredraw", val1 );
SetDSequenceMask( p_vout->p_sys->i_seq , p_vout->p_sys->mask );
} else if (p_vout->i_changes & VOUT_SIZE_CHANGE)
val1.i_int = 0;
var_Set( p_vout->p_vlc, "drawableredraw", val1 );
SetDSequenceMask( p_vout->p_sys->i_seq , p_vout->p_sys->mask );
}
else
{
p_vout->i_changes &= ~VOUT_SIZE_CHANGE;
p_vout->i_changes &= ~VOUT_SIZE_CHANGE;
}
QTScaleMatrix( p_vout );
......@@ -980,72 +984,34 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
- (void)keyDown:(NSEvent *)o_event
{
playlist_t * p_playlist;
unichar key = 0;
vlc_value_t val;
unsigned int i_pressed_modifiers = 0;
if( [[o_event characters] length] )
{
key = [[o_event characters] characterAtIndex: 0];
}
switch( key )
{
case 'f': case 'F':
[self toggleFullscreen];
break;
case (unichar)0x1b: /* escape */
if( [self isFullscreen] )
{
[self toggleFullscreen];
}
break;
case 'q': case 'Q':
p_vout->p_vlc->b_die = VLC_TRUE;
break;
case ' ':
p_playlist = vlc_object_find( p_vout, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if ( p_playlist != NULL )
{
playlist_Pause( p_playlist );
vlc_object_release( p_playlist);
}
break;
case (unichar)0xf700: /* arrow up */
val.psz_string = "UP";
var_Set( p_vout, "key-pressed", val );
break;
case (unichar)0xf701: /* arrow down */
val.psz_string = "DOWN";
var_Set( p_vout, "key-pressed", val );
break;
case (unichar)0xf702: /* arrow left */
val.psz_string = "LEFT";
var_Set( p_vout, "key-pressed", val );
break;
i_pressed_modifiers = GetCurrentKeyModifiers();
case (unichar)0xf703: /* arrow right */
val.psz_string = "RIGHT";
var_Set( p_vout, "key-pressed", val );
break;
if( i_pressed_modifiers & NSShiftKeyMask )
val.i_int |= KEY_MODIFIER_SHIFT;
if( i_pressed_modifiers & NSControlKeyMask )
val.i_int |= KEY_MODIFIER_CTRL;
if( i_pressed_modifiers & NSAlternateKeyMask )
val.i_int |= KEY_MODIFIER_ALT;
if( i_pressed_modifiers & NSCommandKeyMask )
val.i_int |= KEY_MODIFIER_COMMAND;
case (unichar)0xd: /* return */
case (unichar)0x3: /* enter */
val.psz_string = "ENTER";
var_Set( p_vout, "key-pressed", val );
break;
NSLog( @"detected the modifiers: %x", val.i_int );
key = [[o_event charactersIgnoringModifiers] characterAtIndex: 0];
default:
[super keyDown: o_event];
break;
if( key )
{
val.i_int |= CocoaConvertKey( key );
var_Set( p_vout->p_vlc, "key-pressed", val );
NSLog( @"detected the key: %x", key );
}
else
{
[super keyDown: o_event];
}
}
......
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