Implement wallpaper rendering with multi-output support
This actually renders a wallpaper for each output using the newly added Buffer and BufferPool for shared-memory surfaces and creates a wlr-layer-shell surface per output. Right now, each wallpaper shares the same wallpaper (though scaled to each). wl_output globals get added to a HashMap that is used by Output when it gets an output event. Fix null-safety in WindowManager when no seats/outputs exist and route Window dimensions through pending_manage.
This commit is contained in:
parent
fb8817ebf9
commit
e186a2d017
9 changed files with 568 additions and 35 deletions
|
|
@ -12,15 +12,23 @@ initialized: bool,
|
|||
// Wayland globals
|
||||
wl_compositor: *wl.Compositor,
|
||||
wl_display: *wl.Display,
|
||||
wl_output: *wl.Output,
|
||||
wl_registry: *wl.Registry,
|
||||
wl_shm: *wl.Shm,
|
||||
wl_outputs: *std.AutoHashMapUnmanaged(u32, *wl.Output),
|
||||
|
||||
zwlr_layer_shell_v1: *zwlr.LayerShellV1,
|
||||
|
||||
// Wayland globals that we have special structs for
|
||||
wallpaper_image: *WallpaperImage,
|
||||
wm: *WindowManager,
|
||||
xkb_bindings: *XkbBindings,
|
||||
|
||||
/// Pool of Buffers used for rendering wallpapers
|
||||
buffer_pool: BufferPool = .{},
|
||||
|
||||
/// Holds a pixman.Image (and its raw pixels) for the wallpaper
|
||||
/// (same image on all outputs, but scaled separately)
|
||||
wallpaper_image: *WallpaperImage,
|
||||
|
||||
// WM Configuration
|
||||
config: *Config,
|
||||
|
||||
|
|
@ -36,12 +44,14 @@ pub const PendingManage = struct {
|
|||
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,
|
||||
wl_outputs: *std.AutoHashMapUnmanaged(u32, *wl.Output),
|
||||
|
||||
river_layer_shell_v1: *river.LayerShellV1, // TODO
|
||||
river_window_manager_v1: *river.WindowManagerV1,
|
||||
river_xkb_bindings_v1: *river.XkbBindingsV1,
|
||||
|
||||
zwlr_layer_shell_v1: *zwlr.LayerShellV1,
|
||||
config: *Config,
|
||||
};
|
||||
|
|
@ -54,9 +64,10 @@ pub fn create(options: Options) !*Context {
|
|||
.initialized = false,
|
||||
.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,
|
||||
.wl_outputs = options.wl_outputs,
|
||||
.zwlr_layer_shell_v1 = options.zwlr_layer_shell_v1,
|
||||
.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),
|
||||
|
|
@ -70,6 +81,9 @@ pub fn destroy(context: *Context) void {
|
|||
context.xkb_bindings.destroy();
|
||||
context.wm.destroy();
|
||||
|
||||
context.wallpaper_image.destroy();
|
||||
context.buffer_pool.deinit();
|
||||
|
||||
utils.allocator.destroy(context);
|
||||
}
|
||||
|
||||
|
|
@ -98,6 +112,7 @@ const zwlr = wayland.client.zwlr;
|
|||
|
||||
const utils = @import("utils.zig");
|
||||
const Config = @import("Config.zig");
|
||||
const BufferPool = @import("BufferPool.zig");
|
||||
const WallpaperImage = @import("WallpaperImage.zig");
|
||||
const WindowManager = @import("WindowManager.zig");
|
||||
const XkbBindings = @import("XkbBindings.zig");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue