window: Add a META_MAXIMIZE_BOTH maximization flag

Which has both directions set. This is a simple cleanup to
remove the constant VERTICAL | HORIZONTAL all over the place.

https://bugzilla.gnome.org/show_bug.cgi?id=726352
This commit is contained in:
Jasper St. Pierre 2014-03-13 18:32:20 -04:00
parent 991c85f6a0
commit 24e12053ea
5 changed files with 27 additions and 61 deletions

View File

@ -687,7 +687,7 @@ meta_window_actor_has_shadow (MetaWindowActor *self)
/* Leaving out shadows for maximized and fullscreen windows is an effeciency /* Leaving out shadows for maximized and fullscreen windows is an effeciency
* win and also prevents the unsightly effect of the shadow of maximized * win and also prevents the unsightly effect of the shadow of maximized
* window appearing on an adjacent window */ * window appearing on an adjacent window */
if ((meta_window_get_maximized (priv->window) == (META_MAXIMIZE_HORIZONTAL | META_MAXIMIZE_VERTICAL)) || if ((meta_window_get_maximized (priv->window) == META_MAXIMIZE_BOTH) ||
meta_window_is_fullscreen (priv->window)) meta_window_is_fullscreen (priv->window))
return FALSE; return FALSE;

View File

@ -322,8 +322,7 @@ meta_core_maximize (Display *xdisplay,
if (meta_prefs_get_raise_on_click ()) if (meta_prefs_get_raise_on_click ())
meta_window_raise (window); meta_window_raise (window);
meta_window_maximize (window, meta_window_maximize (window, META_MAXIMIZE_BOTH);
META_MAXIMIZE_HORIZONTAL | META_MAXIMIZE_VERTICAL);
} }
void void
@ -336,11 +335,9 @@ meta_core_toggle_maximize_vertically (Display *xdisplay,
meta_window_raise (window); meta_window_raise (window);
if (META_WINDOW_MAXIMIZED_VERTICALLY (window)) if (META_WINDOW_MAXIMIZED_VERTICALLY (window))
meta_window_unmaximize (window, meta_window_unmaximize (window, META_MAXIMIZE_VERTICAL);
META_MAXIMIZE_VERTICAL);
else else
meta_window_maximize (window, meta_window_maximize (window, META_MAXIMIZE_VERTICAL);
META_MAXIMIZE_VERTICAL);
} }
void void
@ -353,11 +350,9 @@ meta_core_toggle_maximize_horizontally (Display *xdisplay,
meta_window_raise (window); meta_window_raise (window);
if (META_WINDOW_MAXIMIZED_HORIZONTALLY (window)) if (META_WINDOW_MAXIMIZED_HORIZONTALLY (window))
meta_window_unmaximize (window, meta_window_unmaximize (window, META_MAXIMIZE_HORIZONTAL);
META_MAXIMIZE_HORIZONTAL);
else else
meta_window_maximize (window, meta_window_maximize (window, META_MAXIMIZE_HORIZONTAL);
META_MAXIMIZE_HORIZONTAL);
} }
void void
@ -370,11 +365,9 @@ meta_core_toggle_maximize (Display *xdisplay,
meta_window_raise (window); meta_window_raise (window);
if (META_WINDOW_MAXIMIZED (window)) if (META_WINDOW_MAXIMIZED (window))
meta_window_unmaximize (window, meta_window_unmaximize (window, META_MAXIMIZE_BOTH);
META_MAXIMIZE_HORIZONTAL | META_MAXIMIZE_VERTICAL);
else else
meta_window_maximize (window, meta_window_maximize (window, META_MAXIMIZE_BOTH);
META_MAXIMIZE_HORIZONTAL | META_MAXIMIZE_VERTICAL);
} }
void void
@ -386,8 +379,7 @@ meta_core_unmaximize (Display *xdisplay,
if (meta_prefs_get_raise_on_click ()) if (meta_prefs_get_raise_on_click ())
meta_window_raise (window); meta_window_raise (window);
meta_window_unmaximize (window, meta_window_unmaximize (window, META_MAXIMIZE_BOTH);
META_MAXIMIZE_HORIZONTAL | META_MAXIMIZE_VERTICAL);
} }
void void

