[mutter/wayland] Add a META_MAXIMIZE_BOTH
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wayland] Add a META_MAXIMIZE_BOTH
- Date: Sat, 15 Mar 2014 13:50:14 +0000 (UTC)
commit 0f859863407dd976e88cf4eca842e4c07a77b22e
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Mar 13 18:32:20 2014 -0400
Add a META_MAXIMIZE_BOTH
Which has the value of META_MAXIMIZE_VERTICAL |
META_MAXIMIZE_HORIZONTAL.
This is an obvious code cleanup.
src/compositor/meta-window-actor.c | 2 +-
src/core/core.c | 24 ++++++++----------------
src/core/keybindings.c | 30 ++++++++----------------------
src/core/window.c | 28 +++++++---------------------
src/meta/window.h | 4 +++-
src/wayland/meta-wayland-surface.c | 8 ++++----
6 files changed, 31 insertions(+), 65 deletions(-)
---
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index a26d342..e5d54e9 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -714,7 +714,7 @@ meta_window_actor_has_shadow (MetaWindowActor *self)
/* Leaving out shadows for maximized and fullscreen windows is an effeciency
* win and also prevents the unsightly effect of the shadow of maximized
* 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))
return FALSE;
diff --git a/src/core/core.c b/src/core/core.c
index cb2a747..9f41a35 100644
--- a/src/core/core.c
+++ b/src/core/core.c
@@ -328,8 +328,7 @@ meta_core_maximize (Display *xdisplay,
if (meta_prefs_get_raise_on_click ())
meta_window_raise (window);
- meta_window_maximize (window,
- META_MAXIMIZE_HORIZONTAL | META_MAXIMIZE_VERTICAL);
+ meta_window_maximize (window, META_MAXIMIZE_BOTH);
}
void
@@ -342,11 +341,9 @@ meta_core_toggle_maximize_vertically (Display *xdisplay,
meta_window_raise (window);
if (META_WINDOW_MAXIMIZED_VERTICALLY (window))
- meta_window_unmaximize (window,
- META_MAXIMIZE_VERTICAL);
+ meta_window_unmaximize (window, META_MAXIMIZE_VERTICAL);
else
- meta_window_maximize (window,
- META_MAXIMIZE_VERTICAL);
+ meta_window_maximize (window, META_MAXIMIZE_VERTICAL);
}
void
@@ -359,11 +356,9 @@ meta_core_toggle_maximize_horizontally (Display *xdisplay,
meta_window_raise (window);
if (META_WINDOW_MAXIMIZED_HORIZONTALLY (window))
- meta_window_unmaximize (window,
- META_MAXIMIZE_HORIZONTAL);
+ meta_window_unmaximize (window, META_MAXIMIZE_HORIZONTAL);
else
- meta_window_maximize (window,
- META_MAXIMIZE_HORIZONTAL);
+ meta_window_maximize (window, META_MAXIMIZE_HORIZONTAL);
}
void
@@ -376,11 +371,9 @@ meta_core_toggle_maximize (Display *xdisplay,
meta_window_raise (window);
if (META_WINDOW_MAXIMIZED (window))
- meta_window_unmaximize (window,
- META_MAXIMIZE_HORIZONTAL | META_MAXIMIZE_VERTICAL);
+ meta_window_unmaximize (window, META_MAXIMIZE_BOTH);
else
- meta_window_maximize (window,
- META_MAXIMIZE_HORIZONTAL | META_MAXIMIZE_VERTICAL);
+ meta_window_maximize (window, META_MAXIMIZE_BOTH);
}
void
@@ -392,8 +385,7 @@ meta_core_unmaximize (Display *xdisplay,
if (meta_prefs_get_raise_on_click ())
meta_window_raise (window);
- meta_window_unmaximize (window,
- META_MAXIMIZE_HORIZONTAL | META_MAXIMIZE_VERTICAL);
+ meta_window_unmaximize (window, META_MAXIMIZE_BOTH);
}
void
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
index 23b83b7..415ccf8 100644
--- a/src/core/keybindings.c
+++ b/src/core/keybindings.c
@@ -1975,9 +1975,7 @@ process_mouse_move_resize_grab (MetaDisplay *display,
* moveresize now to get the position back to the original.
*/
if (window->shaken_loose || window->tile_mode == META_TILE_MAXIMIZED)
- meta_window_maximize (window,
- META_MAXIMIZE_HORIZONTAL |
- META_MAXIMIZE_VERTICAL);
+ meta_window_maximize (window, META_MAXIMIZE_BOTH);
else if (window->tile_mode != META_TILE_NONE)
meta_window_tile (window);
else
@@ -2038,9 +2036,7 @@ process_keyboard_move_grab (MetaDisplay *display,
* now to get the position back to the original.
*/
if (window->shaken_loose)
- meta_window_maximize (window,
- META_MAXIMIZE_HORIZONTAL |
- META_MAXIMIZE_VERTICAL);
+ meta_window_maximize (window, META_MAXIMIZE_BOTH);
else
meta_window_move_resize (display->grab_window,
TRUE,
@@ -2901,11 +2897,9 @@ handle_toggle_tiled (MetaDisplay *display,
: META_TILE_NONE;
if (window->saved_maximize)
- meta_window_maximize (window, META_MAXIMIZE_VERTICAL |
- META_MAXIMIZE_HORIZONTAL);
+ meta_window_maximize (window, META_MAXIMIZE_BOTH);
else
- meta_window_unmaximize (window, META_MAXIMIZE_VERTICAL |
- META_MAXIMIZE_HORIZONTAL);
+ meta_window_unmaximize (window, META_MAXIMIZE_BOTH);
}
else if (meta_window_can_tile_side_by_side (window))
{
@@ -2931,13 +2925,9 @@ handle_toggle_maximized (MetaDisplay *display,
gpointer dummy)
{
if (META_WINDOW_MAXIMIZED (window))
- meta_window_unmaximize (window,
- META_MAXIMIZE_HORIZONTAL |
- META_MAXIMIZE_VERTICAL);
+ meta_window_unmaximize (window, META_MAXIMIZE_BOTH);
else if (window->has_maximize_func)
- meta_window_maximize (window,
- META_MAXIMIZE_HORIZONTAL |
- META_MAXIMIZE_VERTICAL);
+ meta_window_maximize (window, META_MAXIMIZE_BOTH);
}
static void
@@ -2949,9 +2939,7 @@ handle_maximize (MetaDisplay *display,
gpointer dummy)
{
if (window->has_maximize_func)
- meta_window_maximize (window,
- META_MAXIMIZE_HORIZONTAL |
- META_MAXIMIZE_VERTICAL);
+ meta_window_maximize (window, META_MAXIMIZE_BOTH);
}
static void
@@ -2963,9 +2951,7 @@ handle_unmaximize (MetaDisplay *display,
gpointer dummy)
{
if (window->maximized_vertically || window->maximized_horizontally)
- meta_window_unmaximize (window,
- META_MAXIMIZE_HORIZONTAL |
- META_MAXIMIZE_VERTICAL);
+ meta_window_unmaximize (window, META_MAXIMIZE_BOTH);
}
static void
diff --git a/src/core/window.c b/src/core/window.c
index a0335aa..a70fe66 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -1368,9 +1368,7 @@ meta_window_apply_session_info (MetaWindow *window,
if (window->has_maximize_func && info->maximized)
{
- meta_window_maximize (window,
- META_MAXIMIZE_HORIZONTAL |
- META_MAXIMIZE_VERTICAL);
+ meta_window_maximize (window, META_MAXIMIZE_BOTH);
if (info->saved_rect_set)
{
@@ -3370,7 +3368,7 @@ meta_window_tile (MetaWindow *window)
return;
if (window->tile_mode == META_TILE_MAXIMIZED)
- directions = META_MAXIMIZE_VERTICAL | META_MAXIMIZE_HORIZONTAL;
+ directions = META_MAXIMIZE_BOTH;
else
directions = META_MAXIMIZE_VERTICAL;
@@ -7456,15 +7454,11 @@ menu_callback (MetaWindowMenu *menu,
break;
case META_MENU_OP_UNMAXIMIZE:
- meta_window_unmaximize (window,
- META_MAXIMIZE_HORIZONTAL |
- META_MAXIMIZE_VERTICAL);
+ meta_window_unmaximize (window, META_MAXIMIZE_BOTH);
break;
case META_MENU_OP_MAXIMIZE:
- meta_window_maximize (window,
- META_MAXIMIZE_HORIZONTAL |
- META_MAXIMIZE_VERTICAL);
+ meta_window_maximize (window, META_MAXIMIZE_BOTH);
break;
case META_MENU_OP_UNSHADE:
@@ -7981,10 +7975,7 @@ update_move (MetaWindow *window,
display->grab_anchor_root_x = x;
display->grab_anchor_root_y = y;
- meta_window_unmaximize (window,
- META_MAXIMIZE_HORIZONTAL |
- META_MAXIMIZE_VERTICAL);
-
+ meta_window_unmaximize (window, META_MAXIMIZE_BOTH);
return;
}
@@ -8028,9 +8019,7 @@ update_move (MetaWindow *window,
window->user_rect.x = window->saved_rect.x;
window->user_rect.y = window->saved_rect.y;
- meta_window_unmaximize (window,
- META_MAXIMIZE_HORIZONTAL |
- META_MAXIMIZE_VERTICAL);
+ meta_window_unmaximize (window, META_MAXIMIZE_BOTH);
}
display->grab_initial_window_pos = work_area;
@@ -8038,10 +8027,7 @@ update_move (MetaWindow *window,
display->grab_anchor_root_y = y;
window->shaken_loose = FALSE;
- meta_window_maximize (window,
- META_MAXIMIZE_HORIZONTAL |
- META_MAXIMIZE_VERTICAL);
-
+ meta_window_maximize (window, META_MAXIMIZE_BOTH);
return;
}
}
diff --git a/src/meta/window.h b/src/meta/window.h
index 430dc6b..d8871c5 100644
--- a/src/meta/window.h
+++ b/src/meta/window.h
@@ -72,11 +72,13 @@ typedef enum
* MetaMaximizeFlags:
* @META_MAXIMIZE_HORIZONTAL: Horizontal
* @META_MAXIMIZE_VERTICAL: Vertical
+ * @META_MAXIMIZE_BOTH: Both
*/
typedef enum
{
META_MAXIMIZE_HORIZONTAL = 1 << 0,
- META_MAXIMIZE_VERTICAL = 1 << 1
+ META_MAXIMIZE_VERTICAL = 1 << 1,
+ META_MAXIMIZE_BOTH = (1 << 0 | 1 << 1),
} MetaMaximizeFlags;
/**
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index 86f3dd8..940c32f 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -857,9 +857,9 @@ xdg_surface_request_change_state (struct wl_client *client,
{
case XDG_SURFACE_STATE_MAXIMIZED:
if (value)
- meta_window_maximize (surface->window, META_MAXIMIZE_HORIZONTAL | META_MAXIMIZE_VERTICAL);
+ meta_window_maximize (surface->window, META_MAXIMIZE_BOTH);
else
- meta_window_unmaximize (surface->window, META_MAXIMIZE_HORIZONTAL | META_MAXIMIZE_VERTICAL);
+ meta_window_unmaximize (surface->window, META_MAXIMIZE_BOTH);
break;
case XDG_SURFACE_STATE_FULLSCREEN:
if (value)
@@ -1153,9 +1153,9 @@ wl_shell_surface_set_state (MetaWaylandSurface *surface,
meta_window_unmake_fullscreen (surface->window);
if (state == SURFACE_STATE_MAXIMIZED)
- meta_window_maximize (surface->window, META_MAXIMIZE_VERTICAL | META_MAXIMIZE_HORIZONTAL);
+ meta_window_maximize (surface->window, META_MAXIMIZE_BOTH);
else
- meta_window_unmaximize (surface->window, META_MAXIMIZE_VERTICAL | META_MAXIMIZE_HORIZONTAL);
+ meta_window_unmaximize (surface->window, META_MAXIMIZE_BOTH);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]