[vlc-commits] vout:win32: remove the code related to wallpaper mode in each display module
Steve Lhomme
git at videolan.org
Tue Apr 2 16:33:17 CEST 2019
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Apr 2 14:56:53 2019 +0200| [0e3a8e281c072a8b80814fdc8d219ceeb85496fc] | committer: Steve Lhomme
vout:win32: remove the code related to wallpaper mode in each display module
Remove all the functions and related variables not used anymore.
The last deprecated use of VOUT_DISPLAY_CHANGE_FULLSCREEN is gone on Windows.
We do not need the hfswnd HWND anymore.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0e3a8e281c072a8b80814fdc8d219ceeb85496fc
---
include/vlc_vout_display.h | 13 +----
modules/video_output/win32/common.c | 100 ---------------------------------
modules/video_output/win32/common.h | 3 -
modules/video_output/win32/direct3d9.c | 67 ----------------------
modules/video_output/win32/events.c | 93 ++----------------------------
modules/video_output/win32/events.h | 5 --
src/video_output/display.c | 4 +-
7 files changed, 8 insertions(+), 277 deletions(-)
diff --git a/include/vlc_vout_display.h b/include/vlc_vout_display.h
index 9b532d2557..f42db98a58 100644
--- a/include/vlc_vout_display.h
+++ b/include/vlc_vout_display.h
@@ -126,12 +126,10 @@ enum {
*/
VOUT_DISPLAY_RESET_PICTURES, /* const vout_display_cfg_t *, es_format_t * */
-#if defined(_WIN32) || defined(__OS2__)
+#if defined(__OS2__)
/* Ask the module to acknowledge/refuse the fullscreen state change after
* being requested (externally or by VOUT_DISPLAY_EVENT_FULLSCREEN */
VOUT_DISPLAY_CHANGE_FULLSCREEN VLC_DEPRECATED_ENUM, /* bool fs */
-#endif
-#if defined(__OS2__)
/* Ask the module to acknowledge/refuse the window management state change
* after being requested externally or by VOUT_DISPLAY_WINDOW_STATE */
VOUT_DISPLAY_CHANGE_WINDOW_STATE VLC_DEPRECATED_ENUM, /* unsigned state */
@@ -375,15 +373,6 @@ static inline void vout_display_SendEvent(vout_display_t *vd, int query, ...)
VLC_API void vout_display_SendEventPicturesInvalid(vout_display_t *vd);
-#if defined(_WIN32) || defined(__OS2__)
-VLC_DEPRECATED
-static inline void vout_display_SendEventFullscreen(vout_display_t *vd, bool is_fullscreen)
-{
- if (vout_display_Control(vd, VOUT_DISPLAY_CHANGE_FULLSCREEN,
- is_fullscreen) == VLC_SUCCESS)
- ((vout_display_cfg_t *)vd->cfg)->is_fullscreen = is_fullscreen;
-}
-#endif
static inline void vout_display_SendEventMousePressed(vout_display_t *vd, int button)
{
vout_window_ReportMousePressed(vd->cfg->window, button);
diff --git a/modules/video_output/win32/common.c b/modules/video_output/win32/common.c
index cfd524b057..152744fc19 100644
--- a/modules/video_output/win32/common.c
+++ b/modules/video_output/win32/common.c
@@ -93,7 +93,6 @@ int CommonInit(vlc_object_t *obj, display_win32_area_t *area,
sys->hwnd = NULL;
sys->hvideownd = NULL;
sys->hparent = NULL;
- sys->hfswnd = NULL;
sys->is_first_placement = true;
sys->is_on_top = false;
@@ -107,11 +106,6 @@ int CommonInit(vlc_object_t *obj, display_win32_area_t *area,
/* */
event_cfg_t cfg;
memset(&cfg, 0, sizeof(cfg));
-#ifdef MODULE_NAME_IS_direct3d9
- cfg.use_desktop = sys->use_desktop;
-#endif
- cfg.x = var_InheritInteger(obj, "video-x");
- cfg.y = var_InheritInteger(obj, "video-y");
cfg.width = area->vdcfg.display.width;
cfg.height = area->vdcfg.display.height;
cfg.is_projected = projection_gestures;
@@ -123,7 +117,6 @@ int CommonInit(vlc_object_t *obj, display_win32_area_t *area,
sys->hparent = hwnd.hparent;
sys->hwnd = hwnd.hwnd;
sys->hvideownd = hwnd.hvideownd;
- sys->hfswnd = hwnd.hfswnd;
return VLC_SUCCESS;
}
@@ -268,87 +261,6 @@ static void CommonChangeThumbnailClip(vlc_object_t *obj, vout_display_sys_win32_
}
CoUninitialize();
}
-
-static int CommonControlSetFullscreen(vlc_object_t *obj, vout_display_sys_win32_t *sys, bool is_fullscreen)
-{
-#ifdef MODULE_NAME_IS_direct3d9
- if (sys->use_desktop && is_fullscreen)
- return VLC_EGENERIC;
-#endif
-
- /* */
- HWND hwnd = sys->hparent && sys->hfswnd ? sys->hfswnd : sys->hwnd;
-
- /* Save the current windows placement/placement to restore
- when fullscreen is over */
- WINDOWPLACEMENT window_placement;
- window_placement.length = sizeof(WINDOWPLACEMENT);
- GetWindowPlacement(hwnd, &window_placement);
-
- if (is_fullscreen) {
- msg_Dbg(obj, "entering fullscreen mode");
-
- /* Change window style, no borders and no title bar */
- SetWindowLong(hwnd, GWL_STYLE, WS_CLIPCHILDREN | WS_VISIBLE);
-
- if (sys->hparent) {
- /* Retrieve current window position so fullscreen will happen
- *on the right screen */
- HMONITOR hmon = MonitorFromWindow(sys->hparent,
- MONITOR_DEFAULTTONEAREST);
- MONITORINFO mi;
- mi.cbSize = sizeof(MONITORINFO);
- if (GetMonitorInfo(hmon, &mi))
- SetWindowPos(hwnd, 0,
- mi.rcMonitor.left,
- mi.rcMonitor.top,
- RECTWidth(mi.rcMonitor),
- RECTHeight(mi.rcMonitor),
- SWP_NOZORDER|SWP_FRAMECHANGED);
- } else {
- /* Maximize non embedded window */
- ShowWindow(hwnd, SW_SHOWMAXIMIZED);
- }
-
- if (sys->hparent) {
- /* Hide the previous window */
- RECT rect;
- GetClientRect(hwnd, &rect);
- SetParent(sys->hwnd, hwnd);
- SetWindowPos(sys->hwnd, 0, 0, 0,
- rect.right, rect.bottom,
- SWP_NOZORDER|SWP_FRAMECHANGED);
-
- HWND topLevelParent = GetAncestor(sys->hparent, GA_ROOT);
- ShowWindow(topLevelParent, SW_HIDE);
- }
- SetForegroundWindow(hwnd);
- } else {
- msg_Dbg(obj, "leaving fullscreen mode");
-
- /* Change window style, no borders and no title bar */
- SetWindowLong(hwnd, GWL_STYLE, EventThreadGetWindowStyle(sys->event));
-
- if (sys->hparent) {
- RECT rect;
- GetClientRect(sys->hparent, &rect);
- SetParent(sys->hwnd, sys->hparent);
- SetWindowPos(sys->hwnd, 0, 0, 0,
- rect.right, rect.bottom,
- SWP_NOZORDER|SWP_FRAMECHANGED);
-
- HWND topLevelParent = GetAncestor(sys->hparent, GA_ROOT);
- ShowWindow(topLevelParent, SW_SHOW);
- SetForegroundWindow(sys->hparent);
- ShowWindow(hwnd, SW_HIDE);
- } else {
- /* return to normal window for non embedded vout */
- SetWindowPlacement(hwnd, &window_placement);
- ShowWindow(hwnd, SW_SHOWNORMAL);
- }
- }
- return VLC_SUCCESS;
-}
#endif /* !VLC_WINSTORE_APP */
int CommonControl(vout_display_t *vd, display_win32_area_t *area, vout_display_sys_win32_t *sys, int query, va_list args)
@@ -382,18 +294,6 @@ int CommonControl(vout_display_t *vd, display_win32_area_t *area, vout_display_s
UpdateRects(vd, area, sys);
return VLC_SUCCESS;
}
-#if !VLC_WINSTORE_APP
- case VOUT_DISPLAY_CHANGE_FULLSCREEN: {
- bool fs = va_arg(args, int);
- if (sys->event != NULL)
- {
- if (CommonControlSetFullscreen(VLC_OBJECT(vd), sys, fs))
- return VLC_EGENERIC;
- UpdateRects(vd, area, sys);
- }
- return VLC_SUCCESS;
- }
-#endif /* !VLC_WINSTORE_APP */
case VOUT_DISPLAY_RESET_PICTURES:
vlc_assert_unreachable();
diff --git a/modules/video_output/win32/common.h b/modules/video_output/win32/common.h
index 8e601f7970..2e0a320bb6 100644
--- a/modules/video_output/win32/common.h
+++ b/modules/video_output/win32/common.h
@@ -57,7 +57,6 @@ typedef struct vout_display_sys_win32_t
HWND hwnd; /* Handle of the main window */
HWND hvideownd; /* Handle of the video sub-window */
HWND hparent; /* Handle of the parent window */
- HWND hfswnd; /* Handle of the fullscreen window */
# if !defined(NDEBUG) && defined(HAVE_DXGIDEBUG_H)
HINSTANCE dxgidebug_dll;
@@ -66,8 +65,6 @@ typedef struct vout_display_sys_win32_t
/* Misc */
bool is_first_placement;
bool is_on_top;
-
- bool use_desktop; /* show video on desktop window ? */
} vout_display_sys_win32_t;
diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index 5cea586923..225f810b5d 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -141,10 +141,6 @@ struct vout_display_sys_t
display_win32_area_t area;
bool allow_hw_yuv; /* Should we use hardware YUV->RGB conversions */
- struct {
- bool is_fullscreen;
- bool is_on_top;
- } desktop_save;
// core objects
d3d9_handle_t hd3d;
@@ -168,8 +164,6 @@ struct vout_display_sys_t
bool lost_not_ready;
bool clear_scene;
- atomic_bool new_desktop_mode;
-
/* outside rendering */
void *outside_opaque;
void (*swapCb)(void* opaque);
@@ -910,29 +904,6 @@ static int Direct3D9Reset(vout_display_t *vd, video_format_t *fmtp)
return VLC_SUCCESS;
}
-static void UpdateDesktopMode(vout_display_t *vd)
-{
- vout_display_sys_t *sys = vd->sys;
-
- if (sys->sys.use_desktop) {
- /* Save non-desktop state */
- sys->desktop_save.is_fullscreen = sys->area.vdcfg.is_fullscreen;
- sys->desktop_save.is_on_top = sys->sys.is_on_top;
-
- /* Disable fullscreen/on_top while using desktop */
- if (sys->desktop_save.is_fullscreen)
- vout_display_SendEventFullscreen(vd, false);
- if (sys->desktop_save.is_on_top)
- EventThreadSetAbove( sys->sys.event, false );
- } else {
- /* Restore fullscreen/on_top */
- if (sys->desktop_save.is_fullscreen)
- vout_display_SendEventFullscreen(vd, true);
- if (sys->desktop_save.is_on_top)
- EventThreadSetAbove( sys->sys.event, true );
- }
-}
-
static void Direct3D9ImportSubpicture(vout_display_t *vd,
size_t *count_ptr, d3d_region_t **region,
subpicture_t *subpicture)
@@ -1210,12 +1181,6 @@ static void Prepare(vout_display_t *vd, picture_t *picture,
CommonManage(vd, &sys->area, &sys->sys);
- /* Desktop mode change */
- bool prev_desktop = sys->sys.use_desktop;
- sys->sys.use_desktop = atomic_load( &sys->new_desktop_mode );
- if (sys->sys.use_desktop != prev_desktop)
- UpdateDesktopMode(vd);
-
/* Position Change */
if (sys->area.place_changed) {
#if 0 /* need that when bicubic filter is available */
@@ -1559,23 +1524,6 @@ static int Control(vout_display_t *vd, int query, va_list args)
}
}
-/*****************************************************************************
- * DesktopCallback: desktop mode variable callback
- *****************************************************************************/
-static int DesktopCallback(vlc_object_t *object, char const *psz_cmd,
- vlc_value_t oldval, vlc_value_t newval,
- void *p_data)
-{
- vout_display_t *vd = (vout_display_t *)object;
- vout_display_sys_t *sys = vd->sys;
- VLC_UNUSED(psz_cmd);
- VLC_UNUSED(oldval);
- VLC_UNUSED(p_data);
-
- atomic_store( &sys->new_desktop_mode, newval.b_bool );
- return VLC_SUCCESS;
-}
-
typedef struct
{
char **values;
@@ -1672,12 +1620,9 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
if (!sys->hxdll)
msg_Warn(vd, "cannot load Direct3D9 Shader Library; HLSL pixel shading will be disabled.");
- sys->sys.use_desktop = var_CreateGetBool(vd, "video-wallpaper");
sys->reset_device = false;
sys->lost_not_ready = false;
sys->allow_hw_yuv = var_CreateGetBool(vd, "directx-hw-yuv");
- sys->desktop_save.is_fullscreen = cfg->is_fullscreen;
- sys->desktop_save.is_on_top = false;
InitArea(vd, &sys->area, cfg);
if (d3d9_device == NULL)
@@ -1709,12 +1654,6 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
else
vd->info.subpicture_chromas = NULL;
- /* Interaction */
- atomic_init( &sys->new_desktop_mode, sys->sys.use_desktop );
-
- var_Change(vd, "video-wallpaper", VLC_VAR_SETTEXT, _("Desktop"));
- var_AddCallback(vd, "video-wallpaper", DesktopCallback, NULL);
-
video_format_Clean(fmtp);
video_format_Copy(fmtp, &fmt);
@@ -1724,10 +1663,6 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
vd->display = Display;
vd->control = Control;
- /* Fix state in case of desktop mode */
- if (sys->sys.use_desktop && cfg->is_fullscreen)
- vout_display_SendEventFullscreen(vd, false);
-
return VLC_SUCCESS;
error:
Direct3D9Close(vd);
@@ -1742,8 +1677,6 @@ error:
*/
static void Close(vout_display_t *vd)
{
- var_DelCallback(vd, "video-wallpaper", DesktopCallback, NULL);
-
Direct3D9Close(vd);
CommonClean(VLC_OBJECT(vd), &vd->sys->sys);
diff --git a/modules/video_output/win32/events.c b/modules/video_output/win32/events.c
index 1b875e8bee..a387433667 100644
--- a/modules/video_output/win32/events.c
+++ b/modules/video_output/win32/events.c
@@ -44,8 +44,6 @@
/*****************************************************************************
* Local prototypes.
*****************************************************************************/
-#define WM_VLC_SET_TOP_STATE (WM_APP + 2)
-
struct event_thread_t
{
vlc_object_t *obj;
@@ -59,7 +57,6 @@ struct event_thread_t
bool b_error;
/* */
- bool use_desktop;
bool is_projected;
/* Mouse */
@@ -83,7 +80,6 @@ struct event_thread_t
HWND hparent;
HWND hwnd;
HWND hvideownd;
- HWND hfswnd;
vout_display_place_t place;
atomic_bool size_changed;
@@ -415,12 +411,11 @@ void EventThreadDestroy( event_thread_t *p_event )
int EventThreadStart( event_thread_t *p_event, event_hwnd_t *p_hwnd, const event_cfg_t *p_cfg )
{
- p_event->use_desktop = p_cfg->use_desktop;
p_event->is_projected = p_cfg->is_projected;
- p_event->window_area.left = p_cfg->x;
- p_event->window_area.top = p_cfg->y;
- p_event->window_area.right = p_cfg->x + p_cfg->width;
- p_event->window_area.bottom = p_cfg->y + p_cfg->height;
+ p_event->window_area.left = 0;
+ p_event->window_area.top = 0;
+ p_event->window_area.right = p_cfg->width;
+ p_event->window_area.bottom = p_cfg->height;
atomic_store(&p_event->size_changed, false);
@@ -454,7 +449,6 @@ int EventThreadStart( event_thread_t *p_event, event_hwnd_t *p_hwnd, const event
p_hwnd->hparent = p_event->hparent;
p_hwnd->hwnd = p_event->hwnd;
p_hwnd->hvideownd = p_event->hvideownd;
- p_hwnd->hfswnd = p_event->hfswnd;
return VLC_SUCCESS;
}
@@ -538,45 +532,6 @@ static void MouseReleased( event_thread_t *p_event, unsigned button )
vout_window_ReportMouseReleased(p_event->parent_window, button);
}
-#if defined(MODULE_NAME_IS_direct3d9) || defined(MODULE_NAME_IS_direct3d11)
-static int CALLBACK
-enumWindowsProc(HWND hwnd, LPARAM lParam)
-{
- HWND *wnd = (HWND *)lParam;
-
- char name[128];
- name[0] = '\0';
- GetClassNameA( hwnd, name, 128 );
-
- if( !strcasecmp( name, "WorkerW" ) )
- {
- hwnd = FindWindowEx( hwnd, NULL, TEXT("SHELLDLL_DefView"), NULL );
- if( hwnd ) hwnd = FindWindowEx( hwnd, NULL, TEXT("SysListView32"), NULL );
- if( hwnd )
- {
- *wnd = hwnd;
- return false;
- }
- }
- return true;
-}
-
-static HWND GetDesktopHandle(vlc_object_t *obj)
-{
- /* Find Program Manager */
- HWND hwnd = FindWindow( TEXT("Progman"), NULL );
- if( hwnd ) hwnd = FindWindowEx( hwnd, NULL, TEXT("SHELLDLL_DefView"), NULL );
- if( hwnd ) hwnd = FindWindowEx( hwnd, NULL, TEXT("SysListView32"), NULL );
- if( hwnd )
- return hwnd;
-
- msg_Dbg( obj, "Couldn't find desktop icon window,. Trying the hard way." );
-
- EnumWindows( enumWindowsProc, (LPARAM)&hwnd );
- return hwnd;
-}
-#endif
-
static long FAR PASCAL VideoEventProc( HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam )
{
@@ -686,20 +641,8 @@ static int Win32VoutCreateWindow( event_thread_t *p_event )
/* Get this module's instance */
hInstance = GetModuleHandle(NULL);
- #if defined(MODULE_NAME_IS_direct3d9) || defined(MODULE_NAME_IS_direct3d11)
- if( !p_event->use_desktop )
- #endif
- {
- /* If an external window was specified, we'll draw in it. */
- p_event->hparent = p_event->parent_window->handle.hwnd;
- }
- #if defined(MODULE_NAME_IS_direct3d9) || defined(MODULE_NAME_IS_direct3d11)
- else
- {
- p_event->parent_window = NULL;
- p_event->hparent = GetDesktopHandle(p_event->obj);
- }
- #endif
+ /* If an external window was specified, we'll draw in it. */
+ p_event->hparent = p_event->parent_window->handle.hwnd;
p_event->cursor_arrow = LoadCursor(NULL, IDC_ARROW);
p_event->cursor_empty = EmptyCursor(hInstance);
@@ -787,19 +730,6 @@ static int Win32VoutCreateWindow( event_thread_t *p_event )
/* Hmmm, apparently this is a blocking call... */
SetWindowLong( p_event->hparent, GWL_STYLE,
parent_style | WS_CLIPCHILDREN );
-
- /* Create our fullscreen window */
- p_event->hfswnd =
- CreateWindowEx( WS_EX_APPWINDOW, p_event->class_main,
- TEXT(VOUT_TITLE) TEXT(" (VLC Fullscreen Video Output)"),
- WS_OVERLAPPEDWINDOW|WS_CLIPCHILDREN|WS_SIZEBOX,
- CW_USEDEFAULT, CW_USEDEFAULT,
- CW_USEDEFAULT, CW_USEDEFAULT,
- NULL, NULL, hInstance, NULL );
- }
- else
- {
- p_event->hfswnd = NULL;
}
int err = CreateVideoWindow( p_event );
@@ -825,8 +755,6 @@ static void Win32VoutCloseWindow( event_thread_t *p_event )
DestroyWindow( p_event->hvideownd );
DestroyWindow( p_event->hwnd );
- if( p_event->hfswnd )
- DestroyWindow( p_event->hfswnd );
p_event->hwnd = NULL;
@@ -897,10 +825,6 @@ static long FAR PASCAL WinVoutEventProc( HWND hwnd, UINT message,
PostQuitMessage( 0 );
return 0;
- case WM_VLC_SET_TOP_STATE:
- SetAbove( p_event, wParam != 0);
- return 0;
-
case WM_KILLFOCUS:
return 0;
@@ -918,11 +842,6 @@ static long FAR PASCAL WinVoutEventProc( HWND hwnd, UINT message,
return DefWindowProc(hwnd, message, wParam, lParam);
}
-void EventThreadSetAbove( event_thread_t *p_event, bool is_on_top )
-{
- PostMessage( p_event->hwnd, WM_VLC_SET_TOP_STATE, is_on_top != 0, 0);
-}
-
static struct
{
int i_dxkey;
diff --git a/modules/video_output/win32/events.h b/modules/video_output/win32/events.h
index 8b31d12558..83300afb38 100644
--- a/modules/video_output/win32/events.h
+++ b/modules/video_output/win32/events.h
@@ -30,10 +30,7 @@
typedef struct event_thread_t event_thread_t;
typedef struct {
- bool use_desktop; /* direct3d */
bool is_projected;
- int x;
- int y;
unsigned width;
unsigned height;
} event_cfg_t;
@@ -43,7 +40,6 @@ typedef struct {
HWND hparent;
HWND hwnd;
HWND hvideownd;
- HWND hfswnd;
} event_hwnd_t;
event_thread_t *EventThreadCreate( vlc_object_t *, vout_window_t *);
@@ -54,7 +50,6 @@ void EventThreadStop( event_thread_t * );
int EventThreadGetWindowStyle( event_thread_t * );
void EventThreadUpdatePlace( event_thread_t *p_event,
const vout_display_place_t *p_place );
-void EventThreadSetAbove( event_thread_t *, bool );
bool EventThreadGetAndResetSizeChanged( event_thread_t * );
# ifdef __cplusplus
diff --git a/src/video_output/display.c b/src/video_output/display.c
index 8395758bb1..e5c072ae2a 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -778,15 +778,13 @@ vout_display_t *vout_display_New(vlc_object_t *parent,
if (vd->module == NULL)
goto error;
-#if defined(_WIN32) || defined(__OS2__)
+#if defined(__OS2__)
if ((var_GetBool(parent, "fullscreen")
|| var_GetBool(parent, "video-wallpaper"))
&& vout_display_Control(vd, VOUT_DISPLAY_CHANGE_FULLSCREEN,
true) == VLC_SUCCESS)
osys->cfg.is_fullscreen = true;
-#endif
-#if defined(__OS2__)
if (var_InheritBool(parent, "video-on-top"))
vout_display_Control(vd, VOUT_DISPLAY_CHANGE_WINDOW_STATE,
(unsigned)VOUT_WINDOW_STATE_ABOVE);
More information about the vlc-commits
mailing list