Merge pull request #2328 from emersion/xdg-shell-set-title

Handle set_{title,app_id} for xdg-shell and zxdg-shell-v6
This commit is contained in:
Ryan Dwyer 2018-07-23 08:18:58 +10:00 committed by GitHub
commit 89dc047ca9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 54 additions and 2 deletions

View File

@ -110,6 +110,8 @@ struct sway_xdg_shell_v6_view {
struct wl_listener request_resize;
struct wl_listener request_maximize;
struct wl_listener request_fullscreen;
struct wl_listener set_title;
struct wl_listener set_app_id;
struct wl_listener new_popup;
struct wl_listener map;
struct wl_listener unmap;
@ -124,6 +126,8 @@ struct sway_xdg_shell_view {
struct wl_listener request_resize;
struct wl_listener request_maximize;
struct wl_listener request_fullscreen;
struct wl_listener set_title;
struct wl_listener set_app_id;
struct wl_listener new_popup;
struct wl_listener map;
struct wl_listener unmap;

View File

@ -225,10 +225,24 @@ static void handle_commit(struct wl_listener *listener, void *data) {
transaction_notify_view_ready(view, xdg_surface->configure_serial);
}
view_update_title(view, false);
view_damage_from(view);
}
static void handle_set_title(struct wl_listener *listener, void *data) {
struct sway_xdg_shell_view *xdg_shell_view =
wl_container_of(listener, xdg_shell_view, set_title);
struct sway_view *view = &xdg_shell_view->view;
view_update_title(view, false);
view_execute_criteria(view);
}
static void handle_set_app_id(struct wl_listener *listener, void *data) {
struct sway_xdg_shell_view *xdg_shell_view =
wl_container_of(listener, xdg_shell_view, set_app_id);
struct sway_view *view = &xdg_shell_view->view;
view_execute_criteria(view);
}
static void handle_new_popup(struct wl_listener *listener, void *data) {
struct sway_xdg_shell_view *xdg_shell_view =
wl_container_of(listener, xdg_shell_view, new_popup);
@ -304,6 +318,8 @@ static void handle_unmap(struct wl_listener *listener, void *data) {
wl_list_remove(&xdg_shell_view->request_fullscreen.link);
wl_list_remove(&xdg_shell_view->request_move.link);
wl_list_remove(&xdg_shell_view->request_resize.link);
wl_list_remove(&xdg_shell_view->set_title.link);
wl_list_remove(&xdg_shell_view->set_app_id.link);
}
static void handle_map(struct wl_listener *listener, void *data) {
@ -349,6 +365,14 @@ static void handle_map(struct wl_listener *listener, void *data) {
xdg_shell_view->request_resize.notify = handle_request_resize;
wl_signal_add(&xdg_surface->toplevel->events.request_resize,
&xdg_shell_view->request_resize);
xdg_shell_view->set_title.notify = handle_set_title;
wl_signal_add(&xdg_surface->toplevel->events.set_title,
&xdg_shell_view->set_title);
xdg_shell_view->set_app_id.notify = handle_set_app_id;
wl_signal_add(&xdg_surface->toplevel->events.set_app_id,
&xdg_shell_view->set_app_id);
}
static void handle_destroy(struct wl_listener *listener, void *data) {

View File

@ -220,10 +220,24 @@ static void handle_commit(struct wl_listener *listener, void *data) {
transaction_notify_view_ready(view, xdg_surface_v6->configure_serial);
}
view_update_title(view, false);
view_damage_from(view);
}
static void handle_set_title(struct wl_listener *listener, void *data) {
struct sway_xdg_shell_v6_view *xdg_shell_v6_view =
wl_container_of(listener, xdg_shell_v6_view, set_title);
struct sway_view *view = &xdg_shell_v6_view->view;
view_update_title(view, false);
view_execute_criteria(view);
}
static void handle_set_app_id(struct wl_listener *listener, void *data) {
struct sway_xdg_shell_v6_view *xdg_shell_v6_view =
wl_container_of(listener, xdg_shell_v6_view, set_app_id);
struct sway_view *view = &xdg_shell_v6_view->view;
view_execute_criteria(view);
}
static void handle_new_popup(struct wl_listener *listener, void *data) {
struct sway_xdg_shell_v6_view *xdg_shell_v6_view =
wl_container_of(listener, xdg_shell_v6_view, new_popup);
@ -299,6 +313,8 @@ static void handle_unmap(struct wl_listener *listener, void *data) {
wl_list_remove(&xdg_shell_v6_view->request_fullscreen.link);
wl_list_remove(&xdg_shell_v6_view->request_move.link);
wl_list_remove(&xdg_shell_v6_view->request_resize.link);
wl_list_remove(&xdg_shell_v6_view->set_title.link);
wl_list_remove(&xdg_shell_v6_view->set_app_id.link);
}
static void handle_map(struct wl_listener *listener, void *data) {
@ -344,6 +360,14 @@ static void handle_map(struct wl_listener *listener, void *data) {
xdg_shell_v6_view->request_resize.notify = handle_request_resize;
wl_signal_add(&xdg_surface->toplevel->events.request_resize,
&xdg_shell_v6_view->request_resize);
xdg_shell_v6_view->set_title.notify = handle_set_title;
wl_signal_add(&xdg_surface->toplevel->events.set_title,
&xdg_shell_v6_view->set_title);
xdg_shell_v6_view->set_app_id.notify = handle_set_app_id;
wl_signal_add(&xdg_surface->toplevel->events.set_app_id,
&xdg_shell_v6_view->set_app_id);
}
static void handle_destroy(struct wl_listener *listener, void *data) {