summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/constraints.c65
-rw-r--r--src/core/core.c30
-rw-r--r--src/core/prefs.c16
-rw-r--r--src/core/screen-private.h5
-rw-r--r--src/core/screen.c66
-rw-r--r--src/core/window-private.h19
-rw-r--r--src/core/window.c181
7 files changed, 354 insertions, 28 deletions
diff --git a/src/core/constraints.c b/src/core/constraints.c
index 5a3ef438..1b2b70ab 100644
--- a/src/core/constraints.c
+++ b/src/core/constraints.c
@@ -98,6 +98,7 @@ typedef enum
PRIORITY_ENTIRELY_VISIBLE_ON_WORKAREA = 1,
PRIORITY_SIZE_HINTS_INCREMENTS = 1,
PRIORITY_MAXIMIZATION = 2,
+ PRIORITY_TILING = 2,
PRIORITY_FULLSCREEN = 2,
PRIORITY_SIZE_HINTS_LIMITS = 3,
PRIORITY_TITLEBAR_VISIBLE = 4,
@@ -145,6 +146,10 @@ static gboolean constrain_maximization (MetaWindow *window,
ConstraintInfo *info,
ConstraintPriority priority,
gboolean check_only);
+static gboolean constrain_tiling (MetaWindow *window,
+ ConstraintInfo *info,
+ ConstraintPriority priority,
+ gboolean check_only);
static gboolean constrain_fullscreen (MetaWindow *window,
ConstraintInfo *info,
ConstraintPriority priority,
@@ -211,6 +216,7 @@ typedef struct {
static const Constraint all_constraints[] = {
{constrain_maximization, "constrain_maximization"},
+ {constrain_tiling, "constrain_tiling"},
{constrain_fullscreen, "constrain_fullscreen"},
{constrain_size_increments, "constrain_size_increments"},
{constrain_size_limits, "constrain_size_limits"},
@@ -737,7 +743,8 @@ constrain_maximization (MetaWindow *window,
return TRUE;
/* Determine whether constraint applies; exit if it doesn't */
- if (!window->maximized_horizontally && !window->maximized_vertically)
+ if ((!window->maximized_horizontally && !window->maximized_vertically) ||
+ META_WINDOW_TILED (window))
return TRUE;
/* Calculate target_size = maximized size of (window + frame) */
@@ -806,6 +813,58 @@ constrain_maximization (MetaWindow *window,
}
static gboolean
+constrain_tiling (MetaWindow *window,
+ ConstraintInfo *info,
+ ConstraintPriority priority,
+ gboolean check_only)
+{
+ MetaRectangle target_size;
+ MetaRectangle min_size, max_size;
+ gboolean hminbad, vminbad;
+ gboolean horiz_equal, vert_equal;
+ gboolean constraint_already_satisfied;
+
+ if (priority > PRIORITY_TILING)
+ return TRUE;
+
+ /* Determine whether constraint applies; exit if it doesn't */
+ if (!META_WINDOW_TILED (window))
+ return TRUE;
+
+ /* Calculate target_size - as the tile previews need this as well, we
+ * use an external function for the actual calculation
+ */
+ meta_window_get_current_tile_area (window, &target_size);
+ unextend_by_frame (&target_size, info->fgeom);
+
+ /* Check min size constraints; max size constraints are ignored as for
+ * maximized windows.
+ */
+ get_size_limits (window, info->fgeom, FALSE, &min_size, &max_size);
+ hminbad = target_size.width < min_size.width;
+ vminbad = target_size.height < min_size.height;
+ if (hminbad || vminbad)
+ return TRUE;
+
+ /* Determine whether constraint is already satisfied; exit if it is */
+ horiz_equal = target_size.x == info->current.x &&
+ target_size.width == info->current.width;
+ vert_equal = target_size.y == info->current.y &&
+ target_size.height == info->current.height;
+ constraint_already_satisfied = horiz_equal && vert_equal;
+ if (check_only || constraint_already_satisfied)
+ return constraint_already_satisfied;
+
+ /*** Enforce constraint ***/
+ info->current.x = target_size.x;
+ info->current.width = target_size.width;
+ info->current.y = target_size.y;
+ info->current.height = target_size.height;
+
+ return TRUE;
+}
+
+static gboolean
constrain_fullscreen (MetaWindow *window,
ConstraintInfo *info,
ConstraintPriority priority,
@@ -856,7 +915,7 @@ constrain_size_increments (MetaWindow *window,
/* Determine whether constraint applies; exit if it doesn't */
if (META_WINDOW_MAXIMIZED (window) || window->fullscreen ||
- info->action_type == ACTION_MOVE)
+ META_WINDOW_TILED (window) || info->action_type == ACTION_MOVE)
return TRUE;
/* Determine whether constraint is already satisfied; exit if it is */
@@ -987,7 +1046,7 @@ constrain_aspect_ratio (MetaWindow *window,
constraints_are_inconsistent = minr > maxr;
if (constraints_are_inconsistent ||
META_WINDOW_MAXIMIZED (window) || window->fullscreen ||
- info->action_type == ACTION_MOVE)
+ META_WINDOW_TILED (window) || info->action_type == ACTION_MOVE)
return TRUE;
/* Determine whether constraint is already satisfied; exit if it is. We
diff --git a/src/core/core.c b/src/core/core.c
index 76e5548b..c8fa02b7 100644
--- a/src/core/core.c
+++ b/src/core/core.c
@@ -28,6 +28,7 @@
#include "frame-private.h"
#include "workspace.h"
#include "prefs.h"
+#include "errors.h"
/* Looks up the MetaWindow representing the frame of the given X window.
* Used as a helper function by a bunch of the functions below.
@@ -297,6 +298,35 @@ meta_core_user_lower_and_unfocus (Display *xdisplay,
}
void
+meta_core_lower_beneath_focus_window (Display *xdisplay,
+ Window xwindow,
+ guint32 timestamp)
+{
+ XWindowChanges changes;
+ MetaDisplay *display;
+ MetaScreen *screen;
+ MetaWindow *focus_window;
+
+ display = meta_display_for_x_display (xdisplay);
+ screen = meta_display_screen_for_xwindow (display, xwindow);
+ focus_window = meta_stack_get_top (screen->stack);
+
+ if (focus_window == NULL)
+ return;
+
+ changes.stack_mode = Below;
+ changes.sibling = focus_window->frame ? focus_window->frame->xwindow
+ : focus_window->xwindow;
+
+ meta_error_trap_push (display);
+ XConfigureWindow (xdisplay,
+ xwindow,
+ CWSibling | CWStackMode,
+ &changes);
+ meta_error_trap_pop (display, FALSE);
+}
+
+void
meta_core_user_focus (Display *xdisplay,
Window frame_xwindow,
guint32 timestamp)
diff --git a/src/core/prefs.c b/src/core/prefs.c
index 116a9bb8..5f46b554 100644
--- a/src/core/prefs.c
+++ b/src/core/prefs.c
@@ -117,6 +117,7 @@ static gboolean compositing_fast_alt_tab = FALSE;
static gboolean resize_with_right_button = FALSE;
static gboolean center_new_windows = FALSE;
static gboolean force_fullscreen = TRUE;
+static gboolean side_by_side_tiling = FALSE;
static MetaVisualBellType visual_bell_type = META_VISUAL_BELL_FULLSCREEN_FLASH;
static MetaButtonLayout button_layout;
@@ -401,6 +402,12 @@ static MetaBoolPreference preferences_bool[] =
&center_new_windows,
FALSE,
},
+ { "side-by-side-tiling",
+ KEY_GENERAL_SCHEMA,
+ META_PREF_SIDE_BY_SIDE_TILING,
+ &side_by_side_tiling,
+ FALSE,
+ },
{ NULL, NULL, 0, NULL, FALSE },
};
@@ -1545,6 +1552,9 @@ meta_preference_to_string (MetaPreference pref)
case META_PREF_FORCE_FULLSCREEN:
return "FORCE_FULLSCREEN";
+
+ case META_PREF_SIDE_BY_SIDE_TILING:
+ return "SIDE_BY_SIDE_TILING";
}
return "(unknown)";
@@ -2202,6 +2212,12 @@ meta_prefs_get_center_new_windows (void)
return center_new_windows;
}
+gboolean
+meta_prefs_get_side_by_side_tiling ()
+{
+ return side_by_side_tiling;
+}
+
guint
meta_prefs_get_mouse_button_resize (void)
{
diff --git a/src/core/screen-private.h b/src/core/screen-private.h
index 77ea457f..8eb02d00 100644
--- a/src/core/screen-private.h
+++ b/src/core/screen-private.h
@@ -79,6 +79,9 @@ struct _MetaScreen
MetaRectangle rect; /* Size of screen; rect.x & rect.y are always 0 */
MetaUI *ui;
MetaTabPopup *tab_popup;
+ MetaTilePreview *tile_preview;
+
+ guint tile_preview_timeout_id;
MetaWorkspace *active_workspace;
@@ -160,6 +163,8 @@ void meta_screen_ensure_tab_popup (MetaScreen *scree
MetaTabList list_type,
MetaTabShowType show_type);
void meta_screen_ensure_workspace_popup (MetaScreen *screen);
+void meta_screen_tile_preview_update (MetaScreen *screen,
+ gboolean delay);
MetaWindow* meta_screen_get_mouse_window (MetaScreen *screen,
MetaWindow *not_this_one);
diff --git a/src/core/screen.c b/src/core/screen.c
index a35447ad..f52f382c 100644
--- a/src/core/screen.c
+++ b/src/core/screen.c
@@ -582,7 +582,10 @@ meta_screen_new (MetaDisplay *display,
screen->xscreen);
screen->tab_popup = NULL;
-
+ screen->tile_preview = NULL;
+
+ screen->tile_preview_timeout_id = 0;
+
screen->stack = meta_stack_new (screen);
meta_prefs_add_listener (prefs_changed_callback, screen);
@@ -691,7 +694,13 @@ meta_screen_free (MetaScreen *screen,
if (screen->xinerama_infos)
g_free (screen->xinerama_infos);
-
+
+ if (screen->tile_preview_timeout_id)
+ g_source_remove (screen->tile_preview_timeout_id);
+
+ if (screen->tile_preview)
+ meta_tile_preview_free (screen->tile_preview);
+
g_free (screen->screen_name);
g_free (screen);
@@ -1460,6 +1469,59 @@ meta_screen_ensure_workspace_popup (MetaScreen *screen)
/* don't show tab popup, since proper space isn't selected yet */
}
+static gboolean
+meta_screen_tile_preview_update_timeout (gpointer data)
+{
+ MetaScreen *screen = data;
+ MetaWindow *window = screen->display->grab_window;
+ gboolean composited = screen->display->compositor != NULL;
+
+ screen->tile_preview_timeout_id = 0;
+
+ if (!screen->tile_preview)
+ screen->tile_preview = meta_tile_preview_new (screen->number,
+ composited);
+
+ if (window
+ && !META_WINDOW_TILED (window)
+ && window->tile_mode != META_TILE_NONE)
+ {
+ MetaRectangle tile_rect;
+
+ meta_window_get_current_tile_area (window, &tile_rect);
+ meta_tile_preview_show (screen->tile_preview, &tile_rect);
+ }
+ else
+ meta_tile_preview_hide (screen->tile_preview);
+
+ return FALSE;
+}
+
+#define TILE_PREVIEW_TIMEOUT_MS 200
+
+void
+meta_screen_tile_preview_update (MetaScreen *screen,
+ gboolean delay)
+{
+ if (delay)
+ {
+ if (screen->tile_preview_timeout_id > 0)
+ return;
+
+ screen->tile_preview_timeout_id =
+ g_timeout_add (TILE_PREVIEW_TIMEOUT_MS,
+ meta_screen_tile_preview_update_timeout,
+ screen);
+ }
+ else
+ {
+ if (screen->tile_preview_timeout_id > 0)
+ g_source_remove (screen->tile_preview_timeout_id);
+
+ meta_screen_tile_preview_update_timeout ((gpointer)screen);
+ }
+}
+
MetaWindow*
meta_screen_get_mouse_window (MetaScreen *screen,
MetaWindow *not_this_one)
diff --git a/src/core/window-private.h b/src/core/window-private.h
index 447a2c4b..f88f8a4d 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -83,6 +83,13 @@ typedef enum {
#define NUMBER_OF_QUEUES 3
+typedef enum {
+ META_TILE_NONE,
+ META_TILE_LEFT,
+ META_TILE_RIGHT,
+ META_TILE_MAXIMIZE
+} MetaTileMode;
+
struct _MetaWindow
{
MetaDisplay *display;
@@ -138,6 +145,11 @@ struct _MetaWindow
guint maximize_vertically_after_placement : 1;
guint minimize_after_placement : 1;
+ /* The current or requested tile mode. If maximized_vertically is true,
+ * this is the current mode. If not, it is the mode which will be
+ * requested after the window grab is released */
+ guint tile_mode : 2;
+
/* Whether we're shaded */
guint shaded : 1;
@@ -383,8 +395,11 @@ struct _MetaWindow
(w)->maximized_vertically)
#define META_WINDOW_MAXIMIZED_VERTICALLY(w) ((w)->maximized_vertically)
#define META_WINDOW_MAXIMIZED_HORIZONTALLY(w) ((w)->maximized_horizontally)
+#define META_WINDOW_TILED(w) ((w)->maximized_vertically && \
+ !(w)->maximized_horizontally && \
+ (w)->tile_mode != META_TILE_NONE)
#define META_WINDOW_ALLOWS_MOVE(w) ((w)->has_move_func && !(w)->fullscreen)
-#define META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS(w) ((w)->has_resize_func && !META_WINDOW_MAXIMIZED (w) && !(w)->fullscreen && !(w)->shaded)
+#define META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS(w) ((w)->has_resize_func && !META_WINDOW_MAXIMIZED (w) && !META_WINDOW_TILED(w) && !(w)->fullscreen && !(w)->shaded)
#define META_WINDOW_ALLOWS_RESIZE(w) (META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS (w) && \
(((w)->size_hints.min_width < (w)->size_hints.max_width) || \
((w)->size_hints.min_height < (w)->size_hints.max_height)))
@@ -575,6 +590,8 @@ void meta_window_get_work_area_for_xinerama (MetaWindow *window,
void meta_window_get_work_area_all_xineramas (MetaWindow *window,
MetaRectangle *area);
+void meta_window_get_current_tile_area (MetaWindow *window,
+ MetaRectangle *tile_area);
gboolean meta_window_same_application (MetaWindow *window,
MetaWindow *other_window);
diff --git a/src/core/window.c b/src/core/window.c
index d997bae7..cd54e5b9 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -470,6 +470,7 @@ meta_window_new_with_attrs (MetaDisplay *display,
window->require_on_single_xinerama = TRUE;
window->require_titlebar_visible = TRUE;
window->on_all_workspaces = FALSE;
+ window->tile_mode = META_TILE_NONE;
window->shaded = FALSE;
window->initially_iconic = FALSE;
window->minimized = FALSE;
@@ -2489,7 +2490,7 @@ ensure_size_hints_satisfied (MetaRectangle *rect,
static void
meta_window_save_rect (MetaWindow *window)
{
- if (!(META_WINDOW_MAXIMIZED (window) || window->fullscreen))
+ if (!(META_WINDOW_MAXIMIZED (window) || META_WINDOW_TILED (window) || window->fullscreen))
{
/* save size/pos as appropriate args for move_resize */
if (!window->maximized_horizontally)
@@ -2531,7 +2532,7 @@ force_save_user_window_placement (MetaWindow *window)
static void
save_user_window_placement (MetaWindow *window)
{
- if (!(META_WINDOW_MAXIMIZED (window) || window->fullscreen))
+ if (!(META_WINDOW_MAXIMIZED (window) || META_WINDOW_TILED (window) || window->fullscreen))
{
MetaRectangle user_rect;
@@ -2596,6 +2597,7 @@ void
meta_window_maximize (MetaWindow *window,
MetaMaximizeFlags directions)
{
+ MetaRectangle *saved_rect = NULL;
/* At least one of the two directions ought to be set */
gboolean maximize_horizontally, maximize_vertically;
maximize_horizontally = directions & META_MAXIMIZE_HORIZONTAL;
@@ -2631,9 +2633,16 @@ meta_window_maximize (MetaWindow *window,
return;
}
+ if (window->tile_mode != META_TILE_NONE)
+ {
+ saved_rect = &window->saved_rect;
+
+ window->maximized_vertically = FALSE;
+ }
+
meta_window_maximize_internal (window,
directions,
- NULL);
+ saved_rect);
/* move_resize with new maximization constraints
*/
@@ -2673,12 +2682,64 @@ unmaximize_window_before_freeing (MetaWindow *window)
}
}
+static void
+meta_window_tile (MetaWindow *window)
+{
+ /* Don't do anything if no tiling is requested */
+ if (window->tile_mode == META_TILE_NONE)
+ return;
+
+ meta_window_maximize_internal (window, META_MAXIMIZE_VERTICAL, NULL);
+ meta_screen_tile_preview_update (window->screen, FALSE);
+
+ /* move_resize with new tiling constraints
+ */
+ meta_window_queue (window, META_QUEUE_MOVE_RESIZE);
+}
+
+static gboolean
+meta_window_can_tile (MetaWindow *window)
+{
+ const MetaXineramaScreenInfo *monitor;
+ MetaRectangle tile_area;
+
+ if (!META_WINDOW_ALLOWS_RESIZE (window))
+ return FALSE;
+
+ monitor = meta_screen_get_current_xinerama (window->screen);
+ meta_window_get_work_area_for_xinerama (window, monitor->number, &tile_area);
+
+ tile_area.width /= 2;
+
+ if (window->frame)
+ {
+ MetaFrameGeometry fgeom;
+
+ meta_frame_calc_geometry (window->frame, &fgeom);
+
+ tile_area.width -= (fgeom.left_width + fgeom.right_width);
+ tile_area.height -= (fgeom.top_height + fgeom.bottom_height);
+ }
+
+ return tile_area.width >= window->size_hints.min_width &&
+ tile_area.height >= window->size_hints.min_height;
+}
+
void
meta_window_unmaximize (MetaWindow *window,
MetaMaximizeFlags directions)
{
/* At least one of the two directions ought to be set */
gboolean unmaximize_horizontally, unmaximize_vertically;
+
+ /* Restore tiling if necessary */
+ if (window->tile_mode != META_TILE_NONE)
+ {
+ window->maximized_horizontally = FALSE;
+ meta_window_tile (window);
+ return;
+ }
+
unmaximize_horizontally = directions & META_MAXIMIZE_HORIZONTAL;
unmaximize_vertically = directions & META_MAXIMIZE_VERTICAL;
g_assert (unmaximize_horizontally || unmaximize_vertically);
@@ -2723,17 +2784,6 @@ meta_window_unmaximize (MetaWindow *window,
*/
ensure_size_hints_satisfied (&target_rect, &window->size_hints);
- /* When we unmaximize, if we're doing a mouse move also we could
- * get the window suddenly jumping to the upper left corner of
- * the workspace, since that's where it was when the grab op
- * started. So we need to update the grab state.
- */
- if (meta_grab_op_is_moving (window->display->grab_op) &&
- window->display->grab_window == window)
- {
- window->display->grab_anchor_window_pos = target_rect;
- }
-
meta_window_move_resize (window,
FALSE,
target_rect.x,
@@ -2745,6 +2795,19 @@ meta_window_unmaximize (MetaWindow *window,
*/
force_save_user_window_placement (window);
+ /* When we unmaximize, if we're doing a mouse move also we could
+ * get the window suddenly jumping to the upper left corner of
+ * the workspace, since that's where it was when the grab op
+ * started. So we need to update the grab state. We have to do
+ * it after the actual operation, as the window may have been moved
+ * by constraints.
+ */
+ if (meta_grab_op_is_moving (window->display->grab_op) &&
+ window->display->grab_window == window)
+ {
+ window->display->grab_anchor_window_pos = window->user_rect;
+ }
+
if (window->display->grab_wireframe_active)
{
window->display->grab_wireframe_rect = target_rect;
@@ -6898,20 +6961,60 @@ update_move (MetaWindow *window,
if (dx == 0 && dy == 0)
return;
- /* shake loose (unmaximize) maximized window if dragged beyond the threshold
- * in the Y direction. You can't pull a window loose via X motion.
+ /* Originally for detaching maximized windows, but we use this
+ * for the zones at the sides of the monitor where trigger tiling
+ * because it's about the right size
*/
-#define DRAG_THRESHOLD_TO_SHAKE_THRESHOLD_FACTOR 6
+#define DRAG_THRESHOLD_TO_SHAKE_THRESHOLD_FACTOR 2
shake_threshold = meta_ui_get_drag_threshold (window->screen->ui) *
DRAG_THRESHOLD_TO_SHAKE_THRESHOLD_FACTOR;
- if (META_WINDOW_MAXIMIZED (window) && ABS (dy) >= shake_threshold)
+
+ if (meta_prefs_get_side_by_side_tiling () &&
+ meta_window_can_tile (window))
+ {
+ const MetaXineramaScreenInfo *monitor;
+ MetaRectangle work_area;
+
+ /* For tiling we are interested in the work area of the monitor where
+ * the pointer is located.
+ * Also see comment in meta_window_get_current_tile_area()
+ */
+ monitor = meta_screen_get_current_xinerama (window->screen);
+ meta_window_get_work_area_for_xinerama (window,
+ monitor->number,
+ &work_area);
+
+ if (y >= monitor->rect.y &&
+ y < (monitor->rect.y + monitor->rect.height))
+ {
+ /* check if cursor is near an edge of the work area */
+ if (x >= monitor->rect.x && x < (work_area.x + shake_threshold))
+ window->tile_mode = META_TILE_LEFT;
+ else if (x >= work_area.x + work_area.width - shake_threshold &&
+ x < (monitor->rect.x + monitor->rect.width))
+ window->tile_mode = META_TILE_RIGHT;
+ else if ((y >= monitor->rect.y) && (y < work_area.y + shake_threshold))
+ window->tile_mode = META_TILE_MAXIMIZE;
+ else
+ window->tile_mode = META_TILE_NONE;
+ }
+ }
+
+ /* shake loose (unmaximize) maximized or tiled window if dragged beyond
+ * the threshold in the Y direction. Tiled windows can also be pulled
+ * loose via X motion.
+ */
+
+ if ((META_WINDOW_MAXIMIZED (window) && ABS (dy) >= shake_threshold) ||
+ (META_WINDOW_TILED (window) && (MAX (ABS (dx), ABS (dy)) >= shake_threshold)))
{
double prop;
/* Shake loose */
- window->shaken_loose = TRUE;
+ window->shaken_loose = META_WINDOW_MAXIMIZED (window);
+ window->tile_mode = META_TILE_NONE;
/* move the unmaximized window to the cursor */
prop =
@@ -6995,13 +7098,20 @@ update_move (MetaWindow *window,
}
}
+ /* Delay showing the tile preview slightly to make it more unlikely to
+ * trigger it unwittingly, e.g. when shaking loose the window or moving
+ * it to another monitor.
+ */
+ meta_screen_tile_preview_update (window->screen,
+ window->tile_mode != META_TILE_NONE);
+
if (display->grab_wireframe_active)
old = display->grab_wireframe_rect;
else
meta_window_get_client_root_coords (window, &old);
- /* Don't allow movement in the maximized directions */
- if (window->maximized_horizontally)
+ /* Don't allow movement in the maximized directions or while tiled */
+ if (window->maximized_horizontally || META_WINDOW_TILED (window))
new_x = old.x;
if (window->maximized_vertically)
new_y = old.y;
@@ -7417,7 +7527,11 @@ meta_window_handle_mouse_grab_op_event (MetaWindow *window,
{
if (meta_grab_op_is_moving (window->display->grab_op))
{
- if (event->xbutton.root == window->screen->xroot)
+ if (window->tile_mode != META_TILE_NONE)
+ meta_window_tile (window);
+ else if (window->tile_mode == META_TILE_MAXIMIZE)
+ meta_window_maximize (window, META_MAXIMIZE_HORIZONTAL | META_MAXIMIZE_VERTICAL);
+ else if (event->xbutton.root == window->screen->xroot)
update_move (window, event->xbutton.state & ShiftMask,
event->xbutton.x_root, event->xbutton.y_root);
}
@@ -7575,6 +7689,29 @@ meta_window_get_work_area_all_xineramas (MetaWindow *window,
window->desc, area->x, area->y, area->width, area->height);
}
+void
+meta_window_get_current_tile_area (MetaWindow *window,
+ MetaRectangle *tile_area)
+{
+ const MetaXineramaScreenInfo *monitor;
+
+ g_return_if_fail (window->tile_mode != META_TILE_NONE);
+
+ /* The definition of "current" of meta_window_get_work_area_current_xinerama()
+ * and meta_screen_get_current_xinerama() is slightly different: the former
+ * refers to the monitor which contains the largest part of the window, the
+ * latter to the one where the pointer is located.
+ */
+ monitor = meta_screen_get_current_xinerama (window->screen);
+ meta_window_get_work_area_for_xinerama (window, monitor->number, tile_area);
+
+ if (window->tile_mode == META_TILE_LEFT ||
+ window->tile_mode == META_TILE_RIGHT)
+ tile_area->width /= 2;
+
+ if (window->tile_mode == META_TILE_RIGHT)
+ tile_area->x += tile_area->width;
+}
gboolean
meta_window_same_application (MetaWindow *window,