window: Disallow maximization for windows that can't be maximized

Windows that have minimum widths larger than the screen can't be maximized,
even though we put them in a maximized state and allow users to do so:
the window just won't change size and position. Fix this by simply not giving
the option to maximize, like what happens for non-resizable windows.

https://bugzilla.gnome.org/show_bug.cgi?id=643606
This commit is contained in:
Jasper St. Pierre 2012-03-12 23:18:03 -04:00
parent 8c1b2d5eda
commit 7f64d6b92e

View File

@ -4550,6 +4550,10 @@ meta_window_update_monitor (MetaWindow *window)
if (old) if (old)
g_signal_emit_by_name (window->screen, "window-left-monitor", old->number, window); g_signal_emit_by_name (window->screen, "window-left-monitor", old->number, window);
g_signal_emit_by_name (window->screen, "window-entered-monitor", window->monitor->number, window); g_signal_emit_by_name (window->screen, "window-entered-monitor", window->monitor->number, window);
/* If we're changing monitors, we need to update the has_maximize_func flag,
* as the working area has changed. */
recalc_window_features (window);
} }
} }
@ -8006,6 +8010,23 @@ recalc_window_features (MetaWindow *window)
window->has_maximize_func = FALSE; window->has_maximize_func = FALSE;
} }
if (window->has_maximize_func)
{
MetaRectangle work_area;
MetaFrameBorders borders;
int min_frame_width, min_frame_height;
meta_window_get_work_area_current_monitor (window, &work_area);
meta_frame_calc_borders (window->frame, &borders);
min_frame_width = window->size_hints.min_width + borders.visible.left + borders.visible.right;
min_frame_height = window->size_hints.min_height + borders.visible.top + borders.visible.bottom;
if (min_frame_width >= work_area.width ||
min_frame_height >= work_area.height)
window->has_maximize_func = FALSE;
}
meta_topic (META_DEBUG_WINDOW_OPS, meta_topic (META_DEBUG_WINDOW_OPS,
"Window %s fullscreen = %d not resizable, maximizable = %d fullscreenable = %d min size %dx%d max size %dx%d\n", "Window %s fullscreen = %d not resizable, maximizable = %d fullscreenable = %d min size %dx%d max size %dx%d\n",
window->desc, window->desc,