summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2019-04-12 07:58:30 -0400
committerraveit65 <[email protected]>2019-06-16 18:12:44 +0200
commitcfd49bdf68ef48fcd53a084c74626372fc169688 (patch)
tree4f20be7afc95f063f04bb6114a90c5aa7c650c6b
parent147a9bd1e56201bb93879627cd186c235e050ca4 (diff)
downloadmarco-cfd49bdf68ef48fcd53a084c74626372fc169688.tar.bz2
marco-cfd49bdf68ef48fcd53a084c74626372fc169688.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.
-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
-rw-r--r--src/include/common.h12
-rw-r--r--src/include/ui.h18
-rw-r--r--src/ui/frames.c35
-rw-r--r--src/ui/frames.h7
-rw-r--r--src/ui/preview-widget.c47
-rw-r--r--src/ui/preview-widget.h6
-rw-r--r--src/ui/theme-viewer.c11
-rw-r--r--src/ui/theme.c83
-rw-r--r--src/ui/theme.h10
-rw-r--r--src/ui/ui.c30
18 files changed, 295 insertions, 358 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 cbe0eb7e..41ba1ff5 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -4386,11 +4386,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,
@@ -4408,15 +4404,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 e5046bbb..bba84b4c 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;
@@ -3518,8 +3518,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;
@@ -3546,7 +3545,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
*/
@@ -3561,7 +3560,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,
@@ -3583,12 +3582,12 @@ meta_window_move_resize_internal (MetaWindow *window,
{
int 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;
@@ -3630,8 +3629,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;
@@ -3654,8 +3653,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))
@@ -3726,15 +3725,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);
}
diff --git a/src/include/common.h b/src/include/common.h
index 81937307..fce641c1 100644
--- a/src/include/common.h
+++ b/src/include/common.h
@@ -25,9 +25,10 @@
#ifndef META_COMMON_H
#define META_COMMON_H
-/* Don't include GTK or core headers here */
+/* Don't include core headers here */
#include <X11/Xlib.h>
#include <glib.h>
+#include <gtk/gtk.h>
typedef struct _MetaResizePopup MetaResizePopup;
@@ -300,6 +301,15 @@ struct _MetaButtonLayout
gboolean right_buttons_has_spacer[MAX_BUTTONS_PER_CORNER];
};
+typedef struct _MetaFrameBorders MetaFrameBorders;
+struct _MetaFrameBorders
+{
+ /* The frame border is made up of two pieces - an inner visible portion
+ * and an outer portion that is invisible but responds to events.
+ */
+ GtkBorder visible;
+};
+
/* should investigate changing these to whatever most apps use */
#define META_ICON_WIDTH 48
#define META_ICON_HEIGHT 48
diff --git a/src/include/ui.h b/src/include/ui.h
index ba9b1696..bbfaf287 100644
--- a/src/include/ui.h
+++ b/src/include/ui.h
@@ -62,17 +62,13 @@ MetaUI* meta_ui_new (Display *xdisplay,
Screen *screen);
void meta_ui_free (MetaUI *ui);
-void meta_ui_theme_get_frame_borders (MetaUI *ui,
- MetaFrameType type,
- MetaFrameFlags flags,
- int *top_height,
- int *bottom_height,
- int *left_width,
- int *right_width);
-void meta_ui_get_frame_geometry (MetaUI *ui,
- Window frame_xwindow,
- int *top_height, int *bottom_height,
- int *left_width, int *right_width);
+void meta_ui_theme_get_frame_borders (MetaUI *ui,
+ MetaFrameType type,
+ MetaFrameFlags flags,
+ MetaFrameBorders *borders);
+void meta_ui_get_frame_borders (MetaUI *ui,
+ Window frame_xwindow,
+ MetaFrameBorders *borders);
Window meta_ui_create_frame_window (MetaUI *ui,
Display *xdisplay,
Visual *xvisual,
diff --git a/src/ui/frames.c b/src/ui/frames.c
index 8e6eefd3..264e2373 100644
--- a/src/ui/frames.c
+++ b/src/ui/frames.c
@@ -668,10 +668,9 @@ meta_frames_lookup_window (MetaFrames *frames,
}
void
-meta_frames_get_geometry (MetaFrames *frames,
- Window xwindow,
- int *top_height, int *bottom_height,
- int *left_width, int *right_width)
+meta_frames_get_borders (MetaFrames *frames,
+ Window xwindow,
+ MetaFrameBorders *borders)
{
MetaFrameFlags flags;
MetaUIFrame *frame;
@@ -702,14 +701,13 @@ meta_frames_get_geometry (MetaFrames *frames,
type,
frame->text_height,
flags,
- top_height, bottom_height,
- left_width, right_width);
+ borders);
/* Scale frame geometry to ensure proper frame position */
- *top_height *= scale;
- *bottom_height *= scale;
- *left_width *= scale;
- *right_width *= scale;
+ borders->visible.top *= scale;
+ borders->visible.bottom *= scale;
+ borders->visible.left *= scale;
+ borders->visible.right *= scale;
}
#ifdef HAVE_SHAPE
@@ -2062,6 +2060,7 @@ populate_cache (MetaFrames *frames,
MetaUIFrame *frame)
{
int top, bottom, left, right;
+ MetaFrameBorders borders;
int width, height;
int frame_width, frame_height, screen_width, screen_height;
gint scale;
@@ -2092,7 +2091,12 @@ populate_cache (MetaFrames *frames,
frame_type,
frame->text_height,
frame_flags,
- &top, &bottom, &left, &right);
+ &borders);
+
+ top = borders.visible.top;
+ left = borders.visible.left;
+ right = borders.visible.right;
+ bottom = borders.visible.bottom;
pixels = get_cache (frames, frame);
scale = gdk_window_get_scale_factor (frame->window);
@@ -2197,6 +2201,7 @@ subtract_client_area (cairo_region_t *region, MetaUIFrame *frame)
GdkRectangle area;
MetaFrameFlags flags;
MetaFrameType type;
+ MetaFrameBorders borders;
cairo_region_t *tmp_region;
Display *display;
gint scale;
@@ -2212,13 +2217,13 @@ subtract_client_area (cairo_region_t *region, MetaUIFrame *frame)
META_CORE_GET_END);
meta_theme_get_frame_borders (meta_theme_get_current (),
- type, frame->text_height, flags,
- &area.x, NULL, &area.y, NULL);
+ type, frame->text_height, flags,
+ &borders);
area.width /= scale;
area.height /= scale;
- area.x /= scale;
- area.y /= scale;
+ area.x = borders.visible.left / scale;
+ area.y = borders.visible.top / scale;
tmp_region = cairo_region_create_rectangle (&area);
cairo_region_subtract (region, tmp_region);
diff --git a/src/ui/frames.h b/src/ui/frames.h
index 736c37ca..1262f148 100644
--- a/src/ui/frames.h
+++ b/src/ui/frames.h
@@ -127,10 +127,9 @@ void meta_frames_set_title (MetaFrames *frames,
void meta_frames_repaint_frame (MetaFrames *frames,
Window xwindow);
-void meta_frames_get_geometry (MetaFrames *frames,
- Window xwindow,
- int *top_height, int *bottom_height,
- int *left_width, int *right_width);
+void meta_frames_get_borders (MetaFrames *frames,
+ Window xwindow,
+ MetaFrameBorders *borders);
void meta_frames_apply_shapes (MetaFrames *frames,
Window xwindow,
diff --git a/src/ui/preview-widget.c b/src/ui/preview-widget.c
index 6dc4691c..1db34950 100644
--- a/src/ui/preview-widget.c
+++ b/src/ui/preview-widget.c
@@ -98,10 +98,10 @@ meta_preview_init (MetaPreview *preview)
META_FRAME_ALLOWS_SHADE |
META_FRAME_ALLOWS_MOVE;
- preview->left_width = -1;
- preview->right_width = -1;
- preview->top_height = -1;
- preview->bottom_height = -1;
+ preview->borders.visible.left = -1;
+ preview->borders.visible.right = -1;
+ preview->borders.visible.top = -1;
+ preview->borders.visible.bottom = -1;
}
GtkWidget*
@@ -172,7 +172,7 @@ ensure_info (MetaPreview *preview)
pango_font_description_free (font_desc);
}
- if (preview->top_height < 0)
+ if (preview->borders.visible.top < 0)
{
if (preview->theme)
{
@@ -180,17 +180,14 @@ ensure_info (MetaPreview *preview)
preview->type,
preview->text_height,
preview->flags,
- &preview->top_height,
- &preview->bottom_height,
- &preview->left_width,
- &preview->right_width);
+ &preview->borders);
}
else
{
- preview->top_height = 0;
- preview->bottom_height = 0;
- preview->left_width = 0;
- preview->right_width = 0;
+ preview->borders.visible.top = 0;
+ preview->borders.visible.bottom = 0;
+ preview->borders.visible.left = 0;
+ preview->borders.visible.right = 0;
}
}
}
@@ -223,8 +220,8 @@ meta_preview_draw (GtkWidget *widget,
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
gtk_widget_get_allocation (widget, &allocation);
- client_width = allocation.width - preview->left_width - preview->right_width - border_width * 2;
- client_height = allocation.height - preview->top_height - preview->bottom_height - border_width * 2;
+ client_width = allocation.width - preview->borders.visible.left - preview->borders.visible.right - border_width * 2;
+ client_height = allocation.height - preview->borders.visible.top - preview->borders.visible.bottom - border_width * 2;
if (client_width < 0)
client_width = 1;
@@ -268,7 +265,7 @@ meta_preview_get_preferred_width (GtkWidget *widget,
ensure_info (preview);
- *minimum = *natural = preview->left_width + preview->right_width;
+ *minimum = *natural = preview->borders.visible.left + preview->borders.visible.right;
child = gtk_bin_get_child (GTK_BIN (preview));
if (child && gtk_widget_get_visible (child))
@@ -304,7 +301,7 @@ meta_preview_get_preferred_height (GtkWidget *widget,
ensure_info (preview);
- *minimum = *natural = preview->top_height + preview->bottom_height;
+ *minimum = *natural = preview->borders.visible.top + preview->borders.visible.bottom;
child = gtk_bin_get_child (GTK_BIN (preview));
if (child && gtk_widget_get_visible (child))
@@ -349,11 +346,11 @@ meta_preview_size_allocate (GtkWidget *widget,
gtk_widget_get_visible (child))
{
gtk_widget_get_allocation (widget, &widget_allocation);
- child_allocation.x = widget_allocation.x + border_width + preview->left_width;
- child_allocation.y = widget_allocation.y + border_width + preview->top_height;
+ child_allocation.x = widget_allocation.x + border_width + preview->borders.visible.left;
+ child_allocation.y = widget_allocation.y + border_width + preview->borders.visible.top;
- child_allocation.width = MAX (1, widget_allocation.width - border_width * 2 - preview->left_width - preview->right_width);
- child_allocation.height = MAX (1, widget_allocation.height - border_width * 2 - preview->top_height - preview->bottom_height);
+ child_allocation.width = MAX (1, widget_allocation.width - border_width * 2 - preview->borders.visible.left - preview->borders.visible.right);
+ child_allocation.height = MAX (1, widget_allocation.height - border_width * 2 - preview->borders.visible.top - preview->borders.visible.bottom);
gtk_widget_size_allocate (gtk_bin_get_child (GTK_BIN (widget)), &child_allocation);
}
}
@@ -367,10 +364,10 @@ clear_cache (MetaPreview *preview)
preview->layout = NULL;
}
- preview->left_width = -1;
- preview->right_width = -1;
- preview->top_height = -1;
- preview->bottom_height = -1;
+ preview->borders.visible.left = -1;
+ preview->borders.visible.right = -1;
+ preview->borders.visible.top = -1;
+ preview->borders.visible.bottom = -1;
}
void
diff --git a/src/ui/preview-widget.h b/src/ui/preview-widget.h
index 1bbd97e7..11818588 100644
--- a/src/ui/preview-widget.h
+++ b/src/ui/preview-widget.h
@@ -50,11 +50,7 @@ struct _MetaPreview
PangoLayout *layout;
int text_height;
- int left_width;
- int right_width;
- int top_height;
- int bottom_height;
-
+ MetaFrameBorders borders;
MetaButtonLayout button_layout;
};
diff --git a/src/ui/theme-viewer.c b/src/ui/theme-viewer.c
index 65df34fa..f88df0b0 100644
--- a/src/ui/theme-viewer.c
+++ b/src/ui/theme-viewer.c
@@ -1000,7 +1000,7 @@ run_theme_benchmark (void)
GtkWidget* widget;
cairo_surface_t *pixmap;
cairo_t *cr;
- int top_height, bottom_height, left_width, right_width;
+ MetaFrameBorders borders;
MetaButtonState button_states[META_BUTTON_TYPE_LAST] =
{
META_BUTTON_STATE_NORMAL,
@@ -1026,10 +1026,7 @@ run_theme_benchmark (void)
META_FRAME_TYPE_NORMAL,
get_text_height (widget),
get_flags (widget),
- &top_height,
- &bottom_height,
- &left_width,
- &right_width);
+ &borders);
layout = create_title_layout (widget);
@@ -1064,8 +1061,8 @@ run_theme_benchmark (void)
*/
pixmap = gdk_window_create_similar_surface (gtk_widget_get_window (widget),
CAIRO_CONTENT_COLOR,
- client_width + left_width + right_width,
- client_height + top_height + bottom_height);
+ client_width + borders.visible.left + borders.visible.right,
+ client_height + borders.visible.top + borders.visible.bottom);
cr = cairo_create (pixmap);
meta_theme_draw_frame (global_theme,
diff --git a/src/ui/theme.c b/src/ui/theme.c
index a7368c92..20cf6913 100644
--- a/src/ui/theme.c
+++ b/src/ui/theme.c
@@ -405,10 +405,7 @@ void
meta_frame_layout_get_borders (const MetaFrameLayout *layout,
int text_height,
MetaFrameFlags flags,
- int *top_height,
- int *bottom_height,
- int *left_width,
- int *right_width)
+ MetaFrameBorders *borders)
{
int buttons_height, title_height;
@@ -423,34 +420,20 @@ meta_frame_layout_get_borders (const MetaFrameLayout *layout,
layout->title_vertical_pad +
layout->title_border.top + layout->title_border.bottom;
- if (top_height)
- {
- *top_height = MAX (buttons_height, title_height);
- }
-
- if (left_width)
- *left_width = layout->left_width;
- if (right_width)
- *right_width = layout->right_width;
-
- if (bottom_height)
- {
- if (flags & META_FRAME_SHADED)
- *bottom_height = 0;
- else
- *bottom_height = layout->bottom_height;
- }
+ borders->visible.top = MAX (buttons_height, title_height);
+ borders->visible.left = layout->left_width;
+ borders->visible.right = layout->right_width;
+ if (flags & META_FRAME_SHADED)
+ borders->visible.bottom = 0;
+ else
+ borders->visible.bottom = layout->bottom_height;
if (flags & META_FRAME_FULLSCREEN)
{
- if (top_height)
- *top_height = 0;
- if (bottom_height)
- *bottom_height = 0;
- if (left_width)
- *left_width = 0;
- if (right_width)
- *right_width = 0;
+ borders->visible.top = 0;
+ borders->visible.bottom = 0;
+ borders->visible.left = 0;
+ borders->visible.right = 0;
}
}
@@ -647,12 +630,16 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout,
GdkRectangle *right_bg_rects[MAX_BUTTONS_PER_CORNER];
gboolean right_buttons_has_spacer[MAX_BUTTONS_PER_CORNER];
+ MetaFrameBorders borders;
+
meta_frame_layout_get_borders (layout, text_height,
flags,
- &fgeom->top_height,
- &fgeom->bottom_height,
- &fgeom->left_width,
- &fgeom->right_width);
+ &borders);
+
+ fgeom->left_width = borders.visible.left;
+ fgeom->right_width = borders.visible.right;
+ fgeom->top_height = borders.visible.top;
+ fgeom->bottom_height = borders.visible.bottom;
width = client_width + fgeom->left_width + fgeom->right_width;
@@ -5659,30 +5646,23 @@ meta_theme_draw_frame_by_name (MetaTheme *theme,
}
void
-meta_theme_get_frame_borders (MetaTheme *theme,
- MetaFrameType type,
- int text_height,
- MetaFrameFlags flags,
- int *top_height,
- int *bottom_height,
- int *left_width,
- int *right_width)
+meta_theme_get_frame_borders (MetaTheme *theme,
+ MetaFrameType type,
+ int text_height,
+ MetaFrameFlags flags,
+ MetaFrameBorders *borders)
{
MetaFrameStyle *style;
g_return_if_fail (type < META_FRAME_TYPE_LAST);
- if (top_height)
- *top_height = 0;
- if (bottom_height)
- *bottom_height = 0;
- if (left_width)
- *left_width = 0;
- if (right_width)
- *right_width = 0;
-
style = theme_get_style (theme, type, flags);
+ borders->visible.top = 0;
+ borders->visible.left = 0;
+ borders->visible.right = 0;
+ borders->visible.bottom = 0;
+
/* Parser is not supposed to allow this currently */
if (style == NULL)
return;
@@ -5690,8 +5670,7 @@ meta_theme_get_frame_borders (MetaTheme *theme,
meta_frame_layout_get_borders (style->layout,
text_height,
flags,
- top_height, bottom_height,
- left_width, right_width);
+ borders);
}
void
diff --git a/src/ui/theme.h b/src/ui/theme.h
index ef6af363..2e4a425c 100644
--- a/src/ui/theme.h
+++ b/src/ui/theme.h
@@ -877,10 +877,7 @@ void meta_frame_layout_unref (MetaFrameLayout *layout)
void meta_frame_layout_get_borders (const MetaFrameLayout *layout,
int text_height,
MetaFrameFlags flags,
- int *top_height,
- int *bottom_height,
- int *left_width,
- int *right_width);
+ MetaFrameBorders *borders);
void meta_frame_layout_calc_geometry (const MetaFrameLayout *layout,
int text_height,
MetaFrameFlags flags,
@@ -1080,10 +1077,7 @@ void meta_theme_get_frame_borders (MetaTheme *theme,
MetaFrameType type,
int text_height,
MetaFrameFlags flags,
- int *top_height,
- int *bottom_height,
- int *left_width,
- int *right_width);
+ MetaFrameBorders *borders);
void meta_theme_calc_geometry (MetaTheme *theme,
MetaFrameType type,
int text_height,
diff --git a/src/ui/ui.c b/src/ui/ui.c
index 00c1176a..fdb9733a 100644
--- a/src/ui/ui.c
+++ b/src/ui/ui.c
@@ -295,14 +295,11 @@ meta_ui_free (MetaUI *ui)
}
void
-meta_ui_get_frame_geometry (MetaUI *ui,
- Window frame_xwindow,
- int *top_height, int *bottom_height,
- int *left_width, int *right_width)
+meta_ui_get_frame_borders (MetaUI *ui,
+ Window frame_xwindow,
+ MetaFrameBorders *borders)
{
- meta_frames_get_geometry (ui->frames, frame_xwindow,
- top_height, bottom_height,
- left_width, right_width);
+ meta_frames_get_borders (ui->frames, frame_xwindow, borders);
}
static void
@@ -634,13 +631,10 @@ meta_ui_window_should_not_cause_focus (Display *xdisplay,
}
void
-meta_ui_theme_get_frame_borders (MetaUI *ui,
- MetaFrameType type,
- MetaFrameFlags flags,
- int *top_height,
- int *bottom_height,
- int *left_width,
- int *right_width)
+meta_ui_theme_get_frame_borders (MetaUI *ui,
+ MetaFrameType type,
+ MetaFrameFlags flags,
+ MetaFrameBorders *borders)
{
int text_height;
GtkStyleContext *style = NULL;
@@ -681,15 +675,17 @@ meta_ui_theme_get_frame_borders (MetaUI *ui,
meta_theme_get_frame_borders (meta_theme_get_current (),
type, text_height, flags,
- top_height, bottom_height,
- left_width, right_width);
+ borders);
if (free_font_desc)
pango_font_description_free (free_font_desc);
}
else
{
- *top_height = *bottom_height = *left_width = *right_width = 0;
+ borders->visible.top = 0;
+ borders->visible.bottom = 0;
+ borders->visible.left = 0;
+ borders->visible.right = 0;
}
if (style != NULL)