Clean up build scaffolding for libsfdo and add the creation and

destruction of an sfdo data structure associated with a sway server with
a view to future use of icon themes in places such as titlebars
This commit is contained in:
myrslint 2025-04-16 20:50:42 +00:00
parent f3cca0d86f
commit 34d2020042
4 changed files with 559 additions and 425 deletions

View file

@ -8,7 +8,11 @@
#if WLR_HAS_XWAYLAND #if WLR_HAS_XWAYLAND
#include "sway/xwayland.h" #include "sway/xwayland.h"
#endif #endif
#if HAVE_LIBSFDO
#include <sfdo-desktop.h>
#include <sfdo-icon.h>
#include <sfdo-basedir.h>
#endif
struct sway_transaction; struct sway_transaction;
struct sway_session_lock { struct sway_session_lock {
@ -24,6 +28,15 @@ struct sway_session_lock {
struct wl_listener destroy; struct wl_listener destroy;
}; };
#if HAVE_LIBSFDO
struct sfdo {
struct sfdo_desktop_ctx *desktop_ctx;
struct sfdo_icon_ctx *icon_ctx;
struct sfdo_desktop_db *desktop_db;
struct sfdo_icon_theme *icon_theme;
};
#endif
struct sway_server { struct sway_server {
struct wl_display *wl_display; struct wl_display *wl_display;
struct wl_event_loop *wl_event_loop; struct wl_event_loop *wl_event_loop;
@ -146,6 +159,11 @@ struct sway_server {
list_t *dirty_nodes; list_t *dirty_nodes;
struct wl_event_source *delayed_modeset; struct wl_event_source *delayed_modeset;
#if HAVE_LIBSFDO
struct sfdo *sfdo;
#endif
}; };
extern struct sway_server server; extern struct sway_server server;
@ -192,4 +210,9 @@ void set_rr_scheduling(void);
void handle_new_tearing_hint(struct wl_listener *listener, void *data); void handle_new_tearing_hint(struct wl_listener *listener, void *data);
#if HAVE_LIBSFDO
struct sfdo *sfdo_create(char *theme);
void sfdo_destroy(struct sfdo *sfdo);
#endif
#endif #endif

View file

@ -38,34 +38,6 @@ if is_freebsd
add_project_arguments('-D_C11_SOURCE', language: 'c') add_project_arguments('-D_C11_SOURCE', language: 'c')
endif endif
# Check for (currrently) optional libsfdo
sfdo_basedir = dependency(
'libsfdo-basedir',
default_options: ['default_library=static', 'examples=false', 'tests=false'],
version: '>=0.1.3',
required: get_option('sfdo'),
)
sfdo_desktop = dependency(
'libsfdo-desktop',
default_options: ['default_library=static', 'examples=false', 'tests=false'],
version: '>=0.1.3',
required: get_option('sfdo'),
)
sfdo_desktop_file = dependency(
'libsfdo-desktop-file',
default_options: ['default_library=static', 'examples=false', 'tests=false'],
version: '>=0.1.3',
required: get_option('sfdo'),
)
sfdo_icon = dependency(
'libsfdo-icon',
default_options: ['default_library=static', 'examples=false', 'tests=false'],
version: '>=0.1.3',
required: get_option('sfdo'),
)
have_libsfdo = sfdo_basedir.found() and sfdo_desktop.found() and sfdo_desktop_file.found() and sfdo_icon.found()
# Execute the wlroots subproject, if any # Execute the wlroots subproject, if any
wlroots_version = ['>=0.20.0', '<0.21.0'] wlroots_version = ['>=0.20.0', '<0.21.0']
subproject( subproject(
@ -88,6 +60,34 @@ endforeach
null_dep = dependency('', required: false) null_dep = dependency('', required: false)
# Check for (currrently) optional libsfdo
sfdo_basedir = dependency(
'libsfdo-basedir',
version: '>=0.1.3',
required: get_option('sfdo')
)
sfdo_desktop = dependency(
'libsfdo-desktop',
version: '>=0.1.3',
required: get_option('sfdo')
)
sfdo_desktop_file = dependency(
'libsfdo-desktop-file',
version: '>=0.1.3',
required: get_option('sfdo')
)
sfdo_icon = dependency(
'libsfdo-icon',
version: '>=0.1.3',
required: get_option('sfdo')
)
have_libsfdo = (
sfdo_basedir.found() and
sfdo_desktop.found() and
sfdo_desktop_file.found() and
sfdo_icon.found()
)
jsonc = dependency('json-c', version: '>=0.13') jsonc = dependency('json-c', version: '>=0.13')
pcre2 = dependency('libpcre2-8') pcre2 = dependency('libpcre2-8')
wayland_server = dependency('wayland-server', version: '>=1.21.0') wayland_server = dependency('wayland-server', version: '>=1.21.0')

View file

@ -244,6 +244,15 @@ if wlroots_features['libinput_backend']
sway_sources += 'input/libinput.c' sway_sources += 'input/libinput.c'
endif endif
if have_libsfdo
sway_deps += [
sfdo_basedir,
sfdo_desktop,
sfdo_desktop_file,
sfdo_icon
]
endif
executable( executable(
'sway', 'sway',
sway_sources + wl_protos_src, sway_sources + wl_protos_src,

File diff suppressed because it is too large Load diff