diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/compositor.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/examples/compositor.c b/examples/compositor.c index 9d96b053..841407bf 100644 --- a/examples/compositor.c +++ b/examples/compositor.c @@ -56,6 +56,8 @@ struct sample_state { struct wl_listener cursor_motion_absolute; struct wl_listener cursor_button; struct wl_listener cursor_axis; + + struct wl_listener new_xdg_surface_v6; }; /* @@ -85,6 +87,15 @@ static void output_frame_handle_surface(struct sample_state *sample, } } } + +static void handle_new_xdg_surface_v6(struct wl_listener *listener, + void *data) { + struct wlr_xdg_surface_v6 *surface = data; + wlr_log(L_DEBUG, "new xdg surface: title=%s, app_id=%s", + surface->title, surface->app_id); + // configure the surface and add it to data structures here +} + static void handle_output_frame(struct output_state *output, struct timespec *ts) { struct compositor_state *state = output->compositor; @@ -309,6 +320,12 @@ int main(int argc, char *argv[]) { state.wl_shell = wlr_wl_shell_create(compositor.display); state.xdg_shell = wlr_xdg_shell_v6_create(compositor.display); + // shell events + wl_signal_add(&state.xdg_shell->events.new_surface, + &state.new_xdg_surface_v6); + state.new_xdg_surface_v6.notify = handle_new_xdg_surface_v6; + + state.data_device_manager = wlr_data_device_manager_create(compositor.display); @@ -341,6 +358,8 @@ int main(int argc, char *argv[]) { wl_display_run(compositor.display); + wl_list_remove(&state.new_xdg_surface_v6.link); + wlr_xwayland_destroy(state.xwayland); close(state.keymap_fd); wlr_seat_destroy(state.wl_seat); |