[gtk+] W32: correctly guess max window size from the size of the workarea of the screen it's on



commit 42ee23769164bbc912082215619e792fe7b130ca
Author: Руслан Ижбулатов <lrn1986 gmail com>
Date:   Thu Apr 10 20:05:19 2014 +0000

    W32: correctly guess max window size from the size of the workarea of the screen it's on
    
    Get monitor on which the most of the window is located (nearest monitor if
    window is not on screen), get its work area (area not occupied by taskbar or
    any other bars) and use that for maxsize.
    
    Previous default of 30000 meant that windows maximized onto full screen,
    even covering the area where taskbar is.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=726592

 gdk/win32/gdkevents-win32.c |   23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)
---
diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c
index 59292d5..4b32f1c 100644
--- a/gdk/win32/gdkevents-win32.c
+++ b/gdk/win32/gdkevents-win32.c
@@ -3076,8 +3076,27 @@ gdk_event_translate (MSG  *msg,
        }
       else
        {
-         mmi->ptMaxTrackSize.x = 30000;
-         mmi->ptMaxTrackSize.y = 30000;
+         HMONITOR winmon;
+         MONITORINFO moninfo;
+
+         winmon = MonitorFromWindow (GDK_WINDOW_HWND (window), MONITOR_DEFAULTTONEAREST);
+
+         moninfo.cbSize = sizeof (moninfo);
+
+         if (GetMonitorInfoA (winmon, &moninfo))
+           {
+             mmi->ptMaxTrackSize.x = moninfo.rcWork.right - moninfo.rcWork.left;
+             mmi->ptMaxTrackSize.y = moninfo.rcWork.bottom - moninfo.rcWork.top;
+           }
+         else
+           {
+             /* Apparently, this is just a very big number (bigger than any widget
+               * could realistically be) to make sure the window is as big as
+               * possible when maximized.
+               */
+             mmi->ptMaxTrackSize.x = 30000;
+             mmi->ptMaxTrackSize.y = 30000;
+           }
        }
 
       if (impl->hint_flags & (GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]