mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
frames: Remove get_frame_bounds
It's now unused, and we can't use it if we want to let GTK+ paint and scan the frame region. With it, we can also stop depending on the terrible GTK+ hack and remove the corner radius properties in the frame geometry, as they aren't needed any more.
This commit is contained in:
parent
b97ad209c2
commit
20acb73024
@ -220,11 +220,6 @@ meta_window_destroy_frame (MetaWindow *window)
|
|||||||
frame->xwindow);
|
frame->xwindow);
|
||||||
|
|
||||||
window->frame = NULL;
|
window->frame = NULL;
|
||||||
if (window->frame_bounds)
|
|
||||||
{
|
|
||||||
cairo_region_destroy (window->frame_bounds);
|
|
||||||
window->frame_bounds = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Move keybindings to window instead of frame */
|
/* Move keybindings to window instead of frame */
|
||||||
meta_window_grab_keys (window);
|
meta_window_grab_keys (window);
|
||||||
@ -387,15 +382,6 @@ meta_frame_sync_to_window (MetaFrame *frame,
|
|||||||
return need_resize;
|
return need_resize;
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_region_t *
|
|
||||||
meta_frame_get_frame_bounds (MetaFrame *frame)
|
|
||||||
{
|
|
||||||
return meta_ui_get_frame_bounds (frame->window->screen->ui,
|
|
||||||
frame->xwindow,
|
|
||||||
frame->rect.width,
|
|
||||||
frame->rect.height);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_frame_queue_draw (MetaFrame *frame)
|
meta_frame_queue_draw (MetaFrame *frame)
|
||||||
{
|
{
|
||||||
|
@ -71,8 +71,6 @@ gboolean meta_frame_sync_to_window (MetaFrame *frame,
|
|||||||
gboolean need_move,
|
gboolean need_move,
|
||||||
gboolean need_resize);
|
gboolean need_resize);
|
||||||
|
|
||||||
cairo_region_t *meta_frame_get_frame_bounds (MetaFrame *frame);
|
|
||||||
|
|
||||||
void meta_frame_set_screen_cursor (MetaFrame *frame,
|
void meta_frame_set_screen_cursor (MetaFrame *frame,
|
||||||
MetaCursor cursor);
|
MetaCursor cursor);
|
||||||
|
|
||||||
|
@ -333,9 +333,6 @@ struct _MetaWindow
|
|||||||
/* if TRUE, window is attached to its parent */
|
/* if TRUE, window is attached to its parent */
|
||||||
guint attached : 1;
|
guint attached : 1;
|
||||||
|
|
||||||
/* if non-NULL, the bounds of the window frame */
|
|
||||||
cairo_region_t *frame_bounds;
|
|
||||||
|
|
||||||
/* Note: can be NULL */
|
/* Note: can be NULL */
|
||||||
GSList *struts;
|
GSList *struts;
|
||||||
|
|
||||||
|
@ -217,9 +217,6 @@ meta_window_finalize (GObject *object)
|
|||||||
if (window->mini_icon)
|
if (window->mini_icon)
|
||||||
g_object_unref (G_OBJECT (window->mini_icon));
|
g_object_unref (G_OBJECT (window->mini_icon));
|
||||||
|
|
||||||
if (window->frame_bounds)
|
|
||||||
cairo_region_destroy (window->frame_bounds);
|
|
||||||
|
|
||||||
meta_icon_cache_free (&window->icon_cache);
|
meta_icon_cache_free (&window->icon_cache);
|
||||||
|
|
||||||
g_free (window->sm_client_id);
|
g_free (window->sm_client_id);
|
||||||
@ -4581,7 +4578,6 @@ meta_window_move_resize_internal (MetaWindow *window,
|
|||||||
gboolean need_resize_frame = FALSE;
|
gboolean need_resize_frame = FALSE;
|
||||||
int size_dx;
|
int size_dx;
|
||||||
int size_dy;
|
int size_dy;
|
||||||
gboolean frame_shape_changed = FALSE;
|
|
||||||
gboolean is_configure_request;
|
gboolean is_configure_request;
|
||||||
gboolean do_gravity_adjust;
|
gboolean do_gravity_adjust;
|
||||||
gboolean is_user_action;
|
gboolean is_user_action;
|
||||||
@ -4880,7 +4876,7 @@ meta_window_move_resize_internal (MetaWindow *window,
|
|||||||
meta_window_set_gravity (window, StaticGravity);
|
meta_window_set_gravity (window, StaticGravity);
|
||||||
|
|
||||||
if (configure_frame_first && window->frame)
|
if (configure_frame_first && window->frame)
|
||||||
frame_shape_changed = meta_frame_sync_to_window (window->frame,
|
meta_frame_sync_to_window (window->frame,
|
||||||
gravity,
|
gravity,
|
||||||
need_move_frame, need_resize_frame);
|
need_move_frame, need_resize_frame);
|
||||||
|
|
||||||
@ -4937,7 +4933,7 @@ meta_window_move_resize_internal (MetaWindow *window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!configure_frame_first && window->frame)
|
if (!configure_frame_first && window->frame)
|
||||||
frame_shape_changed = meta_frame_sync_to_window (window->frame,
|
meta_frame_sync_to_window (window->frame,
|
||||||
gravity,
|
gravity,
|
||||||
need_move_frame, need_resize_frame);
|
need_move_frame, need_resize_frame);
|
||||||
|
|
||||||
@ -4982,12 +4978,6 @@ meta_window_move_resize_internal (MetaWindow *window,
|
|||||||
* b) all constraints are obeyed by window->rect and frame->rect
|
* b) all constraints are obeyed by window->rect and frame->rect
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (frame_shape_changed && window->frame_bounds)
|
|
||||||
{
|
|
||||||
cairo_region_destroy (window->frame_bounds);
|
|
||||||
window->frame_bounds = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
meta_window_foreach_transient (window, maybe_move_attached_dialog, NULL);
|
meta_window_foreach_transient (window, maybe_move_attached_dialog, NULL);
|
||||||
|
|
||||||
meta_stack_update_window_tile_matches (window->screen->stack,
|
meta_stack_update_window_tile_matches (window->screen->stack,
|
||||||
@ -10649,27 +10639,6 @@ meta_window_get_frame_type (MetaWindow *window)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* meta_window_get_frame_bounds:
|
|
||||||
*
|
|
||||||
* Gets a region representing the outer bounds of the window's frame.
|
|
||||||
*
|
|
||||||
* Return value: (transfer none) (allow-none): a #cairo_region_t
|
|
||||||
* holding the outer bounds of the window, or %NULL if the window
|
|
||||||
* doesn't have a frame.
|
|
||||||
*/
|
|
||||||
cairo_region_t *
|
|
||||||
meta_window_get_frame_bounds (MetaWindow *window)
|
|
||||||
{
|
|
||||||
if (!window->frame_bounds)
|
|
||||||
{
|
|
||||||
if (window->frame)
|
|
||||||
window->frame_bounds = meta_frame_get_frame_bounds (window->frame);
|
|
||||||
}
|
|
||||||
|
|
||||||
return window->frame_bounds;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* meta_window_is_attached_dialog:
|
* meta_window_is_attached_dialog:
|
||||||
* @window: a #MetaWindow
|
* @window: a #MetaWindow
|
||||||
|
@ -167,8 +167,6 @@ const char *meta_window_get_mutter_hints (MetaWindow *window);
|
|||||||
|
|
||||||
MetaFrameType meta_window_get_frame_type (MetaWindow *window);
|
MetaFrameType meta_window_get_frame_type (MetaWindow *window);
|
||||||
|
|
||||||
cairo_region_t *meta_window_get_frame_bounds (MetaWindow *window);
|
|
||||||
|
|
||||||
MetaWindow *meta_window_get_tile_match (MetaWindow *window);
|
MetaWindow *meta_window_get_tile_match (MetaWindow *window);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
129
src/ui/frames.c
129
src/ui/frames.c
@ -751,135 +751,6 @@ get_client_rect (MetaFrameGeometry *fgeom,
|
|||||||
rect->height = window_height - fgeom->borders.total.bottom - rect->y;
|
rect->height = window_height - fgeom->borders.total.bottom - rect->y;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The visible frame rectangle surrounds the visible portion of the
|
|
||||||
* frame window; it subtracts only the invisible borders from the frame
|
|
||||||
* window's size.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
get_visible_frame_rect (MetaFrameGeometry *fgeom,
|
|
||||||
int window_width,
|
|
||||||
int window_height,
|
|
||||||
cairo_rectangle_int_t *rect)
|
|
||||||
{
|
|
||||||
rect->x = fgeom->borders.invisible.left;
|
|
||||||
rect->y = fgeom->borders.invisible.top;
|
|
||||||
rect->width = window_width - fgeom->borders.invisible.right - rect->x;
|
|
||||||
rect->height = window_height - fgeom->borders.invisible.bottom - rect->y;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cairo_region_t *
|
|
||||||
get_visible_region (MetaFrames *frames,
|
|
||||||
MetaUIFrame *frame,
|
|
||||||
MetaFrameGeometry *fgeom,
|
|
||||||
int window_width,
|
|
||||||
int window_height)
|
|
||||||
{
|
|
||||||
cairo_region_t *corners_region;
|
|
||||||
cairo_region_t *visible_region;
|
|
||||||
cairo_rectangle_int_t rect;
|
|
||||||
cairo_rectangle_int_t frame_rect;
|
|
||||||
|
|
||||||
corners_region = cairo_region_create ();
|
|
||||||
get_visible_frame_rect (fgeom, window_width, window_height, &frame_rect);
|
|
||||||
|
|
||||||
if (fgeom->top_left_corner_rounded_radius != 0)
|
|
||||||
{
|
|
||||||
const int corner = fgeom->top_left_corner_rounded_radius;
|
|
||||||
const float radius = corner;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i=0; i<corner; i++)
|
|
||||||
{
|
|
||||||
const int width = floor(0.5 + radius - sqrt(radius*radius - (radius-(i+0.5))*(radius-(i+0.5))));
|
|
||||||
rect.x = frame_rect.x;
|
|
||||||
rect.y = frame_rect.y + i;
|
|
||||||
rect.width = width;
|
|
||||||
rect.height = 1;
|
|
||||||
|
|
||||||
cairo_region_union_rectangle (corners_region, &rect);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fgeom->top_right_corner_rounded_radius != 0)
|
|
||||||
{
|
|
||||||
const int corner = fgeom->top_right_corner_rounded_radius;
|
|
||||||
const float radius = corner;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i=0; i<corner; i++)
|
|
||||||
{
|
|
||||||
const int width = floor(0.5 + radius - sqrt(radius*radius - (radius-(i+0.5))*(radius-(i+0.5))));
|
|
||||||
rect.x = frame_rect.x + frame_rect.width - width;
|
|
||||||
rect.y = frame_rect.y + i;
|
|
||||||
rect.width = width;
|
|
||||||
rect.height = 1;
|
|
||||||
|
|
||||||
cairo_region_union_rectangle (corners_region, &rect);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fgeom->bottom_left_corner_rounded_radius != 0)
|
|
||||||
{
|
|
||||||
const int corner = fgeom->bottom_left_corner_rounded_radius;
|
|
||||||
const float radius = corner;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i=0; i<corner; i++)
|
|
||||||
{
|
|
||||||
const int width = floor(0.5 + radius - sqrt(radius*radius - (radius-(i+0.5))*(radius-(i+0.5))));
|
|
||||||
rect.x = frame_rect.x;
|
|
||||||
rect.y = frame_rect.y + frame_rect.height - i - 1;
|
|
||||||
rect.width = width;
|
|
||||||
rect.height = 1;
|
|
||||||
|
|
||||||
cairo_region_union_rectangle (corners_region, &rect);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fgeom->bottom_right_corner_rounded_radius != 0)
|
|
||||||
{
|
|
||||||
const int corner = fgeom->bottom_right_corner_rounded_radius;
|
|
||||||
const float radius = corner;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i=0; i<corner; i++)
|
|
||||||
{
|
|
||||||
const int width = floor(0.5 + radius - sqrt(radius*radius - (radius-(i+0.5))*(radius-(i+0.5))));
|
|
||||||
rect.x = frame_rect.x + frame_rect.width - width;
|
|
||||||
rect.y = frame_rect.y + frame_rect.height - i - 1;
|
|
||||||
rect.width = width;
|
|
||||||
rect.height = 1;
|
|
||||||
|
|
||||||
cairo_region_union_rectangle (corners_region, &rect);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
visible_region = cairo_region_create_rectangle (&frame_rect);
|
|
||||||
cairo_region_subtract (visible_region, corners_region);
|
|
||||||
cairo_region_destroy (corners_region);
|
|
||||||
|
|
||||||
return visible_region;
|
|
||||||
}
|
|
||||||
|
|
||||||
cairo_region_t *
|
|
||||||
meta_frames_get_frame_bounds (MetaFrames *frames,
|
|
||||||
Window xwindow,
|
|
||||||
int window_width,
|
|
||||||
int window_height)
|
|
||||||
{
|
|
||||||
MetaUIFrame *frame;
|
|
||||||
MetaFrameGeometry fgeom;
|
|
||||||
|
|
||||||
frame = meta_frames_lookup_window (frames, xwindow);
|
|
||||||
g_return_val_if_fail (frame != NULL, NULL);
|
|
||||||
|
|
||||||
meta_frames_calc_geometry (frames, frame, &fgeom);
|
|
||||||
|
|
||||||
return get_visible_region (frames, frame,
|
|
||||||
&fgeom,
|
|
||||||
window_width, window_height);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_frames_move_resize_frame (MetaFrames *frames,
|
meta_frames_move_resize_frame (MetaFrames *frames,
|
||||||
Window xwindow,
|
Window xwindow,
|
||||||
|
@ -138,11 +138,6 @@ void meta_frames_unflicker_bg (MetaFrames *frames,
|
|||||||
int target_width,
|
int target_width,
|
||||||
int target_height);
|
int target_height);
|
||||||
|
|
||||||
cairo_region_t *meta_frames_get_frame_bounds (MetaFrames *frames,
|
|
||||||
Window xwindow,
|
|
||||||
int window_width,
|
|
||||||
int window_height);
|
|
||||||
|
|
||||||
void meta_frames_render_background (MetaFrames *frames,
|
void meta_frames_render_background (MetaFrames *frames,
|
||||||
Window xwindow,
|
Window xwindow,
|
||||||
cairo_t *cr);
|
cairo_t *cr);
|
||||||
|
@ -252,12 +252,6 @@ struct _MetaFrameGeometry
|
|||||||
MetaButtonLayout button_layout;
|
MetaButtonLayout button_layout;
|
||||||
int n_left_buttons;
|
int n_left_buttons;
|
||||||
int n_right_buttons;
|
int n_right_buttons;
|
||||||
|
|
||||||
/* Round corners */
|
|
||||||
guint top_left_corner_rounded_radius;
|
|
||||||
guint top_right_corner_rounded_radius;
|
|
||||||
guint bottom_left_corner_rounded_radius;
|
|
||||||
guint bottom_right_corner_rounded_radius;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
|
@ -543,8 +543,6 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout,
|
|||||||
int title_right_edge;
|
int title_right_edge;
|
||||||
int width, height;
|
int width, height;
|
||||||
int button_width, button_height;
|
int button_width, button_height;
|
||||||
int min_size_for_rounding;
|
|
||||||
double tl, tr, bl, br;
|
|
||||||
|
|
||||||
/* the left/right rects in order; the max # of rects
|
/* the left/right rects in order; the max # of rects
|
||||||
* is the number of button functions
|
* is the number of button functions
|
||||||
@ -874,33 +872,6 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout,
|
|||||||
fgeom->title_rect.width = 0;
|
fgeom->title_rect.width = 0;
|
||||||
fgeom->title_rect.height = 0;
|
fgeom->title_rect.height = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & META_FRAME_SHADED)
|
|
||||||
min_size_for_rounding = 0;
|
|
||||||
else
|
|
||||||
min_size_for_rounding = 5;
|
|
||||||
|
|
||||||
fgeom->top_left_corner_rounded_radius = 0;
|
|
||||||
fgeom->top_right_corner_rounded_radius = 0;
|
|
||||||
fgeom->bottom_left_corner_rounded_radius = 0;
|
|
||||||
fgeom->bottom_right_corner_rounded_radius = 0;
|
|
||||||
|
|
||||||
gtk_style_context_get (ctx,
|
|
||||||
GTK_STATE_ACTIVE,
|
|
||||||
"border-top-left-radius", &tl,
|
|
||||||
"border-top-right-radius", &tr,
|
|
||||||
"border-bottom-left-radius", &bl,
|
|
||||||
"border-bottom-right-radius", &br,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
if (borders.visible.top + borders.visible.left >= min_size_for_rounding)
|
|
||||||
fgeom->top_left_corner_rounded_radius = tl;
|
|
||||||
if (borders.visible.top + borders.visible.right >= min_size_for_rounding)
|
|
||||||
fgeom->top_right_corner_rounded_radius = tr;
|
|
||||||
if (borders.visible.bottom + borders.visible.left >= min_size_for_rounding)
|
|
||||||
fgeom->bottom_left_corner_rounded_radius = bl;
|
|
||||||
if (borders.visible.bottom + borders.visible.right >= min_size_for_rounding)
|
|
||||||
fgeom->bottom_right_corner_rounded_radius = br;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
10
src/ui/ui.c
10
src/ui/ui.c
@ -474,16 +474,6 @@ meta_ui_reset_frame_bg (MetaUI *ui,
|
|||||||
meta_frames_reset_bg (ui->frames, xwindow);
|
meta_frames_reset_bg (ui->frames, xwindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_region_t *
|
|
||||||
meta_ui_get_frame_bounds (MetaUI *ui,
|
|
||||||
Window xwindow,
|
|
||||||
int window_width,
|
|
||||||
int window_height)
|
|
||||||
{
|
|
||||||
return meta_frames_get_frame_bounds (ui->frames, xwindow,
|
|
||||||
window_width, window_height);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_ui_queue_frame_draw (MetaUI *ui,
|
meta_ui_queue_frame_draw (MetaUI *ui,
|
||||||
Window xwindow)
|
Window xwindow)
|
||||||
|
@ -95,11 +95,6 @@ void meta_ui_unflicker_frame_bg (MetaUI *ui,
|
|||||||
void meta_ui_reset_frame_bg (MetaUI *ui,
|
void meta_ui_reset_frame_bg (MetaUI *ui,
|
||||||
Window xwindow);
|
Window xwindow);
|
||||||
|
|
||||||
cairo_region_t *meta_ui_get_frame_bounds (MetaUI *ui,
|
|
||||||
Window xwindow,
|
|
||||||
int window_width,
|
|
||||||
int window_height);
|
|
||||||
|
|
||||||
void meta_ui_render_background (MetaUI *ui,
|
void meta_ui_render_background (MetaUI *ui,
|
||||||
Window xwindow,
|
Window xwindow,
|
||||||
cairo_t *cr);
|
cairo_t *cr);
|
||||||
|
Loading…
Reference in New Issue
Block a user