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

@ -41,6 +41,7 @@
struct wb_server {
struct wl_display *wl_display;
struct wl_event_loop *wl_event_loop;
struct wlr_allocator *allocator;
struct wlr_backend *backend;

View file

@ -36,9 +36,6 @@ xkbcommon = dependency('xkbcommon')
msgfmt = find_program('msgfmt', required: false)
if msgfmt.found()
source_root = meson.current_source_dir()
add_project_arguments('-DGETTEXT_PACKAGE="' + meson.project_name().to_lower() + '"',
'-DLOCALEDIR="' + get_option('prefix') / get_option('localedir') + '"',
'-DUSE_NLS=1', language: 'c')
subdir('po')
endif

View file

@ -11,8 +11,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Waybox 0.0.1\n"
"Report-Msgid-Bugs-To: https://github.com/wizbright/waybox/issues\n"
"POT-Creation-Date: 2023-11-21 15:47-0500\n"
"PO-Revision-Date: 2023-11-21 12:49-0500\n"
"POT-Creation-Date: 2024-01-25 21:21-0500\n"
"PO-Revision-Date: 2024-01-25 21:34-0500\n"
"Last-Translator: Volker Ribbert <volker.nospam@netcologne.de>\n"
"Language-Team: <de@li.org>\n"
"Language: de\n"
@ -131,7 +131,10 @@ msgid "Unsupported input device detected"
msgstr "Unerkanntes Eingabegerät entdeckt"
msgid "Failed to connect to a Wayland display"
msgstr "Scheiterte an eines Wayland-Displays verbinden"
msgstr "Scheiterte an ein Wayland-Display verbinden"
msgid "Failed to get an event loop"
msgstr "Scheiterte eine Ereignisschleife zu bekommen"
msgid "Failed to create renderer"
msgstr "Das Renderer wurde nicht erfolgreich hergestellt"

View file

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Waybox 0.0.1\n"
"Report-Msgid-Bugs-To: https://github.com/wizbright/waybox/issues\n"
"POT-Creation-Date: 2023-11-21 15:47-0500\n"
"PO-Revision-Date: 2023-12-07 13:16-0500\n"
"POT-Creation-Date: 2024-01-25 21:21-0500\n"
"PO-Revision-Date: 2024-01-25 21:35-0500\n"
"Last-Translator: Keith <keith@localhost>\n"
"Language-Team: Esperanto\n"
"Language: eo\n"
@ -130,6 +130,9 @@ msgstr "Nerekonata enigilo malkovrita"
msgid "Failed to connect to a Wayland display"
msgstr "Malsukcesis konektiĝi al Wayland-ekrano"
msgid "Failed to get an event loop"
msgstr "Malsukcesis atingi evento-iteracion"
msgid "Failed to create renderer"
msgstr "Malsukcesis krei servilan bildigilon"

View file

@ -1,3 +1,7 @@
add_project_arguments('-DGETTEXT_PACKAGE="' + meson.project_name().to_lower() + '"',
'-DLOCALEDIR="' + get_option('prefix') / get_option('localedir') + '"',
'-DUSE_NLS=1', language: 'c')
i18n = import('i18n', required: false)
if i18n.found()
i18n.gettext(meson.project_name().to_lower(),

View file

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: waybox\n"
"Report-Msgid-Bugs-To: https://github.com/wizbright/waybox/issues\n"
"POT-Creation-Date: 2023-11-21 15:47-0500\n"
"POT-Creation-Date: 2024-01-25 21:21-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -122,6 +122,9 @@ msgstr ""
msgid "Failed to connect to a Wayland display"
msgstr ""
msgid "Failed to get an event loop"
msgstr ""
msgid "Failed to create renderer"
msgstr ""

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;