From dbde557944de3b87ba110d6cd6ac4fc518b5dbaf Mon Sep 17 00:00:00 2001 From: Tristan Ross Date: Thu, 2 May 2024 18:32:40 -0700 Subject: [PATCH] feat: adding missing libs and adding some protocols --- flake.nix | 3 ++- linux/CMakeLists.txt | 2 +- linux/channels/display.c | 12 ++++++++++++ linux/channels/display.h | 2 ++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index 38685867..fa222f67 100644 --- a/flake.nix +++ b/flake.nix @@ -31,7 +31,8 @@ src = lib.cleanSource self; buildInputs = with s; lib.optionalAttrs (stdenv.isLinux) [ - pam accountsservice polkit seatd wlroots_0_17 libdrm libGL + pam accountsservice polkit seatd wlroots_0_17 libdrm libGL libxkbcommon + mesa vulkan-loader ]; pubspecLock = lib.importJSON ./pubspec.lock.json; diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt index 0c171bb2..a359a16d 100644 --- a/linux/CMakeLists.txt +++ b/linux/CMakeLists.txt @@ -59,7 +59,7 @@ pkg_check_modules(ACCOUNTSSERVICE REQUIRED IMPORTED_TARGET accountsservice) pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) pkg_check_modules(LIBSEAT REQUIRED IMPORTED_TARGET libseat) pkg_check_modules(PAM REQUIRED IMPORTED_TARGET pam) -pkg_check_modules(WLROOTS REQUIRED IMPORTED_TARGET wlroots wayland-server) +pkg_check_modules(WLROOTS REQUIRED IMPORTED_TARGET wlroots wayland-server xkbcommon) add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}" -DWLR_USE_UNSTABLE) diff --git a/linux/channels/display.c b/linux/channels/display.c index 69d6a1aa..b312d201 100644 --- a/linux/channels/display.c +++ b/linux/channels/display.c @@ -20,11 +20,23 @@ static void method_call_handler(FlMethodChannel* channel, FlMethodCall* method_c const char* socket = wl_display_add_socket_auto(disp->display); if (socket == NULL) { fl_method_call_respond_error(method_call, "wayland", "failed to create socket", NULL, NULL); + wlr_backend_destroy(disp->backend); wl_display_destroy(disp->display); free(disp); return; } + if (!wlr_backend_start(disp->backend)) { + fl_method_call_respond_error(method_call, "wlroots", "failed to start backend", NULL, NULL); + wlr_backend_destroy(disp->backend); + wl_display_destroy(disp->display); + free(disp); + return; + } + + wlr_subcompositor_create(disp->display); + wlr_data_device_manager_create(disp->display); + pthread_create(&disp->thread, NULL, (void *(*)(void*))wl_display_run, disp->display); g_hash_table_insert(self->displays, (gpointer)g_strdup(socket), (gpointer)disp); diff --git a/linux/channels/display.h b/linux/channels/display.h index 5b9630e6..2729c3bd 100644 --- a/linux/channels/display.h +++ b/linux/channels/display.h @@ -14,6 +14,8 @@ extern "C" { #endif #include +#include +#include #include #ifdef __cplusplus