Begin work to add wallpaper support to beansprout

Added pixman and zigimg dependencies
Set up in build.zig, added to both exe and exe_check

Add new protocols:
     river-layer-shell-v1
     wlr-layer-shell-unstable-v1
     xdg-shell (dep of wlr-layer-shell-unstable-v1)

Update Context.zig to hold wl_output, wl_shm, and a WallpaperImage
Also re-ordered all of its fields into alphabetical order
Context.create() now takes a Context.Options struct so that it takes
     one arg instead of many smaller args.

Added new WallpaperImage.zig, but it's not yet actually used
This commit is contained in:
Ben Buhse 2026-02-06 16:37:33 -06:00
commit fb8817ebf9
No known key found for this signature in database
GPG key ID: 7916ACFCD38FD0B4
7 changed files with 718 additions and 26 deletions

View file

@ -10,11 +10,14 @@ const Context = @This();
initialized: bool,
// Wayland globals
wl_display: *wl.Display,
wl_registry: *wl.Registry,
wl_compositor: *wl.Compositor,
wl_display: *wl.Display,
wl_output: *wl.Output,
wl_registry: *wl.Registry,
wl_shm: *wl.Shm,
// Wayland globals that we have structs for
// Wayland globals that we have special structs for
wallpaper_image: *WallpaperImage,
wm: *WindowManager,
xkb_bindings: *XkbBindings,
@ -28,25 +31,36 @@ pub const PendingManage = struct {
config: ?*Config = null,
};
pub fn create(
wl_display: *wl.Display,
wl_registry: *wl.Registry,
// I use this because otherwise create() takes
// a LOT of arguments.
pub const Options = struct {
wl_compositor: *wl.Compositor,
wl_display: *wl.Display,
wl_output: *wl.Output,
wl_registry: *wl.Registry,
wl_shm: *wl.Shm,
river_layer_shell_v1: *river.LayerShellV1,
river_window_manager_v1: *river.WindowManagerV1,
river_xkb_bindings_v1: *river.XkbBindingsV1,
zwlr_layer_shell_v1: *zwlr.LayerShellV1,
config: *Config,
) !*Context {
};
pub fn create(options: Options) !*Context {
const context = try utils.allocator.create(Context);
errdefer context.destroy();
context.* = .{
.initialized = false,
.wl_display = wl_display,
.wl_registry = wl_registry,
.wl_compositor = wl_compositor,
.wm = try WindowManager.create(context, river_window_manager_v1),
.xkb_bindings = try XkbBindings.create(context, river_xkb_bindings_v1),
.config = config,
.wl_compositor = options.wl_compositor,
.wl_display = options.wl_display,
.wl_output = options.wl_output,
.wl_registry = options.wl_registry,
.wl_shm = options.wl_shm,
.wallpaper_image = try WallpaperImage.create("FIXME"), // FIXME: TODO: Get this from Config
.wm = try WindowManager.create(context, options.river_window_manager_v1),
.xkb_bindings = try XkbBindings.create(context, options.river_xkb_bindings_v1),
.config = options.config,
};
return context;
@ -80,9 +94,11 @@ const std = @import("std");
const wayland = @import("wayland");
const river = wayland.client.river;
const wl = wayland.client.wl;
const zwlr = wayland.client.zwlr;
const utils = @import("utils.zig");
const Config = @import("Config.zig");
const WallpaperImage = @import("WallpaperImage.zig");
const WindowManager = @import("WindowManager.zig");
const XkbBindings = @import("XkbBindings.zig");