[gtk+] win32: Ensure newly mapped toplevels are inside the workarea
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] win32: Ensure newly mapped toplevels are inside the workarea
- Date: Thu, 10 Nov 2011 16:49:59 +0000 (UTC)
commit 65002208b990bded0cdb0469f9422471e0b4de27
Author: Alexander Larsson <alexl redhat com>
Date: Wed Nov 2 14:30:23 2011 +0100
win32: Ensure newly mapped toplevels are inside the workarea
This is what e.g. metacity does, and its needed to e.g. get the inital
position of the gimp dock window right.
gdk/win32/gdkwindow-win32.c | 51 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 51 insertions(+), 0 deletions(-)
---
diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c
index f2154ab..4985103 100644
--- a/gdk/win32/gdkwindow-win32.c
+++ b/gdk/win32/gdkwindow-win32.c
@@ -1065,6 +1065,57 @@ show_window_internal (GdkWindow *window,
SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER));
}
+ if (!already_mapped &&
+ GDK_WINDOW_TYPE (window) == GDK_WINDOW_TOPLEVEL &&
+ !window_impl->override_redirect)
+ {
+ /* Ensure new windows are fully onscreen */
+ RECT window_rect;
+ HMONITOR monitor;
+ MONITORINFO mi;
+ int x, y;
+
+ GetWindowRect (GDK_WINDOW_HWND (window), &window_rect);
+
+ monitor = MonitorFromWindow (GDK_WINDOW_HWND (window), MONITOR_DEFAULTTONEAREST);
+ mi.cbSize = sizeof (mi);
+ if (monitor && GetMonitorInfo (monitor, &mi))
+ {
+ x = window_rect.left;
+ y = window_rect.top;
+
+ if (window_rect.right > mi.rcWork.right)
+ {
+ window_rect.left -= (window_rect.right - mi.rcWork.right);
+ window_rect.right -= (window_rect.right - mi.rcWork.right);
+ }
+
+ if (window_rect.bottom > mi.rcWork.bottom)
+ {
+ window_rect.top -= (window_rect.bottom - mi.rcWork.bottom);
+ window_rect.bottom -= (window_rect.bottom - mi.rcWork.bottom);
+ }
+
+ if (window_rect.left < mi.rcWork.left)
+ {
+ window_rect.right += (mi.rcWork.left - window_rect.left);
+ window_rect.left += (mi.rcWork.left - window_rect.left);
+ }
+
+ if (window_rect.top < mi.rcWork.top)
+ {
+ window_rect.bottom += (mi.rcWork.top - window_rect.top);
+ window_rect.top += (mi.rcWork.top - window_rect.top);
+ }
+
+ if (x != window_rect.left || y != window_rect.top)
+ API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), NULL,
+ window_rect.left, window_rect.top, 0, 0,
+ SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER));
+ }
+ }
+
+
if (window->state & GDK_WINDOW_STATE_FULLSCREEN)
{
gdk_window_fullscreen (window);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]