react to wlroots changes

This commit is contained in:
Keith Bowes 2023-06-22 16:21:21 -04:00
parent 6dc905d758
commit fd0c5b04d3
5 changed files with 47 additions and 2 deletions

View file

@ -28,7 +28,7 @@ inc_dir = include_directories('include')
libevdev = dependency('libevdev') libevdev = dependency('libevdev')
libinput = dependency('libinput', version: '>=1.21.0') libinput = dependency('libinput', version: '>=1.21.0')
libxml2 = dependency('libxml-2.0') libxml2 = dependency('libxml-2.0')
wlroots = dependency('wlroots', version: '>=0.16.2') wlroots = dependency('wlroots', version: '>=0.16.0')
wayland_server = dependency('wayland-server', version: '>=1.15') wayland_server = dependency('wayland-server', version: '>=1.15')
wayland_protos = dependency('wayland-protocols', version: '>=1.27') wayland_protos = dependency('wayland-protocols', version: '>=1.27')
xkbcommon = dependency('xkbcommon') xkbcommon = dependency('xkbcommon')

View file

@ -82,8 +82,13 @@ static void process_cursor_motion(struct wb_server *server, uint32_t time) {
/* If there's no view under the cursor, set the cursor image to a /* If there's no view under the cursor, set the cursor image to a
* default. This is what makes the cursor image appear when you move it * default. This is what makes the cursor image appear when you move it
* around the screen, not over any views. */ * around the screen, not over any views. */
#if WLR_CHECK_VERSION(0, 17, 0)
wlr_cursor_set_xcursor(
server->cursor->cursor, server->cursor->xcursor_manager, "default");
#else
wlr_xcursor_manager_set_cursor_image( wlr_xcursor_manager_set_cursor_image(
server->cursor->xcursor_manager, "default", server->cursor->cursor); server->cursor->xcursor_manager, "left_ptr", server->cursor->cursor);
#endif
} }
if (surface) { if (surface) {
/* /*
@ -198,7 +203,9 @@ struct wb_cursor *wb_cursor_create(struct wb_server *server) {
const char *xcursor_size = getenv("XCURSOR_SIZE"); const char *xcursor_size = getenv("XCURSOR_SIZE");
cursor->xcursor_manager = wlr_xcursor_manager_create(getenv("XCURSOR_THEME"), cursor->xcursor_manager = wlr_xcursor_manager_create(getenv("XCURSOR_THEME"),
xcursor_size ? strtoul(xcursor_size, (char **) NULL, 10) : 24); xcursor_size ? strtoul(xcursor_size, (char **) NULL, 10) : 24);
#if !WLR_CHECK_VERSION(0, 17, 0)
wlr_xcursor_manager_load(cursor->xcursor_manager, 1); wlr_xcursor_manager_load(cursor->xcursor_manager, 1);
#endif
cursor->cursor_motion.notify = handle_cursor_motion; cursor->cursor_motion.notify = handle_cursor_motion;
wl_signal_add(&cursor->cursor->events.motion, &cursor->cursor_motion); wl_signal_add(&cursor->cursor->events.motion, &cursor->cursor_motion);

View file

@ -121,8 +121,13 @@ static void handle_surface_commit(struct wl_listener *listener, void *data) {
wlr_scene_node_reparent(&surface->scene->tree->node, output_layer); wlr_scene_node_reparent(&surface->scene->tree->node, output_layer);
} }
#if WLR_CHECK_VERSION(0, 17, 0)
if (committed || layer_surface->surface->mapped != surface->mapped) {
surface->mapped = layer_surface->surface->mapped;
#else
if (committed || layer_surface->mapped != surface->mapped) { if (committed || layer_surface->mapped != surface->mapped) {
surface->mapped = layer_surface->mapped; surface->mapped = layer_surface->mapped;
#endif
arrange_layers(surface->output); arrange_layers(surface->output);
struct timespec now; struct timespec now;
@ -343,9 +348,17 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) {
wl_signal_add(&layer_surface->surface->events.commit, wl_signal_add(&layer_surface->surface->events.commit,
&surface->surface_commit); &surface->surface_commit);
surface->map.notify = handle_map; surface->map.notify = handle_map;
#if WLR_CHECK_VERSION(0, 17, 0)
wl_signal_add(&layer_surface->surface->events.map, &surface->map);
#else
wl_signal_add(&layer_surface->events.map, &surface->map); wl_signal_add(&layer_surface->events.map, &surface->map);
#endif
surface->unmap.notify = handle_unmap; surface->unmap.notify = handle_unmap;
#if WLR_CHECK_VERSION(0, 17, 0)
wl_signal_add(&layer_surface->surface->events.unmap, &surface->unmap);
#else
wl_signal_add(&layer_surface->events.unmap, &surface->unmap); wl_signal_add(&layer_surface->events.unmap, &surface->unmap);
#endif
surface->destroy.notify = handle_destroy; surface->destroy.notify = handle_destroy;
wl_signal_add(&layer_surface->events.destroy, &surface->destroy); wl_signal_add(&layer_surface->events.destroy, &surface->destroy);
surface->new_popup.notify = handle_new_popup; surface->new_popup.notify = handle_new_popup;

View file

@ -66,6 +66,22 @@ void new_output_notify(struct wl_listener *listener, void *data) {
* and our renderer */ * and our renderer */
wlr_output_init_render(wlr_output, server->allocator, server->renderer); wlr_output_init_render(wlr_output, server->allocator, server->renderer);
#if WLR_CHECK_VERSION(0, 17, 0)
struct wlr_output_mode *mode = wlr_output_preferred_mode(wlr_output);
if (mode != NULL) {
struct wlr_output_state state = {0};
wlr_output_state_set_mode(&state, mode);
wlr_output_state_set_enabled(&state, true);
if (!wlr_output_commit_state(wlr_output, &state)) {
wlr_output_state_finish(&state);
wlr_log_errno(WLR_ERROR, "%s", _("Couldn't commit state to output"));
return;
}
wlr_output_state_finish(&state);
}
#else
if (!wl_list_empty(&wlr_output->modes)) { if (!wl_list_empty(&wlr_output->modes)) {
struct wlr_output_mode *mode = wlr_output_preferred_mode(wlr_output); struct wlr_output_mode *mode = wlr_output_preferred_mode(wlr_output);
wlr_output_set_mode(wlr_output, mode); wlr_output_set_mode(wlr_output, mode);
@ -76,6 +92,7 @@ void new_output_notify(struct wl_listener *listener, void *data) {
return; return;
} }
} }
#endif
struct wb_output *output = calloc(1, sizeof(struct wb_output)); struct wb_output *output = calloc(1, sizeof(struct wb_output));
output->server = server; output->server = server;

View file

@ -370,9 +370,17 @@ static void handle_new_xdg_surface(struct wl_listener *listener, void *data) {
/* Listen to the various events it can emit */ /* Listen to the various events it can emit */
view->map.notify = xdg_toplevel_map; view->map.notify = xdg_toplevel_map;
#if WLR_CHECK_VERSION(0, 17, 0)
wl_signal_add(&xdg_surface->surface->events.map, &view->map);
#else
wl_signal_add(&xdg_surface->events.map, &view->map); wl_signal_add(&xdg_surface->events.map, &view->map);
#endif
view->unmap.notify = xdg_toplevel_unmap; view->unmap.notify = xdg_toplevel_unmap;
#if WLR_CHECK_VERSION(0, 17, 0)
wl_signal_add(&xdg_surface->surface->events.unmap, &view->unmap);
#else
wl_signal_add(&xdg_surface->events.unmap, &view->unmap); wl_signal_add(&xdg_surface->events.unmap, &view->unmap);
#endif
view->destroy.notify = xdg_toplevel_destroy; view->destroy.notify = xdg_toplevel_destroy;
wl_signal_add(&xdg_surface->events.destroy, &view->destroy); wl_signal_add(&xdg_surface->events.destroy, &view->destroy);
view->new_popup.notify = handle_new_popup; view->new_popup.notify = handle_new_popup;