- Windows now use libdecor when present.
This commit is contained in:
@@ -23,8 +23,8 @@
|
||||
#include <fennec/platform/linux/wayland/server.h>
|
||||
#include <fennec/platform/linux/wayland/window.h>
|
||||
|
||||
#include <fennec/platform/linux/wayland/lib/loader.h>
|
||||
#include <fennec/platform/linux/wayland/lib/wayland.h>
|
||||
#include <fennec/platform/linux/wayland/lib/loader.h>
|
||||
#include <fennec/platform/linux/wayland/lib/headers/xdg-shell-client-protocols.h>
|
||||
|
||||
#if FENNEC_HAS_LIBDECOR
|
||||
@@ -36,13 +36,13 @@ namespace fennec
|
||||
|
||||
wayland_server::wayland_server(fennec::platform* p)
|
||||
: display_server_base(p)
|
||||
, display(nullptr), registry(nullptr), compositor(nullptr), seat(nullptr), fifo(false), libdecor(false) {
|
||||
, display(nullptr), registry(nullptr), compositor(nullptr), seat(nullptr), fifo(false), has_libdecor(false) {
|
||||
|
||||
// load shared lib
|
||||
assertf(libwayland::load_symbols(platform), "Failed to load libwayland.");
|
||||
|
||||
#if FENNEC_HAS_LIBDECOR
|
||||
libdecor = libdecor::load_symbols(platform);
|
||||
has_libdecor = libdecor::load_symbols(platform);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ wayland_server::~wayland_server() {
|
||||
void wayland_server::connect() {
|
||||
|
||||
static constexpr wl_registry_listener listener = {
|
||||
listen_global, listen_global_remove
|
||||
_wl_registry_listen_global, _wl_registry_on_global_remove
|
||||
};
|
||||
|
||||
if (display != nullptr) {
|
||||
@@ -90,6 +90,27 @@ void wayland_server::connect() {
|
||||
return;
|
||||
}
|
||||
|
||||
#if FENNEC_HAS_LIBDECOR
|
||||
static libdecor_interface libdecor_listener = {
|
||||
.error = _libdecor_on_error,
|
||||
|
||||
.reserved0 = nullptr,
|
||||
.reserved1 = nullptr,
|
||||
.reserved2 = nullptr,
|
||||
.reserved3 = nullptr,
|
||||
.reserved4 = nullptr,
|
||||
.reserved5 = nullptr,
|
||||
.reserved6 = nullptr,
|
||||
.reserved7 = nullptr,
|
||||
.reserved8 = nullptr,
|
||||
.reserved9 = nullptr,
|
||||
};
|
||||
|
||||
if (has_libdecor) {
|
||||
libdecor = libdecor_new(display, &libdecor_listener);
|
||||
}
|
||||
#endif
|
||||
|
||||
auto contexts = ctx_registry::get_type_list();
|
||||
while (not contexts.empty()) {
|
||||
const auto& ctx = contexts.front();
|
||||
@@ -154,13 +175,13 @@ window* wayland_server::create_window(const window::config& conf) {
|
||||
return windows[id];
|
||||
}
|
||||
|
||||
void wayland_server::listen_global(void* data, wl_registry* reg, uint32_t id, const char* name, uint32_t version) {
|
||||
void wayland_server::_wl_registry_listen_global(void* data, wl_registry* reg, uint32_t id, const char* name, uint32_t version) {
|
||||
static constexpr wl_seat_listener seat_listener = {
|
||||
listen_seat_capabilities, listen_seat_name
|
||||
_wl_seat_listen_capabilities, _wl_seat_listen_name
|
||||
};
|
||||
|
||||
static constexpr xdg_wm_base_listener xdg_listener = {
|
||||
listen_xdg_ping
|
||||
_xdg_listen_ping
|
||||
};
|
||||
|
||||
wayland_server* server = static_cast<wayland_server*>(data);
|
||||
@@ -189,20 +210,28 @@ void wayland_server::listen_global(void* data, wl_registry* reg, uint32_t id, co
|
||||
}
|
||||
}
|
||||
|
||||
void wayland_server::listen_global_remove(void*, wl_registry*, uint32_t) {
|
||||
void wayland_server::_wl_registry_on_global_remove(void*, wl_registry*, uint32_t) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
void wayland_server::listen_seat_capabilities(void*, wl_seat*, uint32_t) {
|
||||
void wayland_server::_wl_seat_listen_capabilities(void*, wl_seat*, uint32_t) {
|
||||
|
||||
}
|
||||
|
||||
void wayland_server::listen_seat_name(void*, wl_seat*, const char*) {}
|
||||
void wayland_server::_wl_seat_listen_name(void*, wl_seat*, const char*) {}
|
||||
|
||||
|
||||
void wayland_server::listen_xdg_ping(void*, xdg_wm_base* xdg, uint32_t serial) {
|
||||
void wayland_server::_xdg_listen_ping(void*, xdg_wm_base* xdg, uint32_t serial) {
|
||||
xdg_wm_base_pong(xdg, serial);
|
||||
}
|
||||
|
||||
#if FENNEC_HAS_LIBDECOR
|
||||
void wayland_server::_libdecor_on_error(struct libdecor*, libdecor_error error, const char* message) {
|
||||
fennec::logger::log(
|
||||
fennec::format("libdecor error ({}): {}", static_cast<int>(error), fennec::cstring(message, strlen(message)))
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user