Don't bother looking up EnumDisplayMonitors and GetMonitorInfoA
2008-08-04 Tor Lillqvist <tml@novell.com> * gdk/win32/gdkdisplay-win32.c: Don't bother looking up EnumDisplayMonitors and GetMonitorInfoA dynamically, they are present in NT-based Windows since Windows 2000. (enum_monitor): For some reason the MONITORINFOEX struct in mingw-win64 is different than the proper one as in MSDN and 32-bit mingw, so just copy the proper definition here. svn path=/trunk/; revision=20953
This commit is contained in:
committed by
Tor Lillqvist
parent
8303b4437e
commit
34159c417b
@ -1,3 +1,12 @@
|
|||||||
|
2008-08-04 Tor Lillqvist <tml@novell.com>
|
||||||
|
|
||||||
|
* gdk/win32/gdkdisplay-win32.c: Don't bother looking up
|
||||||
|
EnumDisplayMonitors and GetMonitorInfoA dynamically, they are
|
||||||
|
present in NT-based Windows since Windows 2000.
|
||||||
|
(enum_monitor): For some reason the MONITORINFOEX struct in
|
||||||
|
mingw-win64 is different than the proper one as in MSDN and 32-bit
|
||||||
|
mingw, so just copy the proper definition here.
|
||||||
|
|
||||||
2008-08-03 Björn Lindqvist <bjourne@gmail.com>
|
2008-08-03 Björn Lindqvist <bjourne@gmail.com>
|
||||||
|
|
||||||
Bug 540379 – gtk_tree_view_enable_model_drag_dest and
|
Bug 540379 – gtk_tree_view_enable_model_drag_dest and
|
||||||
|
|||||||
@ -30,14 +30,6 @@
|
|||||||
#undef HAVE_MONITOR_INFO
|
#undef HAVE_MONITOR_INFO
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_MONITOR_INFO
|
|
||||||
typedef BOOL (WINAPI *t_EnumDisplayMonitors)(HDC, LPCRECT, MONITORENUMPROC, LPARAM);
|
|
||||||
typedef BOOL (WINAPI *t_GetMonitorInfoA)(HMONITOR, LPMONITORINFO);
|
|
||||||
|
|
||||||
static t_EnumDisplayMonitors p_EnumDisplayMonitors = NULL;
|
|
||||||
static t_GetMonitorInfoA p_GetMonitorInfoA = NULL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_gdk_windowing_set_default_display (GdkDisplay *display)
|
_gdk_windowing_set_default_display (GdkDisplay *display)
|
||||||
{
|
{
|
||||||
@ -64,7 +56,21 @@ enum_monitor (HMONITOR hmonitor,
|
|||||||
LPRECT rect,
|
LPRECT rect,
|
||||||
LPARAM data)
|
LPARAM data)
|
||||||
{
|
{
|
||||||
MONITORINFOEX monitor_info;
|
/* The struct MONITORINFOEX definition is for some reason different
|
||||||
|
* in the winuser.h bundled with mingw64 from that in MSDN and the
|
||||||
|
* official 32-bit mingw (the MONITORINFO part is in a separate "mi"
|
||||||
|
* member). So to keep this easily compileable with either, repeat
|
||||||
|
* the MSDN definition it here.
|
||||||
|
*/
|
||||||
|
typedef struct tagMONITORINFOEXA2 {
|
||||||
|
DWORD cbSize;
|
||||||
|
RECT rcMonitor;
|
||||||
|
RECT rcWork;
|
||||||
|
DWORD dwFlags;
|
||||||
|
CHAR szDevice[CCHDEVICENAME];
|
||||||
|
} MONITORINFOEXA2;
|
||||||
|
|
||||||
|
MONITORINFOEXA2 monitor_info;
|
||||||
HDC hDC;
|
HDC hDC;
|
||||||
|
|
||||||
gint *index = (gint *) data;
|
gint *index = (gint *) data;
|
||||||
@ -75,7 +81,7 @@ enum_monitor (HMONITOR hmonitor,
|
|||||||
monitor = _gdk_monitors + *index;
|
monitor = _gdk_monitors + *index;
|
||||||
|
|
||||||
monitor_info.cbSize = sizeof (MONITORINFOEX);
|
monitor_info.cbSize = sizeof (MONITORINFOEX);
|
||||||
(*p_GetMonitorInfoA) (hmonitor, (MONITORINFO *) &monitor_info);
|
GetMonitorInfoA (hmonitor, (MONITORINFO *) &monitor_info);
|
||||||
|
|
||||||
#ifndef MONITORINFOF_PRIMARY
|
#ifndef MONITORINFOF_PRIMARY
|
||||||
#define MONITORINFOF_PRIMARY 1
|
#define MONITORINFOF_PRIMARY 1
|
||||||
@ -112,30 +118,16 @@ void
|
|||||||
_gdk_monitor_init (void)
|
_gdk_monitor_init (void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_MONITOR_INFO
|
#ifdef HAVE_MONITOR_INFO
|
||||||
static HMODULE user32 = NULL;
|
|
||||||
|
|
||||||
if (user32 == NULL)
|
|
||||||
{
|
|
||||||
user32 = GetModuleHandle ("user32.dll");
|
|
||||||
|
|
||||||
g_assert (user32 != NULL);
|
|
||||||
|
|
||||||
p_EnumDisplayMonitors = (t_EnumDisplayMonitors) GetProcAddress (user32, "EnumDisplayMonitors");
|
|
||||||
p_GetMonitorInfoA = (t_GetMonitorInfoA) GetProcAddress (user32, "GetMonitorInfoA");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p_EnumDisplayMonitors != NULL && p_GetMonitorInfoA != NULL)
|
|
||||||
{
|
|
||||||
gint i, index;
|
gint i, index;
|
||||||
|
|
||||||
_gdk_num_monitors = 0;
|
_gdk_num_monitors = 0;
|
||||||
|
|
||||||
(*p_EnumDisplayMonitors) (NULL, NULL, count_monitor, (LPARAM) &_gdk_num_monitors);
|
EnumDisplayMonitors (NULL, NULL, count_monitor, (LPARAM) &_gdk_num_monitors);
|
||||||
|
|
||||||
_gdk_monitors = g_renew (GdkWin32Monitor, _gdk_monitors, _gdk_num_monitors);
|
_gdk_monitors = g_renew (GdkWin32Monitor, _gdk_monitors, _gdk_num_monitors);
|
||||||
|
|
||||||
index = 0;
|
index = 0;
|
||||||
(*p_EnumDisplayMonitors) (NULL, NULL, enum_monitor, (LPARAM) &index);
|
EnumDisplayMonitors (NULL, NULL, enum_monitor, (LPARAM) &index);
|
||||||
|
|
||||||
_gdk_offset_x = G_MININT;
|
_gdk_offset_x = G_MININT;
|
||||||
_gdk_offset_y = G_MININT;
|
_gdk_offset_y = G_MININT;
|
||||||
@ -160,10 +152,7 @@ _gdk_monitor_init (void)
|
|||||||
_gdk_monitors[i].rect.x,
|
_gdk_monitors[i].rect.x,
|
||||||
_gdk_monitors[i].rect.y));
|
_gdk_monitors[i].rect.y));
|
||||||
}
|
}
|
||||||
}
|
#else
|
||||||
else
|
|
||||||
#endif /* HAVE_MONITOR_INFO */
|
|
||||||
{
|
|
||||||
HDC hDC;
|
HDC hDC;
|
||||||
|
|
||||||
_gdk_num_monitors = 1;
|
_gdk_num_monitors = 1;
|
||||||
@ -180,8 +169,7 @@ _gdk_monitor_init (void)
|
|||||||
_gdk_monitors[0].rect.height = GetSystemMetrics (SM_CYSCREEN);
|
_gdk_monitors[0].rect.height = GetSystemMetrics (SM_CYSCREEN);
|
||||||
_gdk_offset_x = 0;
|
_gdk_offset_x = 0;
|
||||||
_gdk_offset_y = 0;
|
_gdk_offset_y = 0;
|
||||||
}
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GdkDisplay *
|
GdkDisplay *
|
||||||
|
|||||||
Reference in New Issue
Block a user