View File

@ -2015,9 +2015,7 @@ process_mouse_move_resize_grab (MetaDisplay *display,
* moveresize now to get the position back to the original. * moveresize now to get the position back to the original.
*/ */
if (window->shaken_loose || window->tile_mode == META_TILE_MAXIMIZED) if (window->shaken_loose || window->tile_mode == META_TILE_MAXIMIZED)
meta_window_maximize (window, meta_window_maximize (window, META_MAXIMIZE_BOTH);
META_MAXIMIZE_HORIZONTAL |
META_MAXIMIZE_VERTICAL);
else if (window->tile_mode != META_TILE_NONE) else if (window->tile_mode != META_TILE_NONE)
meta_window_tile (window); meta_window_tile (window);
else else
@ -2079,9 +2077,7 @@ process_keyboard_move_grab (MetaDisplay *display,
* now to get the position back to the original. * now to get the position back to the original.
*/ */
if (window->shaken_loose) if (window->shaken_loose)
meta_window_maximize (window, meta_window_maximize (window, META_MAXIMIZE_BOTH);
META_MAXIMIZE_HORIZONTAL |
META_MAXIMIZE_VERTICAL);
else else
meta_window_move_resize (display->grab_window, meta_window_move_resize (display->grab_window,
TRUE, TRUE,
@ -2945,11 +2941,9 @@ handle_toggle_tiled (MetaDisplay *display,
: META_TILE_NONE; : META_TILE_NONE;
if (window->saved_maximize) if (window->saved_maximize)
meta_window_maximize (window, META_MAXIMIZE_VERTICAL | meta_window_maximize (window, META_MAXIMIZE_BOTH);
META_MAXIMIZE_HORIZONTAL);
else else
meta_window_unmaximize (window, META_MAXIMIZE_VERTICAL | meta_window_unmaximize (window, META_MAXIMIZE_BOTH);
META_MAXIMIZE_HORIZONTAL);
} }
else if (meta_window_can_tile_side_by_side (window)) else if (meta_window_can_tile_side_by_side (window))
{ {
@ -2975,13 +2969,9 @@ handle_toggle_maximized (MetaDisplay *display,
gpointer dummy) gpointer dummy)
{ {
if (META_WINDOW_MAXIMIZED (window)) if (META_WINDOW_MAXIMIZED (window))
meta_window_unmaximize (window, meta_window_unmaximize (window, META_MAXIMIZE_BOTH);
META_MAXIMIZE_HORIZONTAL |
META_MAXIMIZE_VERTICAL);
else if (window->has_maximize_func) else if (window->has_maximize_func)
meta_window_maximize (window, meta_window_maximize (window, META_MAXIMIZE_BOTH);
META_MAXIMIZE_HORIZONTAL |
META_MAXIMIZE_VERTICAL);
} }
static void static void
@ -2993,9 +2983,7 @@ handle_maximize (MetaDisplay *display,
gpointer dummy) gpointer dummy)
{ {
if (window->has_maximize_func) if (window->has_maximize_func)
meta_window_maximize (window, meta_window_maximize (window, META_MAXIMIZE_BOTH);
META_MAXIMIZE_HORIZONTAL |
META_MAXIMIZE_VERTICAL);
} }
static void static void
@ -3007,9 +2995,7 @@ handle_unmaximize (MetaDisplay *display,
gpointer dummy) gpointer dummy)
{ {
if (window->maximized_vertically || window->maximized_horizontally) if (window->maximized_vertically || window->maximized_horizontally)
meta_window_unmaximize (window, meta_window_unmaximize (window, META_MAXIMIZE_BOTH);
META_MAXIMIZE_HORIZONTAL |
META_MAXIMIZE_VERTICAL);
} }
static void static void

View File

@ -1562,9 +1562,7 @@ meta_window_apply_session_info (MetaWindow *window,
if (window->has_maximize_func && info->maximized) if (window->has_maximize_func && info->maximized)
{ {
meta_window_maximize (window, meta_window_maximize (window, META_MAXIMIZE_BOTH);
META_MAXIMIZE_HORIZONTAL |
META_MAXIMIZE_VERTICAL);
if (info->saved_rect_set) if (info->saved_rect_set)
{ {
@ -3676,7 +3674,7 @@ meta_window_tile (MetaWindow *window)
return; return;
if (window->tile_mode == META_TILE_MAXIMIZED) if (window->tile_mode == META_TILE_MAXIMIZED)
directions = META_MAXIMIZE_VERTICAL | META_MAXIMIZE_HORIZONTAL; directions = META_MAXIMIZE_BOTH;
else else
directions = META_MAXIMIZE_VERTICAL; directions = META_MAXIMIZE_VERTICAL;
@ -8712,15 +8710,11 @@ menu_callback (MetaWindowMenu *menu,
break; break;
case META_MENU_OP_UNMAXIMIZE: case META_MENU_OP_UNMAXIMIZE:
meta_window_unmaximize (window, meta_window_unmaximize (window, META_MAXIMIZE_BOTH);
META_MAXIMIZE_HORIZONTAL |
META_MAXIMIZE_VERTICAL);
break; break;
case META_MENU_OP_MAXIMIZE: case META_MENU_OP_MAXIMIZE:
meta_window_maximize (window, meta_window_maximize (window, META_MAXIMIZE_BOTH);
META_MAXIMIZE_HORIZONTAL |
META_MAXIMIZE_VERTICAL);
break; break;
case META_MENU_OP_UNSHADE: case META_MENU_OP_UNSHADE:
@ -9237,10 +9231,7 @@ update_move (MetaWindow *window,
display->grab_anchor_root_x = x; display->grab_anchor_root_x = x;
display->grab_anchor_root_y = y; display->grab_anchor_root_y = y;
meta_window_unmaximize (window, meta_window_unmaximize (window, META_MAXIMIZE_BOTH);
META_MAXIMIZE_HORIZONTAL |
META_MAXIMIZE_VERTICAL);
return; return;
} }
@ -9284,9 +9275,7 @@ update_move (MetaWindow *window,
window->user_rect.x = window->saved_rect.x; window->user_rect.x = window->saved_rect.x;
window->user_rect.y = window->saved_rect.y; window->user_rect.y = window->saved_rect.y;
meta_window_unmaximize (window, meta_window_unmaximize (window, META_MAXIMIZE_BOTH);
META_MAXIMIZE_HORIZONTAL |
META_MAXIMIZE_VERTICAL);
} }
display->grab_initial_window_pos = work_area; display->grab_initial_window_pos = work_area;
@ -9294,10 +9283,7 @@ update_move (MetaWindow *window,
display->grab_anchor_root_y = y; display->grab_anchor_root_y = y;
window->shaken_loose = FALSE; window->shaken_loose = FALSE;
meta_window_maximize (window, meta_window_maximize (window, META_MAXIMIZE_BOTH);
META_MAXIMIZE_HORIZONTAL |
META_MAXIMIZE_VERTICAL);
return; return;
} }
} }

View File

@ -72,11 +72,13 @@ typedef enum
* MetaMaximizeFlags: * MetaMaximizeFlags:
* @META_MAXIMIZE_HORIZONTAL: Horizontal * @META_MAXIMIZE_HORIZONTAL: Horizontal
* @META_MAXIMIZE_VERTICAL: Vertical * @META_MAXIMIZE_VERTICAL: Vertical
* @META_MAXIMIZE_BOTH: Both
*/ */
typedef enum typedef enum
{ {
META_MAXIMIZE_HORIZONTAL = 1 << 0, META_MAXIMIZE_HORIZONTAL = 1 << 0,
META_MAXIMIZE_VERTICAL = 1 << 1 META_MAXIMIZE_VERTICAL = 1 << 1,
META_MAXIMIZE_BOTH = (1 << 0 | 1 << 1),
} MetaMaximizeFlags; } MetaMaximizeFlags;
#define META_TYPE_WINDOW (meta_window_get_type ()) #define META_TYPE_WINDOW (meta_window_get_type ())