From 4b123e0f61eb55e59d30bf442499cf3b3f621c3b Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Tue, 4 Aug 2015 16:05:05 +0100 Subject: [PATCH] hw/xwin: Make window maximizable if a maximium size larger than virtual desktop size is specified Firefox 38 has a WM_NORMAL_HINTS with a maximum size of 32767x32767. Don't remove the maximize control from the window frame if the maximum size is bigger than the virtual desktop size, as maximizing the window will not exceed the maximium size. Signed-off-by: Jon Turney Reviewed-by: Colin Harrison --- hw/xwin/winmultiwindowwm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c index 580d641b7..df7e6d3d5 100644 --- a/hw/xwin/winmultiwindowwm.c +++ b/hw/xwin/winmultiwindowwm.c @@ -1763,8 +1763,12 @@ winApplyHints(WMInfoPtr pWMInfo, xcb_window_t iWindow, HWND hWnd, HWND * zstyle) cookie = xcb_icccm_get_wm_normal_hints(conn, iWindow); if (xcb_icccm_get_wm_normal_hints_reply(conn, cookie, &size_hints, NULL)) { if (size_hints.flags & XCB_ICCCM_SIZE_HINT_P_MAX_SIZE) { - /* Not maximizable if a maximum size is specified */ - hint |= HINT_NOMAXIMIZE; + + /* Not maximizable if a maximum size is specified, and that size + is smaller (in either dimension) than the screen size */ + if ((size_hints.max_width < GetSystemMetrics(SM_CXVIRTUALSCREEN)) + || (size_hints.max_height < GetSystemMetrics(SM_CYVIRTUALSCREEN))) + hint |= HINT_NOMAXIMIZE; if (size_hints.flags & XCB_ICCCM_SIZE_HINT_P_MIN_SIZE) { /*