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
This commit is contained in:
Jasper St. Pierre 2011-07-12 00:37:41 -04:00
parent 7e0a56fb80
commit e0fb83c691
18 changed files with 244 additions and 301 deletions

View File

@ -118,7 +118,7 @@ typedef struct
{ {
MetaRectangle orig; MetaRectangle orig;
MetaRectangle current; MetaRectangle current;
MetaFrameGeometry *fgeom; MetaFrameBorders *borders;
ActionType action_type; ActionType action_type;
gboolean is_user_action; gboolean is_user_action;
@ -194,7 +194,7 @@ static gboolean constrain_partially_onscreen (MetaWindow *window,
static void setup_constraint_info (ConstraintInfo *info, static void setup_constraint_info (ConstraintInfo *info,
MetaWindow *window, MetaWindow *window,
MetaFrameGeometry *orig_fgeom, MetaFrameBorders *orig_borders,
MetaMoveResizeFlags flags, MetaMoveResizeFlags flags,
int resize_gravity, int resize_gravity,
const MetaRectangle *orig, const MetaRectangle *orig,
@ -204,11 +204,11 @@ static void place_window_if_needed (MetaWindow *window,
static void update_onscreen_requirements (MetaWindow *window, static void update_onscreen_requirements (MetaWindow *window,
ConstraintInfo *info); ConstraintInfo *info);
static void extend_by_frame (MetaRectangle *rect, static void extend_by_frame (MetaRectangle *rect,
const MetaFrameGeometry *fgeom); const MetaFrameBorders *borders);
static void unextend_by_frame (MetaRectangle *rect, static void unextend_by_frame (MetaRectangle *rect,
const MetaFrameGeometry *fgeom); const MetaFrameBorders *borders);
static inline void get_size_limits (const MetaWindow *window, static inline void get_size_limits (const MetaWindow *window,
const MetaFrameGeometry *fgeom, const MetaFrameBorders *borders,
gboolean include_frame, gboolean include_frame,
MetaRectangle *min_size, MetaRectangle *min_size,
MetaRectangle *max_size); MetaRectangle *max_size);
@ -279,7 +279,7 @@ do_all_constraints (MetaWindow *window,
void void
meta_window_constrain (MetaWindow *window, meta_window_constrain (MetaWindow *window,
MetaFrameGeometry *orig_fgeom, MetaFrameBorders *orig_borders,
MetaMoveResizeFlags flags, MetaMoveResizeFlags flags,
int resize_gravity, int resize_gravity,
const MetaRectangle *orig, const MetaRectangle *orig,
@ -302,7 +302,7 @@ meta_window_constrain (MetaWindow *window,
setup_constraint_info (&info, setup_constraint_info (&info,
window, window,
orig_fgeom, orig_borders,
flags, flags,
resize_gravity, resize_gravity,
orig, orig,
@ -337,14 +337,14 @@ meta_window_constrain (MetaWindow *window,
* not gobject-style--gobject would be more pain than it's worth) or * not gobject-style--gobject would be more pain than it's worth) or
* smart pointers would be so much nicer here. *shrug* * smart pointers would be so much nicer here. *shrug*
*/ */
if (!orig_fgeom) if (!orig_borders)
g_free (info.fgeom); g_free (info.borders);
} }
static void static void
setup_constraint_info (ConstraintInfo *info, setup_constraint_info (ConstraintInfo *info,
MetaWindow *window, MetaWindow *window,
MetaFrameGeometry *orig_fgeom, MetaFrameBorders *orig_borders,
MetaMoveResizeFlags flags, MetaMoveResizeFlags flags,
int resize_gravity, int resize_gravity,
const MetaRectangle *orig, const MetaRectangle *orig,
@ -357,10 +357,10 @@ setup_constraint_info (ConstraintInfo *info,
info->current = *new; info->current = *new;
/* Create a fake frame geometry if none really exists */ /* Create a fake frame geometry if none really exists */
if (orig_fgeom && !window->fullscreen) if (orig_borders && !window->fullscreen)
info->fgeom = orig_fgeom; info->borders = orig_borders;
else else
info->fgeom = g_new0 (MetaFrameGeometry, 1); info->borders = g_new0 (MetaFrameBorders, 1);
if (flags & META_IS_MOVE_ACTION && flags & META_IS_RESIZE_ACTION) if (flags & META_IS_MOVE_ACTION && flags & META_IS_RESIZE_ACTION)
info->action_type = ACTION_MOVE_AND_RESIZE; info->action_type = ACTION_MOVE_AND_RESIZE;
@ -461,7 +461,6 @@ setup_constraint_info (ConstraintInfo *info,
"Setting up constraint info:\n" "Setting up constraint info:\n"
" orig: %d,%d +%d,%d\n" " orig: %d,%d +%d,%d\n"
" new : %d,%d +%d,%d\n" " new : %d,%d +%d,%d\n"
" fgeom: %d,%d,%d,%d\n"
" action_type : %s\n" " action_type : %s\n"
" is_user_action : %s\n" " is_user_action : %s\n"
" resize_gravity : %s\n" " resize_gravity : %s\n"
@ -471,8 +470,6 @@ setup_constraint_info (ConstraintInfo *info,
info->orig.x, info->orig.y, info->orig.width, info->orig.height, info->orig.x, info->orig.y, info->orig.width, info->orig.height,
info->current.x, info->current.y, info->current.x, info->current.y,
info->current.width, info->current.height, 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_MOVE) ? "Move" :
(info->action_type == ACTION_RESIZE) ? "Resize" : (info->action_type == ACTION_RESIZE) ? "Resize" :
(info->action_type == ACTION_MOVE_AND_RESIZE) ? "Move&Resize" : (info->action_type == ACTION_MOVE_AND_RESIZE) ? "Move&Resize" :
@ -513,7 +510,7 @@ place_window_if_needed(MetaWindow *window,
MetaWorkspace *cur_workspace; MetaWorkspace *cur_workspace;
const MetaMonitorInfo *monitor_info; const MetaMonitorInfo *monitor_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); &placed_rect.x, &placed_rect.y);
did_placement = TRUE; did_placement = TRUE;
@ -573,7 +570,7 @@ place_window_if_needed(MetaWindow *window,
/* maximization may have changed frame geometry */ /* maximization may have changed frame geometry */
if (window->frame && !window->fullscreen) 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) if (window->fullscreen_after_placement)
{ {
@ -634,7 +631,7 @@ update_onscreen_requirements (MetaWindow *window,
/* The require onscreen/on-single-monitor and titlebar_visible /* The require onscreen/on-single-monitor and titlebar_visible
* stuff is relative to the outer window, not the inner * stuff is relative to the outer window, not the inner
*/ */
extend_by_frame (&info->current, info->fgeom); extend_by_frame (&info->current, info->borders);
/* Update whether we want future constraint runs to require the /* Update whether we want future constraint runs to require the
* window to be on fully onscreen. * window to be on fully onscreen.
@ -670,7 +667,7 @@ update_onscreen_requirements (MetaWindow *window,
MetaRectangle titlebar_rect; MetaRectangle titlebar_rect;
titlebar_rect = info->current; titlebar_rect = info->current;
titlebar_rect.height = info->fgeom->top_height; titlebar_rect.height = info->borders->visible.top;
old = window->require_titlebar_visible; old = window->require_titlebar_visible;
window->require_titlebar_visible = window->require_titlebar_visible =
meta_rectangle_overlaps_with_region (info->usable_screen_region, meta_rectangle_overlaps_with_region (info->usable_screen_region,
@ -683,32 +680,32 @@ update_onscreen_requirements (MetaWindow *window,
} }
/* Don't forget to restore the position of the window */ /* Don't forget to restore the position of the window */
unextend_by_frame (&info->current, info->fgeom); unextend_by_frame (&info->current, info->borders);
} }
static void static void
extend_by_frame (MetaRectangle *rect, extend_by_frame (MetaRectangle *rect,
const MetaFrameGeometry *fgeom) const MetaFrameBorders *borders)
{ {
rect->x -= fgeom->left_width; rect->x -= borders->visible.left;
rect->y -= fgeom->top_height; rect->y -= borders->visible.top;
rect->width += fgeom->left_width + fgeom->right_width; rect->width += borders->visible.left + borders->visible.right;
rect->height += fgeom->top_height + fgeom->bottom_height; rect->height += borders->visible.top + borders->visible.bottom;
} }
static void static void
unextend_by_frame (MetaRectangle *rect, unextend_by_frame (MetaRectangle *rect,
const MetaFrameGeometry *fgeom) const MetaFrameBorders *borders)
{ {
rect->x += fgeom->left_width; rect->x += borders->visible.left;
rect->y += fgeom->top_height; rect->y += borders->visible.top;
rect->width -= fgeom->left_width + fgeom->right_width; rect->width -= borders->visible.left + borders->visible.right;
rect->height -= fgeom->top_height + fgeom->bottom_height; rect->height -= borders->visible.top + borders->visible.bottom;
} }
static inline void static inline void
get_size_limits (const MetaWindow *window, get_size_limits (const MetaWindow *window,
const MetaFrameGeometry *fgeom, const MetaFrameBorders *borders,
gboolean include_frame, gboolean include_frame,
MetaRectangle *min_size, MetaRectangle *min_size,
MetaRectangle *max_size) MetaRectangle *max_size)
@ -723,8 +720,8 @@ get_size_limits (const MetaWindow *window,
if (include_frame) if (include_frame)
{ {
int fw = fgeom->left_width + fgeom->right_width; int fw = borders->visible.left + borders->visible.right;
int fh = fgeom->top_height + fgeom->bottom_height; int fh = borders->visible.top + borders->visible.bottom;
min_size->width += fw; min_size->width += fw;
min_size->height += fh; min_size->height += fh;
@ -761,18 +758,18 @@ constrain_modal_dialog (MetaWindow *window,
y = 0; y = 0;
if (parent->frame) if (parent->frame)
{ {
MetaFrameGeometry fgeom; MetaFrameBorders borders;
x += parent->frame->rect.x; x += parent->frame->rect.x;
y += parent->frame->rect.y; y += parent->frame->rect.y;
meta_frame_calc_geometry (parent->frame, &fgeom); meta_frame_calc_borders (parent->frame, &borders);
y += fgeom.top_height; y += borders.visible.top;
y += info->fgeom->top_height; y += info->borders->visible.top;
} }
else 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); constraint_already_satisfied = (x == info->current.x) && (y == info->current.y);
@ -831,19 +828,19 @@ constrain_maximization (MetaWindow *window,
active_workspace_struts = window->screen->active_workspace->all_struts; active_workspace_struts = window->screen->active_workspace->all_struts;
target_size = info->current; target_size = info->current;
extend_by_frame (&target_size, info->fgeom); extend_by_frame (&target_size, info->borders);
meta_rectangle_expand_to_avoiding_struts (&target_size, meta_rectangle_expand_to_avoiding_struts (&target_size,
&info->entire_monitor, &info->entire_monitor,
direction, direction,
active_workspace_struts); active_workspace_struts);
} }
/* Now make target_size = maximized size of client window */ /* Now make target_size = maximized size of client window */
unextend_by_frame (&target_size, info->fgeom); unextend_by_frame (&target_size, info->borders);
/* Check min size constraints; max size constraints are ignored for maximized /* Check min size constraints; max size constraints are ignored for maximized
* windows, as per bug 327543. * 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; hminbad = target_size.width < min_size.width && window->maximized_horizontally;
vminbad = target_size.height < min_size.height && window->maximized_vertically; vminbad = target_size.height < min_size.height && window->maximized_vertically;
if (hminbad || vminbad) if (hminbad || vminbad)
@ -897,12 +894,12 @@ constrain_tiling (MetaWindow *window,
* use an external function for the actual calculation * use an external function for the actual calculation
*/ */
meta_window_get_current_tile_area (window, &target_size); meta_window_get_current_tile_area (window, &target_size);
unextend_by_frame (&target_size, info->fgeom); unextend_by_frame (&target_size, info->borders);
/* Check min size constraints; max size constraints are ignored as for /* Check min size constraints; max size constraints are ignored as for
* maximized windows. * 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; hminbad = target_size.width < min_size.width;
vminbad = target_size.height < min_size.height; vminbad = target_size.height < min_size.height;
if (hminbad || vminbad) if (hminbad || vminbad)
@ -945,7 +942,7 @@ constrain_fullscreen (MetaWindow *window,
monitor = info->entire_monitor; monitor = info->entire_monitor;
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 (&monitor, &min_size); too_big = !meta_rectangle_could_fit_rect (&monitor, &min_size);
too_small = !meta_rectangle_could_fit_rect (&max_size, &monitor); too_small = !meta_rectangle_could_fit_rect (&max_size, &monitor);
if (too_big || too_small) if (too_big || too_small)
@ -1054,7 +1051,7 @@ constrain_size_limits (MetaWindow *window,
return TRUE; return TRUE;
/* Determine whether constraint is already satisfied; exit if it is */ /* 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 */ /* We ignore max-size limits for maximized windows; see #327543 */
if (window->maximized_horizontally) if (window->maximized_horizontally)
max_size.width = MAX (max_size.width, info->current.width); max_size.width = MAX (max_size.width, info->current.width);
@ -1246,8 +1243,8 @@ do_screen_and_monitor_relative_constraints (
/* Determine whether constraint applies; exit if it doesn't */ /* Determine whether constraint applies; exit if it doesn't */
how_far_it_can_be_smushed = info->current; how_far_it_can_be_smushed = info->current;
get_size_limits (window, info->fgeom, TRUE, &min_size, &max_size); get_size_limits (window, info->borders, TRUE, &min_size, &max_size);
extend_by_frame (&info->current, info->fgeom); extend_by_frame (&info->current, info->borders);
if (info->action_type != ACTION_MOVE) if (info->action_type != ACTION_MOVE)
{ {
@ -1267,7 +1264,7 @@ do_screen_and_monitor_relative_constraints (
&info->current); &info->current);
if (exit_early || constraint_satisfied || check_only) if (exit_early || constraint_satisfied || check_only)
{ {
unextend_by_frame (&info->current, info->fgeom); unextend_by_frame (&info->current, info->borders);
return constraint_satisfied; return constraint_satisfied;
} }
@ -1291,7 +1288,7 @@ do_screen_and_monitor_relative_constraints (
info->fixed_directions, info->fixed_directions,
&info->current); &info->current);
unextend_by_frame (&info->current, info->fgeom); unextend_by_frame (&info->current, info->borders);
return TRUE; return TRUE;
} }
@ -1404,8 +1401,8 @@ constrain_titlebar_visible (MetaWindow *window,
*/ */
if (window->frame) if (window->frame)
{ {
bottom_amount = info->current.height + info->fgeom->bottom_height; bottom_amount = info->current.height + info->borders->visible.bottom;
vert_amount_onscreen = info->fgeom->top_height; vert_amount_onscreen = info->borders->visible.top;
} }
else else
bottom_amount = vert_amount_offscreen; bottom_amount = vert_amount_offscreen;
@ -1479,8 +1476,8 @@ constrain_partially_onscreen (MetaWindow *window,
*/ */
if (window->frame) if (window->frame)
{ {
bottom_amount = info->current.height + info->fgeom->bottom_height; bottom_amount = info->current.height + info->borders->visible.bottom;
vert_amount_onscreen = info->fgeom->top_height; vert_amount_onscreen = info->borders->visible.top;
} }
else else
bottom_amount = vert_amount_offscreen; bottom_amount = vert_amount_offscreen;

View File

@ -39,7 +39,7 @@ typedef enum
} MetaMoveResizeFlags; } MetaMoveResizeFlags;
void meta_window_constrain (MetaWindow *window, void meta_window_constrain (MetaWindow *window,
MetaFrameGeometry *orig_fgeom, MetaFrameBorders *orig_borders,
MetaMoveResizeFlags flags, MetaMoveResizeFlags flags,
int resize_gravity, int resize_gravity,
const MetaRectangle *orig, const MetaRectangle *orig,

View File

@ -4311,11 +4311,7 @@ process_request_frame_extents (MetaDisplay *display,
&hints); &hints);
if ((hints_set && hints->decorations) || !hints_set) if ((hints_set && hints->decorations) || !hints_set)
{ {
int top = 0; MetaFrameBorders borders;
int bottom = 0;
int left = 0;
int right = 0;
MetaScreen *screen; MetaScreen *screen;
screen = meta_display_screen_for_xwindow (display, screen = meta_display_screen_for_xwindow (display,
@ -4333,15 +4329,11 @@ process_request_frame_extents (MetaDisplay *display,
meta_ui_theme_get_frame_borders (screen->ui, meta_ui_theme_get_frame_borders (screen->ui,
META_FRAME_TYPE_NORMAL, META_FRAME_TYPE_NORMAL,
0, 0,
&top, &borders);
&bottom, data[0] = borders.visible.left;
&left, data[1] = borders.visible.right;
&right); data[2] = borders.visible.top;
data[3] = borders.visible.bottom;
data[0] = left;
data[1] = right;
data[2] = top;
data[3] = bottom;
} }
meta_topic (META_DEBUG_GEOMETRY, meta_topic (META_DEBUG_GEOMETRY,

View File

@ -302,22 +302,12 @@ meta_frame_get_flags (MetaFrame *frame)
} }
void void
meta_frame_calc_geometry (MetaFrame *frame, meta_frame_calc_borders (MetaFrame *frame,
MetaFrameGeometry *geomp) MetaFrameBorders *borders)
{ {
MetaFrameGeometry geom; meta_ui_get_frame_borders (frame->window->screen->ui,
MetaWindow *window; frame->xwindow,
borders);
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;
} }
gboolean gboolean

View File

@ -26,17 +26,6 @@
#include "window-private.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 struct _MetaFrame
{ {
/* window we frame */ /* window we frame */
@ -71,8 +60,9 @@ MetaFrameFlags meta_frame_get_flags (MetaFrame *frame);
Window meta_frame_get_xwindow (MetaFrame *frame); Window meta_frame_get_xwindow (MetaFrame *frame);
/* These should ONLY be called from meta_window_move_resize_internal */ /* These should ONLY be called from meta_window_move_resize_internal */
void meta_frame_calc_geometry (MetaFrame *frame, void meta_frame_calc_borders (MetaFrame *frame,
MetaFrameGeometry *geomp); MetaFrameBorders *borders);
gboolean meta_frame_sync_to_window (MetaFrame *frame, gboolean meta_frame_sync_to_window (MetaFrame *frame,
int gravity, int gravity,
gboolean need_move, gboolean need_move,

View File

@ -90,7 +90,7 @@ northwestcmp (gconstpointer a, gconstpointer b)
static void static void
find_next_cascade (MetaWindow *window, find_next_cascade (MetaWindow *window,
MetaFrameGeometry *fgeom, MetaFrameBorders *borders,
/* visible windows on relevant workspaces */ /* visible windows on relevant workspaces */
GList *windows, GList *windows,
int x, int x,
@ -120,10 +120,10 @@ find_next_cascade (MetaWindow *window,
* manually cascade. * manually cascade.
*/ */
#define CASCADE_FUZZ 15 #define CASCADE_FUZZ 15
if (fgeom) if (borders)
{ {
x_threshold = MAX (fgeom->left_width, CASCADE_FUZZ); x_threshold = MAX (borders->visible.left, CASCADE_FUZZ);
y_threshold = MAX (fgeom->top_height, CASCADE_FUZZ); y_threshold = MAX (borders->visible.top, CASCADE_FUZZ);
} }
else else
{ {
@ -224,21 +224,21 @@ find_next_cascade (MetaWindow *window,
g_list_free (sorted); g_list_free (sorted);
/* Convert coords to position of window, not position of frame. */ /* Convert coords to position of window, not position of frame. */
if (fgeom == NULL) if (borders == NULL)
{ {
*new_x = cascade_x; *new_x = cascade_x;
*new_y = cascade_y; *new_y = cascade_y;
} }
else else
{ {
*new_x = cascade_x + fgeom->left_width; *new_x = cascade_x + borders->visible.left;
*new_y = cascade_y + fgeom->top_height; *new_y = cascade_y + borders->visible.top;
} }
} }
static void static void
find_most_freespace (MetaWindow *window, find_most_freespace (MetaWindow *window,
MetaFrameGeometry *fgeom, MetaFrameBorders *borders,
/* visible windows on relevant workspaces */ /* visible windows on relevant workspaces */
MetaWindow *focus_window, MetaWindow *focus_window,
int x, int x,
@ -255,8 +255,8 @@ find_most_freespace (MetaWindow *window,
MetaRectangle avoid; MetaRectangle avoid;
MetaRectangle outer; MetaRectangle outer;
frame_size_left = fgeom ? fgeom->left_width : 0; frame_size_left = borders ? borders->visible.left : 0;
frame_size_top = fgeom ? fgeom->top_height : 0; frame_size_top = borders ? borders->visible.top : 0;
meta_window_get_work_area_current_monitor (focus_window, &work_area); meta_window_get_work_area_current_monitor (focus_window, &work_area);
meta_window_get_outer_rect (focus_window, &avoid); meta_window_get_outer_rect (focus_window, &avoid);
@ -336,7 +336,7 @@ find_most_freespace (MetaWindow *window,
static void static void
avoid_being_obscured_as_second_modal_dialog (MetaWindow *window, avoid_being_obscured_as_second_modal_dialog (MetaWindow *window,
MetaFrameGeometry *fgeom, MetaFrameBorders *borders,
int *x, int *x,
int *y) int *y)
{ {
@ -366,7 +366,7 @@ avoid_being_obscured_as_second_modal_dialog (MetaWindow *window,
&focus_window->rect, &focus_window->rect,
&overlap)) &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, meta_topic (META_DEBUG_PLACEMENT,
"Dialog window %s was denied focus but may be modal " "Dialog window %s was denied focus but may be modal "
"to the focus window; had to move it to avoid the " "to the focus window; had to move it to avoid the "
@ -506,7 +506,7 @@ center_tile_rect_in_area (MetaRectangle *rect,
*/ */
static gboolean static gboolean
find_first_fit (MetaWindow *window, find_first_fit (MetaWindow *window,
MetaFrameGeometry *fgeom, MetaFrameBorders *borders,
/* visible windows on relevant workspaces */ /* visible windows on relevant workspaces */
GList *windows, GList *windows,
int monitor, int monitor,
@ -544,10 +544,10 @@ find_first_fit (MetaWindow *window,
rect.width = window->rect.width; rect.width = window->rect.width;
rect.height = window->rect.height; rect.height = window->rect.height;
if (fgeom) if (borders)
{ {
rect.width += fgeom->left_width + fgeom->right_width; rect.width += borders->visible.left + borders->visible.right;
rect.height += fgeom->top_height + fgeom->bottom_height; rect.height += borders->visible.top + borders->visible.bottom;
} }
#ifdef WITH_VERBOSE_MODE #ifdef WITH_VERBOSE_MODE
@ -570,10 +570,10 @@ find_first_fit (MetaWindow *window,
{ {
*new_x = rect.x; *new_x = rect.x;
*new_y = rect.y; *new_y = rect.y;
if (fgeom) if (borders)
{ {
*new_x += fgeom->left_width; *new_x += borders->visible.left;
*new_y += fgeom->top_height; *new_y += borders->visible.top;
} }
retval = TRUE; retval = TRUE;
@ -598,10 +598,10 @@ find_first_fit (MetaWindow *window,
{ {
*new_x = rect.x; *new_x = rect.x;
*new_y = rect.y; *new_y = rect.y;
if (fgeom) if (borders)
{ {
*new_x += fgeom->left_width; *new_x += borders->visible.left;
*new_y += fgeom->top_height; *new_y += borders->visible.top;
} }
retval = TRUE; retval = TRUE;
@ -629,10 +629,10 @@ find_first_fit (MetaWindow *window,
{ {
*new_x = rect.x; *new_x = rect.x;
*new_y = rect.y; *new_y = rect.y;
if (fgeom) if (borders)
{ {
*new_x += fgeom->left_width; *new_x += borders->visible.left;
*new_y += fgeom->top_height; *new_y += borders->visible.top;
} }
retval = TRUE; retval = TRUE;
@ -652,7 +652,7 @@ find_first_fit (MetaWindow *window,
void void
meta_window_place (MetaWindow *window, meta_window_place (MetaWindow *window,
MetaFrameGeometry *fgeom, MetaFrameBorders *borders,
int x, int x,
int y, int y,
int *new_x, int *new_x,
@ -662,12 +662,12 @@ meta_window_place (MetaWindow *window,
const MetaMonitorInfo *xi; const MetaMonitorInfo *xi;
/* frame member variables should NEVER be used in here, only /* 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 * for undecorated windows. Also, this function should
* NEVER have side effects other than computing the * NEVER have side effects other than computing the
* placement coordinates. * placement coordinates.
*/ */
meta_topic (META_DEBUG_PLACEMENT, "Placing window %s\n", window->desc); meta_topic (META_DEBUG_PLACEMENT, "Placing window %s\n", window->desc);
windows = NULL; windows = NULL;
@ -756,7 +756,7 @@ meta_window_place (MetaWindow *window,
{ {
meta_topic (META_DEBUG_PLACEMENT, meta_topic (META_DEBUG_PLACEMENT,
"Not placing window with PPosition or USPosition set\n"); "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; goto done_no_constraints;
} }
} }
@ -791,13 +791,13 @@ meta_window_place (MetaWindow *window,
y += (parent->rect.height - window->rect.height)/3; y += (parent->rect.height - window->rect.height)/3;
/* put top of child's frame, not top of child's client */ /* put top of child's frame, not top of child's client */
if (fgeom) if (borders)
y += fgeom->top_height; y += borders->visible.top;
meta_topic (META_DEBUG_PLACEMENT, "Centered window %s over transient parent\n", meta_topic (META_DEBUG_PLACEMENT, "Centered window %s over transient parent\n",
window->desc); 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; goto done;
} }
@ -866,7 +866,7 @@ meta_window_place (MetaWindow *window,
x = xi->rect.x; x = xi->rect.x;
y = xi->rect.y; y = xi->rect.y;
if (find_first_fit (window, fgeom, windows, if (find_first_fit (window, borders, windows,
xi->number, xi->number,
x, y, &x, &y)) x, y, &x, &y))
goto done_check_denied_focus; goto done_check_denied_focus;
@ -900,7 +900,7 @@ meta_window_place (MetaWindow *window,
* fully overlapping window (e.g. starting multiple terminals) * fully overlapping window (e.g. starting multiple terminals)
* */ * */
if (x == xi->rect.x && y == xi->rect.y) if (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: done_check_denied_focus:
/* If the window is being denied focus and isn't a transient of the /* If the window is being denied focus and isn't a transient of the
@ -934,7 +934,7 @@ meta_window_place (MetaWindow *window,
x = xi->rect.x; x = xi->rect.x;
y = xi->rect.y; 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, xi->number,
x, y, &x, &y); x, y, &x, &y);
g_list_free (focus_window_list); g_list_free (focus_window_list);
@ -944,7 +944,7 @@ meta_window_place (MetaWindow *window,
* as possible. * as possible.
*/ */
if (!found_fit) 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: done:

View File

@ -28,7 +28,7 @@
#include "frame.h" #include "frame.h"
void meta_window_place (MetaWindow *window, void meta_window_place (MetaWindow *window,
MetaFrameGeometry *fgeom, MetaFrameBorders *borders,
int x, int x,
int y, int y,
int *new_x, int *new_x,

View File

@ -3530,12 +3530,12 @@ meta_window_can_tile_side_by_side (MetaWindow *window)
if (window->frame) 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.width -= (borders.visible.left + borders.visible.right);
tile_area.height -= (fgeom.top_height + fgeom.bottom_height); tile_area.height -= (borders.visible.top + borders.visible.bottom);
} }
return tile_area.width >= window->size_hints.min_width && return tile_area.width >= window->size_hints.min_width &&
@ -4068,7 +4068,7 @@ meta_window_activate_with_workspace (MetaWindow *window,
*/ */
static void static void
adjust_for_gravity (MetaWindow *window, adjust_for_gravity (MetaWindow *window,
MetaFrameGeometry *fgeom, MetaFrameBorders *borders,
gboolean coords_assume_border, gboolean coords_assume_border,
int gravity, int gravity,
MetaRectangle *rect) MetaRectangle *rect)
@ -4083,12 +4083,12 @@ adjust_for_gravity (MetaWindow *window,
else else
bw = 0; bw = 0;
if (fgeom) if (borders)
{ {
child_x = fgeom->left_width; child_x = borders->visible.left;
child_y = fgeom->top_height; child_y = borders->visible.top;
frame_width = child_x + rect->width + fgeom->right_width; frame_width = child_x + rect->width + borders->visible.right;
frame_height = child_y + rect->height + fgeom->bottom_height; frame_height = child_y + rect->height + borders->visible.bottom;
} }
else else
{ {
@ -4344,7 +4344,7 @@ meta_window_move_resize_internal (MetaWindow *window,
XWindowChanges values; XWindowChanges values;
unsigned int mask; unsigned int mask;
gboolean need_configure_notify; gboolean need_configure_notify;
MetaFrameGeometry fgeom; MetaFrameBorders borders;
gboolean need_move_client = FALSE; gboolean need_move_client = FALSE;
gboolean need_move_frame = FALSE; gboolean need_move_frame = FALSE;
gboolean need_resize_client = FALSE; gboolean need_resize_client = FALSE;
@ -4389,8 +4389,8 @@ meta_window_move_resize_internal (MetaWindow *window,
old_rect.x, old_rect.y, old_rect.width, old_rect.height); old_rect.x, old_rect.y, old_rect.width, old_rect.height);
if (window->frame) if (window->frame)
meta_frame_calc_geometry (window->frame, meta_frame_calc_borders (window->frame,
&fgeom); &borders);
new_rect.x = root_x_nw; new_rect.x = root_x_nw;
new_rect.y = root_y_nw; new_rect.y = root_y_nw;
@ -4417,7 +4417,7 @@ meta_window_move_resize_internal (MetaWindow *window,
else if (is_configure_request || do_gravity_adjust) else if (is_configure_request || do_gravity_adjust)
{ {
adjust_for_gravity (window, adjust_for_gravity (window,
window->frame ? &fgeom : NULL, window->frame ? &borders : NULL,
/* configure request coords assume /* configure request coords assume
* the border width existed * the border width existed
*/ */
@ -4432,7 +4432,7 @@ meta_window_move_resize_internal (MetaWindow *window,
} }
meta_window_constrain (window, meta_window_constrain (window,
window->frame ? &fgeom : NULL, window->frame ? &borders : NULL,
flags, flags,
gravity, gravity,
&old_rect, &old_rect,
@ -4454,12 +4454,12 @@ meta_window_move_resize_internal (MetaWindow *window,
{ {
int new_w, new_h; 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) if (window->shaded)
new_h = fgeom.top_height; new_h = borders.visible.top;
else 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_dx = new_w - window->frame->rect.width;
frame_size_dy = new_h - window->frame->rect.height; frame_size_dy = new_h - window->frame->rect.height;
@ -4501,8 +4501,8 @@ meta_window_move_resize_internal (MetaWindow *window,
int frame_pos_dx, frame_pos_dy; int frame_pos_dx, frame_pos_dy;
/* Compute new frame coords */ /* Compute new frame coords */
new_x = root_x_nw - fgeom.left_width; new_x = root_x_nw - borders.visible.left;
new_y = root_y_nw - fgeom.top_height; new_y = root_y_nw - borders.visible.top;
frame_pos_dx = new_x - window->frame->rect.x; frame_pos_dx = new_x - window->frame->rect.x;
frame_pos_dy = new_y - window->frame->rect.y; frame_pos_dy = new_y - window->frame->rect.y;
@ -4525,8 +4525,8 @@ meta_window_move_resize_internal (MetaWindow *window,
* remember they are the server coords * remember they are the server coords
*/ */
new_x = fgeom.left_width; new_x = borders.visible.left;
new_y = fgeom.top_height; new_y = borders.visible.top;
if (need_resize_frame && need_move_frame && if (need_resize_frame && need_move_frame &&
static_gravity_works (window->display)) static_gravity_works (window->display))
@ -4597,15 +4597,15 @@ meta_window_move_resize_internal (MetaWindow *window,
/* If frame extents have changed, fill in other frame fields and /* If frame extents have changed, fill in other frame fields and
change frame's extents property. */ change frame's extents property. */
if (window->frame && if (window->frame &&
(window->frame->child_x != fgeom.left_width || (window->frame->child_x != borders.visible.left ||
window->frame->child_y != fgeom.top_height || window->frame->child_y != borders.visible.top ||
window->frame->right_width != fgeom.right_width || window->frame->right_width != borders.visible.right ||
window->frame->bottom_height != fgeom.bottom_height)) window->frame->bottom_height != borders.visible.bottom))
{ {
window->frame->child_x = fgeom.left_width; window->frame->child_x = borders.visible.left;
window->frame->child_y = fgeom.top_height; window->frame->child_y = borders.visible.top;
window->frame->right_width = fgeom.right_width; window->frame->right_width = borders.visible.right;
window->frame->bottom_height = fgeom.bottom_height; window->frame->bottom_height = borders.visible.bottom;
update_net_frame_extents (window); update_net_frame_extents (window);
} }

View File

@ -25,9 +25,10 @@
#ifndef META_COMMON_H #ifndef META_COMMON_H
#define 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 <X11/Xlib.h>
#include <glib.h> #include <glib.h>
#include <gtk/gtk.h>
typedef struct _MetaResizePopup MetaResizePopup; typedef struct _MetaResizePopup MetaResizePopup;
@ -302,6 +303,14 @@ struct _MetaButtonLayout
gboolean right_buttons_has_spacer[MAX_BUTTONS_PER_CORNER]; 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 */ /* should investigate changing these to whatever most apps use */
#define META_ICON_WIDTH 32 #define META_ICON_WIDTH 32
#define META_ICON_HEIGHT 32 #define META_ICON_HEIGHT 32

View File

@ -52,11 +52,7 @@ struct _MetaPreview
PangoLayout *layout; PangoLayout *layout;
int text_height; int text_height;
int left_width; MetaFrameBorders borders;
int right_width;
int top_height;
int bottom_height;
MetaButtonLayout button_layout; MetaButtonLayout button_layout;
}; };

View File

@ -790,10 +790,9 @@ meta_frames_lookup_window (MetaFrames *frames,
} }
void void
meta_frames_get_geometry (MetaFrames *frames, meta_frames_get_borders (MetaFrames *frames,
Window xwindow, Window xwindow,
int *top_height, int *bottom_height, MetaFrameBorders *borders)
int *left_width, int *right_width)
{ {
MetaFrameFlags flags; MetaFrameFlags flags;
MetaUIFrame *frame; MetaUIFrame *frame;
@ -822,8 +821,7 @@ meta_frames_get_geometry (MetaFrames *frames,
type, type,
frame->text_height, frame->text_height,
flags, flags,
top_height, bottom_height, borders);
left_width, right_width);
} }
void void
@ -2051,6 +2049,7 @@ populate_cache (MetaFrames *frames,
MetaUIFrame *frame) MetaUIFrame *frame)
{ {
int top, bottom, left, right; int top, bottom, left, right;
MetaFrameBorders borders;
int width, height; int width, height;
int frame_width, frame_height, screen_width, screen_height; int frame_width, frame_height, screen_width, screen_height;
CachedPixels *pixels; CachedPixels *pixels;
@ -2081,7 +2080,12 @@ populate_cache (MetaFrames *frames,
frame_type, frame_type,
frame->text_height, frame->text_height,
frame_flags, 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); pixels = get_cache (frames, frame);
@ -2168,6 +2172,7 @@ subtract_client_area (cairo_region_t *region,
cairo_rectangle_int_t area; cairo_rectangle_int_t area;
MetaFrameFlags flags; MetaFrameFlags flags;
MetaFrameType type; MetaFrameType type;
MetaFrameBorders borders;
cairo_region_t *tmp_region; cairo_region_t *tmp_region;
Display *display; Display *display;
@ -2180,8 +2185,11 @@ subtract_client_area (cairo_region_t *region,
META_CORE_GET_CLIENT_HEIGHT, &area.height, META_CORE_GET_CLIENT_HEIGHT, &area.height,
META_CORE_GET_END); META_CORE_GET_END);
meta_theme_get_frame_borders (meta_theme_get_current (), meta_theme_get_frame_borders (meta_theme_get_current (),
type, frame->text_height, flags, type, frame->text_height, flags,
&area.y, NULL, &area.x, NULL); &borders);
area.x = borders.visible.left;
area.y = borders.visible.top;
tmp_region = cairo_region_create_rectangle (&area); tmp_region = cairo_region_create_rectangle (&area);
cairo_region_subtract (region, tmp_region); cairo_region_subtract (region, tmp_region);

View File

@ -133,10 +133,9 @@ void meta_frames_update_frame_style (MetaFrames *frames,
void meta_frames_repaint_frame (MetaFrames *frames, void meta_frames_repaint_frame (MetaFrames *frames,
Window xwindow); Window xwindow);
void meta_frames_get_geometry (MetaFrames *frames, void meta_frames_get_borders (MetaFrames *frames,
Window xwindow, Window xwindow,
int *top_height, int *bottom_height, MetaFrameBorders *borders);
int *left_width, int *right_width);
void meta_frames_reset_bg (MetaFrames *frames, void meta_frames_reset_bg (MetaFrames *frames,
Window xwindow); Window xwindow);

View File

@ -94,10 +94,10 @@ meta_preview_init (MetaPreview *preview)
META_FRAME_ALLOWS_SHADE | META_FRAME_ALLOWS_SHADE |
META_FRAME_ALLOWS_MOVE; META_FRAME_ALLOWS_MOVE;
preview->left_width = -1; preview->borders.visible.left = -1;
preview->right_width = -1; preview->borders.visible.right = -1;
preview->top_height = -1; preview->borders.visible.top = -1;
preview->bottom_height = -1; preview->borders.visible.bottom = -1;
} }
GtkWidget* GtkWidget*
@ -168,7 +168,7 @@ ensure_info (MetaPreview *preview)
pango_font_description_free (font_desc); pango_font_description_free (font_desc);
} }
if (preview->top_height < 0) if (preview->borders.visible.top < 0)
{ {
if (preview->theme) if (preview->theme)
{ {
@ -176,17 +176,14 @@ ensure_info (MetaPreview *preview)
preview->type, preview->type,
preview->text_height, preview->text_height,
preview->flags, preview->flags,
&preview->top_height, &preview->borders);
&preview->bottom_height,
&preview->left_width,
&preview->right_width);
} }
else else
{ {
preview->top_height = 0; preview->borders.visible.top = 0;
preview->bottom_height = 0; preview->borders.visible.bottom = 0;
preview->left_width = 0; preview->borders.visible.left = 0;
preview->right_width = 0; preview->borders.visible.right = 0;
} }
} }
} }
@ -215,8 +212,8 @@ meta_preview_draw (GtkWidget *widget,
ensure_info (preview); ensure_info (preview);
cairo_save (cr); cairo_save (cr);
client_width = allocation.width - preview->left_width - preview->right_width; client_width = allocation.width - preview->borders.visible.left - preview->borders.visible.right;
client_height = allocation.height - preview->top_height - preview->bottom_height; client_height = allocation.height - preview->borders.visible.top - preview->borders.visible.bottom;
if (client_width < 0) if (client_width < 0)
client_width = 1; client_width = 1;
@ -258,7 +255,7 @@ meta_preview_get_preferred_width (GtkWidget *widget,
ensure_info (preview); 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)); child = gtk_bin_get_child (GTK_BIN (preview));
if (child && gtk_widget_get_visible (child)) if (child && gtk_widget_get_visible (child))
@ -289,7 +286,7 @@ meta_preview_get_preferred_height (GtkWidget *widget,
ensure_info (preview); 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)); child = gtk_bin_get_child (GTK_BIN (preview));
if (child && gtk_widget_get_visible (child)) if (child && gtk_widget_get_visible (child))
@ -326,11 +323,11 @@ meta_preview_size_allocate (GtkWidget *widget,
if (child && gtk_widget_get_visible (child)) if (child && gtk_widget_get_visible (child))
{ {
gtk_widget_get_allocation (widget, &widget_allocation); gtk_widget_get_allocation (widget, &widget_allocation);
child_allocation.x = widget_allocation.x + preview->left_width; child_allocation.x = widget_allocation.x + preview->borders.visible.left;
child_allocation.y = widget_allocation.y + preview->top_height; child_allocation.y = widget_allocation.y + preview->borders.visible.top;
child_allocation.width = MAX (1, widget_allocation.width - preview->left_width - preview->right_width); child_allocation.width = MAX (1, widget_allocation.width - preview->borders.visible.left - preview->borders.visible.right);
child_allocation.height = MAX (1, widget_allocation.height - preview->top_height - preview->bottom_height); child_allocation.height = MAX (1, widget_allocation.height - preview->borders.visible.top - preview->borders.visible.bottom);
gtk_widget_size_allocate (child, &child_allocation); gtk_widget_size_allocate (child, &child_allocation);
} }
@ -345,10 +342,10 @@ clear_cache (MetaPreview *preview)
preview->layout = NULL; preview->layout = NULL;
} }
preview->left_width = -1; preview->borders.visible.left = -1;
preview->right_width = -1; preview->borders.visible.right = -1;
preview->top_height = -1; preview->borders.visible.top = -1;
preview->bottom_height = -1; preview->borders.visible.bottom = -1;
} }
void void

View File

@ -928,10 +928,7 @@ void meta_frame_layout_unref (MetaFrameLayout *layout)
void meta_frame_layout_get_borders (const MetaFrameLayout *layout, void meta_frame_layout_get_borders (const MetaFrameLayout *layout,
int text_height, int text_height,
MetaFrameFlags flags, MetaFrameFlags flags,
int *top_height, MetaFrameBorders *borders);
int *bottom_height,
int *left_width,
int *right_width);
void meta_frame_layout_calc_geometry (const MetaFrameLayout *layout, void meta_frame_layout_calc_geometry (const MetaFrameLayout *layout,
int text_height, int text_height,
MetaFrameFlags flags, MetaFrameFlags flags,
@ -1124,10 +1121,8 @@ void meta_theme_get_frame_borders (MetaTheme *theme,
MetaFrameType type, MetaFrameType type,
int text_height, int text_height,
MetaFrameFlags flags, MetaFrameFlags flags,
int *top_height, MetaFrameBorders *borders);
int *bottom_height,
int *left_width,
int *right_width);
void meta_theme_calc_geometry (MetaTheme *theme, void meta_theme_calc_geometry (MetaTheme *theme,
MetaFrameType type, MetaFrameType type,
int text_height, int text_height,
@ -1136,7 +1131,7 @@ void meta_theme_calc_geometry (MetaTheme *theme,
int client_height, int client_height,
const MetaButtonLayout *button_layout, const MetaButtonLayout *button_layout,
MetaFrameGeometry *fgeom); MetaFrameGeometry *fgeom);
MetaFrameLayout* meta_theme_lookup_layout (MetaTheme *theme, MetaFrameLayout* meta_theme_lookup_layout (MetaTheme *theme,
const char *name); const char *name);
void meta_theme_insert_layout (MetaTheme *theme, void meta_theme_insert_layout (MetaTheme *theme,

View File

@ -959,7 +959,7 @@ run_theme_benchmark (void)
{ {
GtkWidget* widget; GtkWidget* widget;
cairo_surface_t *pixmap; cairo_surface_t *pixmap;
int top_height, bottom_height, left_width, right_width; MetaFrameBorders borders;
MetaButtonState button_states[META_BUTTON_TYPE_LAST] = MetaButtonState button_states[META_BUTTON_TYPE_LAST] =
{ {
META_BUTTON_STATE_NORMAL, META_BUTTON_STATE_NORMAL,
@ -986,10 +986,7 @@ run_theme_benchmark (void)
META_FRAME_TYPE_NORMAL, META_FRAME_TYPE_NORMAL,
get_text_height (widget), get_text_height (widget),
get_flags (widget), get_flags (widget),
&top_height, &borders);
&bottom_height,
&left_width,
&right_width);
layout = create_title_layout (widget); layout = create_title_layout (widget);
@ -1024,8 +1021,8 @@ run_theme_benchmark (void)
*/ */
pixmap = gdk_window_create_similar_surface (gtk_widget_get_window (widget), pixmap = gdk_window_create_similar_surface (gtk_widget_get_window (widget),
CAIRO_CONTENT_COLOR, CAIRO_CONTENT_COLOR,
client_width + left_width + right_width, client_width + borders.visible.left + borders.visible.right,
client_height + top_height + bottom_height); client_height + borders.visible.top + borders.visible.bottom);
cr = cairo_create (pixmap); cr = cairo_create (pixmap);

View File

@ -400,10 +400,7 @@ void
meta_frame_layout_get_borders (const MetaFrameLayout *layout, meta_frame_layout_get_borders (const MetaFrameLayout *layout,
int text_height, int text_height,
MetaFrameFlags flags, MetaFrameFlags flags,
int *top_height, MetaFrameBorders *borders)
int *bottom_height,
int *left_width,
int *right_width)
{ {
int buttons_height, title_height; int buttons_height, title_height;
@ -418,34 +415,20 @@ meta_frame_layout_get_borders (const MetaFrameLayout *layout,
layout->title_vertical_pad + layout->title_vertical_pad +
layout->title_border.top + layout->title_border.bottom; layout->title_border.top + layout->title_border.bottom;
if (top_height) borders->visible.top = MAX (buttons_height, title_height);
{ borders->visible.left = layout->left_width;
*top_height = MAX (buttons_height, title_height); borders->visible.right = layout->right_width;
} if (flags & META_FRAME_SHADED)
borders->visible.bottom = 0;
if (left_width) else
*left_width = layout->left_width; borders->visible.bottom = layout->bottom_height;
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;
}
if (flags & META_FRAME_FULLSCREEN) if (flags & META_FRAME_FULLSCREEN)
{ {
if (top_height) borders->visible.top = 0;
*top_height = 0; borders->visible.bottom = 0;
if (bottom_height) borders->visible.left = 0;
*bottom_height = 0; borders->visible.right = 0;
if (left_width)
*left_width = 0;
if (right_width)
*right_width = 0;
} }
} }
@ -634,13 +617,18 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout,
gboolean left_buttons_has_spacer[MAX_BUTTONS_PER_CORNER]; gboolean left_buttons_has_spacer[MAX_BUTTONS_PER_CORNER];
GdkRectangle *right_bg_rects[MAX_BUTTONS_PER_CORNER]; GdkRectangle *right_bg_rects[MAX_BUTTONS_PER_CORNER];
gboolean right_buttons_has_spacer[MAX_BUTTONS_PER_CORNER]; gboolean right_buttons_has_spacer[MAX_BUTTONS_PER_CORNER];
MetaFrameBorders borders;
meta_frame_layout_get_borders (layout, text_height, meta_frame_layout_get_borders (layout, text_height,
flags, flags,
&fgeom->top_height, &borders);
&fgeom->bottom_height,
&fgeom->left_width,
&fgeom->right_width); 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; width = client_width + fgeom->left_width + fgeom->right_width;
@ -5585,30 +5573,23 @@ meta_theme_draw_frame_by_name (MetaTheme *theme,
} }
void void
meta_theme_get_frame_borders (MetaTheme *theme, meta_theme_get_frame_borders (MetaTheme *theme,
MetaFrameType type, MetaFrameType type,
int text_height, int text_height,
MetaFrameFlags flags, MetaFrameFlags flags,
int *top_height, MetaFrameBorders *borders)
int *bottom_height,
int *left_width,
int *right_width)
{ {
MetaFrameStyle *style; MetaFrameStyle *style;
g_return_if_fail (type < META_FRAME_TYPE_LAST); 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); 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 */ /* Parser is not supposed to allow this currently */
if (style == NULL) if (style == NULL)
return; return;
@ -5616,8 +5597,7 @@ meta_theme_get_frame_borders (MetaTheme *theme,
meta_frame_layout_get_borders (style->layout, meta_frame_layout_get_borders (style->layout,
text_height, text_height,
flags, flags,
top_height, bottom_height, borders);
left_width, right_width);
} }
void void

View File

@ -306,14 +306,12 @@ meta_ui_free (MetaUI *ui)
} }
void void
meta_ui_get_frame_geometry (MetaUI *ui, meta_ui_get_frame_borders (MetaUI *ui,
Window frame_xwindow, Window frame_xwindow,
int *top_height, int *bottom_height, MetaFrameBorders *borders)
int *left_width, int *right_width)
{ {
meta_frames_get_geometry (ui->frames, frame_xwindow, meta_frames_get_borders (ui->frames, frame_xwindow,
top_height, bottom_height, borders);
left_width, right_width);
} }
Window Window
@ -712,10 +710,7 @@ void
meta_ui_theme_get_frame_borders (MetaUI *ui, meta_ui_theme_get_frame_borders (MetaUI *ui,
MetaFrameType type, MetaFrameType type,
MetaFrameFlags flags, MetaFrameFlags flags,
int *top_height, MetaFrameBorders *borders)
int *bottom_height,
int *left_width,
int *right_width)
{ {
int text_height; int text_height;
GtkStyleContext *style = NULL; GtkStyleContext *style = NULL;
@ -737,12 +732,14 @@ meta_ui_theme_get_frame_borders (MetaUI *ui,
meta_theme_get_frame_borders (meta_theme_get_current (), meta_theme_get_frame_borders (meta_theme_get_current (),
type, text_height, flags, type, text_height, flags,
top_height, bottom_height, borders);
left_width, right_width);
} }
else 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) if (style != NULL)

View File

@ -60,14 +60,10 @@ void meta_ui_free (MetaUI *ui);
void meta_ui_theme_get_frame_borders (MetaUI *ui, void meta_ui_theme_get_frame_borders (MetaUI *ui,
MetaFrameType type, MetaFrameType type,
MetaFrameFlags flags, MetaFrameFlags flags,
int *top_height, MetaFrameBorders *borders);
int *bottom_height, void meta_ui_get_frame_borders (MetaUI *ui,
int *left_width, Window frame_xwindow,
int *right_width); MetaFrameBorders *borders);
void meta_ui_get_frame_geometry (MetaUI *ui,
Window frame_xwindow,
int *top_height, int *bottom_height,
int *left_width, int *right_width);
Window meta_ui_create_frame_window (MetaUI *ui, Window meta_ui_create_frame_window (MetaUI *ui,
Display *xdisplay, Display *xdisplay,
Visual *xvisual, Visual *xvisual,