#include <ddraw.h>
#include <commctrl.h>
-#include <multimon.h>
+#ifndef UNDER_CE
+# include <multimon.h>
+#endif
#undef GetSystemMetrics
#ifndef MONITOR_DEFAULTTONEAREST
p_vout->p_sys->p_display_driver = NULL;
p_vout->p_sys->MonitorFromWindow = NULL;
p_vout->p_sys->GetMonitorInfo = NULL;
- if( (huser32 = GetModuleHandle( "USER32" ) ) )
+ if( (huser32 = GetModuleHandle( _T("USER32") ) ) )
{
p_vout->p_sys->MonitorFromWindow =
- GetProcAddress( huser32, "MonitorFromWindow" );
+ GetProcAddress( huser32, _T("MonitorFromWindow") );
p_vout->p_sys->GetMonitorInfo =
+#ifndef UNICODE
GetProcAddress( huser32, "GetMonitorInfoA" );
+#else
+ GetProcAddress( huser32, _T("GetMonitorInfoW") );
+#endif
}
var_Create( p_vout, "overlay", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
msg_Dbg( p_vout, "DirectXInitDDraw" );
/* Load direct draw DLL */
- p_vout->p_sys->hddraw_dll = LoadLibrary("DDRAW.DLL");
+ p_vout->p_sys->hddraw_dll = LoadLibrary(_T("DDRAW.DLL"));
if( p_vout->p_sys->hddraw_dll == NULL )
{
msg_Warn( p_vout, "DirectXInitDDraw failed loading ddraw.dll" );
}
OurDirectDrawCreate =
- (void *)GetProcAddress(p_vout->p_sys->hddraw_dll, "DirectDrawCreate");
+ (void *)GetProcAddress( p_vout->p_sys->hddraw_dll,
+ _T("DirectDrawCreate") );
if( OurDirectDrawCreate == NULL )
{
msg_Err( p_vout, "DirectXInitDDraw failed GetProcAddress" );
OurDirectDrawEnumerateEx =
(void *)GetProcAddress( p_vout->p_sys->hddraw_dll,
+#ifndef UNICODE
"DirectDrawEnumerateExA" );
+#else
+ _T("DirectDrawEnumerateExW") );
+#endif
if( OurDirectDrawEnumerateEx && p_vout->p_sys->MonitorFromWindow )
{
if( p_vout->p_sys->b_wallpaper == b_on ) return; /* Nothing to do */
- hwnd = FindWindow( "Progman", NULL );
- if( hwnd ) hwnd = FindWindowEx( hwnd, NULL, "SHELLDLL_DefView", NULL );
- if( hwnd ) hwnd = FindWindowEx( hwnd, NULL, "SysListView32", NULL );
+ hwnd = FindWindow( _T("Progman"), NULL );
+ if( hwnd ) hwnd = FindWindowEx( hwnd, NULL, _T("SHELLDLL_DefView"), NULL );
+ if( hwnd ) hwnd = FindWindowEx( hwnd, NULL, _T("SysListView32"), NULL );
if( !hwnd )
{
msg_Warn( p_vout, "couldn't find \"SysListView32\" window, "
p_item->i_list = 1;
/* Load direct draw DLL */
- hddraw_dll = LoadLibrary("DDRAW.DLL");
+ hddraw_dll = LoadLibrary(_T("DDRAW.DLL"));
if( hddraw_dll == NULL ) return VLC_SUCCESS;
OurDirectDrawEnumerateEx =
+#ifndef UNICODE
(void *)GetProcAddress( hddraw_dll, "DirectDrawEnumerateExA" );
+#else
+ (void *)GetProcAddress( hddraw_dll, _T("DirectDrawEnumerateExW") );
+#endif
if( OurDirectDrawEnumerateEx )
{
vlc_thread_ready( p_event );
/* Set power management stuff */
- if( (hkernel32 = GetModuleHandle( "KERNEL32" ) ) )
+ if( (hkernel32 = GetModuleHandle( _T("KERNEL32") ) ) )
{
ULONG (WINAPI* OurSetThreadExecutionState)( ULONG );
OurSetThreadExecutionState =
- GetProcAddress( hkernel32, "SetThreadExecutionState" );
+ GetProcAddress( hkernel32, _T("SetThreadExecutionState") );
if( OurSetThreadExecutionState )
/* Prevent monitor from powering off */
{
#ifdef MODULE_NAME_IS_glwin32
SetWindowText( p_event->p_vout->p_sys->hwnd,
- VOUT_TITLE " (OpenGL output)" );
+ _T(VOUT_TITLE) _T(" (OpenGL output)") );
#else
if( p_event->p_vout->p_sys->b_using_overlay )
- SetWindowText( p_event->p_vout->p_sys->hwnd,
- VOUT_TITLE " (hardware YUV overlay DirectX output)" );
+ SetWindowText( p_event->p_vout->p_sys->hwnd, _T(VOUT_TITLE)
+ _T(" (hardware YUV overlay DirectX output)") );
else if( p_event->p_vout->p_sys->b_hw_yuv )
- SetWindowText( p_event->p_vout->p_sys->hwnd,
- VOUT_TITLE " (hardware YUV DirectX output)" );
- else SetWindowText( p_event->p_vout->p_sys->hwnd,
- VOUT_TITLE " (software RGB DirectX output)" );
+ SetWindowText( p_event->p_vout->p_sys->hwnd, _T(VOUT_TITLE)
+ _T(" (hardware YUV DirectX output)") );
+ else
+ SetWindowText( p_event->p_vout->p_sys->hwnd, _T(VOUT_TITLE)
+ _T(" (software RGB DirectX output)") );
#endif
}
else
HINSTANCE hInstance;
HMENU hMenu;
RECT rect_window;
- WNDCLASSEX wc; /* window class components */
+ WNDCLASS wc; /* window class components */
HICON vlc_icon = NULL;
char vlc_path[MAX_PATH+1];
int i_style;
/* Get the Icon from the main app */
vlc_icon = NULL;
+#ifndef UNDER_CE
if( GetModuleFileName( NULL, vlc_path, MAX_PATH ) )
{
vlc_icon = ExtractIcon( hInstance, vlc_path, 0 );
}
+#endif
/* Fill in the window class structure */
- wc.cbSize = sizeof(WNDCLASSEX);
wc.style = CS_OWNDC|CS_DBLCLKS; /* style: dbl click */
wc.lpfnWndProc = (WNDPROC)DirectXEventProc; /* event handler */
wc.cbClsExtra = 0; /* no extra class data */
wc.hCursor = LoadCursor(NULL, IDC_ARROW); /* default cursor */
wc.hbrBackground = GetStockObject(BLACK_BRUSH); /* background color */
wc.lpszMenuName = NULL; /* no menu */
- wc.lpszClassName = "VLC DirectX"; /* use a special class */
- wc.hIconSm = vlc_icon; /* load the vlc small icon */
+ wc.lpszClassName = _T("VLC DirectX"); /* use a special class */
/* Register the window class */
- if( !RegisterClassEx(&wc) )
+ if( !RegisterClass(&wc) )
{
WNDCLASS wndclass;
/* Check why it failed. If it's because one already exists
* then fine, otherwise return with an error. */
- if( !GetClassInfo( hInstance, "VLC DirectX", &wndclass ) )
+ if( !GetClassInfo( hInstance, _T("VLC DirectX"), &wndclass ) )
{
msg_Err( p_vout, "DirectXCreateWindow RegisterClass FAILED" );
return VLC_EGENERIC;
}
/* Register the video sub-window class */
- wc.lpszClassName = "VLC DirectX video"; wc.hIconSm = 0; wc.hIcon = 0;
- if( !RegisterClassEx(&wc) )
+ wc.lpszClassName = _T("VLC DirectX video"); wc.hIcon = 0;
+ if( !RegisterClass(&wc) )
{
WNDCLASS wndclass;
/* Check why it failed. If it's because one already exists
* then fine, otherwise return with an error. */
- if( !GetClassInfo( hInstance, "VLC DirectX video", &wndclass ) )
+ if( !GetClassInfo( hInstance, _T("VLC DirectX video"), &wndclass ) )
{
msg_Err( p_vout, "DirectXCreateWindow RegisterClass FAILED" );
return VLC_EGENERIC;
/* Create the window */
p_vout->p_sys->hwnd =
CreateWindowEx( WS_EX_NOPARENTNOTIFY,
- "VLC DirectX", /* name of window class */
- VOUT_TITLE " (DirectX Output)", /* window title bar text */
+ _T("VLC DirectX"), /* name of window class */
+ _T(VOUT_TITLE) _T(" (DirectX Output)"), /* window title */
i_style, /* window style */
(p_vout->p_sys->i_window_x < 0) ? CW_USEDEFAULT :
p_vout->p_sys->i_window_x, /* default X coordinate */
/* Create our fullscreen window */
p_vout->p_sys->hfswnd =
- CreateWindowEx( WS_EX_APPWINDOW, "VLC DirectX",
- VOUT_TITLE " (DirectX Output)",
+ CreateWindowEx( WS_EX_APPWINDOW, _T("VLC DirectX"),
+ _T(VOUT_TITLE) _T(" (DirectX Output)"),
WS_OVERLAPPEDWINDOW|WS_CLIPCHILDREN|WS_SIZEBOX,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
/* Append a "Always On Top" entry in the system menu */
hMenu = GetSystemMenu( p_vout->p_sys->hwnd, FALSE );
- AppendMenu( hMenu, MF_SEPARATOR, 0, "" );
+ AppendMenu( hMenu, MF_SEPARATOR, 0, _T("") );
AppendMenu( hMenu, MF_STRING | MF_UNCHECKED,
- IDM_TOGGLE_ON_TOP, "Always on &Top" );
+ IDM_TOGGLE_ON_TOP, _T("Always on &Top") );
return VLC_SUCCESS;
}
case WM_VLC_CREATE_VIDEO_WIN:
/* Create video sub-window */
p_vout->p_sys->hvideownd =
- CreateWindow( "VLC DirectX video", "", /* window class text */
+ CreateWindow( _T("VLC DirectX video"), _T(""), /* window class */
WS_CHILD | WS_VISIBLE, /* window style */
CW_USEDEFAULT, CW_USEDEFAULT, /* default coordinates */
CW_USEDEFAULT, CW_USEDEFAULT,
#define IDM_TOGGLE_ON_TOP WM_USER + 1
#define DX_POSITION_CHANGE 0x1000
#define DX_WALLPAPER_CHANGE 0x2000
+
+#ifndef _T
+# ifdef UNICODE
+# define _T(q) L##q
+# else
+# define _T(q) q
+# endif
+#endif
+
+/*****************************************************************************
+ * WinCE helpers
+ *****************************************************************************/
+#ifdef UNDER_CE
+
+#define AdjustWindowRect(a,b,c)
+
+#ifndef GCL_HBRBACKGROUND
+# define GCL_HBRBACKGROUND (-10)
+#endif
+
+#define FindWindowEx(a,b,c,d) 0
+
+#define GetWindowPlacement(a,b)
+#define SetWindowPlacement(a,b)
+typedef struct _WINDOWPLACEMENT {
+ UINT length;
+ UINT flags;
+ UINT showCmd;
+ POINT ptMinPosition;
+ POINT ptMaxPosition;
+ RECT rcNormalPosition;
+} WINDOWPLACEMENT;
+
+#ifndef WM_NCMOUSEMOVE
+# define WM_NCMOUSEMOVE 160
+#endif
+#ifndef CS_OWNDC
+# define CS_OWNDC 32
+#endif
+#ifndef SC_SCREENSAVE
+# define SC_SCREENSAVE 0xF140
+#endif
+#ifndef SC_MONITORPOWER
+# define SC_MONITORPOWER 0xF170
+#endif
+#ifndef WM_NCPAINT
+# define WM_NCPAINT 133
+#endif
+#ifndef WS_OVERLAPPEDWINDOW
+# define WS_OVERLAPPEDWINDOW 0xcf0000
+#endif
+#ifndef WS_EX_NOPARENTNOTIFY
+# define WS_EX_NOPARENTNOTIFY 4
+#endif
+#ifndef WS_EX_APPWINDOW
+#define WS_EX_APPWINDOW 0x40000
+#endif
+
+#define SetWindowLongPtr SetWindowLong
+#define GetWindowLongPtr GetWindowLong
+#define GWLP_USERDATA GWL_USERDATA
+
+#endif //UNDER_CE