[gtk+/gtk-2-24-win32] win32: Ensure newly mapped toplevels are inside the workarea
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-2-24-win32] win32: Ensure newly mapped toplevels are inside the workarea
- Date: Wed, 2 Nov 2011 13:31:42 +0000 (UTC)
commit 3cd9920e14acd9ace017046bc420fca5b1e36331
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 | 52 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 52 insertions(+), 0 deletions(-)
---
diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c
index b61a7b7..bef9a1d 100644
--- a/gdk/win32/gdkwindow-win32.c
+++ b/gdk/win32/gdkwindow-win32.c
@@ -1164,6 +1164,58 @@ show_window_internal (GdkWindow *window,
SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER));
}
+ if (!already_mapped &&
+ (GDK_WINDOW_TYPE (window) == GDK_WINDOW_TOPLEVEL ||
+ GDK_WINDOW_TYPE (window) == GDK_WINDOW_DIALOG) &&
+ !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 (private->state & GDK_WINDOW_STATE_FULLSCREEN)
{
gdk_window_fullscreen (window);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]