Commit a35cc84e authored by Geoffroy Couprie's avatar Geoffroy Couprie Committed by Jean-Baptiste Kempf

Windows: remove calls to GetProcAddress for MonitorFromWindow and GetMonitorInfo

Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 6bd4060b
......@@ -3376,6 +3376,7 @@ if test "${enable_directx}" != "no"
then
if test "${SYS}" = "mingw32" -o "${SYS}" = "mingwce"
then
VLC_ADD_LIBS([directx],[-luser32])
AC_CHECK_HEADERS(ddraw.h,
[ VLC_ADD_PLUGIN([directx aout_directx])
VLC_ADD_LIBS([directx],[-lgdi32])
......
......@@ -114,8 +114,6 @@ struct vout_display_sys_t
/* Multi-monitor support */
HMONITOR hmonitor; /* handle of the current monitor */
GUID *display_driver;
HMONITOR (WINAPI* MonitorFromWindow)(HWND, DWORD);
BOOL (WINAPI* GetMonitorInfo)(HMONITOR, LPMONITORINFO);
/* Overlay alignment restrictions */
int i_align_src_boundary;
......
......@@ -44,18 +44,11 @@
#include <vlc_vout_display.h>
#include <vlc_playlist.h> /* needed for wallpaper */
#include <windows.h>
#include <winuser.h>
#include <ddraw.h>
#include <commctrl.h> /* ListView_(Get|Set)* */
#ifndef UNDER_CE
# include <multimon.h>
#endif
#undef GetSystemMetrics
#ifndef MONITOR_DEFAULTTONEAREST
# define MONITOR_DEFAULTTONEAREST 2
#endif
#include "common.h"
#ifdef UNICODE
......@@ -180,16 +173,6 @@ static int Open(vlc_object_t *object)
return VLC_EGENERIC;
}
/* */
HMODULE huser32 = GetModuleHandle(_T("USER32"));
if (huser32) {
sys->MonitorFromWindow = (void*)GetProcAddress(huser32, _T("MonitorFromWindow"));
sys->GetMonitorInfo = (void*)GetProcAddress(huser32, _T("GetMonitorInfoA"));
} else {
sys->MonitorFromWindow = NULL;
sys->GetMonitorInfo = NULL;
}
/* */
sys->use_wallpaper = var_CreateGetBool(vd, "video-wallpaper");
/* FIXME */
......@@ -366,8 +349,8 @@ static void Manage(vout_display_t *vd)
DirectXUpdateOverlay(vd, NULL);
/* Check if we are still on the same monitor */
if (sys->MonitorFromWindow &&
sys->hmonitor != sys->MonitorFromWindow(sys->hwnd, MONITOR_DEFAULTTONEAREST)) {
HMONITOR hmon = MonitorFromWindow(sys->hwnd, MONITOR_DEFAULTTONEAREST);
if (sys->hmonitor != hmon) {
vout_display_SendEventPicturesInvalid(vd);
}
/* */
......@@ -475,7 +458,7 @@ static BOOL WINAPI DirectXOpenDDrawCallback(GUID *guid, LPTSTR desc,
MONITORINFO monitor_info;
monitor_info.cbSize = sizeof(MONITORINFO);
if (sys->GetMonitorInfo(hmon, &monitor_info)) {
if (GetMonitorInfoA(hmon, &monitor_info)) {
RECT rect;
/* Move window to the right screen */
......@@ -591,24 +574,22 @@ static int DirectXOpenDDraw(vout_display_t *vd)
}
/* */
if (sys->MonitorFromWindow) {
HRESULT (WINAPI *OurDirectDrawEnumerateEx)(LPDDENUMCALLBACKEXA, LPVOID, DWORD);
OurDirectDrawEnumerateEx =
(void *)GetProcAddress(sys->hddraw_dll, _T("DirectDrawEnumerateExA"));
if (OurDirectDrawEnumerateEx) {
char *device = var_GetString(vd, "directx-device");
if (device) {
msg_Dbg(vd, "directx-device: %s", device);
free(device);
}
HRESULT (WINAPI *OurDirectDrawEnumerateEx)(LPDDENUMCALLBACKEXA, LPVOID, DWORD);
OurDirectDrawEnumerateEx =
(void *)GetProcAddress(sys->hddraw_dll, _T("DirectDrawEnumerateExA"));
if (OurDirectDrawEnumerateEx) {
char *device = var_GetString(vd, "directx-device");
if (device) {
msg_Dbg(vd, "directx-device: %s", device);
free(device);
}
sys->hmonitor = sys->MonitorFromWindow(sys->hwnd, MONITOR_DEFAULTTONEAREST);
sys->hmonitor = MonitorFromWindow(sys->hwnd, MONITOR_DEFAULTTONEAREST);
/* Enumerate displays */
OurDirectDrawEnumerateEx(DirectXOpenDDrawCallback,
vd, DDENUM_ATTACHEDSECONDARYDEVICES);
}
/* Enumerate displays */
OurDirectDrawEnumerateEx(DirectXOpenDDrawCallback,
vd, DDENUM_ATTACHEDSECONDARYDEVICES);
}
/* Initialize DirectDraw now */
......@@ -640,10 +621,10 @@ static int DirectXOpenDDraw(vout_display_t *vd)
}
/* Get the size of the current display device */
if (sys->hmonitor && sys->GetMonitorInfo) {
if (sys->hmonitor) {
MONITORINFO monitor_info;
monitor_info.cbSize = sizeof(MONITORINFO);
sys->GetMonitorInfo(vd->sys->hmonitor, &monitor_info);
GetMonitorInfoA(vd->sys->hmonitor, &monitor_info);
sys->rect_display = monitor_info.rcMonitor;
} else {
sys->rect_display.left = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment