From 20acb73024cfbf562e81baae59a12a1d73a36881 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Fri, 27 Apr 2012 22:28:04 -0400 Subject: [PATCH] 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. --- src/core/frame.c | 14 ----- src/core/frame.h | 2 - src/core/window-private.h | 3 - src/core/window.c | 43 ++----------- src/meta/window.h | 2 - src/ui/frames.c | 129 -------------------------------------- src/ui/frames.h | 5 -- src/ui/theme-private.h | 6 -- src/ui/theme.c | 29 --------- src/ui/ui.c | 10 --- src/ui/ui.h | 5 -- 11 files changed, 6 insertions(+), 242 deletions(-) diff --git a/src/core/frame.c b/src/core/frame.c index dcc0548a4..937169e6d 100644 --- a/src/core/frame.c +++ b/src/core/frame.c @@ -220,11 +220,6 @@ meta_window_destroy_frame (MetaWindow *window) frame->xwindow); window->frame = NULL; - if (window->frame_bounds) - { - cairo_region_destroy (window->frame_bounds); - window->frame_bounds = NULL; - } /* Move keybindings to window instead of frame */ meta_window_grab_keys (window); @@ -387,15 +382,6 @@ meta_frame_sync_to_window (MetaFrame *frame, 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 meta_frame_queue_draw (MetaFrame *frame) { diff --git a/src/core/frame.h b/src/core/frame.h index 405a2d0f4..bcf9a80a1 100644 --- a/src/core/frame.h +++ b/src/core/frame.h @@ -71,8 +71,6 @@ gboolean meta_frame_sync_to_window (MetaFrame *frame, gboolean need_move, gboolean need_resize); -cairo_region_t *meta_frame_get_frame_bounds (MetaFrame *frame); - void meta_frame_set_screen_cursor (MetaFrame *frame, MetaCursor cursor); diff --git a/src/core/window-private.h b/src/core/window-private.h index d89924c8f..939ecac2b 100644 --- a/src/core/window-private.h +++ b/src/core/window-private.h @@ -333,9 +333,6 @@ struct _MetaWindow /* if TRUE, window is attached to its parent */ guint attached : 1; - /* if non-NULL, the bounds of the window frame */ - cairo_region_t *frame_bounds; - /* Note: can be NULL */ GSList *struts; diff --git a/src/core/window.c b/src/core/window.c index d76c9fb5c..6f8b3b389 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -217,9 +217,6 @@ meta_window_finalize (GObject *object) if (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); g_free (window->sm_client_id); @@ -4581,7 +4578,6 @@ meta_window_move_resize_internal (MetaWindow *window, gboolean need_resize_frame = FALSE; int size_dx; int size_dy; - gboolean frame_shape_changed = FALSE; gboolean is_configure_request; gboolean do_gravity_adjust; gboolean is_user_action; @@ -4880,9 +4876,9 @@ meta_window_move_resize_internal (MetaWindow *window, meta_window_set_gravity (window, StaticGravity); if (configure_frame_first && window->frame) - frame_shape_changed = meta_frame_sync_to_window (window->frame, - gravity, - need_move_frame, need_resize_frame); + meta_frame_sync_to_window (window->frame, + gravity, + need_move_frame, need_resize_frame); values.border_width = 0; values.x = client_move_x; @@ -4937,9 +4933,9 @@ meta_window_move_resize_internal (MetaWindow *window, } if (!configure_frame_first && window->frame) - frame_shape_changed = meta_frame_sync_to_window (window->frame, - gravity, - need_move_frame, need_resize_frame); + meta_frame_sync_to_window (window->frame, + gravity, + need_move_frame, need_resize_frame); /* Put gravity back to be nice to lesser window managers */ if (use_static_gravity) @@ -4982,12 +4978,6 @@ meta_window_move_resize_internal (MetaWindow *window, * 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_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: * @window: a #MetaWindow diff --git a/src/meta/window.h b/src/meta/window.h index 5e09b598a..dd595175f 100644 --- a/src/meta/window.h +++ b/src/meta/window.h @@ -167,8 +167,6 @@ const char *meta_window_get_mutter_hints (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); #endif diff --git a/src/ui/frames.c b/src/ui/frames.c index 08376285b..f06326a03 100644 --- a/src/ui/frames.c +++ b/src/ui/frames.c @@ -751,135 +751,6 @@ get_client_rect (MetaFrameGeometry *fgeom, 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; itop_right_corner_rounded_radius != 0) - { - const int corner = fgeom->top_right_corner_rounded_radius; - const float radius = corner; - int i; - - for (i=0; ibottom_left_corner_rounded_radius != 0) - { - const int corner = fgeom->bottom_left_corner_rounded_radius; - const float radius = corner; - int i; - - for (i=0; ibottom_right_corner_rounded_radius != 0) - { - const int corner = fgeom->bottom_right_corner_rounded_radius; - const float radius = corner; - int i; - - for (i=0; ititle_rect.width = 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; } /** diff --git a/src/ui/ui.c b/src/ui/ui.c index 20746caab..9fb7d1ff8 100644 --- a/src/ui/ui.c +++ b/src/ui/ui.c @@ -474,16 +474,6 @@ meta_ui_reset_frame_bg (MetaUI *ui, 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 meta_ui_queue_frame_draw (MetaUI *ui, Window xwindow) diff --git a/src/ui/ui.h b/src/ui/ui.h index 482fadd74..8651329bd 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -95,11 +95,6 @@ void meta_ui_unflicker_frame_bg (MetaUI *ui, void meta_ui_reset_frame_bg (MetaUI *ui, 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, Window xwindow, cairo_t *cr);