xdg-shell new surface and ack configure events

This commit is contained in:
Tony Crisci 2017-09-15 08:53:08 -04:00
parent 569b147bba
commit 27161a673f
3 changed files with 39 additions and 2 deletions

View file

@ -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);