1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 2003 VideoLAN
5 * $Id: win32_run.cpp,v 1.18 2003/06/03 22:18:58 gbazin Exp $
7 * Authors: Olivier Teulière <ipkiss@via.ecp.fr>
8 * Emmanuel Puig <karibu@via.ecp.fr>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111,
24 *****************************************************************************/
28 //--- VLC -------------------------------------------------------------------
32 //--- GENERAL ---------------------------------------------------------------
35 //--- SKIN ------------------------------------------------------------------
36 #include "../os_api.h"
37 #include "../src/event.h"
38 #include "../os_event.h"
39 #include "../src/banks.h"
40 #include "../src/window.h"
41 #include "../os_window.h"
42 #include "../src/theme.h"
43 #include "../os_theme.h"
44 #include "../src/skin_common.h"
45 #include "../src/vlcproc.h"
47 //---------------------------------------------------------------------------
49 //---------------------------------------------------------------------------
50 bool IsVLCEvent( unsigned int msg );
51 int SkinManage( intf_thread_t *p_intf );
53 //---------------------------------------------------------------------------
54 // Refresh Timer Callback
55 //---------------------------------------------------------------------------
56 void CALLBACK RefreshTimer( HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime )
58 intf_thread_t *p_intf = (intf_thread_t *)GetWindowLongPtr( hwnd,
62 //---------------------------------------------------------------------------
65 //---------------------------------------------------------------------------
67 //---------------------------------------------------------------------------
68 void OSRun( intf_thread_t *p_intf )
70 VlcProc *Proc = new VlcProc( p_intf );
72 list<SkinWindow *>::const_iterator win;
76 // Create refresh timer
77 SetTimer( ((OSTheme *)p_intf->p_sys->p_theme)->GetParentWindow(), 42, 200,
78 (TIMERPROC)RefreshTimer );
80 // Compute windows message list
81 while( GetMessage( &msg, NULL, 0, 0 ) )
84 for( win = p_intf->p_sys->p_theme->WindowList.begin();
85 win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
87 if( msg.hwnd == NULL ||
88 msg.hwnd == ((Win32Window*)(*win))->GetHandle() )
93 if( win == p_intf->p_sys->p_theme->WindowList.end() )
95 // DispatchMessage( &msg );
96 // DefWindowProc( msg.hwnd, msg.message, msg.wParam, msg.lParam );
100 TranslateMessage( &msg );
103 ProcessEvent = (Event *)new OSEvent( p_intf, msg.hwnd, msg.message,
104 msg.wParam, msg.lParam );
106 /*****************************
107 * Process keyboard shortcuts *
108 *****************************/
109 if( msg.message == WM_KEYUP )
111 msg_Err( p_intf, "Key : %i (%i)", msg.wParam, KeyModifier );
113 if( msg.wParam == 17 )
115 else if( KeyModifier == 0 )
117 p_intf->p_sys->p_theme->EvtBank->TestShortcut(
121 else if( msg.message == WM_KEYDOWN )
124 if( msg.wParam == 17 )
126 else if( KeyModifier > 0 )
128 p_intf->p_sys->p_theme->EvtBank->TestShortcut(
129 msg.wParam, KeyModifier );
132 else if( msg.message == WM_SYSKEYDOWN )
135 if( msg.wParam == 18 )
138 else if( msg.message == WM_SYSKEYUP )
140 // If key is a system key
144 /************************
145 * Process timer message *
146 ************************/
147 else if( msg.message == WM_TIMER )
149 DispatchMessage( &msg );
152 /***********************
153 * VLC specific message *
154 ***********************/
155 else if( IsVLCEvent( msg.message ) )
157 if( !Proc->EventProc( ProcessEvent ) )
161 /**********************
162 * Broadcasted message *
163 **********************/
164 else if( msg.hwnd == NULL )
166 for( win = p_intf->p_sys->p_theme->WindowList.begin();
167 win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
169 (*win)->ProcessEvent( ProcessEvent );
173 /***********************
174 * Process window event *
175 ***********************/
178 DispatchMessage( &msg );
182 ProcessEvent->DestructParameters();
183 delete (OSEvent *)ProcessEvent;
185 // Check if vlc is closing
189 //---------------------------------------------------------------------------
190 bool IsVLCEvent( unsigned int msg )
192 return( msg > VLC_MESSAGE && msg < VLC_WINDOW );
194 //---------------------------------------------------------------------------