prevent window self-maximisation

This commit is contained in:
Peter Bloomfield 2010-01-20 10:59:07 -05:00 committed by Thomas Thurman
parent 767cb27f78
commit 4943d79d68
4 changed files with 33 additions and 6 deletions

View File

@ -528,10 +528,11 @@ place_window_if_needed(MetaWindow *window,
if (window->placed || did_placement) if (window->placed || did_placement)
{ {
if (window->maximize_horizontally_after_placement || if (window->maximize_horizontally_after_placement ||
window->maximize_vertically_after_placement) window->maximize_vertically_after_placement ||
window->fullscreen_after_placement)
{ {
/* define a sane saved_rect so that the user can unmaximize to /* define a sane saved_rect so that the user can unmaximize or
* something reasonable. * make unfullscreen to something reasonable.
*/ */
if (info->current.width >= info->work_area_xinerama.width) if (info->current.width >= info->work_area_xinerama.width)
{ {
@ -558,6 +559,13 @@ place_window_if_needed(MetaWindow *window,
if (window->frame && !window->fullscreen) if (window->frame && !window->fullscreen)
meta_frame_calc_geometry (window->frame, info->fgeom); meta_frame_calc_geometry (window->frame, info->fgeom);
if (window->fullscreen_after_placement)
{
window->saved_rect = info->current;
window->fullscreen = TRUE;
window->fullscreen_after_placement = FALSE;
}
window->maximize_horizontally_after_placement = FALSE; window->maximize_horizontally_after_placement = FALSE;
window->maximize_vertically_after_placement = FALSE; window->maximize_vertically_after_placement = FALSE;
} }

View File

@ -144,6 +144,9 @@ struct _MetaWindow
/* Whether we're fullscreen */ /* Whether we're fullscreen */
guint fullscreen : 1; guint fullscreen : 1;
/* Whether we have to fullscreen after placement */
guint fullscreen_after_placement : 1;
/* Area to cover when in fullscreen mode. If _NET_WM_FULLSCREEN_MONITORS has /* Area to cover when in fullscreen mode. If _NET_WM_FULLSCREEN_MONITORS has
* been overridden (via a client message), the window will cover the union of * been overridden (via a client message), the window will cover the union of
* these monitors. If not, this is the single monitor which the window's * these monitors. If not, this is the single monitor which the window's
@ -247,6 +250,9 @@ struct _MetaWindow
/* Have we placed this window? */ /* Have we placed this window? */
guint placed : 1; guint placed : 1;
/* Must we force_save_user_window_placement? */
guint force_save_user_rect : 1;
/* Is this not a transient of the focus window which is being denied focus? */ /* Is this not a transient of the focus window which is being denied focus? */
guint denied_focus_and_not_transient : 1; guint denied_focus_and_not_transient : 1;

View File

@ -624,6 +624,7 @@ reload_net_wm_state (MetaWindow *window,
window->shaded = FALSE; window->shaded = FALSE;
window->maximized_horizontally = FALSE; window->maximized_horizontally = FALSE;
window->maximized_vertically = FALSE; window->maximized_vertically = FALSE;
window->fullscreen = FALSE;
window->wm_state_modal = FALSE; window->wm_state_modal = FALSE;
window->wm_state_skip_taskbar = FALSE; window->wm_state_skip_taskbar = FALSE;
window->wm_state_skip_pager = FALSE; window->wm_state_skip_pager = FALSE;
@ -652,7 +653,7 @@ reload_net_wm_state (MetaWindow *window,
else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_SKIP_PAGER) else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_SKIP_PAGER)
window->wm_state_skip_pager = TRUE; window->wm_state_skip_pager = TRUE;
else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_FULLSCREEN) else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_FULLSCREEN)
window->fullscreen = TRUE; window->fullscreen_after_placement = TRUE;
else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_ABOVE) else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_ABOVE)
window->wm_state_above = TRUE; window->wm_state_above = TRUE;
else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_BELOW) else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_BELOW)

