From f387a840d89f8040fdea57a1e9e159d79fa0e7ff Mon Sep 17 00:00:00 2001 From: Ilia Bozhinov Date: Sat, 25 Aug 2018 22:46:55 +0300 Subject: [PATCH] rootston: add title/app_id/class listeners --- include/rootston/view.h | 7 +++++++ rootston/xdg_shell.c | 19 +++++++++++++++++++ rootston/xdg_shell_v6.c | 17 +++++++++++++++++ rootston/xwayland.c | 17 +++++++++++++++++ 4 files changed, 60 insertions(+) diff --git a/include/rootston/view.h b/include/rootston/view.h index e67aaf36..a514bc4f 100644 --- a/include/rootston/view.h +++ b/include/rootston/view.h @@ -33,6 +33,8 @@ struct roots_xdg_surface_v6 { 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 surface_commit; @@ -52,6 +54,9 @@ struct roots_xdg_surface { 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 surface_commit; @@ -71,6 +76,8 @@ struct roots_xwayland_surface { struct wl_listener request_fullscreen; struct wl_listener map; struct wl_listener unmap; + struct wl_listener set_title; + struct wl_listener set_class; struct wl_listener surface_commit; }; diff --git a/rootston/xdg_shell.c b/rootston/xdg_shell.c index d3fc5372..8d8a1479 100644 --- a/rootston/xdg_shell.c +++ b/rootston/xdg_shell.c @@ -265,6 +265,8 @@ static void destroy(struct roots_view *view) { wl_list_remove(&roots_xdg_surface->request_resize.link); wl_list_remove(&roots_xdg_surface->request_maximize.link); wl_list_remove(&roots_xdg_surface->request_fullscreen.link); + wl_list_remove(&roots_xdg_surface->set_title.link); + wl_list_remove(&roots_xdg_surface->set_app_id.link); roots_xdg_surface->view->xdg_surface->data = NULL; free(roots_xdg_surface); } @@ -326,6 +328,18 @@ static void handle_request_fullscreen(struct wl_listener *listener, view_set_fullscreen(view, e->fullscreen, e->output); } +static void handle_set_title(struct wl_listener *listener, void *data) { + struct roots_xdg_surface *roots_xdg_surface = + wl_container_of(listener, roots_xdg_surface, set_title); +} + +static void handle_set_app_id(struct wl_listener *listener, void *data) { + struct roots_xdg_surface *roots_xdg_surface = + wl_container_of(listener, roots_xdg_surface, set_title); + wlr_log(WLR_INFO, "surface title %s", + roots_xdg_surface->view->xdg_surface->toplevel->title); +} + static void handle_surface_commit(struct wl_listener *listener, void *data) { struct roots_xdg_surface *roots_surface = wl_container_of(listener, roots_surface, surface_commit); @@ -438,6 +452,11 @@ void handle_xdg_shell_surface(struct wl_listener *listener, void *data) { roots_surface->request_fullscreen.notify = handle_request_fullscreen; wl_signal_add(&surface->toplevel->events.request_fullscreen, &roots_surface->request_fullscreen); + roots_surface->set_title.notify = handle_set_title; + wl_signal_add(&surface->toplevel->events.set_title, &roots_surface->set_title); + roots_surface->set_app_id.notify = handle_set_app_id; + wl_signal_add(&surface->toplevel->events.set_app_id, + &roots_surface->set_app_id); roots_surface->new_popup.notify = handle_new_popup; wl_signal_add(&surface->events.new_popup, &roots_surface->new_popup); surface->data = roots_surface; diff --git a/rootston/xdg_shell_v6.c b/rootston/xdg_shell_v6.c index 6bdf749f..e7b55039 100644 --- a/rootston/xdg_shell_v6.c +++ b/rootston/xdg_shell_v6.c @@ -265,6 +265,8 @@ static void destroy(struct roots_view *view) { wl_list_remove(&roots_xdg_surface->request_resize.link); wl_list_remove(&roots_xdg_surface->request_maximize.link); wl_list_remove(&roots_xdg_surface->request_fullscreen.link); + wl_list_remove(&roots_xdg_surface->set_title.link); + wl_list_remove(&roots_xdg_surface->set_app_id.link); free(roots_xdg_surface); } @@ -325,6 +327,16 @@ static void handle_request_fullscreen(struct wl_listener *listener, view_set_fullscreen(view, e->fullscreen, e->output); } +static void handle_set_title(struct wl_listener *listener, void *data) { + struct roots_xdg_surface_v6 *roots_xdg_surface = + wl_container_of(listener, roots_xdg_surface, set_title); +} + +static void handle_set_app_id(struct wl_listener *listener, void *data) { + struct roots_xdg_surface_v6 *roots_xdg_surface = + wl_container_of(listener, roots_xdg_surface, set_title); +} + static void handle_surface_commit(struct wl_listener *listener, void *data) { struct roots_xdg_surface_v6 *roots_surface = wl_container_of(listener, roots_surface, surface_commit); @@ -437,6 +449,11 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) { roots_surface->request_fullscreen.notify = handle_request_fullscreen; wl_signal_add(&surface->toplevel->events.request_fullscreen, &roots_surface->request_fullscreen); + roots_surface->set_title.notify = handle_set_title; + wl_signal_add(&surface->toplevel->events.set_title, &roots_surface->set_title); + roots_surface->set_app_id.notify = handle_set_app_id; + wl_signal_add(&surface->toplevel->events.set_app_id, + &roots_surface->set_app_id); roots_surface->new_popup.notify = handle_new_popup; wl_signal_add(&surface->events.new_popup, &roots_surface->new_popup); diff --git a/rootston/xwayland.c b/rootston/xwayland.c index d98f808b..f887ed40 100644 --- a/rootston/xwayland.c +++ b/rootston/xwayland.c @@ -114,6 +114,8 @@ static void destroy(struct roots_view *view) { wl_list_remove(&roots_surface->request_move.link); wl_list_remove(&roots_surface->request_resize.link); wl_list_remove(&roots_surface->request_maximize.link); + wl_list_remove(&roots_surface->set_title.link); + wl_list_remove(&roots_surface->set_class.link); wl_list_remove(&roots_surface->map.link); wl_list_remove(&roots_surface->unmap.link); free(roots_surface); @@ -198,6 +200,16 @@ static void handle_request_fullscreen(struct wl_listener *listener, view_set_fullscreen(view, xwayland_surface->fullscreen, NULL); } +static void handle_set_title(struct wl_listener *listener, void *data) { + struct roots_xwayland_surface *roots_surface = + wl_container_of(listener, roots_surface, set_title); +} + +static void handle_set_class(struct wl_listener *listener, void *data) { + struct roots_xwayland_surface *roots_surface = + wl_container_of(listener, roots_surface, set_title); +} + static void handle_surface_commit(struct wl_listener *listener, void *data) { struct roots_xwayland_surface *roots_surface = wl_container_of(listener, roots_surface, surface_commit); @@ -300,6 +312,11 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) { roots_surface->request_fullscreen.notify = handle_request_fullscreen; wl_signal_add(&surface->events.request_fullscreen, &roots_surface->request_fullscreen); + roots_surface->set_title.notify = handle_set_title; + wl_signal_add(&surface->events.set_title, &roots_surface->set_title); + roots_surface->set_class.notify = handle_set_class; + wl_signal_add(&surface->events.set_class, + &roots_surface->set_class); struct roots_view *view = view_create(desktop); if (view == NULL) {