diff options
author | emersion <contact@emersion.fr> | 2018-07-22 22:20:07 +0100 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2018-07-22 22:20:07 +0100 |
commit | 238c8afc74241efdc44d1cf88322d322ce1226d9 (patch) | |
tree | 67496961350dfc7959a74e33be428efb5e567698 /sway/desktop/xdg_shell.c | |
parent | Merge pull request #2296 from RyanDwyer/floating-modifier (diff) | |
download | sway-238c8afc74241efdc44d1cf88322d322ce1226d9.tar.gz sway-238c8afc74241efdc44d1cf88322d322ce1226d9.tar.zst sway-238c8afc74241efdc44d1cf88322d322ce1226d9.zip |
Handle set_{title,app_id} for xdg-shell and zxdg-shell-v6
This allows to update the title even if the view doesn't commit.
This is useful e.g. when a terminal sets its toplevel title to
the currently running command and when the view isn't visible.
Diffstat (limited to 'sway/desktop/xdg_shell.c')
-rw-r--r-- | sway/desktop/xdg_shell.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c index 706b35c3..62c3abc8 100644 --- a/sway/desktop/xdg_shell.c +++ b/sway/desktop/xdg_shell.c | |||
@@ -225,10 +225,24 @@ static void handle_commit(struct wl_listener *listener, void *data) { | |||
225 | transaction_notify_view_ready(view, xdg_surface->configure_serial); | 225 | transaction_notify_view_ready(view, xdg_surface->configure_serial); |
226 | } | 226 | } |
227 | 227 | ||
228 | view_update_title(view, false); | ||
229 | view_damage_from(view); | 228 | view_damage_from(view); |
230 | } | 229 | } |
231 | 230 | ||
231 | static void handle_set_title(struct wl_listener *listener, void *data) { | ||
232 | struct sway_xdg_shell_view *xdg_shell_view = | ||
233 | wl_container_of(listener, xdg_shell_view, set_title); | ||
234 | struct sway_view *view = &xdg_shell_view->view; | ||
235 | view_update_title(view, false); | ||
236 | view_execute_criteria(view); | ||
237 | } | ||
238 | |||
239 | static void handle_set_app_id(struct wl_listener *listener, void *data) { | ||
240 | struct sway_xdg_shell_view *xdg_shell_view = | ||
241 | wl_container_of(listener, xdg_shell_view, set_app_id); | ||
242 | struct sway_view *view = &xdg_shell_view->view; | ||
243 | view_execute_criteria(view); | ||
244 | } | ||
245 | |||
232 | static void handle_new_popup(struct wl_listener *listener, void *data) { | 246 | static void handle_new_popup(struct wl_listener *listener, void *data) { |
233 | struct sway_xdg_shell_view *xdg_shell_view = | 247 | struct sway_xdg_shell_view *xdg_shell_view = |
234 | wl_container_of(listener, xdg_shell_view, new_popup); | 248 | wl_container_of(listener, xdg_shell_view, new_popup); |
@@ -304,6 +318,8 @@ static void handle_unmap(struct wl_listener *listener, void *data) { | |||
304 | wl_list_remove(&xdg_shell_view->request_fullscreen.link); | 318 | wl_list_remove(&xdg_shell_view->request_fullscreen.link); |
305 | wl_list_remove(&xdg_shell_view->request_move.link); | 319 | wl_list_remove(&xdg_shell_view->request_move.link); |
306 | wl_list_remove(&xdg_shell_view->request_resize.link); | 320 | wl_list_remove(&xdg_shell_view->request_resize.link); |
321 | wl_list_remove(&xdg_shell_view->set_title.link); | ||
322 | wl_list_remove(&xdg_shell_view->set_app_id.link); | ||
307 | } | 323 | } |
308 | 324 | ||
309 | static void handle_map(struct wl_listener *listener, void *data) { | 325 | static void handle_map(struct wl_listener *listener, void *data) { |
@@ -349,6 +365,14 @@ static void handle_map(struct wl_listener *listener, void *data) { | |||
349 | xdg_shell_view->request_resize.notify = handle_request_resize; | 365 | xdg_shell_view->request_resize.notify = handle_request_resize; |
350 | wl_signal_add(&xdg_surface->toplevel->events.request_resize, | 366 | wl_signal_add(&xdg_surface->toplevel->events.request_resize, |
351 | &xdg_shell_view->request_resize); | 367 | &xdg_shell_view->request_resize); |
368 | |||
369 | xdg_shell_view->set_title.notify = handle_set_title; | ||
370 | wl_signal_add(&xdg_surface->toplevel->events.set_title, | ||
371 | &xdg_shell_view->set_title); | ||
372 | |||
373 | xdg_shell_view->set_app_id.notify = handle_set_app_id; | ||
374 | wl_signal_add(&xdg_surface->toplevel->events.set_app_id, | ||
375 | &xdg_shell_view->set_app_id); | ||
352 | } | 376 | } |
353 | 377 | ||
354 | static void handle_destroy(struct wl_listener *listener, void *data) { | 378 | static void handle_destroy(struct wl_listener *listener, void *data) { |