aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-02-25 18:51:03 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-02-25 18:51:03 +0000
commit595b32ddf99d40fa5c51f7b3e0696a27cc6adb28 (patch)
tree7e7a2d303312bcc335c2404dec6d406a5d2e5776
parentwayland: decoration-configure: call render_resize() to add/remove CSDs (diff)
render: render_resize_*() returns a boolean indicating whether size changed.
-rw-r--r--render.c16
-rw-r--r--render.h5
2 files changed, 12 insertions, 9 deletions
diff --git a/render.c b/render.c
index 29a47cfc..460ffd74 100644
--- a/render.c
+++ b/render.c
@@ -1114,11 +1114,11 @@ render_search_box(struct terminal *term)
}
/* Move to terminal.c? */
-static void
+static bool
maybe_resize(struct terminal *term, int width, int height, bool force)
{
if (!force && (width == 0 || height == 0))
- return;
+ return false;
int scale = -1;
tll_foreach(term->window->on_outputs, it) {
@@ -1136,7 +1136,7 @@ maybe_resize(struct terminal *term, int width, int height, bool force)
if (!force && width == 0 && height == 0) {
/* Assume we're not fully up and running yet */
- return;
+ return false;
}
/* Scaled CSD border + title bar sizes */
@@ -1161,7 +1161,7 @@ maybe_resize(struct terminal *term, int width, int height, bool force)
height = max(height, min_height);
if (!force && width == term->width && height == term->height && scale == term->scale)
- return;
+ return false;
selection_cancel(term);
@@ -1261,22 +1261,24 @@ maybe_resize(struct terminal *term, int width, int height, bool force)
term->render.last_cursor.cell = NULL;
damage_view:
- xdg_toplevel_set_min_size(term->window->xdg_toplevel, min_width / scale, min_height / scale);
+ xdg_toplevel_set_min_size(
+ term->window->xdg_toplevel, min_width / scale, min_height / scale);
tll_free(term->normal.scroll_damage);
tll_free(term->alt.scroll_damage);
render_csd(term);
term->render.last_buf = NULL;
term_damage_view(term);
render_refresh(term);
+ return true;
}
-void
+bool
render_resize(struct terminal *term, int width, int height)
{
return maybe_resize(term, width, height, false);
}
-void
+bool
render_resize_force(struct terminal *term, int width, int height)
{
return maybe_resize(term, width, height, true);
diff --git a/render.h b/render.h
index 9c96aa24..8602d367 100644
--- a/render.h
+++ b/render.h
@@ -1,4 +1,5 @@
#pragma once
+#include <stdbool.h>
#include "terminal.h"
#include "fdm.h"
@@ -8,8 +9,8 @@ struct renderer;
struct renderer *render_init(struct fdm *fdm, struct wayland *wayl);
void render_destroy(struct renderer *renderer);
-void render_resize(struct terminal *term, int width, int height);
-void render_resize_force(struct terminal *term, int width, int height);
+bool render_resize(struct terminal *term, int width, int height);
+bool render_resize_force(struct terminal *term, int width, int height);
void render_set_title(struct terminal *term, const char *title);
void render_refresh(struct terminal *term);