diff options
author | Tor Lillqvist <tml@iki.fi> | 2004-09-03 01:27:57 +0000 |
---|---|---|
committer | Tor Lillqvist <tml@src.gnome.org> | 2004-09-03 01:27:57 +0000 |
commit | f8ef369e7844fcfec03ae45c22ab77b61073a716 (patch) | |
tree | 6f27e086d0c3d90f9aea09e3fcf396ae93de8cc1 /gdk/win32/gdkdisplay-win32.c | |
parent | f96b1284706d85aefdb99d5f4bebb20c675e6f66 (diff) | |
download | gtk+-f8ef369e7844fcfec03ae45c22ab77b61073a716.tar.gz |
List the three theme gtkrc files separately, zip doesn't do anything if
2004-09-03 Tor Lillqvist <tml@iki.fi>
* gtk-zip.sh.in: List the three theme gtkrc files separately, zip
doesn't do anything if one of the files on its command line
doesn't exist.
Handle changes of screen resolution on Win32. (#151581, reported by
Arjohn Kampman)
* gdk/win32/gdkwindow-win32.c (_gdk_windowing_window_init,
_gdk_root_window_size_init): Factor out setting the root window's
size (as the size of the union of all monitors) to a new function.
* gdk/win32/gdkdisplay-win32.c (gdk_display_open,
_gdk_monitor_init): Factor out the monitor query to a new
function.
* gdk/win32/gdkprivate-win32.h: Declare above new functions.
* gdk/win32/gdkevents-win32.c (gdk_event_translate,
handle_display_change): Handle WM_DISPLAYCHANGE by calling the
above two functions, and emitting the "size_changed" signal on our
(only) GdkScreen.
Diffstat (limited to 'gdk/win32/gdkdisplay-win32.c')
-rw-r--r-- | gdk/win32/gdkdisplay-win32.c | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/gdk/win32/gdkdisplay-win32.c b/gdk/win32/gdkdisplay-win32.c index 6d0e9d4ec1..16a5127254 100644 --- a/gdk/win32/gdkdisplay-win32.c +++ b/gdk/win32/gdkdisplay-win32.c @@ -102,23 +102,21 @@ enum_monitor (HMONITOR hmonitor, } #endif /* HAVE_MONITOR_INFO */ -GdkDisplay * -gdk_display_open (const gchar *display_name) +void +_gdk_monitor_init (void) { - HMODULE user32; - - if (_gdk_display != NULL) - return NULL; /* single display only */ +#ifdef HAVE_MONITOR_INFO + static HMODULE user32 = NULL; - _gdk_display = g_object_new (GDK_TYPE_DISPLAY, NULL); - _gdk_screen = g_object_new (GDK_TYPE_SCREEN, NULL); + if (user32 == NULL) + { + user32 = GetModuleHandle ("user32.dll"); -#ifdef HAVE_MONITOR_INFO - user32 = GetModuleHandle ("user32.dll"); - g_assert (user32 != NULL); + g_assert (user32 != NULL); - p_EnumDisplayMonitors = (t_EnumDisplayMonitors) GetProcAddress (user32, "EnumDisplayMonitors"); - p_GetMonitorInfoA = (t_GetMonitorInfoA) GetProcAddress (user32, "GetMonitorInfoA"); + p_EnumDisplayMonitors = (t_EnumDisplayMonitors) GetProcAddress (user32, "EnumDisplayMonitors"); + p_GetMonitorInfoA = (t_GetMonitorInfoA) GetProcAddress (user32, "GetMonitorInfoA"); + } if (p_EnumDisplayMonitors != NULL && p_GetMonitorInfoA != NULL) { @@ -128,10 +126,11 @@ gdk_display_open (const gchar *display_name) (*p_EnumDisplayMonitors) (NULL, NULL, count_monitor, (LPARAM) &_gdk_num_monitors); - _gdk_monitors = g_new (GdkRectangle, _gdk_num_monitors); + _gdk_monitors = g_renew (GdkRectangle, _gdk_monitors, _gdk_num_monitors); + index = 0; (*p_EnumDisplayMonitors) (NULL, NULL, enum_monitor, (LPARAM) &index); -#if 1 + _gdk_offset_x = G_MININT; _gdk_offset_y = G_MININT; @@ -154,7 +153,6 @@ gdk_display_open (const gchar *display_name) _gdk_monitors[i].height, _gdk_monitors[i].x, _gdk_monitors[i].y)); } -#endif } else #endif /* HAVE_MONITOR_INFO */ @@ -162,7 +160,7 @@ gdk_display_open (const gchar *display_name) unsigned int width, height; _gdk_num_monitors = 1; - _gdk_monitors = g_new (GdkRectangle, 1); + _gdk_monitors = g_renew (GdkRectangle, _gdk_monitors, 1); width = GetSystemMetrics (SM_CXSCREEN); height = GetSystemMetrics (SM_CYSCREEN); @@ -175,6 +173,18 @@ gdk_display_open (const gchar *display_name) _gdk_offset_y = 0; } +} + +GdkDisplay * +gdk_display_open (const gchar *display_name) +{ + if (_gdk_display != NULL) + return NULL; /* single display only */ + + _gdk_display = g_object_new (GDK_TYPE_DISPLAY, NULL); + _gdk_screen = g_object_new (GDK_TYPE_SCREEN, NULL); + + _gdk_monitor_init (); _gdk_visual_init (); gdk_screen_set_default_colormap (_gdk_screen, gdk_screen_get_system_colormap (_gdk_screen)); |