summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2019-04-12 07:58:30 -0400
committerVictor Kareh <[email protected]>2019-06-05 10:49:37 -0400
commitc66b32666e48996b97e691ed002f86b6ff18dec5 (patch)
tree3e5d1b07331ab708cac920fcfe62e504aa2481ad /src/core
parent707eb409e7dfeec276f6dfa3e667a0140b3300aa (diff)
downloadmarco-c66b32666e48996b97e691ed002f86b6ff18dec5.tar.bz2
marco-c66b32666e48996b97e691ed002f86b6ff18dec5.tar.xz
Replace public MetaFrameGeometry with MetaFrameBorders
There were actually *two* MetaFrameGeometry structs: one in theme-private.h, one in frame.h. The latter public struct was populated by a mix of (void*) casting and int pointers, usually pulling directly from the data in the private struct. Remove the public struct, replace it with MetaFrameBorders and scrap all the pointer hacks to populate it, instead relying on both structs being used in common code. This commit should be relatively straightforward, and it should not do any tricky logic at all, just a sophisticated find and replace. https://bugzilla.gnome.org/show_bug.cgi?id=644930 upstream commit: https://gitlab.gnome.org/GNOME/metacity/commit/72224a165 NOTE: Patch copied from metacity and adapted for marco.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/constraints.c105
-rw-r--r--src/core/constraints.h2
-rw-r--r--src/core/display.c21
-rw-r--r--src/core/frame-private.h29
-rw-r--r--src/core/frame.c20
-rw-r--r--src/core/place.c136
-rw-r--r--src/core/place.h12
-rw-r--r--src/core/window.c69
8 files changed, 181 insertions, 213 deletions
diff --git a/src/core/constraints.c b/src/core/constraints.c
index 2c56c780..1eaed498 100644
--- a/src/core/constraints.c
+++ b/src/core/constraints.c
@@ -117,7 +117,7 @@ typedef struct
{
MetaRectangle orig;
MetaRectangle current;
- MetaFrameGeometry *fgeom;
+ MetaFrameBorders *borders;
ActionType action_type;
gboolean is_user_action;
@@ -189,7 +189,7 @@ static gboolean constrain_partially_onscreen (MetaWindow *window,
static void setup_constraint_info (ConstraintInfo *info,
MetaWindow *window,
- MetaFrameGeometry *orig_fgeom,
+ MetaFrameBorders *orig_borders,
MetaMoveResizeFlags flags,
int resize_gravity,
const MetaRectangle *orig,
@@ -200,12 +200,12 @@ static void update_onscreen_requirements (MetaWindow *window,
ConstraintInfo *info);
static void extend_by_frame (MetaWindow *window,
MetaRectangle *rect,
- const MetaFrameGeometry *fgeom);
+ const MetaFrameBorders *borders);
static void unextend_by_frame (MetaWindow *window,
MetaRectangle *rect,
- const MetaFrameGeometry *fgeom);
+ const MetaFrameBorders *borders);
static inline void get_size_limits (const MetaWindow *window,
- const MetaFrameGeometry *fgeom,
+ const MetaFrameBorders *borders,
gboolean include_frame,
MetaRectangle *min_size,
MetaRectangle *max_size);
@@ -281,7 +281,7 @@ do_all_constraints (MetaWindow *window,
void
meta_window_constrain (MetaWindow *window,
- MetaFrameGeometry *orig_fgeom,
+ MetaFrameBorders *orig_borders,
MetaMoveResizeFlags flags,
int resize_gravity,
const MetaRectangle *orig,
@@ -304,7 +304,7 @@ meta_window_constrain (MetaWindow *window,
setup_constraint_info (&info,
window,
- orig_fgeom,
+ orig_borders,
flags,
resize_gravity,
orig,
@@ -339,14 +339,14 @@ meta_window_constrain (MetaWindow *window,
* not gobject-style--gobject would be more pain than it's worth) or
* smart pointers would be so much nicer here. *shrug*
*/
- if (!orig_fgeom)
- g_free (info.fgeom);
+ if (!orig_borders)
+ g_free (info.borders);
}
static void
setup_constraint_info (ConstraintInfo *info,
MetaWindow *window,
- MetaFrameGeometry *orig_fgeom,
+ MetaFrameBorders *orig_borders,
MetaMoveResizeFlags flags,
int resize_gravity,
const MetaRectangle *orig,
@@ -359,10 +359,10 @@ setup_constraint_info (ConstraintInfo *info,
info->current = *new;
/* Create a fake frame geometry if none really exists */
- if (orig_fgeom && !window->fullscreen)
- info->fgeom = orig_fgeom;
+ if (orig_borders && !window->fullscreen)
+ info->borders = orig_borders;
else
- info->fgeom = g_new0 (MetaFrameGeometry, 1);
+ info->borders = g_new0 (MetaFrameBorders, 1);
if (flags & META_IS_MOVE_ACTION && flags & META_IS_RESIZE_ACTION)
info->action_type = ACTION_MOVE_AND_RESIZE;
@@ -469,7 +469,6 @@ setup_constraint_info (ConstraintInfo *info,
"Setting up constraint info:\n"
" orig: %d,%d +%d,%d\n"
" new : %d,%d +%d,%d\n"
- " fgeom: %d,%d,%d,%d\n"
" action_type : %s\n"
" is_user_action : %s\n"
" resize_gravity : %s\n"
@@ -479,8 +478,6 @@ setup_constraint_info (ConstraintInfo *info,
info->orig.x, info->orig.y, info->orig.width, info->orig.height,
info->current.x, info->current.y,
info->current.width, info->current.height,
- info->fgeom->left_width, info->fgeom->right_width,
- info->fgeom->top_height, info->fgeom->bottom_height,
(info->action_type == ACTION_MOVE) ? "Move" :
(info->action_type == ACTION_RESIZE) ? "Resize" :
(info->action_type == ACTION_MOVE_AND_RESIZE) ? "Move&Resize" :
@@ -521,7 +518,7 @@ place_window_if_needed(MetaWindow *window,
MetaWorkspace *cur_workspace;
const MetaXineramaScreenInfo *xinerama_info;
- meta_window_place (window, info->fgeom, info->orig.x, info->orig.y,
+ meta_window_place (window, info->borders, info->orig.x, info->orig.y,
&placed_rect.x, &placed_rect.y);
did_placement = TRUE;
@@ -581,7 +578,7 @@ place_window_if_needed(MetaWindow *window,
/* maximization may have changed frame geometry */
if (window->frame && !window->fullscreen)
- meta_frame_calc_geometry (window->frame, info->fgeom);
+ meta_frame_calc_borders (window->frame, info->borders);
if (window->fullscreen_after_placement)
{
@@ -639,7 +636,7 @@ update_onscreen_requirements (MetaWindow *window,
/* The require onscreen/on-single-xinerama and titlebar_visible
* stuff is relative to the outer window, not the inner
*/
- extend_by_frame (window, &info->current, info->fgeom);
+ extend_by_frame (window, &info->current, info->borders);
/* Update whether we want future constraint runs to require the
* window to be on fully onscreen.
@@ -675,7 +672,7 @@ update_onscreen_requirements (MetaWindow *window,
MetaRectangle titlebar_rect;
titlebar_rect = info->current;
- titlebar_rect.height = info->fgeom->top_height;
+ titlebar_rect.height = info->borders->visible.top;
old = window->require_titlebar_visible;
window->require_titlebar_visible =
meta_rectangle_overlaps_with_region (info->usable_screen_region,
@@ -688,20 +685,20 @@ update_onscreen_requirements (MetaWindow *window,
}
/* Don't forget to restore the position of the window */
- unextend_by_frame (window, &info->current, info->fgeom);
+ unextend_by_frame (window, &info->current, info->borders);
}
static void
extend_by_frame (MetaWindow *window,
MetaRectangle *rect,
- const MetaFrameGeometry *fgeom)
+ const MetaFrameBorders *borders)
{
if (window->frame)
{
- rect->x -= fgeom->left_width;
- rect->y -= fgeom->top_height;
- rect->width += fgeom->left_width + fgeom->right_width;
- rect->height += fgeom->top_height + fgeom->bottom_height;
+ rect->x -= borders->visible.left;
+ rect->y -= borders->visible.top;
+ rect->width += borders->visible.left + borders->visible.right;
+ rect->height += borders->visible.top + borders->visible.bottom;
}
else
{
@@ -715,14 +712,14 @@ extend_by_frame (MetaWindow *window,
static void
unextend_by_frame (MetaWindow *window,
MetaRectangle *rect,
- const MetaFrameGeometry *fgeom)
+ const MetaFrameBorders *borders)
{
if (window->frame)
{
- rect->x += fgeom->left_width;
- rect->y += fgeom->top_height;
- rect->width -= fgeom->left_width + fgeom->right_width;
- rect->height -= fgeom->top_height + fgeom->bottom_height;
+ rect->x += borders->visible.left;
+ rect->y += borders->visible.top;
+ rect->width -= borders->visible.left + borders->visible.right;
+ rect->height -= borders->visible.top + borders->visible.bottom;
}
else
{
@@ -735,7 +732,7 @@ unextend_by_frame (MetaWindow *window,
static inline void
get_size_limits (const MetaWindow *window,
- const MetaFrameGeometry *fgeom,
+ const MetaFrameBorders *borders,
gboolean include_frame,
MetaRectangle *min_size,
MetaRectangle *max_size)
@@ -755,8 +752,8 @@ get_size_limits (const MetaWindow *window,
if (window->frame)
{
- fw = fgeom->left_width + fgeom->right_width;
- fh = fgeom->top_height + fgeom->bottom_height;
+ fw = borders->visible.left + borders->visible.right;
+ fh = borders->visible.top + borders->visible.bottom;
min_size->width += fw;
min_size->height += fh;
@@ -807,18 +804,18 @@ constrain_modal_dialog (MetaWindow *window,
y = 0;
if (parent->frame)
{
- MetaFrameGeometry fgeom;
+ MetaFrameBorders borders;
x += parent->frame->rect.x;
y += parent->frame->rect.y;
- meta_frame_calc_geometry (parent->frame, &fgeom);
- y += fgeom.top_height;
+ meta_frame_calc_borders (parent->frame, &borders);
+ y += borders.visible.top;
- y += info->fgeom->top_height;
+ y += info->borders->visible.top;
}
else
- y = parent->rect.y + info->fgeom->top_height;
+ y = parent->rect.y + info->borders->visible.top;
constraint_already_satisfied = (x == info->current.x) && (y == info->current.y);
@@ -874,19 +871,19 @@ constrain_maximization (MetaWindow *window,
active_workspace_struts = window->screen->active_workspace->all_struts;
target_size = info->current;
- extend_by_frame (window, &target_size, info->fgeom);
+ extend_by_frame (window, &target_size, info->borders);
meta_rectangle_expand_to_avoiding_struts (&target_size,
&info->entire_xinerama,
direction,
active_workspace_struts);
}
/* Now make target_size = maximized size of client window */
- unextend_by_frame (window, &target_size, info->fgeom);
+ unextend_by_frame (window, &target_size, info->borders);
/* Check min size constraints; max size constraints are ignored for maximized
* windows, as per bug 327543.
*/
- get_size_limits (window, info->fgeom, FALSE, &min_size, &max_size);
+ get_size_limits (window, info->borders, FALSE, &min_size, &max_size);
hminbad = target_size.width < min_size.width && window->maximized_horizontally;
vminbad = target_size.height < min_size.height && window->maximized_vertically;
if (hminbad || vminbad)
@@ -942,12 +939,12 @@ constrain_tiling (MetaWindow *window,
* use an external function for the actual calculation
*/
meta_window_get_current_tile_area (window, &target_size);
- unextend_by_frame (window, &target_size, info->fgeom);
+ unextend_by_frame (window, &target_size, info->borders);
/* Check min size constraints; max size constraints are ignored as for
* maximized windows.
*/
- get_size_limits (window, info->fgeom, FALSE, &min_size, &max_size);
+ get_size_limits (window, info->borders, FALSE, &min_size, &max_size);
hminbad = target_size.width < min_size.width;
vminbad = target_size.height < min_size.height;
if (hminbad || vminbad)
@@ -1095,7 +1092,7 @@ constrain_fullscreen (MetaWindow *window,
xinerama = info->entire_xinerama;
- get_size_limits (window, info->fgeom, FALSE, &min_size, &max_size);
+ get_size_limits (window, info->borders, FALSE, &min_size, &max_size);
too_big = !meta_rectangle_could_fit_rect (&xinerama, &min_size);
too_small = !meta_rectangle_could_fit_rect (&max_size, &xinerama);
if (too_big || too_small)
@@ -1203,7 +1200,7 @@ constrain_size_limits (MetaWindow *window,
return TRUE;
/* Determine whether constraint is already satisfied; exit if it is */
- get_size_limits (window, info->fgeom, FALSE, &min_size, &max_size);
+ get_size_limits (window, info->borders, FALSE, &min_size, &max_size);
/* We ignore max-size limits for maximized windows; see #327543 */
if (window->maximized_horizontally)
max_size.width = MAX (max_size.width, info->current.width);
@@ -1394,8 +1391,8 @@ do_screen_and_xinerama_relative_constraints (
/* Determine whether constraint applies; exit if it doesn't */
how_far_it_can_be_smushed = info->current;
- get_size_limits (window, info->fgeom, TRUE, &min_size, &max_size);
- extend_by_frame (window, &info->current, info->fgeom);
+ get_size_limits (window, info->borders, TRUE, &min_size, &max_size);
+ extend_by_frame (window, &info->current, info->borders);
if (info->action_type != ACTION_MOVE)
{
@@ -1415,7 +1412,7 @@ do_screen_and_xinerama_relative_constraints (
&info->current);
if (exit_early || constraint_satisfied || check_only)
{
- unextend_by_frame (window, &info->current, info->fgeom);
+ unextend_by_frame (window, &info->current, info->borders);
return constraint_satisfied;
}
@@ -1439,7 +1436,7 @@ do_screen_and_xinerama_relative_constraints (
info->fixed_directions,
&info->current);
- unextend_by_frame (window, &info->current, info->fgeom);
+ unextend_by_frame (window, &info->current, info->borders);
return TRUE;
}
@@ -1551,8 +1548,8 @@ constrain_titlebar_visible (MetaWindow *window,
*/
if (window->frame)
{
- bottom_amount = info->current.height + info->fgeom->bottom_height;
- vert_amount_onscreen = info->fgeom->top_height;
+ bottom_amount = info->current.height + info->borders->visible.bottom;
+ vert_amount_onscreen = info->borders->visible.top;
}
else
bottom_amount = vert_amount_offscreen;
@@ -1626,8 +1623,8 @@ constrain_partially_onscreen (MetaWindow *window,
*/
if (window->frame)
{
- bottom_amount = info->current.height + info->fgeom->bottom_height;
- vert_amount_onscreen = info->fgeom->top_height;
+ bottom_amount = info->current.height + info->borders->visible.bottom;
+ vert_amount_onscreen = info->borders->visible.top;
}
else
bottom_amount = vert_amount_offscreen;
diff --git a/src/core/constraints.h b/src/core/constraints.h
index dfe9122c..9e72d9d8 100644
--- a/src/core/constraints.h
+++ b/src/core/constraints.h
@@ -39,7 +39,7 @@ typedef enum
} MetaMoveResizeFlags;
void meta_window_constrain (MetaWindow *window,
- MetaFrameGeometry *orig_fgeom,
+ MetaFrameBorders *orig_borders,
MetaMoveResizeFlags flags,
int resize_gravity,
const MetaRectangle *orig,
diff --git a/src/core/display.c b/src/core/display.c
index 216688ec..e25300d0 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -4470,11 +4470,7 @@ process_request_frame_extents (MetaDisplay *display,
&hints);
if ((hints_set && hints->decorations) || !hints_set)
{
- int top = 0;
- int bottom = 0;
- int left = 0;
- int right = 0;
-
+ MetaFrameBorders borders;
MetaScreen *screen;
screen = meta_display_screen_for_xwindow (display,
@@ -4492,15 +4488,12 @@ process_request_frame_extents (MetaDisplay *display,
meta_ui_theme_get_frame_borders (screen->ui,
META_FRAME_TYPE_NORMAL,
0,
- &top,
- &bottom,
- &left,
- &right);
-
- data[0] = left;
- data[1] = right;
- data[2] = top;
- data[3] = bottom;
+ &borders);
+
+ data[0] = borders.visible.left;
+ data[1] = borders.visible.right;
+ data[2] = borders.visible.top;
+ data[3] = borders.visible.bottom;
}
meta_topic (META_DEBUG_GEOMETRY,
diff --git a/src/core/frame-private.h b/src/core/frame-private.h
index 24ec3cc1..a5c01995 100644
--- a/src/core/frame-private.h
+++ b/src/core/frame-private.h
@@ -27,17 +27,6 @@
#include "frame.h"
#include "window-private.h"
-typedef struct _MetaFrameGeometry MetaFrameGeometry;
-
-struct _MetaFrameGeometry
-{
- /* border sizes (space between frame and child) */
- int left_width;
- int right_width;
- int top_height;
- int bottom_height;
-};
-
struct _MetaFrame
{
/* window we frame */
@@ -71,15 +60,15 @@ void meta_frame_queue_draw (MetaFrame *frame);
MetaFrameFlags meta_frame_get_flags (MetaFrame *frame);
/* These should ONLY be called from meta_window_move_resize_internal */
-void meta_frame_calc_geometry (MetaFrame *frame,
- MetaFrameGeometry *geomp);
-void meta_frame_sync_to_window (MetaFrame *frame,
- int gravity,
- gboolean need_move,
- gboolean need_resize);
-
-void meta_frame_set_screen_cursor (MetaFrame *frame,
- MetaCursor cursor);
+void meta_frame_calc_borders (MetaFrame *frame,
+ MetaFrameBorders *borders);
+void meta_frame_sync_to_window (MetaFrame *frame,
+ int gravity,
+ gboolean need_move,
+ gboolean need_resize);
+
+void meta_frame_set_screen_cursor (MetaFrame *frame,
+ MetaCursor cursor);
#endif
diff --git a/src/core/frame.c b/src/core/frame.c
index d47be374..f2405922 100644
--- a/src/core/frame.c
+++ b/src/core/frame.c
@@ -295,22 +295,12 @@ meta_frame_get_flags (MetaFrame *frame)
}
void
-meta_frame_calc_geometry (MetaFrame *frame,
- MetaFrameGeometry *geomp)
+meta_frame_calc_borders (MetaFrame *frame,
+ MetaFrameBorders *borders)
{
- MetaFrameGeometry geom;
- MetaWindow *window;
-
- window = frame->window;
-
- meta_ui_get_frame_geometry (window->screen->ui,
- frame->xwindow,
- &geom.top_height,
- &geom.bottom_height,
- &geom.left_width,
- &geom.right_width);
-
- *geomp = geom;
+ meta_ui_get_frame_borders (frame->window->screen->ui,
+ frame->xwindow,
+ borders);
}
static void
diff --git a/src/core/place.c b/src/core/place.c
index bcfafe42..b3fa6569 100644
--- a/src/core/place.c
+++ b/src/core/place.c
@@ -88,8 +88,8 @@ northwestcmp (gconstpointer a, gconstpointer b)
}
static gboolean
-place_by_pointer(MetaWindow *window,
- MetaFrameGeometry *fgeom,
+place_by_pointer(MetaWindow *window,
+ MetaFrameBorders *borders,
MetaPlacementMode placement_mode,
int *new_x,
int *new_y)
@@ -113,9 +113,9 @@ place_by_pointer(MetaWindow *window,
window_width = window->frame ? window->frame->rect.width : window->rect.width;
window_height = window->frame ? window->frame->rect.height : window->rect.height;
- if (fgeom) {
- *new_x = root_x_return + fgeom->left_width - window_width / 2;
- *new_y = root_y_return + fgeom->top_height - window_height / 2;
+ if (borders) {
+ *new_x = root_x_return + borders->visible.left - window_width / 2;
+ *new_y = root_y_return + borders->visible.top - window_height / 2;
}
else {
*new_x = root_x_return - window_width / 2;
@@ -129,14 +129,14 @@ place_by_pointer(MetaWindow *window,
}
static void
-find_next_cascade (MetaWindow *window,
- MetaFrameGeometry *fgeom,
+find_next_cascade (MetaWindow *window,
+ MetaFrameBorders *borders,
/* visible windows on relevant workspaces */
- GList *windows,
- int x,
- int y,
- int *new_x,
- int *new_y)
+ GList *windows,
+ int x,
+ int y,
+ int *new_x,
+ int *new_y)
{
GList *tmp;
GList *sorted;
@@ -160,10 +160,10 @@ find_next_cascade (MetaWindow *window,
* manually cascade.
*/
#define CASCADE_FUZZ 15
- if (fgeom)
+ if (borders)
{
- x_threshold = MAX (fgeom->left_width, CASCADE_FUZZ);
- y_threshold = MAX (fgeom->top_height, CASCADE_FUZZ);
+ x_threshold = MAX (borders->visible.left, CASCADE_FUZZ);
+ y_threshold = MAX (borders->visible.top, CASCADE_FUZZ);
}
else
{
@@ -264,27 +264,27 @@ find_next_cascade (MetaWindow *window,
g_list_free (sorted);
/* Convert coords to position of window, not position of frame. */
- if (fgeom == NULL)
+ if (borders == NULL)
{
*new_x = cascade_x;
*new_y = cascade_y;
}
else
{
- *new_x = cascade_x + fgeom->left_width;
- *new_y = cascade_y + fgeom->top_height;
+ *new_x = cascade_x + borders->visible.left;
+ *new_y = cascade_y + borders->visible.top;
}
}
static void
-find_most_freespace (MetaWindow *window,
- MetaFrameGeometry *fgeom,
+find_most_freespace (MetaWindow *window,
+ MetaFrameBorders *borders,
/* visible windows on relevant workspaces */
- MetaWindow *focus_window,
- int x,
- int y,
- int *new_x,
- int *new_y)
+ MetaWindow *focus_window,
+ int x,
+ int y,
+ int *new_x,
+ int *new_y)
{
MetaWindowDirection side;
int max_area;
@@ -295,8 +295,8 @@ find_most_freespace (MetaWindow *window,
MetaRectangle avoid;
MetaRectangle outer;
- frame_size_left = fgeom ? fgeom->left_width : 0;
- frame_size_top = fgeom ? fgeom->top_height : 0;
+ frame_size_left = borders ? borders->visible.left : 0;
+ frame_size_top = borders ? borders->visible.top : 0;
meta_window_get_work_area_current_xinerama (focus_window, &work_area);
meta_window_get_outer_rect (focus_window, &avoid);
@@ -375,10 +375,10 @@ find_most_freespace (MetaWindow *window,
}
static void
-avoid_being_obscured_as_second_modal_dialog (MetaWindow *window,
- MetaFrameGeometry *fgeom,
- int *x,
- int *y)
+avoid_being_obscured_as_second_modal_dialog (MetaWindow *window,
+ MetaFrameBorders *borders,
+ int *x,
+ int *y)
{
/* We can't center this dialog if it was denied focus and it
* overlaps with the focus window and this dialog is modal and this
@@ -406,7 +406,7 @@ avoid_being_obscured_as_second_modal_dialog (MetaWindow *window,
&focus_window->rect,
&overlap))
{
- find_most_freespace (window, fgeom, focus_window, *x, *y, x, y);
+ find_most_freespace (window, borders, focus_window, *x, *y, x, y);
meta_topic (META_DEBUG_PLACEMENT,
"Dialog window %s was denied focus but may be modal "
"to the focus window; had to move it to avoid the "
@@ -545,15 +545,15 @@ center_rect_in_area (MetaRectangle *rect,
* don't want to create a 1x1 Emacs.
*/
static gboolean
-find_first_fit (MetaWindow *window,
- MetaFrameGeometry *fgeom,
+find_first_fit (MetaWindow *window,
+ MetaFrameBorders *borders,
/* visible windows on relevant workspaces */
- GList *windows,
- int xinerama,
- int x,
- int y,
- int *new_x,
- int *new_y)
+ GList *windows,
+ int xinerama,
+ int x,
+ int y,
+ int *new_x,
+ int *new_y)
{
/* This algorithm is limited - it just brute-force tries
* to fit the window in a small number of locations that are aligned
@@ -584,10 +584,10 @@ find_first_fit (MetaWindow *window,
rect.width = window->rect.width;
rect.height = window->rect.height;
- if (fgeom)
+ if (borders)
{
- rect.width += fgeom->left_width + fgeom->right_width;
- rect.height += fgeom->top_height + fgeom->bottom_height;
+ rect.width += borders->visible.left + borders->visible.right;
+ rect.height += borders->visible.top + borders->visible.bottom;
}
#ifdef WITH_VERBOSE_MODE
@@ -614,10 +614,10 @@ find_first_fit (MetaWindow *window,
{
*new_x = rect.x;
*new_y = rect.y;
- if (fgeom)
+ if (borders)
{
- *new_x += fgeom->left_width;
- *new_y += fgeom->top_height;
+ *new_x += borders->visible.left;
+ *new_y += borders->visible.top;
}
retval = TRUE;
@@ -642,10 +642,10 @@ find_first_fit (MetaWindow *window,
{
*new_x = rect.x;
*new_y = rect.y;
- if (fgeom)
+ if (borders)
{
- *new_x += fgeom->left_width;
- *new_y += fgeom->top_height;
+ *new_x += borders->visible.left;
+ *new_y += borders->visible.top;
}
retval = TRUE;
@@ -673,10 +673,10 @@ find_first_fit (MetaWindow *window,
{
*new_x = rect.x;
*new_y = rect.y;
- if (fgeom)
+ if (borders)
{
- *new_x += fgeom->left_width;
- *new_y += fgeom->top_height;
+ *new_x += borders->visible.left;
+ *new_y += borders->visible.top;
}
retval = TRUE;
@@ -695,19 +695,19 @@ find_first_fit (MetaWindow *window,
}
void
-meta_window_place (MetaWindow *window,
- MetaFrameGeometry *fgeom,
- int x,
- int y,
- int *new_x,
- int *new_y)
+meta_window_place (MetaWindow *window,
+ MetaFrameBorders *borders,
+ int x,
+ int y,
+ int *new_x,
+ int *new_y)
{
GList *windows;
const MetaXineramaScreenInfo *xi;
MetaPlacementMode placement_mode;
/* frame member variables should NEVER be used in here, only
- * MetaFrameGeometry. But remember fgeom == NULL
+ * MetaFrameBorders. But remember borders == NULL
* for undecorated windows. Also, this function should
* NEVER have side effects other than computing the
* placement coordinates.
@@ -785,7 +785,7 @@ meta_window_place (MetaWindow *window,
{
meta_topic (META_DEBUG_PLACEMENT,
"Not placing window with PPosition or USPosition set\n");
- avoid_being_obscured_as_second_modal_dialog (window, fgeom, &x, &y);
+ avoid_being_obscured_as_second_modal_dialog (window, borders, &x, &y);
goto done_no_constraints;
}
}
@@ -820,13 +820,13 @@ meta_window_place (MetaWindow *window,
y += (parent->rect.height - window->rect.height)/3;
/* put top of child's frame, not top of child's client */
- if (fgeom)
- y += fgeom->top_height;
+ if (borders)
+ y += borders->visible.top;
meta_topic (META_DEBUG_PLACEMENT, "Centered window %s over transient parent\n",
window->desc);
- avoid_being_obscured_as_second_modal_dialog (window, fgeom, &x, &y);
+ avoid_being_obscured_as_second_modal_dialog (window, borders, &x, &y);
goto done;
}
@@ -901,11 +901,11 @@ meta_window_place (MetaWindow *window,
if (placement_mode == META_PLACEMENT_MODE_POINTER ||
placement_mode == META_PLACEMENT_MODE_MANUAL)
{
- if (place_by_pointer (window, fgeom, placement_mode, &x, &y))
+ if (place_by_pointer (window, borders, placement_mode, &x, &y))
goto done_check_denied_focus;
}
- if (find_first_fit (window, fgeom, windows,
+ if (find_first_fit (window, borders, windows,
xi->number,
x, y, &x, &y))
goto done_check_denied_focus;
@@ -939,7 +939,7 @@ meta_window_place (MetaWindow *window,
* fully overlapping window (e.g. starting multiple terminals)
* */
if (!meta_prefs_get_center_new_windows() && (x == xi->rect.x && y == xi->rect.y))
- find_next_cascade (window, fgeom, windows, x, y, &x, &y);
+ find_next_cascade (window, borders, windows, x, y, &x, &y);
done_check_denied_focus:
/* If the window is being denied focus and isn't a transient of the
@@ -973,7 +973,7 @@ meta_window_place (MetaWindow *window,
x = xi->rect.x;
y = xi->rect.y;
- found_fit = find_first_fit (window, fgeom, focus_window_list,
+ found_fit = find_first_fit (window, borders, focus_window_list,
xi->number,
x, y, &x, &y);
g_list_free (focus_window_list);
@@ -983,7 +983,7 @@ meta_window_place (MetaWindow *window,
* as possible.
*/
if (!found_fit)
- find_most_freespace (window, fgeom, focus_window, x, y, &x, &y);
+ find_most_freespace (window, borders, focus_window, x, y, &x, &y);
}
done:
diff --git a/src/core/place.h b/src/core/place.h
index 9f58c417..468e3a39 100644
--- a/src/core/place.h
+++ b/src/core/place.h
@@ -27,11 +27,11 @@
#include "window-private.h"
#include "frame-private.h"
-void meta_window_place (MetaWindow *window,
- MetaFrameGeometry *fgeom,
- int x,
- int y,
- int *new_x,
- int *new_y);
+void meta_window_place (MetaWindow *window,
+ MetaFrameBorders *borders,
+ int x,
+ int y,
+ int *new_x,
+ int *new_y);
#endif
diff --git a/src/core/window.c b/src/core/window.c
index 620b3a2d..7c8a19a9 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -2771,12 +2771,12 @@ meta_window_can_tile (MetaWindow *window)
if (window->frame)
{
- MetaFrameGeometry fgeom;
+ MetaFrameBorders borders;
- meta_frame_calc_geometry (window->frame, &fgeom);
+ meta_frame_calc_borders (window->frame, &borders);
- tile_area.width -= (fgeom.left_width + fgeom.right_width);
- tile_area.height -= (fgeom.top_height + fgeom.bottom_height);
+ tile_area.width -= (borders.visible.left + borders.visible.right);
+ tile_area.height -= (borders.visible.top + borders.visible.bottom);
}
return tile_area.width >= window->size_hints.min_width &&
@@ -3241,11 +3241,11 @@ meta_window_activate_with_workspace (MetaWindow *window,
* internal or client window).
*/
static void
-adjust_for_gravity (MetaWindow *window,
- MetaFrameGeometry *fgeom,
- gboolean coords_assume_border,
- int gravity,
- MetaRectangle *rect)
+adjust_for_gravity (MetaWindow *window,
+ MetaFrameBorders *borders,
+ gboolean coords_assume_border,
+ int gravity,
+ MetaRectangle *rect)
{
int ref_x, ref_y;
int bw;
@@ -3257,12 +3257,12 @@ adjust_for_gravity (MetaWindow *window,
else
bw = 0;
- if (fgeom)
+ if (borders)
{
- child_x = fgeom->left_width;
- child_y = fgeom->top_height;
- frame_width = child_x + rect->width + fgeom->right_width;
- frame_height = child_y + rect->height + fgeom->bottom_height;
+ child_x = borders->visible.left;
+ child_y = borders->visible.top;
+ frame_width = child_x + rect->width + borders->visible.right;
+ frame_height = child_y + rect->height + borders->visible.bottom;
}
else
{
@@ -3470,7 +3470,7 @@ meta_window_move_resize_internal (MetaWindow *window,
XWindowChanges values;
unsigned int mask;
gboolean need_configure_notify;
- MetaFrameGeometry fgeom;
+ MetaFrameBorders borders;
gboolean need_move_client = FALSE;
gboolean need_move_frame = FALSE;
gboolean need_resize_client = FALSE;
@@ -3516,8 +3516,7 @@ meta_window_move_resize_internal (MetaWindow *window,
old_rect.x, old_rect.y, old_rect.width, old_rect.height);
if (have_window_frame)
- meta_frame_calc_geometry (window->frame,
- &fgeom);
+ meta_frame_calc_borders (window->frame, &borders);
new_rect.x = root_x_nw;
new_rect.y = root_y_nw;
@@ -3544,7 +3543,7 @@ meta_window_move_resize_internal (MetaWindow *window,
else if (is_configure_request || do_gravity_adjust)
{
adjust_for_gravity (window,
- have_window_frame ? &fgeom : NULL,
+ have_window_frame ? &borders : NULL,
/* configure request coords assume
* the border width existed
*/
@@ -3559,7 +3558,7 @@ meta_window_move_resize_internal (MetaWindow *window,
}
meta_window_constrain (window,
- have_window_frame ? &fgeom : NULL,
+ have_window_frame ? &borders : NULL,
flags,
gravity,
&old_rect,
@@ -3581,12 +3580,12 @@ meta_window_move_resize_internal (MetaWindow *window,
{
int frame_size_dx, frame_size_dy, new_w, new_h;
- new_w = window->rect.width + fgeom.left_width + fgeom.right_width;
+ new_w = window->rect.width + borders.visible.left + borders.visible.right;
if (window->shaded)
- new_h = fgeom.top_height;
+ new_h = borders.visible.top;
else
- new_h = window->rect.height + fgeom.top_height + fgeom.bottom_height;
+ new_h = window->rect.height + borders.visible.top + borders.visible.bottom;
frame_size_dx = new_w - window->frame->rect.width;
frame_size_dy = new_h - window->frame->rect.height;
@@ -3623,8 +3622,8 @@ meta_window_move_resize_internal (MetaWindow *window,
int frame_pos_dx, frame_pos_dy;
/* Compute new frame coords */
- new_x = root_x_nw - fgeom.left_width;
- new_y = root_y_nw - fgeom.top_height;
+ new_x = root_x_nw - borders.visible.left;
+ new_y = root_y_nw - borders.visible.top;
frame_pos_dx = new_x - window->frame->rect.x;
frame_pos_dy = new_y - window->frame->rect.y;
@@ -3647,8 +3646,8 @@ meta_window_move_resize_internal (MetaWindow *window,
* remember they are the server coords
*/
- new_x = fgeom.left_width;
- new_y = fgeom.top_height;
+ new_x = borders.visible.left;
+ new_y = borders.visible.top;
if (need_resize_frame && need_move_frame &&
static_gravity_works (window->display))
@@ -3719,15 +3718,15 @@ meta_window_move_resize_internal (MetaWindow *window,
/* If frame extents have changed, fill in other frame fields and
change frame's extents property. */
if (have_window_frame &&
- (window->frame->child_x != fgeom.left_width ||
- window->frame->child_y != fgeom.top_height ||
- window->frame->right_width != fgeom.right_width ||
- window->frame->bottom_height != fgeom.bottom_height))
- {
- window->frame->child_x = fgeom.left_width;
- window->frame->child_y = fgeom.top_height;
- window->frame->right_width = fgeom.right_width;
- window->frame->bottom_height = fgeom.bottom_height;
+ (window->frame->child_x != borders.visible.left ||
+ window->frame->child_y != borders.visible.top ||
+ window->frame->right_width != borders.visible.right ||
+ window->frame->bottom_height != borders.visible.bottom))
+ {
+ window->frame->child_x = borders.visible.left;
+ window->frame->child_y = borders.visible.top;
+ window->frame->right_width = borders.visible.right;
+ window->frame->bottom_height = borders.visible.bottom;
update_net_frame_extents (window);
}