diff options
-rw-r--r-- | src/core/core.c | 1 | ||||
-rw-r--r-- | src/core/display.c | 2 | ||||
-rw-r--r-- | src/core/frame-private.h | 6 | ||||
-rw-r--r-- | src/core/frame.c | 26 | ||||
-rw-r--r-- | src/core/window-private.h | 2 | ||||
-rw-r--r-- | src/core/window.c | 25 |
6 files changed, 57 insertions, 5 deletions
diff --git a/src/core/core.c b/src/core/core.c index 38a62a1c..b679ebf8 100644 --- a/src/core/core.c +++ b/src/core/core.c @@ -232,6 +232,7 @@ meta_core_queue_frame_resize (Display *xdisplay, MetaWindow *window = get_window (xdisplay, frame_xwindow); meta_window_queue (window, META_QUEUE_MOVE_RESIZE); + meta_window_frame_size_changed (window); } void diff --git a/src/core/display.c b/src/core/display.c index 1cffd62f..d83c7b3d 100644 --- a/src/core/display.c +++ b/src/core/display.c @@ -4071,6 +4071,8 @@ meta_display_queue_retheme_all_windows (MetaDisplay *display) MetaWindow *window = tmp->data; meta_window_queue (window, META_QUEUE_MOVE_RESIZE); + meta_window_frame_size_changed (window); + if (window->frame) { window->frame->need_reapply_frame_shape = TRUE; diff --git a/src/core/frame-private.h b/src/core/frame-private.h index bae2616c..ec94d4e2 100644 --- a/src/core/frame-private.h +++ b/src/core/frame-private.h @@ -40,6 +40,9 @@ struct _MetaFrame */ MetaRectangle rect; + /* valid if borders_cached is set */ + MetaFrameBorders cached_borders; + /* position of client, size of frame */ int child_x; int child_y; @@ -49,6 +52,7 @@ struct _MetaFrame guint mapped : 1; guint need_reapply_frame_shape : 1; guint is_flashing : 1; /* used by the visual bell flash */ + guint borders_cached : 1; }; void meta_window_ensure_frame (MetaWindow *window); @@ -62,6 +66,8 @@ gboolean meta_frame_sync_to_window (MetaFrame *frame, gboolean need_move, gboolean need_resize); +void meta_frame_clear_cached_borders (MetaFrame *frame); + cairo_region_t *meta_frame_get_frame_bounds (MetaFrame *frame); void meta_frame_set_screen_cursor (MetaFrame *frame, diff --git a/src/core/frame.c b/src/core/frame.c index 93ed8847..03d4e66a 100644 --- a/src/core/frame.c +++ b/src/core/frame.c @@ -83,6 +83,7 @@ meta_window_ensure_frame (MetaWindow *window) frame->mapped = FALSE; frame->need_reapply_frame_shape = TRUE; frame->is_flashing = FALSE; + frame->borders_cached = FALSE; meta_verbose ("Framing window %s: visual %s default, depth %d default depth %d\n", window->desc, @@ -340,9 +341,28 @@ void meta_frame_calc_borders (MetaFrame *frame, MetaFrameBorders *borders) { - meta_ui_get_frame_borders (frame->window->screen->ui, - frame->xwindow, - borders); + if (frame == NULL) + { + meta_frame_borders_clear (borders); + } + else + { + if (!frame->borders_cached) + { + meta_ui_get_frame_borders (frame->window->screen->ui, + frame->xwindow, + &frame->cached_borders); + frame->borders_cached = TRUE; + } + + *borders = frame->cached_borders; + } +} + +void +meta_frame_clear_cached_borders (MetaFrame *frame) +{ + frame->borders_cached = FALSE; } static gboolean diff --git a/src/core/window-private.h b/src/core/window-private.h index 1f201bee..0d917b02 100644 --- a/src/core/window-private.h +++ b/src/core/window-private.h @@ -649,6 +649,8 @@ const char* meta_window_get_startup_id (MetaWindow *window); void meta_window_recalc_features (MetaWindow *window); void meta_window_recalc_window_type (MetaWindow *window); +void meta_window_frame_size_changed (MetaWindow *window); + void meta_window_stack_just_above (MetaWindow *window, MetaWindow *above_this_one); void meta_window_stack_just_below (MetaWindow *window, diff --git a/src/core/window.c b/src/core/window.c index 7eac51c5..07ed8afa 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -2828,6 +2828,8 @@ meta_window_make_above (MetaWindow *window) meta_window_update_layer (window); meta_window_raise (window); set_net_wm_state (window); + + meta_window_frame_size_changed (window); } void @@ -2837,6 +2839,8 @@ meta_window_unmake_above (MetaWindow *window) meta_window_raise (window); meta_window_update_layer (window); set_net_wm_state (window); + + meta_window_frame_size_changed (window); } void @@ -2961,7 +2965,8 @@ meta_window_shade (MetaWindow *window, { window->shaded = TRUE; - meta_window_queue(window, META_QUEUE_MOVE_RESIZE | META_QUEUE_CALC_SHOWING); + meta_window_queue (window, META_QUEUE_MOVE_RESIZE | META_QUEUE_CALC_SHOWING); + meta_window_frame_size_changed (window); /* After queuing the calc showing, since _focus flushes it, * and we need to focus the frame @@ -2984,7 +2989,9 @@ meta_window_unshade (MetaWindow *window, if (window->shaded) { window->shaded = FALSE; - meta_window_queue(window, META_QUEUE_MOVE_RESIZE | META_QUEUE_CALC_SHOWING); + + meta_window_queue (window, META_QUEUE_MOVE_RESIZE | META_QUEUE_CALC_SHOWING); + meta_window_frame_size_changed (window); /* focus the window */ meta_topic (META_DEBUG_FOCUS, @@ -4437,6 +4444,8 @@ window_stick_impl (MetaWindow *window) */ window->on_all_workspaces = TRUE; + meta_window_frame_size_changed (window); + /* We do, however, change the MRU lists of all the workspaces */ tmp = window->screen->workspaces; @@ -4467,6 +4476,8 @@ window_unstick_impl (MetaWindow *window) window->on_all_workspaces = FALSE; + meta_window_frame_size_changed (window); + /* Remove window from MRU lists that it doesn't belong in */ tmp = window->screen->workspaces; while (tmp) @@ -5515,6 +5526,7 @@ static void meta_window_appears_focused_changed (MetaWindow *window) { set_net_wm_state (window); + meta_window_frame_size_changed (window); if (window->frame) meta_frame_queue_draw (window->frame); @@ -6297,6 +6309,13 @@ recalc_window_type (MetaWindow *window) } } +void +meta_window_frame_size_changed (MetaWindow *window) +{ + if (window->frame) + meta_frame_clear_cached_borders (window->frame); +} + static void set_allowed_actions_hint (MetaWindow *window) { @@ -6588,6 +6607,8 @@ recalc_window_features (MetaWindow *window) old_always_sticky != window->always_sticky) set_allowed_actions_hint (window); + meta_window_frame_size_changed (window); + /* FIXME perhaps should ensure if we don't have a shade func, * we aren't shaded, etc. */ |