X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fcontrol%2Fglobalhotkeys%2Fwin32.c;h=8e3aeafbf5b4b228e3556c7f4164a684d068e468;hb=c574f41b2880a489f4248f0546c24aabc292caa1;hp=af88dd2f6ee63c9d8377f509a428792dc4bf091b;hpb=e939adf8af45848220407705489a3c3f74454ef1;p=vlc diff --git a/modules/control/globalhotkeys/win32.c b/modules/control/globalhotkeys/win32.c index af88dd2f6e..8e3aeafbf5 100644 --- a/modules/control/globalhotkeys/win32.c +++ b/modules/control/globalhotkeys/win32.c @@ -1,5 +1,5 @@ /***************************************************************************** - * globalhotkeys.c: Global-Hotkey handling for vlc + * win32.c: Global-Hotkey WIN32 handling for vlc ***************************************************************************** * Copyright (C) 2008-2009 the VideoLAN team * @@ -42,14 +42,14 @@ LRESULT CALLBACK WMHOTKEYPROC( HWND, UINT, WPARAM, LPARAM ); /***************************************************************************** * Module descriptor *****************************************************************************/ -vlc_module_begin(); - set_shortname( _("Global Hotkeys") ); - set_category( CAT_INTERFACE ); - set_subcategory( SUBCAT_INTERFACE_HOTKEYS ); - set_description( _("Global Hotkeys interface") ); - set_capability( "interface", 0 ); - set_callbacks( Open, Close ); -vlc_module_end(); +vlc_module_begin() + set_shortname( N_("Global Hotkeys") ) + set_category( CAT_INTERFACE ) + set_subcategory( SUBCAT_INTERFACE_HOTKEYS ) + set_description( N_("Global Hotkeys interface") ) + set_capability( "interface", 0 ) + set_callbacks( Open, Close ) +vlc_module_end() struct intf_sys_t { @@ -162,20 +162,20 @@ static void *Thread( void *p_data ) vlc_cond_signal( &p_sys->wait ); vlc_mutex_unlock( &p_sys->lock ); - SetWindowLongPtr( p_sys->hotkeyWindow, GWL_WNDPROC, + SetWindowLongPtr( p_sys->hotkeyWindow, GWLP_WNDPROC, (LONG_PTR)WMHOTKEYPROC ); - SetWindowLongPtr( p_sys->hotkeyWindow, GWL_USERDATA, + SetWindowLongPtr( p_sys->hotkeyWindow, GWLP_USERDATA, (LONG_PTR)p_intf ); /* Registering of Hotkeys */ - for( struct hotkey *p_hotkey = p_intf->p_libvlc->p_hotkeys; + for( const struct hotkey *p_hotkey = p_intf->p_libvlc->p_hotkeys; p_hotkey->psz_action != NULL; p_hotkey++ ) { if( asprintf( &psz_hotkey, "global-%s", p_hotkey->psz_action ) < 0 ) break; - i_key = config_GetInt( p_intf, psz_hotkey ); + i_key = var_InheritInteger( p_intf, psz_hotkey ); free( psz_hotkey ); @@ -187,6 +187,8 @@ static void *Thread( void *p_data ) #define HANDLE( key ) case KEY_##key: i_vk = VK_##key; break #define HANDLE2( key, key2 ) case KEY_##key: i_vk = VK_##key2; break +#define KEY_SPACE ' ' + #ifndef VK_VOLUME_DOWN #define VK_VOLUME_DOWN 0xAE #define VK_VOLUME_UP 0xAF @@ -260,7 +262,7 @@ static void *Thread( void *p_data ) DispatchMessage( &message ); /* Unregistering of Hotkeys */ - for( struct hotkey *p_hotkey = p_intf->p_libvlc->p_hotkeys; + for( const struct hotkey *p_hotkey = p_intf->p_libvlc->p_hotkeys; p_hotkey->psz_action != NULL; p_hotkey++ ) { @@ -290,19 +292,18 @@ LRESULT CALLBACK WMHOTKEYPROC( HWND hwnd, UINT uMsg, WPARAM wParam, { case WM_HOTKEY: { - int i; char psz_atomName[40]; - intf_thread_t *p_intf = - (intf_thread_t*)GetWindowLongPtr( hwnd, GWL_USERDATA ); - struct hotkey *p_hotkeys = p_intf->p_libvlc->p_hotkeys; + LONG_PTR ret = GetWindowLongPtr( hwnd, GWLP_USERDATA ); + intf_thread_t *p_intf = (intf_thread_t*)ret; + const struct hotkey *p_hotkeys = p_intf->p_libvlc->p_hotkeys; - i = GlobalGetAtomNameA( - wParam, psz_atomName, sizeof( psz_atomName ) ); - if( !i ) return 0; + if( !GlobalGetAtomNameA( + wParam, psz_atomName, sizeof( psz_atomName ) ) ) + return 0; /* search for key associated with VLC */ - for( i = 0; p_hotkeys[i].psz_action != NULL; i++ ) + for( int i = 0; p_hotkeys[i].psz_action != NULL; i++ ) { if( strcmp( p_hotkeys[i].psz_action, psz_atomName ) ) continue;