Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
062a0875
Commit
062a0875
authored
Sep 11, 2013
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Win32: common code is not DirectX specific
parent
47b8510a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
33 deletions
+31
-33
modules/video_output/msw/events.c
modules/video_output/msw/events.c
+31
-33
No files found.
modules/video_output/msw/events.c
View file @
062a0875
/*****************************************************************************
/*****************************************************************************
* events.c: Windows
DirectX
video output events handler
* events.c: Windows video output events handler
*****************************************************************************
*****************************************************************************
* Copyright (C) 2001-2009 VLC authors and VideoLAN
* Copyright (C) 2001-2009 VLC authors and VideoLAN
* $Id$
* $Id$
...
@@ -35,22 +35,20 @@
...
@@ -35,22 +35,20 @@
#include <vlc_vout_window.h>
#include <vlc_vout_window.h>
#include <windows.h>
#include <windows.h>
#include <windowsx.h>
#include <windowsx.h>
/* GET_X_LPARAM */
#include <shellapi.h>
#include <shellapi.h>
/* ExtractIcon */
#include <ctype.h>
#ifdef MODULE_NAME_IS_directdraw
#ifdef MODULE_NAME_IS_directdraw
#include <ddraw.h>
#
include <ddraw.h>
#endif
#endif
#ifdef MODULE_NAME_IS_direct3d
#ifdef MODULE_NAME_IS_direct3d
#include <d3d9.h>
#
include <d3d9.h>
#endif
#endif
#ifdef MODULE_NAME_IS_glwin32
#ifdef MODULE_NAME_IS_glwin32
#include "../opengl.h"
#
include "../opengl.h"
#endif
#endif
#ifdef MODULE_NAME_IS_direct2d
#ifdef MODULE_NAME_IS_direct2d
#include <d2d1.h>
#
include <d2d1.h>
#endif
#endif
#include <vlc_keys.h>
#include <vlc_keys.h>
...
@@ -106,11 +104,11 @@ struct event_thread_t
...
@@ -106,11 +104,11 @@ struct event_thread_t
bool
has_moved
;
bool
has_moved
;
};
};
static
int
DirectX
CreateWindow
(
event_thread_t
*
);
static
int
Win32Vout
CreateWindow
(
event_thread_t
*
);
static
void
DirectX
CloseWindow
(
event_thread_t
*
);
static
void
Win32Vout
CloseWindow
(
event_thread_t
*
);
static
long
FAR
PASCAL
DirectX
EventProc
(
HWND
,
UINT
,
WPARAM
,
LPARAM
);
static
long
FAR
PASCAL
WinVout
EventProc
(
HWND
,
UINT
,
WPARAM
,
LPARAM
);
static
int
DirectX
ConvertKey
(
int
i_key
);
static
int
Win32Vout
ConvertKey
(
int
i_key
);
static
inline
bool
isMouseEvent
(
WPARAM
type
)
static
inline
bool
isMouseEvent
(
WPARAM
type
)
{
{
...
@@ -209,7 +207,7 @@ static void *EventThread( void *p_this )
...
@@ -209,7 +207,7 @@ static void *EventThread( void *p_this )
/* Create a window for the video */
/* Create a window for the video */
/* Creating a window under Windows also initializes the thread's event
/* Creating a window under Windows also initializes the thread's event
* message queue */
* message queue */
if
(
DirectX
CreateWindow
(
p_event
)
)
if
(
Win32Vout
CreateWindow
(
p_event
)
)
p_event
->
b_error
=
true
;
p_event
->
b_error
=
true
;
p_event
->
b_ready
=
true
;
p_event
->
b_ready
=
true
;
...
@@ -337,7 +335,7 @@ static void *EventThread( void *p_this )
...
@@ -337,7 +335,7 @@ static void *EventThread( void *p_this )
/* The key events are first processed here and not translated
/* The key events are first processed here and not translated
* into WM_CHAR events because we need to know the status of the
* into WM_CHAR events because we need to know the status of the
* modifier keys. */
* modifier keys. */
int
i_key
=
DirectX
ConvertKey
(
msg
.
wParam
);
int
i_key
=
Win32Vout
ConvertKey
(
msg
.
wParam
);
if
(
!
i_key
)
if
(
!
i_key
)
{
{
/* This appears to be a "normal" (ascii) key */
/* This appears to be a "normal" (ascii) key */
...
@@ -438,9 +436,9 @@ static void *EventThread( void *p_this )
...
@@ -438,9 +436,9 @@ static void *EventThread( void *p_this )
p_event
->
hwnd
=
NULL
;
/* Window already destroyed */
p_event
->
hwnd
=
NULL
;
/* Window already destroyed */
}
}
msg_Dbg
(
vd
,
"
DirectX
EventThread terminating"
);
msg_Dbg
(
vd
,
"
Win32 Vout
EventThread terminating"
);
DirectX
CloseWindow
(
p_event
);
Win32Vout
CloseWindow
(
p_event
);
vlc_restorecancel
(
canc
);
vlc_restorecancel
(
canc
);
return
NULL
;
return
NULL
;
}
}
...
@@ -486,13 +484,13 @@ static HWND GetDesktopHandle(vout_display_t *vd)
...
@@ -486,13 +484,13 @@ static HWND GetDesktopHandle(vout_display_t *vd)
/* following functions are local */
/* following functions are local */
/*****************************************************************************
/*****************************************************************************
*
DirectX
CreateWindow: create a window for the video.
*
Win32Vout
CreateWindow: create a window for the video.
*****************************************************************************
*****************************************************************************
* Before creating a direct draw surface, we need to create a window in which
* Before creating a direct draw surface, we need to create a window in which
* the video will be displayed. This window will also allow us to capture the
* the video will be displayed. This window will also allow us to capture the
* events.
* events.
*****************************************************************************/
*****************************************************************************/
static
int
DirectX
CreateWindow
(
event_thread_t
*
p_event
)
static
int
Win32Vout
CreateWindow
(
event_thread_t
*
p_event
)
{
{
vout_display_t
*
vd
=
p_event
->
vd
;
vout_display_t
*
vd
=
p_event
->
vd
;
HINSTANCE
hInstance
;
HINSTANCE
hInstance
;
...
@@ -502,7 +500,7 @@ static int DirectXCreateWindow( event_thread_t *p_event )
...
@@ -502,7 +500,7 @@ static int DirectXCreateWindow( event_thread_t *p_event )
TCHAR
vlc_path
[
MAX_PATH
+
1
];
TCHAR
vlc_path
[
MAX_PATH
+
1
];
int
i_style
,
i_stylex
;
int
i_style
,
i_stylex
;
msg_Dbg
(
vd
,
"
DirectX
CreateWindow"
);
msg_Dbg
(
vd
,
"
Win32Vout
CreateWindow"
);
/* Get this module's instance */
/* Get this module's instance */
hInstance
=
GetModuleHandle
(
NULL
);
hInstance
=
GetModuleHandle
(
NULL
);
...
@@ -537,7 +535,7 @@ static int DirectXCreateWindow( event_thread_t *p_event )
...
@@ -537,7 +535,7 @@ static int DirectXCreateWindow( event_thread_t *p_event )
/* Fill in the window class structure */
/* Fill in the window class structure */
wc
.
style
=
CS_OWNDC
|
CS_DBLCLKS
;
/* style: dbl click */
wc
.
style
=
CS_OWNDC
|
CS_DBLCLKS
;
/* style: dbl click */
wc
.
lpfnWndProc
=
(
WNDPROC
)
DirectX
EventProc
;
/* event handler */
wc
.
lpfnWndProc
=
(
WNDPROC
)
WinVout
EventProc
;
/* event handler */
wc
.
cbClsExtra
=
0
;
/* no extra class data */
wc
.
cbClsExtra
=
0
;
/* no extra class data */
wc
.
cbWndExtra
=
0
;
/* no extra window data */
wc
.
cbWndExtra
=
0
;
/* no extra window data */
wc
.
hInstance
=
hInstance
;
/* instance */
wc
.
hInstance
=
hInstance
;
/* instance */
...
@@ -554,7 +552,7 @@ static int DirectXCreateWindow( event_thread_t *p_event )
...
@@ -554,7 +552,7 @@ static int DirectXCreateWindow( event_thread_t *p_event )
if
(
p_event
->
vlc_icon
)
if
(
p_event
->
vlc_icon
)
DestroyIcon
(
p_event
->
vlc_icon
);
DestroyIcon
(
p_event
->
vlc_icon
);
msg_Err
(
vd
,
"
DirectX
CreateWindow RegisterClass FAILED (err=%lu)"
,
GetLastError
()
);
msg_Err
(
vd
,
"
Win32Vout
CreateWindow RegisterClass FAILED (err=%lu)"
,
GetLastError
()
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
...
@@ -564,7 +562,7 @@ static int DirectXCreateWindow( event_thread_t *p_event )
...
@@ -564,7 +562,7 @@ static int DirectXCreateWindow( event_thread_t *p_event )
wc
.
hbrBackground
=
NULL
;
/* no background color */
wc
.
hbrBackground
=
NULL
;
/* no background color */
if
(
!
RegisterClass
(
&
wc
)
)
if
(
!
RegisterClass
(
&
wc
)
)
{
{
msg_Err
(
vd
,
"
DirectX
CreateWindow RegisterClass FAILED (err=%lu)"
,
GetLastError
()
);
msg_Err
(
vd
,
"
Win32Vout
CreateWindow RegisterClass FAILED (err=%lu)"
,
GetLastError
()
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
...
@@ -611,7 +609,7 @@ static int DirectXCreateWindow( event_thread_t *p_event )
...
@@ -611,7 +609,7 @@ static int DirectXCreateWindow( event_thread_t *p_event )
p_event
->
hwnd
=
p_event
->
hwnd
=
CreateWindowEx
(
WS_EX_NOPARENTNOTIFY
|
i_stylex
,
CreateWindowEx
(
WS_EX_NOPARENTNOTIFY
|
i_stylex
,
p_event
->
class_main
,
/* name of window class */
p_event
->
class_main
,
/* name of window class */
_T
(
VOUT_TITLE
)
_T
(
" (
DirectX
Output)"
),
/* window title */
_T
(
VOUT_TITLE
)
_T
(
" (
VLC Video
Output)"
),
/* window title */
i_style
,
/* window style */
i_style
,
/* window style */
(
!
p_event
->
wnd_cfg
.
x
)
?
(
UINT
)
CW_USEDEFAULT
:
(
!
p_event
->
wnd_cfg
.
x
)
?
(
UINT
)
CW_USEDEFAULT
:
(
UINT
)
p_event
->
wnd_cfg
.
x
,
/* default X coordinate */
(
UINT
)
p_event
->
wnd_cfg
.
x
,
/* default X coordinate */
...
@@ -626,7 +624,7 @@ static int DirectXCreateWindow( event_thread_t *p_event )
...
@@ -626,7 +624,7 @@ static int DirectXCreateWindow( event_thread_t *p_event )
if
(
!
p_event
->
hwnd
)
if
(
!
p_event
->
hwnd
)
{
{
msg_Warn
(
vd
,
"
DirectX
CreateWindow create window FAILED (err=%lu)"
,
GetLastError
()
);
msg_Warn
(
vd
,
"
Win32Vout
CreateWindow create window FAILED (err=%lu)"
,
GetLastError
()
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
...
@@ -645,7 +643,7 @@ static int DirectXCreateWindow( event_thread_t *p_event )
...
@@ -645,7 +643,7 @@ static int DirectXCreateWindow( event_thread_t *p_event )
/* Create our fullscreen window */
/* Create our fullscreen window */
p_event
->
hfswnd
=
p_event
->
hfswnd
=
CreateWindowEx
(
WS_EX_APPWINDOW
,
p_event
->
class_main
,
CreateWindowEx
(
WS_EX_APPWINDOW
,
p_event
->
class_main
,
_T
(
VOUT_TITLE
)
_T
(
" (
DirectX
Output)"
),
_T
(
VOUT_TITLE
)
_T
(
" (
VLC Fullscreen Video
Output)"
),
WS_OVERLAPPEDWINDOW
|
WS_CLIPCHILDREN
|
WS_SIZEBOX
,
WS_OVERLAPPEDWINDOW
|
WS_CLIPCHILDREN
|
WS_SIZEBOX
,
CW_USEDEFAULT
,
CW_USEDEFAULT
,
CW_USEDEFAULT
,
CW_USEDEFAULT
,
CW_USEDEFAULT
,
CW_USEDEFAULT
,
CW_USEDEFAULT
,
CW_USEDEFAULT
,
...
@@ -688,14 +686,14 @@ static int DirectXCreateWindow( event_thread_t *p_event )
...
@@ -688,14 +686,14 @@ static int DirectXCreateWindow( event_thread_t *p_event )
}
}
/*****************************************************************************
/*****************************************************************************
*
DirectXCloseWindow: close the window created by DirectX
CreateWindow
*
Win32VoutCloseWindow: close the window created by Win32Vout
CreateWindow
*****************************************************************************
*****************************************************************************
* This function returns all resources allocated by
DirectX
CreateWindow.
* This function returns all resources allocated by
Win32Vout
CreateWindow.
*****************************************************************************/
*****************************************************************************/
static
void
DirectX
CloseWindow
(
event_thread_t
*
p_event
)
static
void
Win32Vout
CloseWindow
(
event_thread_t
*
p_event
)
{
{
vout_display_t
*
vd
=
p_event
->
vd
;
vout_display_t
*
vd
=
p_event
->
vd
;
msg_Dbg
(
vd
,
"
DirectX
CloseWindow"
);
msg_Dbg
(
vd
,
"
Win32Vout
CloseWindow"
);
DestroyWindow
(
p_event
->
hwnd
);
DestroyWindow
(
p_event
->
hwnd
);
if
(
p_event
->
hfswnd
)
if
(
p_event
->
hfswnd
)
...
@@ -718,7 +716,7 @@ static void DirectXCloseWindow( event_thread_t *p_event )
...
@@ -718,7 +716,7 @@ static void DirectXCloseWindow( event_thread_t *p_event )
}
}
/*****************************************************************************
/*****************************************************************************
*
DirectX
EventProc: This is the window event processing function.
*
WinVout
EventProc: This is the window event processing function.
*****************************************************************************
*****************************************************************************
* On Windows, when you create a window you have to attach an event processing
* On Windows, when you create a window you have to attach an event processing
* function to it. The aim of this function is to manage "Queued Messages" and
* function to it. The aim of this function is to manage "Queued Messages" and
...
@@ -728,7 +726,7 @@ static void DirectXCloseWindow( event_thread_t *p_event )
...
@@ -728,7 +726,7 @@ static void DirectXCloseWindow( event_thread_t *p_event )
* Nonqueued Messages are those that Windows will send directly to this
* Nonqueued Messages are those that Windows will send directly to this
* procedure (like WM_DESTROY, WM_WINDOWPOSCHANGED...)
* procedure (like WM_DESTROY, WM_WINDOWPOSCHANGED...)
*****************************************************************************/
*****************************************************************************/
static
long
FAR
PASCAL
DirectX
EventProc
(
HWND
hwnd
,
UINT
message
,
static
long
FAR
PASCAL
WinVout
EventProc
(
HWND
hwnd
,
UINT
message
,
WPARAM
wParam
,
LPARAM
lParam
)
WPARAM
wParam
,
LPARAM
lParam
)
{
{
event_thread_t
*
p_event
;
event_thread_t
*
p_event
;
...
@@ -935,7 +933,7 @@ static struct
...
@@ -935,7 +933,7 @@ static struct
{
0
,
0
}
{
0
,
0
}
};
};
static
int
DirectX
ConvertKey
(
int
i_key
)
static
int
Win32Vout
ConvertKey
(
int
i_key
)
{
{
int
i
;
int
i
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment