2003-09-19 16:33:51 +02:00
|
|
|
#include <limits.h>
|
|
|
|
#include <windows.h>
|
|
|
|
|
2004-10-28 03:15:53 +02:00
|
|
|
#include "osdep/keycodes.h"
|
|
|
|
#include "input/input.h"
|
|
|
|
#include "input/mouse.h"
|
|
|
|
#include "mp_msg.h"
|
2003-09-19 16:33:51 +02:00
|
|
|
#include "video_out.h"
|
|
|
|
#include "aspect.h"
|
|
|
|
#include "w32_common.h"
|
|
|
|
|
|
|
|
extern void mplayer_put_key(int code);
|
|
|
|
|
2006-04-12 22:17:07 +02:00
|
|
|
#ifndef MONITOR_DEFAULTTOPRIMARY
|
|
|
|
#define MONITOR_DEFAULTTOPRIMARY 1
|
|
|
|
#endif
|
|
|
|
|
2003-09-19 16:33:51 +02:00
|
|
|
static const char* classname = "MPlayer - Media player for Win32";
|
|
|
|
int vo_vm = 0;
|
|
|
|
HDC vo_hdc = 0;
|
|
|
|
|
2006-04-12 16:11:26 +02:00
|
|
|
// last non-fullscreen extends
|
|
|
|
int prev_width;
|
|
|
|
int prev_height;
|
|
|
|
int prev_x;
|
|
|
|
int prev_y;
|
|
|
|
|
2003-09-19 16:33:51 +02:00
|
|
|
uint32_t o_dwidth;
|
|
|
|
uint32_t o_dheight;
|
|
|
|
|
|
|
|
static HINSTANCE hInstance;
|
2006-12-17 13:33:09 +01:00
|
|
|
#define vo_window vo_w32_window
|
2004-12-11 17:57:42 +01:00
|
|
|
HWND vo_window = 0;
|
2005-12-06 23:15:03 +01:00
|
|
|
static int event_flags;
|
2006-04-16 15:38:28 +02:00
|
|
|
static int mon_cnt;
|
2003-09-19 16:33:51 +02:00
|
|
|
|
2006-04-12 16:11:26 +02:00
|
|
|
static HMONITOR (WINAPI* myMonitorFromWindow)(HWND, DWORD);
|
|
|
|
static BOOL (WINAPI* myGetMonitorInfo)(HMONITOR, LPMONITORINFO);
|
2006-04-16 15:38:28 +02:00
|
|
|
static BOOL (WINAPI* myEnumDisplayMonitors)(HDC, LPCRECT, MONITORENUMPROC, LPARAM);
|
2006-04-12 16:11:26 +02:00
|
|
|
|
2003-09-19 16:33:51 +02:00
|
|
|
static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
|
2006-04-12 16:11:26 +02:00
|
|
|
RECT r;
|
|
|
|
POINT p;
|
2003-09-19 16:33:51 +02:00
|
|
|
switch (message) {
|
2005-12-07 16:53:02 +01:00
|
|
|
case WM_PAINT:
|
2005-12-06 23:15:03 +01:00
|
|
|
event_flags |= VO_EVENT_EXPOSE;
|
|
|
|
break;
|
2006-04-12 16:11:26 +02:00
|
|
|
case WM_MOVE:
|
|
|
|
p.x = 0;
|
|
|
|
p.y = 0;
|
|
|
|
ClientToScreen(vo_window, &p);
|
|
|
|
vo_dx = p.x;
|
|
|
|
vo_dy = p.y;
|
|
|
|
break;
|
2005-12-06 23:15:03 +01:00
|
|
|
case WM_SIZE:
|
|
|
|
event_flags |= VO_EVENT_RESIZE;
|
2006-04-12 16:11:26 +02:00
|
|
|
GetClientRect(vo_window, &r);
|
|
|
|
vo_dwidth = r.right;
|
|
|
|
vo_dheight = r.bottom;
|
2005-12-06 23:15:03 +01:00
|
|
|
break;
|
2006-07-07 13:14:25 +02:00
|
|
|
case WM_WINDOWPOSCHANGING:
|
|
|
|
return 0;
|
2004-02-29 18:42:49 +01:00
|
|
|
case WM_CLOSE:
|
2005-11-02 22:50:55 +01:00
|
|
|
mplayer_put_key(KEY_CLOSE_WIN);
|
2003-09-19 16:33:51 +02:00
|
|
|
break;
|
|
|
|
case WM_SYSCOMMAND:
|
|
|
|
switch (wParam) {
|
|
|
|
case SC_SCREENSAVE:
|
|
|
|
case SC_MONITORPOWER:
|
|
|
|
mp_msg(MSGT_VO, MSGL_V, "vo: win32: killing screensaver\n");
|
2005-08-14 12:30:18 +02:00
|
|
|
return 0;
|
2003-09-19 16:33:51 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case WM_KEYDOWN:
|
|
|
|
switch (wParam) {
|
|
|
|
case VK_LEFT: mplayer_put_key(KEY_LEFT); break;
|
|
|
|
case VK_UP: mplayer_put_key(KEY_UP); break;
|
|
|
|
case VK_RIGHT: mplayer_put_key(KEY_RIGHT); break;
|
|
|
|
case VK_DOWN: mplayer_put_key(KEY_DOWN); break;
|
|
|
|
case VK_TAB: mplayer_put_key(KEY_TAB); break;
|
|
|
|
case VK_CONTROL: mplayer_put_key(KEY_CTRL); break;
|
2006-11-02 19:42:07 +01:00
|
|
|
case VK_BACK: mplayer_put_key(KEY_BS); break;
|
2003-09-19 16:33:51 +02:00
|
|
|
case VK_DELETE: mplayer_put_key(KEY_DELETE); break;
|
|
|
|
case VK_INSERT: mplayer_put_key(KEY_INSERT); break;
|
|
|
|
case VK_HOME: mplayer_put_key(KEY_HOME); break;
|
|
|
|
case VK_END: mplayer_put_key(KEY_END); break;
|
|
|
|
case VK_PRIOR: mplayer_put_key(KEY_PAGE_UP); break;
|
|
|
|
case VK_NEXT: mplayer_put_key(KEY_PAGE_DOWN); break;
|
|
|
|
case VK_ESCAPE: mplayer_put_key(KEY_ESC); break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case WM_CHAR:
|
|
|
|
mplayer_put_key(wParam);
|
|
|
|
break;
|
|
|
|
case WM_LBUTTONDOWN:
|
2004-08-01 22:13:42 +02:00
|
|
|
if (!vo_nomouse_input && (vo_fs || (wParam & MK_CONTROL))) {
|
|
|
|
mplayer_put_key(MOUSE_BTN0);
|
|
|
|
break;
|
|
|
|
}
|
2003-09-19 16:33:51 +02:00
|
|
|
if (!vo_fs) {
|
|
|
|
ReleaseCapture();
|
|
|
|
SendMessage(hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
break;
|
2004-08-01 22:13:42 +02:00
|
|
|
case WM_MBUTTONDOWN:
|
|
|
|
if (!vo_nomouse_input)
|
|
|
|
mplayer_put_key(MOUSE_BTN1);
|
|
|
|
break;
|
|
|
|
case WM_RBUTTONDOWN:
|
|
|
|
if (!vo_nomouse_input)
|
|
|
|
mplayer_put_key(MOUSE_BTN2);
|
|
|
|
break;
|
|
|
|
case WM_MOUSEWHEEL:
|
|
|
|
if (!vo_nomouse_input) {
|
|
|
|
int x = GET_WHEEL_DELTA_WPARAM(wParam);
|
|
|
|
if (x > 0)
|
|
|
|
mplayer_put_key(MOUSE_BTN3);
|
|
|
|
else
|
|
|
|
mplayer_put_key(MOUSE_BTN4);
|
|
|
|
break;
|
|
|
|
}
|
2003-09-19 16:33:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return DefWindowProc(hWnd, message, wParam, lParam);
|
|
|
|
}
|
|
|
|
|
|
|
|
int vo_w32_check_events(void) {
|
|
|
|
MSG msg;
|
2005-12-06 23:15:03 +01:00
|
|
|
event_flags = 0;
|
2003-09-19 16:33:51 +02:00
|
|
|
while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) {
|
|
|
|
TranslateMessage(&msg);
|
|
|
|
DispatchMessage(&msg);
|
|
|
|
}
|
2007-03-04 11:30:55 +01:00
|
|
|
if (WinID >= 0) {
|
|
|
|
RECT r;
|
|
|
|
GetClientRect(vo_window, &r);
|
|
|
|
if (r.right != vo_dwidth || r.bottom != vo_dheight)
|
|
|
|
event_flags |= VO_EVENT_RESIZE;
|
|
|
|
vo_dwidth = r.right;
|
|
|
|
vo_dheight = r.bottom;
|
|
|
|
}
|
2003-09-19 16:33:51 +02:00
|
|
|
|
2005-12-06 23:15:03 +01:00
|
|
|
return event_flags;
|
2003-09-19 16:33:51 +02:00
|
|
|
}
|
|
|
|
|
2006-04-16 15:38:28 +02:00
|
|
|
static BOOL CALLBACK mon_enum(HMONITOR hmon, HDC hdc, LPRECT r, LPARAM p) {
|
|
|
|
// this defaults to the last screen if specified number does not exist
|
|
|
|
xinerama_x = r->left;
|
|
|
|
xinerama_y = r->top;
|
|
|
|
vo_screenwidth = r->right - r->left;
|
|
|
|
vo_screenheight = r->bottom - r->top;
|
|
|
|
if (mon_cnt == xinerama_screen)
|
|
|
|
return FALSE;
|
|
|
|
mon_cnt++;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2006-12-17 13:33:09 +01:00
|
|
|
void w32_update_xinerama_info(void) {
|
2006-04-16 15:38:28 +02:00
|
|
|
xinerama_x = xinerama_y = 0;
|
|
|
|
if (xinerama_screen < -1) {
|
|
|
|
int tmp;
|
|
|
|
xinerama_x = GetSystemMetrics(SM_XVIRTUALSCREEN);
|
|
|
|
xinerama_y = GetSystemMetrics(SM_YVIRTUALSCREEN);
|
|
|
|
tmp = GetSystemMetrics(SM_CXVIRTUALSCREEN);
|
|
|
|
if (tmp) vo_screenwidth = tmp;
|
|
|
|
tmp = GetSystemMetrics(SM_CYVIRTUALSCREEN);
|
|
|
|
if (tmp) vo_screenheight = tmp;
|
|
|
|
} else if (xinerama_screen == -1 && myMonitorFromWindow && myGetMonitorInfo) {
|
|
|
|
MONITORINFO mi;
|
|
|
|
HMONITOR m = myMonitorFromWindow(vo_window, MONITOR_DEFAULTTOPRIMARY);
|
|
|
|
mi.cbSize = sizeof(mi);
|
|
|
|
myGetMonitorInfo(m, &mi);
|
|
|
|
xinerama_x = mi.rcMonitor.left;
|
|
|
|
xinerama_y = mi.rcMonitor.top;
|
|
|
|
vo_screenwidth = mi.rcMonitor.right - mi.rcMonitor.left;
|
|
|
|
vo_screenheight = mi.rcMonitor.bottom - mi.rcMonitor.top;
|
|
|
|
} else if (xinerama_screen > 0 && myEnumDisplayMonitors) {
|
|
|
|
mon_cnt = 0;
|
|
|
|
myEnumDisplayMonitors(NULL, NULL, mon_enum, 0);
|
|
|
|
}
|
|
|
|
aspect_save_screenres(vo_screenwidth, vo_screenheight);
|
|
|
|
}
|
|
|
|
|
2005-02-21 15:44:39 +01:00
|
|
|
static void updateScreenProperties() {
|
|
|
|
DEVMODE dm;
|
|
|
|
dm.dmSize = sizeof dm;
|
|
|
|
dm.dmDriverExtra = 0;
|
|
|
|
dm.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
|
|
|
|
if (!EnumDisplaySettings(0, ENUM_CURRENT_SETTINGS, &dm)) {
|
|
|
|
mp_msg(MSGT_VO, MSGL_ERR, "vo: win32: unable to enumerate display settings!\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
vo_screenwidth = dm.dmPelsWidth;
|
|
|
|
vo_screenheight = dm.dmPelsHeight;
|
|
|
|
vo_depthonscreen = dm.dmBitsPerPel;
|
2006-12-17 13:33:09 +01:00
|
|
|
w32_update_xinerama_info();
|
2005-02-21 15:44:39 +01:00
|
|
|
}
|
|
|
|
|
2003-09-19 16:33:51 +02:00
|
|
|
static void changeMode(void) {
|
|
|
|
DEVMODE dm;
|
|
|
|
dm.dmSize = sizeof dm;
|
|
|
|
dm.dmDriverExtra = 0;
|
|
|
|
|
|
|
|
dm.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
|
|
|
|
dm.dmBitsPerPel = vo_depthonscreen;
|
|
|
|
dm.dmPelsWidth = vo_screenwidth;
|
|
|
|
dm.dmPelsHeight = vo_screenheight;
|
|
|
|
|
|
|
|
if (vo_vm) {
|
|
|
|
int bestMode = -1;
|
|
|
|
int bestScore = INT_MAX;
|
|
|
|
int i;
|
|
|
|
for (i = 0; EnumDisplaySettings(0, i, &dm); ++i) {
|
2005-08-14 12:30:18 +02:00
|
|
|
int score = (dm.dmPelsWidth - o_dwidth) * (dm.dmPelsHeight - o_dheight);
|
2003-09-19 16:33:51 +02:00
|
|
|
if (dm.dmBitsPerPel != vo_depthonscreen) continue;
|
|
|
|
if (dm.dmPelsWidth < o_dwidth) continue;
|
|
|
|
if (dm.dmPelsHeight < o_dheight) continue;
|
|
|
|
|
|
|
|
if (score < bestScore) {
|
|
|
|
bestScore = score;
|
|
|
|
bestMode = i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (bestMode != -1)
|
|
|
|
EnumDisplaySettings(0, bestMode, &dm);
|
|
|
|
|
|
|
|
ChangeDisplaySettings(&dm, CDS_FULLSCREEN);
|
2005-02-21 15:44:39 +01:00
|
|
|
}
|
2003-09-19 16:33:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void resetMode(void) {
|
2004-12-11 17:57:42 +01:00
|
|
|
if (vo_vm)
|
2003-09-19 16:33:51 +02:00
|
|
|
ChangeDisplaySettings(0, 0);
|
|
|
|
}
|
|
|
|
|
2006-04-12 16:11:26 +02:00
|
|
|
static int createRenderingContext(void) {
|
2003-11-30 17:36:10 +01:00
|
|
|
HWND layer = HWND_NOTOPMOST;
|
2005-08-14 12:30:18 +02:00
|
|
|
PIXELFORMATDESCRIPTOR pfd;
|
2005-11-17 21:49:46 +01:00
|
|
|
RECT r;
|
2005-08-14 12:30:18 +02:00
|
|
|
int pf;
|
2006-07-08 16:57:25 +02:00
|
|
|
if (WinID < 0) {
|
2005-11-17 21:49:46 +01:00
|
|
|
int style = (vo_border && !vo_fs) ?
|
|
|
|
(WS_OVERLAPPEDWINDOW | WS_SIZEBOX) : WS_POPUP;
|
2003-09-19 16:33:51 +02:00
|
|
|
|
2003-11-30 17:36:10 +01:00
|
|
|
if (vo_fs || vo_ontop) layer = HWND_TOPMOST;
|
2003-09-19 16:33:51 +02:00
|
|
|
if (vo_fs) {
|
|
|
|
changeMode();
|
2006-11-17 18:44:51 +01:00
|
|
|
while (ShowCursor(0) >= 0) /**/ ;
|
2003-09-19 16:33:51 +02:00
|
|
|
} else {
|
|
|
|
resetMode();
|
2006-11-17 18:44:51 +01:00
|
|
|
while (ShowCursor(1) < 0) /**/ ;
|
2003-09-19 16:33:51 +02:00
|
|
|
}
|
2005-02-21 15:44:39 +01:00
|
|
|
updateScreenProperties();
|
2005-11-17 21:49:46 +01:00
|
|
|
ShowWindow(vo_window, SW_HIDE);
|
|
|
|
SetWindowLong(vo_window, GWL_STYLE, style);
|
2006-04-12 16:11:26 +02:00
|
|
|
if (vo_fs) {
|
|
|
|
prev_width = vo_dwidth;
|
|
|
|
prev_height = vo_dheight;
|
|
|
|
prev_x = vo_dx;
|
|
|
|
prev_y = vo_dy;
|
|
|
|
vo_dwidth = vo_screenwidth;
|
|
|
|
vo_dheight = vo_screenheight;
|
2006-04-16 15:38:28 +02:00
|
|
|
vo_dx = xinerama_x;
|
|
|
|
vo_dy = xinerama_y;
|
2006-04-12 16:11:26 +02:00
|
|
|
} else {
|
|
|
|
vo_dwidth = prev_width;
|
|
|
|
vo_dheight = prev_height;
|
|
|
|
vo_dx = prev_x;
|
|
|
|
vo_dy = prev_y;
|
2006-11-04 22:44:53 +01:00
|
|
|
// HACK around what probably is a windows focus bug:
|
|
|
|
// when pressing 'f' on the console, then 'f' again to
|
|
|
|
// return to windowed mode, any input into the video
|
|
|
|
// window is lost forever.
|
|
|
|
SetFocus(vo_window);
|
2006-04-12 16:11:26 +02:00
|
|
|
}
|
|
|
|
r.left = vo_dx;
|
2005-11-17 21:49:46 +01:00
|
|
|
r.right = r.left + vo_dwidth;
|
2006-04-12 16:11:26 +02:00
|
|
|
r.top = vo_dy;
|
2005-11-17 21:49:46 +01:00
|
|
|
r.bottom = r.top + vo_dheight;
|
|
|
|
AdjustWindowRect(&r, style, 0);
|
|
|
|
SetWindowPos(vo_window, layer, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_SHOWWINDOW);
|
2006-07-08 16:57:25 +02:00
|
|
|
}
|
2003-09-19 16:33:51 +02:00
|
|
|
|
|
|
|
memset(&pfd, 0, sizeof pfd);
|
|
|
|
pfd.nSize = sizeof pfd;
|
|
|
|
pfd.nVersion = 1;
|
|
|
|
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
|
|
|
|
pfd.iPixelType = PFD_TYPE_RGBA;
|
|
|
|
pfd.cColorBits = 24;
|
|
|
|
pfd.iLayerType = PFD_MAIN_PLANE;
|
2005-08-14 12:30:18 +02:00
|
|
|
pf = ChoosePixelFormat(vo_hdc, &pfd);
|
2003-09-19 16:33:51 +02:00
|
|
|
if (!pf) {
|
|
|
|
mp_msg(MSGT_VO, MSGL_ERR, "vo: win32: unable to select a valid pixel format!\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
SetPixelFormat(vo_hdc, pf, &pfd);
|
|
|
|
|
|
|
|
mp_msg(MSGT_VO, MSGL_V, "vo: win32: running at %dx%d with depth %d\n", vo_screenwidth, vo_screenheight, vo_depthonscreen);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2006-04-12 16:11:26 +02:00
|
|
|
int vo_w32_config(uint32_t width, uint32_t height, uint32_t flags) {
|
|
|
|
// store original size for videomode switching
|
|
|
|
o_dwidth = width;
|
|
|
|
o_dheight = height;
|
|
|
|
|
2006-07-10 12:22:29 +02:00
|
|
|
prev_width = vo_dwidth = width;
|
|
|
|
prev_height = vo_dheight = height;
|
2006-04-12 16:11:26 +02:00
|
|
|
prev_x = vo_dx;
|
|
|
|
prev_y = vo_dy;
|
|
|
|
|
|
|
|
vo_fs = flags & VOFLAG_FULLSCREEN;
|
|
|
|
vo_vm = flags & VOFLAG_MODESWITCHING;
|
|
|
|
return createRenderingContext();
|
|
|
|
}
|
|
|
|
|
2006-12-17 13:33:09 +01:00
|
|
|
int vo_w32_init(void) {
|
2003-09-19 16:33:51 +02:00
|
|
|
HICON mplayerIcon = 0;
|
|
|
|
char exedir[MAX_PATH];
|
2006-04-12 16:11:26 +02:00
|
|
|
HINSTANCE user32;
|
2003-09-19 16:33:51 +02:00
|
|
|
|
2004-12-11 17:57:42 +01:00
|
|
|
if (vo_window)
|
2003-09-19 16:33:51 +02:00
|
|
|
return 1;
|
|
|
|
|
|
|
|
hInstance = GetModuleHandle(0);
|
|
|
|
|
|
|
|
if (GetModuleFileName(0, exedir, MAX_PATH))
|
|
|
|
mplayerIcon = ExtractIcon(hInstance, exedir, 0);
|
|
|
|
if (!mplayerIcon)
|
|
|
|
mplayerIcon = LoadIcon(0, IDI_APPLICATION);
|
|
|
|
|
2005-08-15 01:16:17 +02:00
|
|
|
{
|
|
|
|
WNDCLASSEX wcex = { sizeof wcex, CS_OWNDC, WndProc, 0, 0, hInstance, mplayerIcon, LoadCursor(0, IDC_ARROW), (HBRUSH)GetStockObject(BLACK_BRUSH), 0, classname, mplayerIcon };
|
2003-09-19 16:33:51 +02:00
|
|
|
|
|
|
|
if (!RegisterClassEx(&wcex)) {
|
|
|
|
mp_msg(MSGT_VO, MSGL_ERR, "vo: win32: unable to register window class!\n");
|
|
|
|
return 0;
|
|
|
|
}
|
2005-08-15 01:16:17 +02:00
|
|
|
}
|
2003-09-19 16:33:51 +02:00
|
|
|
|
2005-08-21 11:59:45 +02:00
|
|
|
if (WinID >= 0)
|
|
|
|
vo_window = WinID;
|
|
|
|
else {
|
2005-11-17 21:49:46 +01:00
|
|
|
vo_window = CreateWindowEx(0, classname, classname,
|
|
|
|
vo_border ? (WS_OVERLAPPEDWINDOW | WS_SIZEBOX) : WS_POPUP,
|
|
|
|
CW_USEDEFAULT, 0, 100, 100, 0, 0, hInstance, 0);
|
2004-12-11 17:57:42 +01:00
|
|
|
if (!vo_window) {
|
2003-09-19 16:33:51 +02:00
|
|
|
mp_msg(MSGT_VO, MSGL_ERR, "vo: win32: unable to create window!\n");
|
|
|
|
return 0;
|
|
|
|
}
|
2005-08-21 11:59:45 +02:00
|
|
|
}
|
2003-09-19 16:33:51 +02:00
|
|
|
|
2004-12-11 17:57:42 +01:00
|
|
|
vo_hdc = GetDC(vo_window);
|
2003-09-19 16:33:51 +02:00
|
|
|
|
2006-04-12 16:11:26 +02:00
|
|
|
myMonitorFromWindow = NULL;
|
|
|
|
myGetMonitorInfo = NULL;
|
2006-04-16 15:38:28 +02:00
|
|
|
myEnumDisplayMonitors = NULL;
|
2006-04-12 16:11:26 +02:00
|
|
|
user32 = GetModuleHandle("user32.dll");
|
|
|
|
if (user32) {
|
|
|
|
myMonitorFromWindow = GetProcAddress(user32, "MonitorFromWindow");
|
|
|
|
myGetMonitorInfo = GetProcAddress(user32, "GetMonitorInfoA");
|
2006-04-16 15:38:28 +02:00
|
|
|
myEnumDisplayMonitors = GetProcAddress(user32, "EnumDisplayMonitors");
|
2006-04-12 16:11:26 +02:00
|
|
|
}
|
2005-02-21 15:44:39 +01:00
|
|
|
updateScreenProperties();
|
2003-09-19 16:33:51 +02:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void vo_w32_fullscreen(void) {
|
|
|
|
vo_fs = !vo_fs;
|
|
|
|
|
|
|
|
createRenderingContext();
|
|
|
|
}
|
|
|
|
|
2005-11-17 21:49:46 +01:00
|
|
|
void vo_w32_border() {
|
|
|
|
vo_border = !vo_border;
|
|
|
|
createRenderingContext();
|
|
|
|
}
|
|
|
|
|
2003-11-30 17:36:10 +01:00
|
|
|
void vo_w32_ontop( void )
|
|
|
|
{
|
|
|
|
vo_ontop = !vo_ontop;
|
|
|
|
if (!vo_fs) {
|
|
|
|
HWND layer = HWND_NOTOPMOST;
|
|
|
|
if (vo_ontop) layer = HWND_TOPMOST;
|
2004-12-11 17:57:42 +01:00
|
|
|
SetWindowPos(vo_window, layer, (vo_screenwidth - vo_dwidth) / 2, (vo_screenheight - vo_dheight) / 2, vo_dwidth, vo_dheight, SWP_SHOWWINDOW);
|
2003-11-30 17:36:10 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-09-19 16:33:51 +02:00
|
|
|
void vo_w32_uninit() {
|
|
|
|
mp_msg(MSGT_VO, MSGL_V, "vo: win32: uninit\n");
|
|
|
|
resetMode();
|
|
|
|
ShowCursor(1);
|
|
|
|
vo_depthonscreen = 0;
|
2005-08-22 11:05:18 +02:00
|
|
|
if (WinID < 0)
|
2004-12-11 17:57:42 +01:00
|
|
|
DestroyWindow(vo_window);
|
|
|
|
vo_window = 0;
|
2003-11-16 15:37:42 +01:00
|
|
|
UnregisterClass(classname, 0);
|
2003-09-19 16:33:51 +02:00
|
|
|
}
|