#include <windowsx.h>
#include <shellapi.h>
-#ifdef MODULE_NAME_IS_directx
+#ifdef MODULE_NAME_IS_directdraw
#include <ddraw.h>
#endif
#ifdef MODULE_NAME_IS_direct3d
#include "common.h"
-#ifndef UNDER_CE
#include <vlc_windows_interfaces.h>
-#endif
-
-#ifdef UNDER_CE
-#include <aygshell.h>
- //WINSHELLAPI BOOL WINAPI SHFullScreen(HWND hwndRequester, DWORD dwState);
-#endif
static void CommonChangeThumbnailClip(vout_display_t *, bool show);
static int CommonControlSetFullscreen(vout_display_t *, bool is_fullscreen);
-#if !defined(UNDER_CE) && !defined(MODULE_NAME_IS_glwin32)
static void DisableScreensaver(vout_display_t *);
static void RestoreScreensaver(vout_display_t *);
-#endif
/* */
int CommonInit(vout_display_t *vd)
#ifdef MODULE_NAME_IS_direct3d
cfg.use_desktop = sys->use_desktop;
#endif
-#ifdef MODULE_NAME_IS_directx
+#ifdef MODULE_NAME_IS_directdraw
cfg.use_overlay = sys->use_overlay;
#endif
cfg.win.type = VOUT_WINDOW_TYPE_HWND;
}
/* Why not with glwin32 */
-#if !defined(UNDER_CE) && !defined(MODULE_NAME_IS_glwin32)
var_Create(vd, "disable-screensaver", VLC_VAR_BOOL | VLC_VAR_DOINHERIT);
DisableScreensaver (vd);
-#endif
return VLC_SUCCESS;
}
EventThreadDestroy(sys->event);
}
-#if !defined(UNDER_CE) && !defined(MODULE_NAME_IS_glwin32)
RestoreScreensaver(vd);
-#endif
}
void CommonManage(vout_display_t *vd)
* with the associated window (hvideownd)
*
* For directx, it is still important to call UpdateRects
- * on a move of the parent window, even if no resize occured
+ * on a move of the parent window, even if no resize occurred
*/
SetWindowPos(sys->hwnd, 0, 0, 0,
rect_parent.right - rect_parent.left,
/* */
static void CommonChangeThumbnailClip(vout_display_t *vd, bool show)
{
-#ifndef UNDER_CE
vout_display_sys_t *sys = vd->sys;
/* Windows 7 taskbar thumbnail code */
if (!GetVersionEx(&winVer) || winVer.dwMajorVersion <= 5)
return;
- CoInitialize(0);
+ CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
void *ptr;
- if (S_OK == CoCreateInstance(&clsid_ITaskbarList,
+ if (S_OK == CoCreateInstance(&CLSID_TaskbarList,
NULL, CLSCTX_INPROC_SERVER,
&IID_ITaskbarList3,
&ptr)) {
- LPTASKBARLIST3 taskbl = ptr;
- taskbl->vt->HrInit(taskbl);
+ ITaskbarList3 *taskbl = ptr;
+ taskbl->lpVtbl->HrInit(taskbl);
HWND hroot = GetAncestor(sys->hwnd,GA_ROOT);
RECT relative;
relative.right = video.right - video.left + relative.left;
relative.bottom = video.bottom - video.top + relative.top - 25;
}
- if (S_OK != taskbl->vt->SetThumbnailClip(taskbl, hroot,
+ if (S_OK != taskbl->lpVtbl->SetThumbnailClip(taskbl, hroot,
show ? &relative : NULL))
msg_Err(vd, "SetThumbNailClip failed");
- taskbl->vt->Release(taskbl);
+ taskbl->lpVtbl->Release(taskbl);
}
CoUninitialize();
-#endif
}
/*****************************************************************************
vout_display_PlacePicture(&place, source, &place_cfg, false);
EventThreadUpdateSourceAndPlace(sys->event, source, &place);
-#if defined(MODULE_NAME_IS_wingapi)
- if (place.width != vd->fmt.i_width || place.height != vd->fmt.i_height)
- vout_display_SendEventPicturesInvalid(vd);
-#endif
if (sys->hvideownd)
SetWindowPos(sys->hvideownd, 0,
rect_dest.top = point.y + place.y;
rect_dest.bottom = rect_dest.top + place.height;
-#ifdef MODULE_NAME_IS_directx
+#ifdef MODULE_NAME_IS_directdraw
/* Apply overlay hardware constraints */
if (sys->use_overlay)
AlignRect(&rect_dest, sys->i_align_dest_boundary, sys->i_align_dest_size);
#endif
-#if defined(MODULE_NAME_IS_directx)
+#if defined(MODULE_NAME_IS_directdraw)
/* UpdateOverlay directdraw function doesn't automatically clip to the
* display size so we need to do it otherwise it will fail */
(rect_dest.bottom - rect_dest_clipped.bottom) *
source->i_visible_height / (rect_dest.bottom - rect_dest.top);
-#ifdef MODULE_NAME_IS_directx
+#ifdef MODULE_NAME_IS_directdraw
/* Apply overlay hardware constraints */
if (sys->use_overlay)
AlignRect(&rect_src_clipped, sys->i_align_src_boundary, sys->i_align_src_size);
rect_src_clipped.right, rect_src_clipped.bottom);
#endif
-#ifdef MODULE_NAME_IS_directx
+#ifdef MODULE_NAME_IS_directdraw
/* The destination coordinates need to be relative to the current
* directdraw primary surface (display) */
rect_dest_clipped.left -= sys->rect_display.left;
SetWindowLong(hwnd, GWL_STYLE, WS_CLIPCHILDREN | WS_VISIBLE);
if (sys->hparent) {
-#ifdef UNDER_CE
- POINT point = {0,0};
- RECT rect;
- ClientToScreen(sys->hwnd, &point);
- GetClientRect(sys->hwnd, &rect);
- SetWindowPos(hwnd, 0, point.x, point.y,
- rect.right, rect.bottom,
- SWP_NOZORDER|SWP_FRAMECHANGED);
-#else
/* Retrieve current window position so fullscreen will happen
*on the right screen */
HMONITOR hmon = MonitorFromWindow(sys->hparent,
mi.rcMonitor.right - mi.rcMonitor.left,
mi.rcMonitor.bottom - mi.rcMonitor.top,
SWP_NOZORDER|SWP_FRAMECHANGED);
-#endif
} else {
/* Maximize non embedded window */
ShowWindow(hwnd, SW_SHOWMAXIMIZED);
rect.right, rect.bottom,
SWP_NOZORDER|SWP_FRAMECHANGED);
-#ifdef UNDER_CE
- HWND topLevelParent = GetParent(sys->hparent);
-#else
HWND topLevelParent = GetAncestor(sys->hparent, GA_ROOT);
-#endif
ShowWindow(topLevelParent, SW_HIDE);
}
SetForegroundWindow(hwnd);
rect.right, rect.bottom,
SWP_NOZORDER|SWP_FRAMECHANGED);
-#ifdef UNDER_CE
- HWND topLevelParent = GetParent(sys->hparent);
-#else
HWND topLevelParent = GetAncestor(sys->hparent, GA_ROOT);
-#endif
ShowWindow(topLevelParent, SW_SHOW);
SetForegroundWindow(sys->hparent);
ShowWindow(hwnd, SW_HIDE);
}
}
-#if !defined(UNDER_CE) && !defined(MODULE_NAME_IS_glwin32)
static void DisableScreensaver(vout_display_t *vd)
{
vout_display_sys_t *sys = vd->sys;
/* disable screensaver by temporarily changing system settings */
- sys->i_spi_lowpowertimeout = 0;
- sys->i_spi_powerofftimeout = 0;
- sys->i_spi_screensavetimeout = 0;
+ sys->i_spi_screensaveactive = 0;
if (var_GetBool(vd, "disable-screensaver")) {
msg_Dbg(vd, "disabling screen saver");
- SystemParametersInfo(SPI_GETLOWPOWERTIMEOUT, 0,
- &sys->i_spi_lowpowertimeout, 0);
- if (0 != sys->i_spi_lowpowertimeout) {
- SystemParametersInfo(SPI_SETLOWPOWERTIMEOUT, 0, NULL, 0);
- }
- SystemParametersInfo(SPI_GETPOWEROFFTIMEOUT, 0,
- &sys->i_spi_powerofftimeout, 0);
- if (0 != sys->i_spi_powerofftimeout) {
- SystemParametersInfo(SPI_SETPOWEROFFTIMEOUT, 0, NULL, 0);
+ SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, 0,
+ &sys->i_spi_screensaveactive, 0);
+
+ if (LOWORD(GetVersion()) == 0x0005) {
+ /* If this is NT 5.0 (i.e., Win2K), we need to hack around
+ * KB318781 (see http://support.microsoft.com/kb/318781) */
+
+ HKEY hKeyCP = NULL;
+
+ if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_CURRENT_USER,
+ TEXT("Control Panel\\Desktop"),
+ 0, KEY_QUERY_VALUE, &hKeyCP) &&
+ ERROR_SUCCESS != RegQueryValueEx(hKeyCP, TEXT("SCRNSAVE.EXE"),
+ NULL, NULL, NULL, NULL)) {
+ sys->i_spi_screensaveactive = FALSE;
+ }
}
- SystemParametersInfo(SPI_GETSCREENSAVETIMEOUT, 0,
- &sys->i_spi_screensavetimeout, 0);
- if (0 != sys->i_spi_screensavetimeout) {
- SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, 0, NULL, 0);
+
+ if (FALSE != sys->i_spi_screensaveactive) {
+ SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, 0, NULL, 0);
}
}
}
vout_display_sys_t *sys = vd->sys;
/* restore screensaver system settings */
- if (0 != sys->i_spi_lowpowertimeout) {
- SystemParametersInfo(SPI_SETLOWPOWERTIMEOUT,
- sys->i_spi_lowpowertimeout, NULL, 0);
- }
- if (0 != sys->i_spi_powerofftimeout) {
- SystemParametersInfo(SPI_SETPOWEROFFTIMEOUT,
- sys->i_spi_powerofftimeout, NULL, 0);
- }
- if (0 != sys->i_spi_screensavetimeout) {
- SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT,
- sys->i_spi_screensavetimeout, NULL, 0);
+ if (0 != sys->i_spi_screensaveactive) {
+ SystemParametersInfo(SPI_SETSCREENSAVEACTIVE,
+ sys->i_spi_screensaveactive, NULL, 0);
}
}
-#endif
-