react to wlroots changes

This commit is contained in:
Keith Bowes 2024-01-25 21:37:01 -05:00
parent bce423cd72
commit fb3a845354
9 changed files with 54 additions and 10 deletions

View file

@ -156,7 +156,11 @@ static void handle_cursor_axis(struct wl_listener *listener, void *data) {
/* Notify the client with pointer focus of the axis event. */
wlr_seat_pointer_notify_axis(cursor->server->seat->seat,
event->time_msec, event->orientation, event->delta,
event->delta_discrete, event->source);
event->delta_discrete, event->source
#if WLR_CHECK_VERSION(0, 18, 0)
, event->relative_direction
#endif
);
}
static void handle_cursor_frame(struct wl_listener *listener, void *data) {

View file

@ -21,6 +21,24 @@ void output_frame_notify(struct wl_listener *listener, void *data) {
struct wlr_gamma_control_v1 *gamma_control =
wlr_gamma_control_manager_v1_get_control(output->server->gamma_control_manager,
output->wlr_output);
#if WLR_CHECK_VERSION(0, 18, 0)
struct wlr_output_state pending;
if (!wlr_scene_output_build_state(scene_output, &pending, NULL))
return;
if (!wlr_gamma_control_v1_apply(gamma_control, &pending)) {
wlr_output_state_finish(&pending);
return;
}
if (!wlr_output_test_state(output->wlr_output, &pending)) {
wlr_gamma_control_v1_send_failed_and_destroy(gamma_control);
wlr_output_state_finish(&pending);
return;
}
wlr_output_state_finish(&pending);
#else
if (!wlr_gamma_control_v1_apply(gamma_control, &output->wlr_output->pending)) {
return;
}
@ -29,6 +47,7 @@ void output_frame_notify(struct wl_listener *listener, void *data) {
wlr_output_rollback(output->wlr_output);
wlr_gamma_control_v1_send_failed_and_destroy(gamma_control);
}
#endif
}
/* Render the scene if needed and commit the output */

View file

@ -11,11 +11,21 @@ bool wb_create_backend(struct wb_server* server) {
return false;
}
server->wl_event_loop = wl_display_get_event_loop(server->wl_display);
if (server->wl_event_loop == NULL) {
wlr_log(WLR_ERROR, "%s", _("Failed to get an event loop"));
return false;
}
/* The backend is a wlroots feature which abstracts the underlying input and
* output hardware. The autocreate option will choose the most suitable
* backend based on the current environment, such as opening an X11 window
* if an X11 server is running. */
#if WLR_CHECK_VERSION(0, 18, 0)
server->backend = wlr_backend_autocreate(server->wl_event_loop, NULL);
#else
server->backend = wlr_backend_autocreate(server->wl_display, NULL);
#endif
if (server->backend == NULL) {
wlr_log(WLR_ERROR, "%s", _("Failed to create backend"));
return false;