terminal: Only add the new size to the title when we're resizing
Add a new state_changed_handler callback to the window to know when the
window has changed state; the terminal will use this to know when the
window started and ended its resize operation, and modify the terminal's
titlebar accordingly.
diff --git a/clients/window.c b/clients/window.c
index 6149618..c46cb72 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -241,6 +241,7 @@
window_close_handler_t close_handler;
window_fullscreen_handler_t fullscreen_handler;
window_output_handler_t output_handler;
+ window_state_changed_handler_t state_changed_handler;
struct surface *main_surface;
struct xdg_surface *xdg_surface;
@@ -3887,6 +3888,9 @@
}
window->next_attach_serial = serial;
+
+ if (window->state_changed_handler)
+ window->state_changed_handler(window, window->user_data);
}
static void
@@ -4178,6 +4182,12 @@
xdg_surface_unset_maximized(window->xdg_surface);
}
+int
+window_is_resizing(struct window *window)
+{
+ return window->resizing;
+}
+
void
window_set_minimized(struct window *window)
{
@@ -4247,6 +4257,13 @@
}
void
+window_set_state_changed_handler(struct window *window,
+ window_state_changed_handler_t handler)
+{
+ window->state_changed_handler = handler;
+}
+
+void
window_set_title(struct window *window, const char *title)
{
free(window->title);