]> git.sesse.net Git - vlc/blobdiff - modules/gui/wxwindows/menus.cpp
* access/dvdread.c: misc improvements/fixes.
[vlc] / modules / gui / wxwindows / menus.cpp
index 108e021d0a15f497f6f324221c2e2da90c052689..9d711b4cca22a318a0380fd43649a7fdfac1637b 100644 (file)
@@ -97,7 +97,8 @@ enum
     AudioMenu_Events = wxID_HIGHEST + 2000,
     VideoMenu_Events = wxID_HIGHEST + 3000,
     NavigMenu_Events = wxID_HIGHEST + 4000,
-    PopupMenu_Events = wxID_HIGHEST + 6000
+    PopupMenu_Events = wxID_HIGHEST + 6000,
+    Hotkeys_Events = wxID_HIGHEST + 7000
 };
 
 BEGIN_EVENT_TABLE(Menu, wxMenu)
@@ -177,6 +178,8 @@ void PopupMenu( intf_thread_t *p_intf, wxWindow *p_parent,
         pi_objects[i++] = p_object->i_object_id;
         ppsz_varnames[i] = "video-on-top";
         pi_objects[i++] = p_object->i_object_id;
+        ppsz_varnames[i] = "directx-wallpaper";
+        pi_objects[i++] = p_object->i_object_id;
 
         p_dec_obj = (vlc_object_t *)vlc_object_find( p_object,
                                                      VLC_OBJECT_DECODER,
@@ -343,6 +346,8 @@ wxMenu *VideoMenu( intf_thread_t *_p_intf, wxWindow *p_parent, wxMenu *p_menu )
         pi_objects[i++] = p_object->i_object_id;
         ppsz_varnames[i] = "video-on-top";
         pi_objects[i++] = p_object->i_object_id;
+        ppsz_varnames[i] = "directx-wallpaper";
+        pi_objects[i++] = p_object->i_object_id;
 
         p_dec_obj = (vlc_object_t *)vlc_object_find( p_object,
                                                      VLC_OBJECT_DECODER,
@@ -847,6 +852,8 @@ void MenuEvtHandler::OnShowDialog( wxCommandEvent& event )
 void MenuEvtHandler::OnMenuEvent( wxCommandEvent& event )
 {
     wxMenuItem *p_menuitem = NULL;
+    int i_hotkey_event = p_intf->p_sys->i_first_hotkey_event;
+    int i_hotkeys = p_intf->p_sys->i_hotkeys;
 
     /* Check if this is an auto generated menu item */
     if( event.GetId() < FirstAutoGenerated_Event )
@@ -855,6 +862,21 @@ void MenuEvtHandler::OnMenuEvent( wxCommandEvent& event )
         return;
     }
 
+    /* Check if this is an hotkey event */
+    if( event.GetId() >= i_hotkey_event &&
+        event.GetId() < i_hotkey_event + i_hotkeys )
+    {
+        vlc_value_t val;
+
+        val.i_int =
+            p_intf->p_vlc->p_hotkeys[event.GetId() - i_hotkey_event].i_key;
+
+        /* Get the key combination and send it to the hotkey handler */
+        var_Set( p_intf->p_vlc, "key-pressed", val );
+       msg_Err( p_intf, "received key event: %i", event.GetId() );
+        return;
+    }
+
     if( !p_main_interface ||
         (p_menuitem = p_main_interface->GetMenuBar()->FindItem(event.GetId()))
         == NULL )
@@ -875,7 +897,9 @@ void MenuEvtHandler::OnMenuEvent( wxCommandEvent& event )
                                        p_menuitemext->i_object_id );
         if( p_object == NULL ) return;
 
+        wxMutexGuiLeave(); // We don't want deadlocks
         var_Set( p_object, p_menuitemext->psz_var, p_menuitemext->val );
+        wxMutexGuiEnter();
 
         vlc_object_release( p_object );
     }