View File

@ -457,7 +457,7 @@ meta_window_new_with_attrs (MetaDisplay *display,
window->maximize_horizontally_after_placement = FALSE; window->maximize_horizontally_after_placement = FALSE;
window->maximize_vertically_after_placement = FALSE; window->maximize_vertically_after_placement = FALSE;
window->minimize_after_placement = FALSE; window->minimize_after_placement = FALSE;
window->fullscreen = FALSE; window->fullscreen_after_placement = FALSE;
window->fullscreen_monitors[0] = -1; window->fullscreen_monitors[0] = -1;
window->require_fully_onscreen = TRUE; window->require_fully_onscreen = TRUE;
window->require_on_single_xinerama = TRUE; window->require_on_single_xinerama = TRUE;
@ -478,6 +478,7 @@ meta_window_new_with_attrs (MetaDisplay *display,
meta_topic (META_DEBUG_PLACEMENT, meta_topic (META_DEBUG_PLACEMENT,
"Not placing window 0x%lx since it's already mapped\n", "Not placing window 0x%lx since it's already mapped\n",
xwindow); xwindow);
window->force_save_user_rect = TRUE;
window->denied_focus_and_not_transient = FALSE; window->denied_focus_and_not_transient = FALSE;
window->unmanaging = FALSE; window->unmanaging = FALSE;
window->is_in_queues = 0; window->is_in_queues = 0;
@ -2551,6 +2552,8 @@ meta_window_maximize_internal (MetaWindow *window,
window->maximized_horizontally || maximize_horizontally; window->maximized_horizontally || maximize_horizontally;
window->maximized_vertically = window->maximized_vertically =
window->maximized_vertically || maximize_vertically; window->maximized_vertically || maximize_vertically;
if (maximize_horizontally || maximize_vertically)
window->force_save_user_rect = FALSE;
/* Fix for #336850: If the frame shape isn't reapplied, it is /* Fix for #336850: If the frame shape isn't reapplied, it is
* possible that the frame will retains its rounded corners. That * possible that the frame will retains its rounded corners. That
@ -2713,6 +2716,10 @@ meta_window_unmaximize (MetaWindow *window,
target_rect.width, target_rect.width,
target_rect.height); target_rect.height);
/* Make sure user_rect is current.
*/
force_save_user_window_placement (window);
if (window->display->grab_wireframe_active) if (window->display->grab_wireframe_active)
{ {
window->display->grab_wireframe_rect = target_rect; window->display->grab_wireframe_rect = target_rect;
@ -2762,6 +2769,7 @@ meta_window_make_fullscreen_internal (MetaWindow *window)
meta_window_save_rect (window); meta_window_save_rect (window);
window->fullscreen = TRUE; window->fullscreen = TRUE;
window->force_save_user_rect = FALSE;
meta_stack_freeze (window->screen->stack); meta_stack_freeze (window->screen->stack);
meta_window_update_layer (window); meta_window_update_layer (window);
@ -2811,6 +2819,10 @@ meta_window_unmake_fullscreen (MetaWindow *window)
target_rect.width, target_rect.width,
target_rect.height); target_rect.height);
/* Make sure user_rect is current.
*/
force_save_user_window_placement (window);
meta_window_update_layer (window); meta_window_update_layer (window);
recalc_window_features (window); recalc_window_features (window);
@ -3613,7 +3625,7 @@ meta_window_move_resize_internal (MetaWindow *window,
if (need_configure_notify) if (need_configure_notify)
send_configure_notify (window); send_configure_notify (window);
if (!window->placed) if (!window->placed && window->force_save_user_rect && !window->fullscreen)
force_save_user_window_placement (window); force_save_user_window_placement (window);
else if (is_user_action) else if (is_user_action)
save_user_window_placement (window); save_user_window_placement (window);