From 6b4fa4aac8dbea26b364b7e81b5b98daec03676a Mon Sep 17 00:00:00 2001 From: Eric Petit Date: Sat, 8 Nov 2003 18:23:40 +0000 Subject: [PATCH] + configure.ac: link httpd and stream_out_standard against -lsocket + modules/gui/beos/*: use hotkeys + include/vlc_keys.h, src/misc/configuration.c: renamed modifiers into vlc_modifiers so it does not conflict with BeOS' modifiers() --- configure.ac | 9 +-- include/vlc_keys.h | 12 ++-- modules/gui/beos/VideoOutput.cpp | 98 +++++++++++--------------------- modules/gui/beos/VideoWindow.h | 4 +- src/misc/configuration.c | 28 ++++----- 5 files changed, 56 insertions(+), 95 deletions(-) diff --git a/configure.ac b/configure.ac index 526eeb74ad..04f1d92ff0 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ dnl Autoconf settings for vlc -dnl $Id: configure.ac,v 1.109 2003/11/08 14:54:03 massiot Exp $ +dnl $Id: configure.ac,v 1.110 2003/11/08 18:23:40 titer Exp $ AC_INIT(vlc,0.6.3-cvs) @@ -138,11 +138,6 @@ case "${target_os}" in AX_ADD_LDFLAGS([vlc beos],[-lbe]) AX_ADD_LDFLAGS([beos],[-lmedia -ltranslation -ltracker -lgame]) - dnl Check for BONE presence - AC_CHECK_LIB(socket, connect, - AX_ADD_LDFLAGS([vlc ipv4 access_http access_mms access_udp access_ftp sap http access_output_udp], - [-lbind])) - dnl Ugly check for Zeta if test -f /boot/beos/system/lib/libzeta.so; then AX_ADD_LDFLAGS([beos],[-lzeta]) @@ -281,7 +276,7 @@ AC_CHECK_FUNCS(connect,,[ AC_CHECK_FUNCS(send,,[ AC_CHECK_LIB(socket,send,[ - AX_ADD_LDFLAGS([access_http access_mms access_udp access_ftp sap http access_output_udp],[-lsocket]) + AX_ADD_LDFLAGS([access_http access_mms access_udp access_ftp sap httpd access_output_udp stream_out_standard],[-lsocket]) ]) ]) diff --git a/include/vlc_keys.h b/include/vlc_keys.h index 207f7d5fd4..ae3cea6e24 100644 --- a/include/vlc_keys.h +++ b/include/vlc_keys.h @@ -2,7 +2,7 @@ * hotkeys.h: keycode defines ***************************************************************************** * Copyright (C) 2003 VideoLAN - * $Id: vlc_keys.h,v 1.6 2003/10/30 17:58:07 gbazin Exp $ + * $Id: vlc_keys.h,v 1.7 2003/11/08 18:23:40 titer Exp $ * * Authors: Sigmund Augdal * @@ -67,7 +67,7 @@ typedef struct key_descriptor_s #define ADD_KEY(a) { a, *a } -static const struct key_descriptor_s modifiers[] = +static const struct key_descriptor_s vlc_modifiers[] = { { "Alt", KEY_MODIFIER_ALT }, { "Shift", KEY_MODIFIER_SHIFT }, @@ -76,7 +76,7 @@ static const struct key_descriptor_s modifiers[] = { "Command", KEY_MODIFIER_COMMAND } }; -static const struct key_descriptor_s keys[] = +static const struct key_descriptor_s vlc_keys[] = { { "Unset", KEY_UNSET }, { "Left", KEY_LEFT }, @@ -152,11 +152,11 @@ static const struct key_descriptor_s keys[] = static inline char *KeyToString( int i_key ) { unsigned int i = 0; - for ( i = 0; i < sizeof(keys) / sizeof(key_descriptor_t); i++ ) + for ( i = 0; i < sizeof(vlc_keys) / sizeof(key_descriptor_t); i++ ) { - if ( keys[i].i_key_code == i_key ) + if ( vlc_keys[i].i_key_code == i_key ) { - return keys[i].psz_key_string; + return vlc_keys[i].psz_key_string; } } return NULL; diff --git a/modules/gui/beos/VideoOutput.cpp b/modules/gui/beos/VideoOutput.cpp index ed7a31c091..27a3391b8a 100644 --- a/modules/gui/beos/VideoOutput.cpp +++ b/modules/gui/beos/VideoOutput.cpp @@ -2,7 +2,7 @@ * vout_beos.cpp: beos video output display method ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: VideoOutput.cpp,v 1.24 2003/11/04 11:11:30 titer Exp $ + * $Id: VideoOutput.cpp,v 1.25 2003/11/08 18:23:40 titer Exp $ * * Authors: Jean-Marc Dressler * Samuel Hocevar @@ -49,6 +49,7 @@ #include #include #include +#include #include "InterfaceWindow.h" // for load/save_settings() #include "DrawingTidbits.h" @@ -107,6 +108,16 @@ beos_GetAppWindow(char *name) return window; } +static int ConvertKey( int key ) +{ + switch( key ) + { + case B_SPACE: + return KEY_SPACE; + } + return key; +} + /***************************************************************************** * get_interface_window *****************************************************************************/ @@ -1284,72 +1295,27 @@ VLCView::Pulse() /***************************************************************************** * VLCVIew::KeyDown *****************************************************************************/ -void -VLCView::KeyDown(const char *bytes, int32_t numBytes) +void VLCView::KeyDown( const char *bytes, int32 numBytes ) { - VideoWindow *videoWindow = dynamic_cast(Window()); - BWindow* interfaceWindow = get_interface_window(); - if (videoWindow && numBytes > 0) { - uint32_t mods = modifiers(); - switch (*bytes) { - case B_TAB: - case 'f': - case 'F': - // toggle window and full screen mode - // not passing on the tab key to the default KeyDown() - // implementation also avoids loosing the keyboard focus - videoWindow->PostMessage(TOGGLE_FULL_SCREEN); - break; - case B_ESCAPE: - // go back to window mode - if (videoWindow->IsFullScreen()) - videoWindow->PostMessage(TOGGLE_FULL_SCREEN); - break; - case B_SPACE: - // toggle playback - if (interfaceWindow) - interfaceWindow->PostMessage(PAUSE_PLAYBACK); - break; - case B_RIGHT_ARROW: - if (interfaceWindow) - { - if (mods & B_SHIFT_KEY) - // next title - interfaceWindow->PostMessage(NEXT_TITLE); - else - // next chapter - interfaceWindow->PostMessage(NEXT_CHAPTER); - } - break; - case B_LEFT_ARROW: - if (interfaceWindow) - { - if (mods & B_SHIFT_KEY) - // previous title - interfaceWindow->PostMessage(PREV_TITLE); - else - // previous chapter - interfaceWindow->PostMessage(PREV_CHAPTER); - } - break; - case B_UP_ARROW: - // previous file in playlist - interfaceWindow->PostMessage(PREV_FILE); - break; - case B_DOWN_ARROW: - // next file in playlist - interfaceWindow->PostMessage(NEXT_FILE); - break; - case B_PRINT_KEY: - case 's': - case 'S': - videoWindow->PostMessage( SCREEN_SHOT ); - break; - default: - BView::KeyDown(bytes, numBytes); - break; - } - } + VideoWindow * videoWindow = (VideoWindow *) Window(); + + if( !videoWindow || numBytes < 1 ) + { + return; + } + + uint32_t mods = modifiers(); + vlc_value_t val; + + val.i_int = 0; + + switch( *bytes ) + { + default: + val.i_int |= ConvertKey( *bytes ); + var_Set( p_vout->p_vlc, "key-pressed", val ); + break; + } } /***************************************************************************** diff --git a/modules/gui/beos/VideoWindow.h b/modules/gui/beos/VideoWindow.h index b371b606e0..8809adba90 100644 --- a/modules/gui/beos/VideoWindow.h +++ b/modules/gui/beos/VideoWindow.h @@ -2,7 +2,7 @@ * VideoWindow.h: BeOS video window class prototype ***************************************************************************** * Copyright (C) 1999, 2000, 2001 VideoLAN - * $Id: VideoWindow.h,v 1.8 2003/11/04 11:11:30 titer Exp $ + * $Id: VideoWindow.h,v 1.9 2003/11/08 18:23:40 titer Exp $ * * Authors: Jean-Marc Dressler * Tony Castley @@ -117,7 +117,7 @@ class VLCView : public BView const BMessage* dragMessage); virtual void Pulse(); virtual void Draw(BRect updateRect); - virtual void KeyDown(const char* bytes, int32_t numBytes); + virtual void KeyDown(const char* bytes, int32 numBytes); private: vout_thread_t *p_vout; diff --git a/src/misc/configuration.c b/src/misc/configuration.c index ebeeeedb3a..0e2033a1c6 100644 --- a/src/misc/configuration.c +++ b/src/misc/configuration.c @@ -2,7 +2,7 @@ * configuration.c management of the modules configuration ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: configuration.c,v 1.69 2003/11/05 18:59:01 gbazin Exp $ + * $Id: configuration.c,v 1.70 2003/11/08 18:23:40 titer Exp $ * * Authors: Gildas Bazin * @@ -1571,22 +1571,22 @@ static int ConfigStringToKey( char *psz_key ) char *psz_parser = strchr( psz_key, '-' ); while( psz_parser && psz_parser != psz_key ) { - for( i = 0; i < sizeof(modifiers) / sizeof(key_descriptor_t); i++ ) + for( i = 0; i < sizeof(vlc_modifiers) / sizeof(key_descriptor_t); i++ ) { - if( !strncasecmp( modifiers[i].psz_key_string, psz_key, - strlen( modifiers[i].psz_key_string ) ) ) + if( !strncasecmp( vlc_modifiers[i].psz_key_string, psz_key, + strlen( vlc_modifiers[i].psz_key_string ) ) ) { - i_key |= modifiers[i].i_key_code; + i_key |= vlc_modifiers[i].i_key_code; } } psz_key = psz_parser + 1; psz_parser = strchr( psz_key, '-' ); } - for( i = 0; i < sizeof(keys) / sizeof( key_descriptor_t ); i++ ) + for( i = 0; i < sizeof(vlc_keys) / sizeof( key_descriptor_t ); i++ ) { - if( !strcasecmp( keys[i].psz_key_string, psz_key ) ) + if( !strcasecmp( vlc_keys[i].psz_key_string, psz_key ) ) { - i_key |= keys[i].i_key_code; + i_key |= vlc_keys[i].i_key_code; break; } } @@ -1605,20 +1605,20 @@ static char *ConfigKeyToString( int i_key ) } *psz_key = '\0'; p = psz_key; - for( index = 0; index < (sizeof(modifiers) / sizeof(key_descriptor_t)); + for( index = 0; index < (sizeof(vlc_modifiers) / sizeof(key_descriptor_t)); index++ ) { - if( i_key & modifiers[index].i_key_code ) + if( i_key & vlc_modifiers[index].i_key_code ) { - p += sprintf( p, "%s-", modifiers[index].psz_key_string ); + p += sprintf( p, "%s-", vlc_modifiers[index].psz_key_string ); } } - for( index = 0; index < (sizeof(keys) / sizeof( key_descriptor_t)); + for( index = 0; index < (sizeof(vlc_keys) / sizeof( key_descriptor_t)); index++) { - if( (int)( i_key & ~KEY_MODIFIER ) == keys[index].i_key_code ) + if( (int)( i_key & ~KEY_MODIFIER ) == vlc_keys[index].i_key_code ) { - p += sprintf( p, "%s", keys[index].psz_key_string ); + p += sprintf( p, "%s", vlc_keys[index].psz_key_string ); break; } } -- 2.39.2