diff options
author | Pavel Artsishevsky <polter.rnd@gmail.com> | 2022-12-27 15:16:28 +0300 |
---|---|---|
committer | Pavel Artsishevsky <polter.rnd@gmail.com> | 2022-12-27 15:42:30 +0300 |
commit | 4b2c5f41af9c32583ef82b67bf3244573aea361b (patch) | |
tree | 8e5908838d74200cc460ea3cc45e587057e3d5c9 | |
parent | 90c323eedb1b45148a1f5b5bd4ef5ee3482964fc (diff) |
gtk: don't redraw decoration redundantly
When calculating border size we don't need to redraw the whole
decoration but only the title bar, it's enough to get correct height.
Also we don't need to redraw it every time, but only when window has
been maximized or tiled.
This dramatically improves window resize performance.
Signed-off-by: Pavel Artsishevsky <polter.rnd@gmail.com>
-rw-r--r-- | src/plugins/gtk/libdecor-gtk.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/plugins/gtk/libdecor-gtk.c b/src/plugins/gtk/libdecor-gtk.c index 661e526..228161e 100644 --- a/src/plugins/gtk/libdecor-gtk.c +++ b/src/plugins/gtk/libdecor-gtk.c @@ -1727,17 +1727,18 @@ libdecor_plugin_gtk_frame_get_border_size(struct libdecor_plugin *plugin, if (bottom) *bottom = 0; if (top) { - /* Redraw decoration to ensure size will be up-to-date */ - draw_decoration((struct libdecor_frame_gtk *) frame); - GtkWidget *header = ((struct libdecor_frame_gtk *)frame)->header; enum decoration_type type = window_state_to_decoration_type(window_state); /* avoid warnings after decoration has been turned off */ - if (GTK_IS_WIDGET(header) && (type != DECORATION_TYPE_NONE)) + if (GTK_IS_WIDGET(header) && (type != DECORATION_TYPE_NONE)) { + /* Redraw title bar to ensure size will be up-to-date */ + if (configuration && type == DECORATION_TYPE_TITLE_ONLY) + draw_title_bar((struct libdecor_frame_gtk *) frame); *top = gtk_widget_get_allocated_height(header); - else + } else { *top = 0; + } } return true; |