Use the monitor the window currently is on, not always the primary

2007-11-26  Tor Lillqvist  <tml@novell.com>

	* gdk/win32/gdkwindow-win32.c (gdk_window_fullscreen): Use the
	monitor the window currently is on, not always the primary
	monitor. (#463865, Tim Evans)


svn path=/trunk/; revision=19047
This commit is contained in:
Tor Lillqvist 2007-11-25 22:59:50 +00:00 committed by Tor Lillqvist
parent fa7b91a8f7
commit 19209e3a15
2 changed files with 26 additions and 5 deletions

View File

@ -1,3 +1,9 @@
2007-11-26 Tor Lillqvist <tml@novell.com>
* gdk/win32/gdkwindow-win32.c (gdk_window_fullscreen): Use the
monitor the window currently is on, not always the primary
monitor. (#463865, Tim Evans)
2007-11-26 Tor Lillqvist <tml@novell.com>
* gdk/win32/gdktestutils-win32.c: New file, dummy implementations.

View File

@ -3313,9 +3313,11 @@ struct _FullscreenInfo
void
gdk_window_fullscreen (GdkWindow *window)
{
gint width, height;
gint x, y, width, height;
FullscreenInfo *fi;
GdkWindowObject *private = (GdkWindowObject *) window;
HMONITOR monitor;
MONITORINFO mi;
g_return_if_fail (GDK_IS_WINDOW (window));
@ -3327,9 +3329,22 @@ gdk_window_fullscreen (GdkWindow *window)
{
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
width = GetSystemMetrics (SM_CXSCREEN);
height = GetSystemMetrics (SM_CYSCREEN);
monitor = MonitorFromWindow (GDK_WINDOW_HWND (window), MONITOR_DEFAULTTONEAREST);
mi.cbSize = sizeof (mi);
if (monitor && GetMonitorInfo (monitor, &mi))
{
x = mi.rcMonitor.left;
y = mi.rcMonitor.top;
width = mi.rcMonitor.right - x;
height = mi.rcMonitor.bottom - y;
}
else
{
x = y = 0;
width = GetSystemMetrics (SM_CXSCREEN);
height = GetSystemMetrics (SM_CYSCREEN);
}
/* remember for restoring */
fi->hint_flags = impl->hint_flags;
impl->hint_flags &= ~GDK_HINT_MAX_SIZE;
@ -3340,7 +3355,7 @@ gdk_window_fullscreen (GdkWindow *window)
(fi->style & ~WS_OVERLAPPEDWINDOW) | WS_POPUP);
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), HWND_TOP,
0, 0, width, height,
x, y, width, height,
SWP_NOCOPYBITS | SWP_SHOWWINDOW));
gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_FULLSCREEN);