GHOST/Wayland: remove WITH_GHOST_WAYLAND_DBUS
This was only used for accessing cursor themes which only worked with gnome and wasn't used in official releases. Use the default theme or the theme defined by XCURSOR_THEME. Eventually wp_cursor_shape_manager_v1 can be supported which avoids having to access the theme.
This commit is contained in:
parent
e8834565a3
commit
0c91466785
|
@ -335,13 +335,6 @@ if(UNIX AND NOT (APPLE OR HAIKU))
|
|||
option(WITH_GHOST_WAYLAND_LIBDECOR "Optionally build with LibDecor window decorations" ON)
|
||||
mark_as_advanced(WITH_GHOST_WAYLAND_LIBDECOR)
|
||||
|
||||
option(WITH_GHOST_WAYLAND_DBUS "\
|
||||
Optionally build with DBUS support (used for Cursor themes). \
|
||||
May hang on startup systems where DBUS is not used."
|
||||
OFF
|
||||
)
|
||||
mark_as_advanced(WITH_GHOST_WAYLAND_DBUS)
|
||||
|
||||
option(WITH_GHOST_WAYLAND_DYNLOAD "Enable runtime dynamic WAYLAND libraries loading" ON)
|
||||
mark_as_advanced(WITH_GHOST_WAYLAND_DYNLOAD)
|
||||
|
||||
|
@ -2283,7 +2276,6 @@ if(FIRST_RUN)
|
|||
if(WITH_GHOST_WAYLAND)
|
||||
info_cfg_option(WITH_GHOST_WAYLAND_DYNLOAD)
|
||||
info_cfg_option(WITH_GHOST_WAYLAND_LIBDECOR)
|
||||
info_cfg_option(WITH_GHOST_WAYLAND_DBUS)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
|
@ -720,10 +720,6 @@ if(WITH_GHOST_WAYLAND)
|
|||
set_and_warn_library_found("xkbcommon" xkbcommon_FOUND WITH_GHOST_WAYLAND)
|
||||
|
||||
if(WITH_GHOST_WAYLAND)
|
||||
if(WITH_GHOST_WAYLAND_DBUS)
|
||||
pkg_check_modules(dbus REQUIRED dbus-1)
|
||||
endif()
|
||||
|
||||
if(WITH_GHOST_WAYLAND_LIBDECOR)
|
||||
if(_use_system_wayland)
|
||||
pkg_check_modules(libdecor libdecor-0>=0.1)
|
||||
|
@ -734,10 +730,6 @@ if(WITH_GHOST_WAYLAND)
|
|||
set_and_warn_library_found("libdecor" libdecor_FOUND WITH_GHOST_WAYLAND_LIBDECOR)
|
||||
endif()
|
||||
|
||||
if(WITH_GHOST_WAYLAND_DBUS)
|
||||
add_definitions(-DWITH_GHOST_WAYLAND_DBUS)
|
||||
endif()
|
||||
|
||||
if(WITH_GHOST_WAYLAND_LIBDECOR)
|
||||
add_definitions(-DWITH_GHOST_WAYLAND_LIBDECOR)
|
||||
endif()
|
||||
|
|
|
@ -322,15 +322,6 @@ elseif(WITH_GHOST_X11 OR WITH_GHOST_WAYLAND)
|
|||
)
|
||||
endif()
|
||||
|
||||
if(WITH_GHOST_WAYLAND_DBUS)
|
||||
list(APPEND INC_SYS
|
||||
${dbus_INCLUDE_DIRS}
|
||||
)
|
||||
list(APPEND LIB
|
||||
${dbus_LINK_LIBRARIES}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(WITH_GHOST_WAYLAND_LIBDECOR)
|
||||
list(APPEND INC_SYS
|
||||
${libdecor_INCLUDE_DIRS}
|
||||
|
@ -360,7 +351,6 @@ elseif(WITH_GHOST_X11 OR WITH_GHOST_WAYLAND)
|
|||
intern/GHOST_WindowWayland.cc
|
||||
|
||||
intern/GHOST_SystemWayland.hh
|
||||
intern/GHOST_WaylandCursorSettings.hh
|
||||
intern/GHOST_WaylandUtils.hh
|
||||
intern/GHOST_WindowWayland.hh
|
||||
)
|
||||
|
|
|
@ -56,8 +56,6 @@
|
|||
#endif
|
||||
#include <wayland-cursor.h>
|
||||
|
||||
#include "GHOST_WaylandCursorSettings.hh"
|
||||
|
||||
#include <xkbcommon/xkbcommon.h>
|
||||
|
||||
/* Generated by `wayland-scanner`. */
|
||||
|
@ -394,7 +392,7 @@ struct GWL_Cursor {
|
|||
/** The size of `custom_data` in bytes. */
|
||||
size_t custom_data_size = 0;
|
||||
/**
|
||||
* The name of the theme (loaded by DBUS, depends on #WITH_GHOST_WAYLAND_DBUS).
|
||||
* The name of the theme (set by an environment variable).
|
||||
* When disabled, leave as an empty string and the default theme will be used.
|
||||
*/
|
||||
std::string theme_name;
|
||||
|
@ -4328,7 +4326,7 @@ static void gwl_seat_capability_pointer_enable(GWL_Seat *seat)
|
|||
seat->cursor.wl.surface_cursor = wl_compositor_create_surface(seat->system->wl_compositor_get());
|
||||
seat->cursor.visible = true;
|
||||
seat->cursor.wl.buffer = nullptr;
|
||||
if (!get_cursor_settings(seat->cursor.theme_name, seat->cursor.theme_size)) {
|
||||
{
|
||||
/* Use environment variables, falling back to defaults.
|
||||
* These environment variables are used by enough WAYLAND applications
|
||||
* that it makes sense to check them (see `Xcursor` man page). */
|
||||
|
|
|
@ -1,131 +0,0 @@
|
|||
/* SPDX-FileCopyrightText: 2021-2023 Blender Authors
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
/** \file
|
||||
* \ingroup GHOST
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <string>
|
||||
|
||||
#ifdef WITH_GHOST_WAYLAND_DBUS
|
||||
# include <dbus/dbus.h>
|
||||
#endif
|
||||
|
||||
#ifdef WITH_GHOST_WAYLAND_DBUS
|
||||
static DBusMessage *get_setting_sync(DBusConnection *const connection,
|
||||
const char *key,
|
||||
const char *value)
|
||||
{
|
||||
DBusError error;
|
||||
dbus_bool_t success;
|
||||
DBusMessage *message;
|
||||
DBusMessage *reply;
|
||||
|
||||
dbus_error_init(&error);
|
||||
|
||||
message = dbus_message_new_method_call("org.freedesktop.portal.Desktop",
|
||||
"/org/freedesktop/portal/desktop",
|
||||
"org.freedesktop.portal.Settings",
|
||||
"Read");
|
||||
|
||||
success = dbus_message_append_args(
|
||||
message, DBUS_TYPE_STRING, &key, DBUS_TYPE_STRING, &value, DBUS_TYPE_INVALID);
|
||||
|
||||
if (!success) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
reply = dbus_connection_send_with_reply_and_block(
|
||||
connection, message, DBUS_TIMEOUT_USE_DEFAULT, &error);
|
||||
|
||||
dbus_message_unref(message);
|
||||
|
||||
if (dbus_error_is_set(&error)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
static bool parse_type(DBusMessage *const reply, const int type, void *value)
|
||||
{
|
||||
DBusMessageIter iter[3];
|
||||
|
||||
dbus_message_iter_init(reply, &iter[0]);
|
||||
if (dbus_message_iter_get_arg_type(&iter[0]) != DBUS_TYPE_VARIANT) {
|
||||
return false;
|
||||
}
|
||||
|
||||
dbus_message_iter_recurse(&iter[0], &iter[1]);
|
||||
if (dbus_message_iter_get_arg_type(&iter[1]) != DBUS_TYPE_VARIANT) {
|
||||
return false;
|
||||
}
|
||||
|
||||
dbus_message_iter_recurse(&iter[1], &iter[2]);
|
||||
if (dbus_message_iter_get_arg_type(&iter[2]) != type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
dbus_message_iter_get_basic(&iter[2], value);
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif /* WITH_GHOST_WAYLAND_DBUS */
|
||||
|
||||
static bool get_cursor_settings(std::string &theme, int &size)
|
||||
{
|
||||
#ifdef WITH_GHOST_WAYLAND_DBUS
|
||||
static const char name[] = "org.gnome.desktop.interface";
|
||||
static const char key_theme[] = "cursor-theme";
|
||||
static const char key_size[] = "cursor-size";
|
||||
|
||||
DBusError error;
|
||||
DBusConnection *connection;
|
||||
DBusMessage *reply;
|
||||
const char *value_theme = nullptr;
|
||||
|
||||
dbus_error_init(&error);
|
||||
|
||||
connection = dbus_bus_get(DBUS_BUS_SESSION, &error);
|
||||
|
||||
if (dbus_error_is_set(&error)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
reply = get_setting_sync(connection, name, key_theme);
|
||||
if (!reply) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!parse_type(reply, DBUS_TYPE_STRING, &value_theme)) {
|
||||
dbus_message_unref(reply);
|
||||
return false;
|
||||
}
|
||||
|
||||
theme = std::string(value_theme);
|
||||
|
||||
dbus_message_unref(reply);
|
||||
|
||||
reply = get_setting_sync(connection, name, key_size);
|
||||
if (!reply) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!parse_type(reply, DBUS_TYPE_INT32, &size)) {
|
||||
dbus_message_unref(reply);
|
||||
return false;
|
||||
}
|
||||
|
||||
dbus_message_unref(reply);
|
||||
|
||||
return true;
|
||||
#else
|
||||
/* NOTE: eventually we could have alternative ways to access the theme,
|
||||
* this uses the "default" theme which is functional (instead of a user-defined theme). */
|
||||
(void)theme;
|
||||
(void)size;
|
||||
return false;
|
||||
#endif /* !WITH_GHOST_WAYLAND_DBUS */
|
||||
}
|
Loading…
Reference in New Issue