]> git.sesse.net Git - vlc/blobdiff - modules/video_output/directx/events.c
* modules/video_output/directx/events.c: compilation fix.
[vlc] / modules / video_output / directx / events.c
index a7dc35d738e64715a663f5f4bdfdda1c8c6af13b..52b9dade6960aa854c11efb67fdb833bc4956977 100644 (file)
@@ -2,7 +2,7 @@
  * events.c: Windows DirectX video output events handler
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: events.c,v 1.12 2003/03/04 22:48:55 gbazin Exp $
+ * $Id: events.c,v 1.21 2003/07/29 21:46:44 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -35,8 +35,6 @@
 #include <vlc/input.h>
 #include <vlc/vout.h>
 
-#include "netutils.h"
-
 #include <windows.h>
 #include <windowsx.h>
 #include <shellapi.h>
@@ -64,7 +62,7 @@ static long FAR PASCAL DirectXEventProc ( HWND hwnd, UINT message,
 void DirectXEventThread( event_thread_t *p_event )
 {
     MSG msg;
-    POINT old_mouse_pos;
+    POINT old_mouse_pos = {0,0};
     vlc_value_t val;
     int i_width, i_height, i_x, i_y;
 
@@ -172,13 +170,15 @@ void DirectXEventThread( event_thread_t *p_event )
             val.i_int &= ~4;
             var_Set( p_event->p_vout, "mouse-button-down", val );
             {
-                intf_thread_t *p_intf;
-                p_intf = vlc_object_find( p_event, VLC_OBJECT_INTF,
-                                                   FIND_ANYWHERE );
-                if( p_intf )
+                playlist_t *p_playlist =
+                    vlc_object_find( p_event, VLC_OBJECT_PLAYLIST,
+                                     FIND_ANYWHERE );
+                if( p_playlist != NULL )
                 {
-                    p_intf->b_menu_change = 1;
-                    vlc_object_release( p_intf );
+                    vlc_value_t val;
+                    val.b_bool = VLC_TRUE; /* make compiler happy */
+                    var_Set( p_playlist, "intf-popupmenu", val );
+                    vlc_object_release( p_playlist );
                 }
             }
             break;
@@ -191,35 +191,78 @@ void DirectXEventThread( event_thread_t *p_event )
             switch( msg.wParam )
             {
             case VK_ESCAPE:
-                /* exit application */
-                p_event->p_vlc->b_die = VLC_TRUE;
+                if( p_event->p_vout->b_fullscreen )
+                {
+                    p_event->p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
+                }
+                else
+                {
+                    /* close video window */
+                    PostMessage( msg.hwnd, WM_CLOSE, 0, 0 );
+                }
                 break;
 
-            case VK_SPACE:
-            {
-                vlc_object_t *p_input = vlc_object_find( p_event->p_vout,
-                    VLC_OBJECT_INPUT, FIND_ANYWHERE );
-                if( p_input )
+            case VK_MENU:
                 {
-                    input_SetStatus( (input_thread_t *)p_input,
-                                     INPUT_STATUS_PAUSE );
-                    vlc_object_release( p_input );
+                    playlist_t *p_playlist =
+                        vlc_object_find( p_event, VLC_OBJECT_PLAYLIST,
+                                         FIND_ANYWHERE );
+                    if( p_playlist != NULL )
+                    {
+                        vlc_value_t val;
+                        var_Set( p_playlist, "intf-popupmenu", val );
+                        vlc_object_release( p_playlist );
+                    }
                 }
                 break;
-            }
 
-            case VK_F1: network_ChannelJoin( p_event, 1 ); break;
-            case VK_F2: network_ChannelJoin( p_event, 2 ); break;
-            case VK_F3: network_ChannelJoin( p_event, 3 ); break;
-            case VK_F4: network_ChannelJoin( p_event, 4 ); break;
-            case VK_F5: network_ChannelJoin( p_event, 5 ); break;
-            case VK_F6: network_ChannelJoin( p_event, 6 ); break;
-            case VK_F7: network_ChannelJoin( p_event, 7 ); break;
-            case VK_F8: network_ChannelJoin( p_event, 8 ); break;
-            case VK_F9: network_ChannelJoin( p_event, 9 ); break;
-            case VK_F10: network_ChannelJoin( p_event, 10 ); break;
-            case VK_F11: network_ChannelJoin( p_event, 11 ); break;
-            case VK_F12: network_ChannelJoin( p_event, 12 ); break;
+            case VK_LEFT:
+                /* input_Seek( p_event->p_vout, -5,
+                   INPUT_SEEK_SECONDS | INPUT_SEEK_CUR ); */
+                val.psz_string = "LEFT";
+                var_Set( p_event->p_vout, "key-pressed", val );
+                break;
+            case VK_RIGHT:
+                /* input_Seek( p_event->p_vout, 5,
+                   INPUT_SEEK_SECONDS | INPUT_SEEK_CUR ); */
+                val.psz_string = "RIGHT";
+                var_Set( p_event->p_vout, "key-pressed", val );
+                break;
+            case VK_UP:
+                /* input_Seek( p_event->p_vout, 60,
+                   INPUT_SEEK_SECONDS | INPUT_SEEK_CUR ); */
+                val.psz_string = "UP";
+                var_Set( p_event->p_vout, "key-pressed", val );
+                break;
+            case VK_DOWN:
+                /* input_Seek( p_event->p_vout, -60,
+                   INPUT_SEEK_SECONDS | INPUT_SEEK_CUR ); */
+                val.psz_string = "DOWN";
+                var_Set( p_event->p_vout, "key-pressed", val );
+                break;
+            case VK_RETURN:
+                val.psz_string = "ENTER";
+                var_Set( p_event->p_vout, "key-pressed", val );
+                break;
+            case VK_HOME:
+                input_Seek( p_event->p_vout, 0,
+                            INPUT_SEEK_BYTES | INPUT_SEEK_SET );
+                break;
+            case VK_END:
+                input_Seek( p_event->p_vout, 0,
+                            INPUT_SEEK_BYTES | INPUT_SEEK_END );
+                break;
+            case VK_PRIOR:
+                input_Seek( p_event->p_vout, 10,
+                            INPUT_SEEK_SECONDS | INPUT_SEEK_CUR );
+                break;
+            case VK_NEXT:
+                input_Seek( p_event->p_vout, -10,
+                            INPUT_SEEK_SECONDS | INPUT_SEEK_CUR );
+                break;
+            case VK_SPACE:
+                input_SetStatus( p_event->p_vout, INPUT_STATUS_PAUSE );
+                break;
             }
             TranslateMessage(&msg);
             break;
@@ -238,29 +281,6 @@ void DirectXEventThread( event_thread_t *p_event )
                 p_event->p_vout->p_sys->i_changes |= VOUT_FULLSCREEN_CHANGE;
                 break;
 
-            case 'c':                                /* toggle grayscale */
-            case 'C':
-                p_event->p_vout->b_grayscale = ! p_event->p_vout->b_grayscale;
-                p_event->p_vout->p_sys->i_changes |= VOUT_GRAYSCALE_CHANGE;
-                break;
-
-            case 'i':                                     /* toggle info */
-            case 'I':
-                p_event->p_vout->b_info = ! p_event->p_vout->b_info;
-                p_event->p_vout->p_sys->i_changes |= VOUT_INFO_CHANGE;
-                break;
-
-            case 's':                                  /* toggle scaling */
-            case 'S':
-                p_event->p_vout->b_scale = ! p_event->p_vout->b_scale;
-                p_event->p_vout->p_sys->i_changes |= VOUT_SCALE_CHANGE;
-                break;
-
-            case ' ':                                /* toggle interface */
-                p_event->p_vout->b_interface = ! p_event->p_vout->b_interface;
-                p_event->p_vout->p_sys->i_changes |= VOUT_INTF_CHANGE;
-                break;
-
             default:
                 break;
             }
@@ -653,10 +673,19 @@ static long FAR PASCAL DirectXEventProc( HWND hwnd, UINT message,
 
     /* the user wants to close the window */
     case WM_CLOSE:
-        msg_Dbg( p_vout, "WinProc WM_CLOSE" );
-        /* exit application */
-        p_vout->p_vlc->b_die = VLC_TRUE;
+    {
+        playlist_t * p_playlist =
+            (playlist_t *)vlc_object_find( p_vout, VLC_OBJECT_PLAYLIST,
+                                           FIND_ANYWHERE );
+        if( p_playlist == NULL )
+        {
+            return 0;
+        }
+
+        playlist_Stop( p_playlist );
+        vlc_object_release( p_playlist );
         return 0;
+    }
 
     /* the window has been closed so shut down everything now */
     case WM_DESTROY:
@@ -717,4 +746,3 @@ static long FAR PASCAL DirectXEventProc( HWND hwnd, UINT message,
 
     return DefWindowProc(hwnd, message, wParam, lParam);
 }
-