--- modules/control/globalhotkeys.c	Mon Mar 17 18:59:50 2008
+++ modules/control/globalhotkeys.c	Mon Mar 17 19:01:06 2008
@@ -0,0 +1,519 @@
+/*****************************************************************************
+ * hotkeys.c: Global-Hotkey handling for vlc
+ *****************************************************************************
+ * Copyright (C) 2008 the VideoLAN team
+ *
+ * Authors: Domani Hannes <ssbssa at yahoo dot de>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc/vlc.h>
+#include <vlc_interface.h>
+#include <vlc_keys.h>
+
+/*****************************************************************************
+ * Local prototypes
+ *****************************************************************************/
+static int E_(Open)( vlc_object_t *p_this );
+static void RunIntf( intf_thread_t *p_intf );
+LRESULT CALLBACK WMHOTKEYPROC( HWND, UINT, WPARAM, LPARAM );
+
+/*****************************************************************************
+ * Module descriptor
+ *****************************************************************************/
+#define FULLSCREEN_KEY_TEXT N_("Fullscreen")
+#define FULLSCREEN_KEY_LONGTEXT N_("Select the hotkey to use to swap fullscreen state.")
+#define PLAY_PAUSE_KEY_TEXT N_("Play/Pause")
+#define PLAY_PAUSE_KEY_LONGTEXT N_("Select the hotkey to use to swap paused state.")
+#define PAUSE_KEY_TEXT N_("Pause only")
+#define PAUSE_KEY_LONGTEXT N_("Select the hotkey to use to pause.")
+#define PLAY_KEY_TEXT N_("Play only")
+#define PLAY_KEY_LONGTEXT N_("Select the hotkey to use to play.")
+#define FASTER_KEY_TEXT N_("Faster")
+#define FASTER_KEY_LONGTEXT N_("Select the hotkey to use for fast forward playback.")
+#define SLOWER_KEY_TEXT N_("Slower")
+#define SLOWER_KEY_LONGTEXT N_("Select the hotkey to use for slow motion playback.")
+#define NEXT_KEY_TEXT N_("Next")
+#define NEXT_KEY_LONGTEXT N_("Select the hotkey to use to skip to the next item in the playlist.")
+#define PREV_KEY_TEXT N_("Previous")
+#define PREV_KEY_LONGTEXT N_("Select the hotkey to use to skip to the previous item in the playlist.")
+#define STOP_KEY_TEXT N_("Stop")
+#define STOP_KEY_LONGTEXT N_("Select the hotkey to stop playback.")
+#define POSITION_KEY_TEXT N_("Position")
+#define POSITION_KEY_LONGTEXT N_("Select the hotkey to display the position.")
+
+#define JBEXTRASHORT_KEY_TEXT N_("Very short backwards jump")
+#define JBEXTRASHORT_KEY_LONGTEXT \
+    N_("Select the hotkey to make a very short backwards jump.")
+#define JBSHORT_KEY_TEXT N_("Short backwards jump")
+#define JBSHORT_KEY_LONGTEXT \
+    N_("Select the hotkey to make a short backwards jump.")
+#define JBMEDIUM_KEY_TEXT N_("Medium backwards jump")
+#define JBMEDIUM_KEY_LONGTEXT \
+    N_("Select the hotkey to make a medium backwards jump.")
+#define JBLONG_KEY_TEXT N_("Long backwards jump")
+#define JBLONG_KEY_LONGTEXT \
+    N_("Select the hotkey to make a long backwards jump.")
+
+#define JFEXTRASHORT_KEY_TEXT N_("Very short forward jump")
+#define JFEXTRASHORT_KEY_LONGTEXT \
+    N_("Select the hotkey to make a very short forward jump.")
+#define JFSHORT_KEY_TEXT N_("Short forward jump")
+#define JFSHORT_KEY_LONGTEXT \
+    N_("Select the hotkey to make a short forward jump.")
+#define JFMEDIUM_KEY_TEXT N_("Medium forward jump")
+#define JFMEDIUM_KEY_LONGTEXT \
+    N_("Select the hotkey to make a medium forward jump.")
+#define JFLONG_KEY_TEXT N_("Long forward jump")
+#define JFLONG_KEY_LONGTEXT \
+    N_("Select the hotkey to make a long forward jump.")
+
+#define NAV_ACTIVATE_KEY_TEXT N_("Activate")
+#define NAV_ACTIVATE_KEY_LONGTEXT N_("Select the key to activate selected item in DVD menus.")
+#define NAV_UP_KEY_TEXT N_("Navigate up")
+#define NAV_UP_KEY_LONGTEXT N_("Select the key to move the selector up in DVD menus.")
+#define NAV_DOWN_KEY_TEXT N_("Navigate down")
+#define NAV_DOWN_KEY_LONGTEXT N_("Select the key to move the selector down in DVD menus.")
+#define NAV_LEFT_KEY_TEXT N_("Navigate left")
+#define NAV_LEFT_KEY_LONGTEXT N_("Select the key to move the selector left in DVD menus.")
+#define NAV_RIGHT_KEY_TEXT N_("Navigate right")
+#define NAV_RIGHT_KEY_LONGTEXT N_("Select the key to move the selector right in DVD menus.")
+
+#define DISC_MENU_TEXT N_("Go to the DVD menu")
+#define DISC_MENU_LONGTEXT N_("Select the key to take you to the DVD menu")
+#define TITLE_PREV_TEXT N_("Select previous DVD title")
+#define TITLE_PREV_LONGTEXT N_("Select the key to choose the previous title from the DVD")
+#define TITLE_NEXT_TEXT N_("Select next DVD title")
+#define TITLE_NEXT_LONGTEXT N_("Select the key to choose the next title from the DVD")
+#define CHAPTER_PREV_TEXT N_("Select prev DVD chapter")
+#define CHAPTER_PREV_LONGTEXT N_("Select the key to choose the previous chapter from the DVD")
+#define CHAPTER_NEXT_TEXT N_("Select next DVD chapter")
+#define CHAPTER_NEXT_LONGTEXT N_("Select the key to choose the next chapter from the DVD")
+
+#define QUIT_KEY_TEXT N_("Quit")
+#define QUIT_KEY_LONGTEXT N_("Select the hotkey to quit the application.")
+#define VOL_UP_KEY_TEXT N_("Volume up")
+#define VOL_UP_KEY_LONGTEXT N_("Select the key to increase audio volume.")
+#define VOL_DOWN_KEY_TEXT N_("Volume down")
+#define VOL_DOWN_KEY_LONGTEXT N_("Select the key to decrease audio volume.")
+#define VOL_MUTE_KEY_TEXT N_("Mute")
+#define VOL_MUTE_KEY_LONGTEXT N_("Select the key to mute audio.")
+#define SUBDELAY_UP_KEY_TEXT N_("Subtitle delay up")
+#define SUBDELAY_UP_KEY_LONGTEXT N_("Select the key to increase the subtitle delay.")
+#define SUBDELAY_DOWN_KEY_TEXT N_("Subtitle delay down")
+#define SUBDELAY_DOWN_KEY_LONGTEXT N_("Select the key to decrease the subtitle delay.")
+#define AUDIODELAY_UP_KEY_TEXT N_("Audio delay up")
+#define AUDIODELAY_UP_KEY_LONGTEXT N_("Select the key to increase the audio delay.")
+#define AUDIODELAY_DOWN_KEY_TEXT N_("Audio delay down")
+#define AUDIODELAY_DOWN_KEY_LONGTEXT N_("Select the key to decrease the audio delay.")
+
+#define AUDIO_TRACK_KEY_TEXT N_("Cycle audio track")
+#define AUDIO_TRACK_KEY_LONGTEXT N_("Cycle through the available audio tracks(languages).")
+#define SUBTITLE_TRACK_KEY_TEXT N_("Cycle subtitle track")
+#define SUBTITLE_TRACK_KEY_LONGTEXT N_("Cycle through the available subtitle tracks.")
+#define ASPECT_RATIO_KEY_TEXT N_("Cycle source aspect ratio")
+#define ASPECT_RATIO_KEY_LONGTEXT N_("Cycle through a predefined list of source aspect ratios.")
+#define CROP_KEY_TEXT N_("Cycle video crop")
+#define CROP_KEY_LONGTEXT N_("Cycle through a predefined list of crop formats.")
+#define DEINTERLACE_KEY_TEXT N_("Cycle deinterlace modes")
+#define DEINTERLACE_KEY_LONGTEXT N_("Cycle through deinterlace modes.")
+#define INTF_SHOW_KEY_TEXT N_("Show interface")
+#define INTF_SHOW_KEY_LONGTEXT N_("Raise the interface above all other windows.")
+#define INTF_HIDE_KEY_TEXT N_("Hide interface")
+#define INTF_HIDE_KEY_LONGTEXT N_("Lower the interface below all other windows.")
+#define SNAP_KEY_TEXT N_("Take video snapshot")
+#define SNAP_KEY_LONGTEXT N_("Takes a video snapshot and writes it to disk.")
+
+#define HISTORY_BACK_TEXT N_("Go back in browsing history")
+#define HISTORY_BACK_LONGTEXT N_("Select the key to go back (to the previous media item) in the browsing history.")
+#define HISTORY_FORWARD_TEXT N_("Go forward in browsing history")
+#define HISTORY_FORWARD_LONGTEXT N_("Select the key to go forward (to the next media item) in the browsing history.")
+
+#define RECORD_KEY_TEXT N_("Record")
+#define RECORD_KEY_LONGTEXT N_("Record access filter start/stop.")
+#define DUMP_KEY_TEXT N_("Dump")
+#define DUMP_KEY_LONGTEXT N_("Media dump access filter trigger.")
+
+#define CROP_TOP_KEY_TEXT N_("Crop one pixel from the top of the video")
+#define CROP_TOP_KEY_LONGTEXT N_("Crop one pixel from the top of the video")
+#define UNCROP_TOP_KEY_TEXT N_("Uncrop one pixel from the top of the video")
+#define UNCROP_TOP_KEY_LONGTEXT N_("Uncrop one pixel from the top of the video")
+
+#define CROP_LEFT_KEY_TEXT N_("Crop one pixel from the left of the video")
+#define CROP_LEFT_KEY_LONGTEXT N_("Crop one pixel from the left of the video")
+#define UNCROP_LEFT_KEY_TEXT N_("Uncrop one pixel from the left of the video")
+#define UNCROP_LEFT_KEY_LONGTEXT N_("Uncrop one pixel from the left of the video")
+
+#define CROP_BOTTOM_KEY_TEXT N_("Crop one pixel from the bottom of the video")
+#define CROP_BOTTOM_KEY_LONGTEXT N_("Crop one pixel from the bottom of the video")
+#define UNCROP_BOTTOM_KEY_TEXT N_("Uncrop one pixel from the bottom of the video")
+#define UNCROP_BOTTOM_KEY_LONGTEXT N_("Uncrop one pixel from the bottom of the video")
+
+#define CROP_RIGHT_KEY_TEXT N_("Crop one pixel from the right of the video")
+#define CROP_RIGHT_KEY_LONGTEXT N_("Crop one pixel from the right of the video")
+#define UNCROP_RIGHT_KEY_TEXT N_("Uncrop one pixel from the right of the video")
+#define UNCROP_RIGHT_KEY_LONGTEXT N_("Uncrop one pixel from the right of the video")
+
+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( E_(Open), NULL );
+
+    /* Hotkeys */
+    add_key( "global-key-fullscreen", KEY_UNSET, NULL, FULLSCREEN_KEY_TEXT,
+             FULLSCREEN_KEY_LONGTEXT, VLC_FALSE );
+    add_key( "global-key-play-pause", KEY_UNSET, NULL, PLAY_PAUSE_KEY_TEXT,
+             PLAY_PAUSE_KEY_LONGTEXT, VLC_FALSE );
+    add_key( "global-key-pause", KEY_UNSET, NULL, PAUSE_KEY_TEXT,
+             PAUSE_KEY_LONGTEXT, VLC_TRUE );
+    add_key( "global-key-play", KEY_UNSET, NULL, PLAY_KEY_TEXT,
+             PLAY_KEY_LONGTEXT, VLC_TRUE );
+    add_key( "global-key-faster", KEY_UNSET, NULL, FASTER_KEY_TEXT,
+             FASTER_KEY_LONGTEXT, VLC_FALSE );
+    add_key( "global-key-slower", KEY_UNSET, NULL, SLOWER_KEY_TEXT,
+             SLOWER_KEY_LONGTEXT, VLC_FALSE );
+    add_key( "global-key-next", KEY_UNSET, NULL, NEXT_KEY_TEXT,
+             NEXT_KEY_LONGTEXT, VLC_FALSE );
+    add_key( "global-key-prev", KEY_UNSET, NULL, PREV_KEY_TEXT,
+             PREV_KEY_LONGTEXT, VLC_FALSE );
+    add_key( "global-key-stop", KEY_UNSET, NULL, STOP_KEY_TEXT,
+             STOP_KEY_LONGTEXT, VLC_FALSE );
+    add_key( "global-key-position", KEY_UNSET, NULL, POSITION_KEY_TEXT,
+             POSITION_KEY_LONGTEXT, VLC_TRUE );
+    add_key( "global-key-jump-extrashort", KEY_UNSET, NULL,
+             JBEXTRASHORT_KEY_TEXT, JBEXTRASHORT_KEY_LONGTEXT, VLC_FALSE );
+    add_key( "global-key-jump+extrashort", KEY_UNSET, NULL,
+             JFEXTRASHORT_KEY_TEXT, JFEXTRASHORT_KEY_LONGTEXT, VLC_FALSE );
+    add_key( "global-key-jump-short", KEY_UNSET, NULL, JBSHORT_KEY_TEXT,
+             JBSHORT_KEY_LONGTEXT, VLC_FALSE );
+    add_key( "global-key-jump+short", KEY_UNSET, NULL, JFSHORT_KEY_TEXT,
+             JFSHORT_KEY_LONGTEXT, VLC_FALSE );
+    add_key( "global-key-jump-medium", KEY_UNSET, NULL, JBMEDIUM_KEY_TEXT,
+             JBMEDIUM_KEY_LONGTEXT, VLC_FALSE );
+    add_key( "global-key-jump+medium", KEY_UNSET, NULL, JFMEDIUM_KEY_TEXT,
+             JFMEDIUM_KEY_LONGTEXT, VLC_FALSE );
+    add_key( "global-key-jump-long", KEY_UNSET, NULL, JBLONG_KEY_TEXT,
+             JBLONG_KEY_LONGTEXT, VLC_FALSE );
+    add_key( "global-key-jump+long", KEY_UNSET, NULL, JFLONG_KEY_TEXT,
+             JFLONG_KEY_LONGTEXT, VLC_FALSE );
+    add_key( "global-key-nav-activate", KEY_UNSET, NULL, NAV_ACTIVATE_KEY_TEXT,
+             NAV_ACTIVATE_KEY_LONGTEXT, VLC_TRUE );
+    add_key( "global-key-nav-up", KEY_UNSET, NULL, NAV_UP_KEY_TEXT,
+             NAV_UP_KEY_LONGTEXT, VLC_TRUE );
+    add_key( "global-key-nav-down", KEY_UNSET, NULL, NAV_DOWN_KEY_TEXT,
+             NAV_DOWN_KEY_LONGTEXT, VLC_TRUE );
+    add_key( "global-key-nav-left", KEY_UNSET, NULL, NAV_LEFT_KEY_TEXT,
+             NAV_LEFT_KEY_LONGTEXT, VLC_TRUE );
+    add_key( "global-key-nav-right", KEY_UNSET, NULL, NAV_RIGHT_KEY_TEXT,
+             NAV_RIGHT_KEY_LONGTEXT, VLC_TRUE );
+
+    add_key( "global-key-disc-menu", KEY_UNSET, NULL, DISC_MENU_TEXT,
+             DISC_MENU_LONGTEXT, VLC_TRUE );
+    add_key( "global-key-title-prev", KEY_UNSET, NULL, TITLE_PREV_TEXT,
+             TITLE_PREV_LONGTEXT, VLC_TRUE );
+    add_key( "global-key-title-next", KEY_UNSET, NULL, TITLE_NEXT_TEXT,
+             TITLE_NEXT_LONGTEXT, VLC_TRUE );
+    add_key( "global-key-chapter-prev", KEY_UNSET, NULL, CHAPTER_PREV_TEXT,
+             CHAPTER_PREV_LONGTEXT, VLC_TRUE );
+    add_key( "global-key-chapter-next", KEY_UNSET, NULL, CHAPTER_NEXT_TEXT,
+             CHAPTER_NEXT_LONGTEXT, VLC_TRUE );
+    add_key( "global-key-quit", KEY_UNSET, NULL, QUIT_KEY_TEXT,
+             QUIT_KEY_LONGTEXT, VLC_FALSE );
+    add_key( "global-key-vol-up", KEY_UNSET, NULL, VOL_UP_KEY_TEXT,
+             VOL_UP_KEY_LONGTEXT, VLC_FALSE );
+    add_key( "global-key-vol-down", KEY_UNSET, NULL, VOL_DOWN_KEY_TEXT,
+             VOL_DOWN_KEY_LONGTEXT, VLC_FALSE );
+    add_key( "global-key-vol-mute", KEY_UNSET, NULL, VOL_MUTE_KEY_TEXT,
+             VOL_MUTE_KEY_LONGTEXT, VLC_FALSE );
+    add_key( "global-key-subdelay-up", KEY_UNSET, NULL,
+             SUBDELAY_UP_KEY_TEXT, SUBDELAY_UP_KEY_LONGTEXT, VLC_TRUE );
+    add_key( "global-key-subdelay-down", KEY_UNSET, NULL,
+             SUBDELAY_DOWN_KEY_TEXT, SUBDELAY_DOWN_KEY_LONGTEXT, VLC_TRUE );
+    add_key( "global-key-audiodelay-up", KEY_UNSET, NULL,
+             AUDIODELAY_UP_KEY_TEXT, AUDIODELAY_UP_KEY_LONGTEXT, VLC_TRUE );
+    add_key( "global-key-audiodelay-down", KEY_UNSET, NULL,
+             AUDIODELAY_DOWN_KEY_TEXT, AUDIODELAY_DOWN_KEY_LONGTEXT, VLC_TRUE );
+    add_key( "global-key-audio-track", KEY_UNSET, NULL, AUDIO_TRACK_KEY_TEXT,
+             AUDIO_TRACK_KEY_LONGTEXT, VLC_FALSE );
+    add_key( "global-key-subtitle-track", KEY_UNSET, NULL,
+             SUBTITLE_TRACK_KEY_TEXT, SUBTITLE_TRACK_KEY_LONGTEXT, VLC_FALSE );
+    add_key( "global-key-aspect-ratio", KEY_UNSET, NULL,
+             ASPECT_RATIO_KEY_TEXT, ASPECT_RATIO_KEY_LONGTEXT, VLC_FALSE );
+    add_key( "global-key-crop", KEY_UNSET, NULL,
+             CROP_KEY_TEXT, CROP_KEY_LONGTEXT, VLC_FALSE );
+    add_key( "global-key-deinterlace", KEY_UNSET, NULL,
+             DEINTERLACE_KEY_TEXT, DEINTERLACE_KEY_LONGTEXT, VLC_FALSE );
+    add_key( "global-key-intf-show", KEY_UNSET, NULL,
+             INTF_SHOW_KEY_TEXT, INTF_SHOW_KEY_LONGTEXT, VLC_TRUE );
+    add_key( "global-key-intf-hide", KEY_UNSET, NULL,
+             INTF_HIDE_KEY_TEXT, INTF_HIDE_KEY_LONGTEXT, VLC_TRUE );
+    add_key( "global-key-snapshot", KEY_UNSET, NULL,
+             SNAP_KEY_TEXT, SNAP_KEY_LONGTEXT, VLC_TRUE );
+    add_key( "global-key-history-back", KEY_UNSET, NULL, HISTORY_BACK_TEXT,
+             HISTORY_BACK_LONGTEXT, VLC_TRUE );
+    add_key( "global-key-history-forward", KEY_UNSET, NULL,
+             HISTORY_FORWARD_TEXT, HISTORY_FORWARD_LONGTEXT, VLC_TRUE );
+    add_key( "global-key-record", KEY_UNSET, NULL,
+             RECORD_KEY_TEXT, RECORD_KEY_LONGTEXT, VLC_TRUE );
+    add_key( "global-key-dump", KEY_UNSET, NULL,
+             DUMP_KEY_TEXT, DUMP_KEY_LONGTEXT, VLC_TRUE );
+
+    add_key( "global-key-crop-top", KEY_UNSET, NULL,
+             CROP_TOP_KEY_TEXT, CROP_TOP_KEY_LONGTEXT, VLC_TRUE );
+    add_key( "global-key-uncrop-top", KEY_UNSET, NULL,
+             UNCROP_TOP_KEY_TEXT, UNCROP_TOP_KEY_LONGTEXT, VLC_TRUE );
+    add_key( "global-key-crop-left", KEY_UNSET, NULL,
+             CROP_LEFT_KEY_TEXT, CROP_LEFT_KEY_LONGTEXT, VLC_TRUE );
+    add_key( "global-key-uncrop-left", KEY_UNSET, NULL,
+             UNCROP_LEFT_KEY_TEXT, UNCROP_LEFT_KEY_LONGTEXT, VLC_TRUE );
+    add_key( "global-key-crop-bottom", KEY_UNSET, NULL,
+             CROP_BOTTOM_KEY_TEXT, CROP_BOTTOM_KEY_LONGTEXT, VLC_TRUE );
+    add_key( "global-key-uncrop-bottom", KEY_UNSET, NULL,
+             UNCROP_BOTTOM_KEY_TEXT, UNCROP_BOTTOM_KEY_LONGTEXT, VLC_TRUE );
+    add_key( "global-key-crop-right", KEY_UNSET, NULL,
+             CROP_RIGHT_KEY_TEXT, CROP_RIGHT_KEY_LONGTEXT, VLC_TRUE );
+    add_key( "global-key-uncrop-right", KEY_UNSET, NULL,
+             UNCROP_RIGHT_KEY_TEXT, UNCROP_RIGHT_KEY_LONGTEXT, VLC_TRUE );
+vlc_module_end();
+
+/*****************************************************************************
+ * Open: initialize interface
+ *****************************************************************************/
+static int E_(Open)( vlc_object_t *p_this )
+{
+    intf_thread_t *p_intf = (intf_thread_t *)p_this;
+
+    p_intf->pf_run = RunIntf;
+
+    return VLC_SUCCESS;
+}
+
+/*****************************************************************************
+ * RunIntf: main loop
+ *****************************************************************************/
+static void RunIntf( intf_thread_t *p_intf )
+{
+    MSG message;
+    module_config_t *p_item;
+    UINT i_keyMod, i_vk;
+    ATOM atom;
+
+    /* Window which receives Hotkeys */
+    p_intf->p_sys =
+        (void*)CreateWindow( _T("STATIC"),           /* name of window class */
+                _T("VLC ghk ") _T(VERSION),         /* window title bar text */
+                0,                                           /* window style */
+                0,                                   /* default X coordinate */
+                0,                                   /* default Y coordinate */
+                0,                                           /* window width */
+                0,                                          /* window height */
+                NULL,                                    /* no parent window */
+                NULL,                              /* no menu in this window */
+                GetModuleHandle(NULL),    /* handle of this program instance */
+                NULL );                                 /* sent to WM_CREATE */
+
+    SetWindowLong( (HWND)p_intf->p_sys, GWL_WNDPROC, (LONG)WMHOTKEYPROC );
+    SetWindowLongPtr( (HWND)p_intf->p_sys, GWL_USERDATA, (LONG_PTR)p_intf );
+
+    if( p_intf->p_module->b_submodule )
+        p_item = ((module_t *)p_intf->p_module->p_parent)->p_config;
+    else
+        p_item = p_intf->p_module->p_config;
+
+    /* Registering of Hotkeys */
+    for( ; p_item->i_type != CONFIG_HINT_END; p_item++ )
+    {
+        if( p_item->i_type != CONFIG_ITEM_KEY ) continue;
+
+        i_keyMod = 0;
+        if( p_item->i_value & KEY_MODIFIER_SHIFT ) i_keyMod |= MOD_SHIFT;
+        if( p_item->i_value & KEY_MODIFIER_ALT ) i_keyMod |= MOD_ALT;
+        if( p_item->i_value & KEY_MODIFIER_CTRL ) i_keyMod |= MOD_CONTROL;
+
+#define HANDLE( key ) case KEY_##key: i_vk = VK_##key; break
+#define HANDLE2( key, key2 ) case KEY_##key: i_vk = VK_##key2; break
+
+#ifndef VK_VOLUME_DOWN
+#define VK_VOLUME_DOWN          0xAE
+#define VK_VOLUME_UP            0xAF
+#endif
+
+#ifndef VK_MEDIA_NEXT_TRACK
+#define VK_MEDIA_NEXT_TRACK     0xB0
+#define VK_MEDIA_PREV_TRACK     0xB1
+#define VK_MEDIA_STOP           0xB2
+#define VK_MEDIA_PLAY_PAUSE     0xB3
+#endif
+
+#ifndef VK_PAGEUP
+#define VK_PAGEUP               0x21
+#define VK_PAGEDOWN             0x22
+#endif
+
+        i_vk = 0;
+        switch( p_item->i_value & ~KEY_MODIFIER )
+        {
+            HANDLE( LEFT );
+            HANDLE( RIGHT );
+            HANDLE( UP );
+            HANDLE( DOWN );
+            HANDLE( SPACE );
+            HANDLE2( ESC, ESCAPE );
+            HANDLE2( ENTER, RETURN );
+            HANDLE( F1 );
+            HANDLE( F2 );
+            HANDLE( F3 );
+            HANDLE( F4 );
+            HANDLE( F5 );
+            HANDLE( F6 );
+            HANDLE( F7 );
+            HANDLE( F8 );
+            HANDLE( F9 );
+            HANDLE( F10 );
+            HANDLE( F11 );
+            HANDLE( F12 );
+            HANDLE( PAGEUP );
+            HANDLE( PAGEDOWN );
+            HANDLE( HOME );
+            HANDLE( END );
+            HANDLE( INSERT );
+            HANDLE( DELETE );
+            HANDLE( VOLUME_DOWN );
+            HANDLE( VOLUME_UP );
+            HANDLE( MEDIA_PLAY_PAUSE );
+            HANDLE( MEDIA_STOP );
+            HANDLE( MEDIA_PREV_TRACK );
+            HANDLE( MEDIA_NEXT_TRACK );
+
+            default:
+                i_vk = p_item->i_value & ~KEY_MODIFIER;
+
+                /* force uppercase */
+                if( i_vk >= 'a' && i_vk <= 'z' )
+                    i_vk -= 32;
+                break;
+        }
+        if( !i_vk ) continue;
+
+#undef HANDLE
+#undef HANDLE2
+
+        atom = GlobalAddAtomA( p_item->psz_name );
+        if( !atom ) continue;
+
+        if( !RegisterHotKey( (HWND)p_intf->p_sys, atom, i_keyMod, i_vk ) )
+            GlobalDeleteAtom( atom );
+    }
+
+    /* Main loop */
+    while( 1 )
+    {
+        if( !PeekMessage( &message, NULL, 0, 0, 0 ) )
+        {
+            if( p_intf->b_die )
+            {
+                if( p_intf->p_module->b_submodule )
+                    p_item = ((module_t *)p_intf->p_module->p_parent)->p_config;
+                else
+                    p_item = p_intf->p_module->p_config;
+
+                /* Unregistering of Hotkeys */
+                for( ; p_item->i_type != CONFIG_HINT_END; p_item++ )
+                {
+                    if( p_item->i_type != CONFIG_ITEM_KEY ) continue;
+
+                    atom = GlobalFindAtomA( p_item->psz_name );
+                    if( !atom ) continue;
+
+                    if( UnregisterHotKey( (HWND)p_intf->p_sys, atom ) )
+                        GlobalDeleteAtom( atom );
+                }
+
+                /* close window */
+                PostMessage( (HWND)p_intf->p_sys, WM_CLOSE, 0, 0 );
+            }
+
+            /* Sleep a bit */
+            msleep( INTF_IDLE_SLEEP );
+
+            continue;
+        }
+
+        if( !GetMessage( &message, NULL, 0, 0 ) ) break;
+        DispatchMessage( &message );
+    }
+}
+
+/*****************************************************************************
+ * WMHOTKEYPROC: event callback
+ *****************************************************************************/
+LRESULT CALLBACK WMHOTKEYPROC( HWND hwnd, UINT uMsg, WPARAM wParam,
+        LPARAM lParam )
+{
+    switch( uMsg )
+    {
+        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_vlc->p_hotkeys;
+
+                i = GlobalGetAtomNameA(
+                        wParam, psz_atomName, sizeof( psz_atomName ) );
+                if( !i || strncmp( psz_atomName, "global-", 7 ) ) return( 0 );
+
+                /* search for key associated with VLC */
+                for( i = 0; p_hotkeys[i].psz_action != NULL; i++ )
+                {
+                    if( strcmp( p_hotkeys[i].psz_action, &psz_atomName[7] ) )
+                        continue;
+
+                    if( p_hotkeys[i].i_key == KEY_UNSET )
+                    {
+                        msg_Warn( p_intf, "%s has no key assigned",
+                                p_hotkeys[i].psz_action );
+
+                        return( 1 );
+                    }
+
+                    var_SetInteger( p_intf->p_vlc,
+                            "key-pressed", p_hotkeys[i].i_key );
+
+                    return( 1 );
+                }
+            }
+            break;
+
+        case WM_DESTROY:
+            PostQuitMessage( 0 );
+            break;
+
+        default:
+            return DefWindowProc( hwnd, uMsg, wParam, lParam );
+    }
+
+    return( 0 );
+}
--- modules/control/Modules.am	Wed Nov 21 22:23:21 2007
+++ modules/control/Modules.am	Mon Mar 17 16:40:03 2008
@@ -6,3 +6,4 @@
 SOURCES_hotkeys = hotkeys.c
 SOURCES_lirc = lirc.c
 SOURCES_rc = rc.c
+SOURCES_globalhotkeys = globalhotkeys.c
--- configure.ac	Sun Feb 24 19:01:55 2008
+++ configure.ac	Mon Mar 17 17:07:00 2008
@@ -1135,6 +1135,7 @@
 elif test "${SYS}" != "mingwce"; then
     VLC_ADD_PLUGINS([ntservice access_smb dmo msn])
     VLC_ADD_LDFLAGS([dmo],[-lole32])
+    VLC_ADD_PLUGINS([globalhotkeys])
 else
     VLC_ADD_PLUGINS([win32text])
 fi
--- src/libvlc.c	Mon Mar 17 19:05:45 2008
+++ src/libvlc.c	Mon Mar 17 19:05:52 2008
@@ -766,6 +766,9 @@
      * Always load the hotkeys interface if it exists
      */
     VLC_AddIntf( 0, "hotkeys,none", VLC_FALSE, VLC_FALSE );
+#ifdef WIN32
+    VLC_AddIntf( 0, "globalhotkeys,none", VLC_FALSE, VLC_FALSE );
+#endif
 
     /*
      * If needed, load the Xscreensaver interface
