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: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 6bd4060b
...@@ -3376,6 +3376,7 @@ if test "${enable_directx}" != "no" ...@@ -3376,6 +3376,7 @@ if test "${enable_directx}" != "no"
then then
if test "${SYS}" = "mingw32" -o "${SYS}" = "mingwce" if test "${SYS}" = "mingw32" -o "${SYS}" = "mingwce"
then then
VLC_ADD_LIBS([directx],[-luser32])
AC_CHECK_HEADERS(ddraw.h, AC_CHECK_HEADERS(ddraw.h,
[ VLC_ADD_PLUGIN([directx aout_directx]) [ VLC_ADD_PLUGIN([directx aout_directx])
VLC_ADD_LIBS([directx],[-lgdi32]) VLC_ADD_LIBS([directx],[-lgdi32])
......
...@@ -114,8 +114,6 @@ struct vout_display_sys_t ...@@ -114,8 +114,6 @@ struct vout_display_sys_t
/* Multi-monitor support */ /* Multi-monitor support */
HMONITOR hmonitor; /* handle of the current monitor */ HMONITOR hmonitor; /* handle of the current monitor */
GUID *display_driver; GUID *display_driver;
HMONITOR (WINAPI* MonitorFromWindow)(HWND, DWORD);
BOOL (WINAPI* GetMonitorInfo)(HMONITOR, LPMONITORINFO);
/* Overlay alignment restrictions */ /* Overlay alignment restrictions */
int i_align_src_boundary; int i_align_src_boundary;
......
...@@ -44,18 +44,11 @@ ...@@ -44,18 +44,11 @@
#include <vlc_vout_display.h> #include <vlc_vout_display.h>
#include <vlc_playlist.h> /* needed for wallpaper */ #include <vlc_playlist.h> /* needed for wallpaper */
#include <windows.h>
#include <winuser.h>
#include <ddraw.h> #include <ddraw.h>
#include <commctrl.h> /* ListView_(Get|Set)* */ #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" #include "common.h"
#ifdef UNICODE #ifdef UNICODE
...@@ -180,16 +173,6 @@ static int Open(vlc_object_t *object) ...@@ -180,16 +173,6 @@ static int Open(vlc_object_t *object)
return VLC_EGENERIC; 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"); sys->use_wallpaper = var_CreateGetBool(vd, "video-wallpaper");
/* FIXME */ /* FIXME */
...@@ -366,8 +349,8 @@ static void Manage(vout_display_t *vd) ...@@ -366,8 +349,8 @@ static void Manage(vout_display_t *vd)
DirectXUpdateOverlay(vd, NULL); DirectXUpdateOverlay(vd, NULL);
/* Check if we are still on the same monitor */ /* Check if we are still on the same monitor */
if (sys->MonitorFromWindow && HMONITOR hmon = MonitorFromWindow(sys->hwnd, MONITOR_DEFAULTTONEAREST);
sys->hmonitor != sys->MonitorFromWindow(sys->hwnd, MONITOR_DEFAULTTONEAREST)) { if (sys->hmonitor != hmon) {
vout_display_SendEventPicturesInvalid(vd); vout_display_SendEventPicturesInvalid(vd);
} }
/* */ /* */
...@@ -475,7 +458,7 @@ static BOOL WINAPI DirectXOpenDDrawCallback(GUID *guid, LPTSTR desc, ...@@ -475,7 +458,7 @@ static BOOL WINAPI DirectXOpenDDrawCallback(GUID *guid, LPTSTR desc,
MONITORINFO monitor_info; MONITORINFO monitor_info;
monitor_info.cbSize = sizeof(MONITORINFO); monitor_info.cbSize = sizeof(MONITORINFO);
if (sys->GetMonitorInfo(hmon, &monitor_info)) { if (GetMonitorInfoA(hmon, &monitor_info)) {
RECT rect; RECT rect;
/* Move window to the right screen */ /* Move window to the right screen */
...@@ -591,7 +574,6 @@ static int DirectXOpenDDraw(vout_display_t *vd) ...@@ -591,7 +574,6 @@ static int DirectXOpenDDraw(vout_display_t *vd)
} }
/* */ /* */
if (sys->MonitorFromWindow) {
HRESULT (WINAPI *OurDirectDrawEnumerateEx)(LPDDENUMCALLBACKEXA, LPVOID, DWORD); HRESULT (WINAPI *OurDirectDrawEnumerateEx)(LPDDENUMCALLBACKEXA, LPVOID, DWORD);
OurDirectDrawEnumerateEx = OurDirectDrawEnumerateEx =
(void *)GetProcAddress(sys->hddraw_dll, _T("DirectDrawEnumerateExA")); (void *)GetProcAddress(sys->hddraw_dll, _T("DirectDrawEnumerateExA"));
...@@ -603,13 +585,12 @@ static int DirectXOpenDDraw(vout_display_t *vd) ...@@ -603,13 +585,12 @@ static int DirectXOpenDDraw(vout_display_t *vd)
free(device); free(device);
} }
sys->hmonitor = sys->MonitorFromWindow(sys->hwnd, MONITOR_DEFAULTTONEAREST); sys->hmonitor = MonitorFromWindow(sys->hwnd, MONITOR_DEFAULTTONEAREST);
/* Enumerate displays */ /* Enumerate displays */
OurDirectDrawEnumerateEx(DirectXOpenDDrawCallback, OurDirectDrawEnumerateEx(DirectXOpenDDrawCallback,
vd, DDENUM_ATTACHEDSECONDARYDEVICES); vd, DDENUM_ATTACHEDSECONDARYDEVICES);
} }
}
/* Initialize DirectDraw now */ /* Initialize DirectDraw now */
LPDIRECTDRAW ddobject; LPDIRECTDRAW ddobject;
...@@ -640,10 +621,10 @@ static int DirectXOpenDDraw(vout_display_t *vd) ...@@ -640,10 +621,10 @@ static int DirectXOpenDDraw(vout_display_t *vd)
} }
/* Get the size of the current display device */ /* Get the size of the current display device */
if (sys->hmonitor && sys->GetMonitorInfo) { if (sys->hmonitor) {
MONITORINFO monitor_info; MONITORINFO monitor_info;
monitor_info.cbSize = sizeof(MONITORINFO); monitor_info.cbSize = sizeof(MONITORINFO);
sys->GetMonitorInfo(vd->sys->hmonitor, &monitor_info); GetMonitorInfoA(vd->sys->hmonitor, &monitor_info);
sys->rect_display = monitor_info.rcMonitor; sys->rect_display = monitor_info.rcMonitor;
} else { } else {
sys->rect_display.left = 0; 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