|
|
|
@ -1,37 +1,37 @@
|
|
|
|
|
const Self = @This();
|
|
|
|
|
|
|
|
|
|
const std = @import("std");
|
|
|
|
|
|
|
|
|
|
const c = @import("c.zig");
|
|
|
|
|
|
|
|
|
|
const Box = @import("box.zig");
|
|
|
|
|
const Log = @import("log.zig").Log;
|
|
|
|
|
const Output = @import("output.zig");
|
|
|
|
|
|
|
|
|
|
pub const LayerSurface = struct {
|
|
|
|
|
const Self = @This();
|
|
|
|
|
output: *Output,
|
|
|
|
|
wlr_layer_surface: *c.wlr_layer_surface_v1,
|
|
|
|
|
|
|
|
|
|
output: *Output,
|
|
|
|
|
wlr_layer_surface: *c.wlr_layer_surface_v1,
|
|
|
|
|
/// True if the layer surface is currently mapped
|
|
|
|
|
mapped: bool,
|
|
|
|
|
|
|
|
|
|
/// True if the layer surface is currently mapped
|
|
|
|
|
mapped: bool,
|
|
|
|
|
box: Box,
|
|
|
|
|
layer: c.zwlr_layer_shell_v1_layer,
|
|
|
|
|
|
|
|
|
|
box: Box,
|
|
|
|
|
layer: c.zwlr_layer_shell_v1_layer,
|
|
|
|
|
// Listeners active the entire lifetime of the layser surface
|
|
|
|
|
listen_destroy: c.wl_listener,
|
|
|
|
|
listen_map: c.wl_listener,
|
|
|
|
|
listen_unmap: c.wl_listener,
|
|
|
|
|
|
|
|
|
|
// Listeners active the entire lifetime of the layser surface
|
|
|
|
|
listen_destroy: c.wl_listener,
|
|
|
|
|
listen_map: c.wl_listener,
|
|
|
|
|
listen_unmap: c.wl_listener,
|
|
|
|
|
// Listeners only active while the layer surface is mapped
|
|
|
|
|
listen_commit: c.wl_listener,
|
|
|
|
|
listen_new_popup: c.wl_listener,
|
|
|
|
|
|
|
|
|
|
// Listeners only active while the layer surface is mapped
|
|
|
|
|
listen_commit: c.wl_listener,
|
|
|
|
|
listen_new_popup: c.wl_listener,
|
|
|
|
|
|
|
|
|
|
pub fn init(
|
|
|
|
|
pub fn init(
|
|
|
|
|
self: *Self,
|
|
|
|
|
output: *Output,
|
|
|
|
|
wlr_layer_surface: *c.wlr_layer_surface_v1,
|
|
|
|
|
layer: c.zwlr_layer_shell_v1_layer,
|
|
|
|
|
) void {
|
|
|
|
|
) void {
|
|
|
|
|
self.output = output;
|
|
|
|
|
self.wlr_layer_surface = wlr_layer_surface;
|
|
|
|
|
wlr_layer_surface.data = self;
|
|
|
|
@ -55,9 +55,9 @@ pub const LayerSurface = struct {
|
|
|
|
|
|
|
|
|
|
self.listen_unmap.notify = handleUnmap;
|
|
|
|
|
c.wl_signal_add(&self.wlr_layer_surface.events.unmap, &self.listen_unmap);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn handleDestroy(listener: ?*c.wl_listener, data: ?*c_void) callconv(.C) void {
|
|
|
|
|
fn handleDestroy(listener: ?*c.wl_listener, data: ?*c_void) callconv(.C) void {
|
|
|
|
|
const self = @fieldParentPtr(Self, "listen_destroy", listener.?);
|
|
|
|
|
const output = self.output;
|
|
|
|
|
|
|
|
|
@ -73,9 +73,9 @@ pub const LayerSurface = struct {
|
|
|
|
|
output.root.server.allocator.destroy(node);
|
|
|
|
|
|
|
|
|
|
self.output.arrangeLayers();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn handleMap(listener: ?*c.wl_listener, data: ?*c_void) callconv(.C) void {
|
|
|
|
|
fn handleMap(listener: ?*c.wl_listener, data: ?*c_void) callconv(.C) void {
|
|
|
|
|
const self = @fieldParentPtr(Self, "listen_map", listener.?);
|
|
|
|
|
const wlr_layer_surface = self.wlr_layer_surface;
|
|
|
|
|
|
|
|
|
@ -94,9 +94,9 @@ pub const LayerSurface = struct {
|
|
|
|
|
wlr_layer_surface.surface,
|
|
|
|
|
wlr_layer_surface.output,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn handleUnmap(listener: ?*c.wl_listener, data: ?*c_void) callconv(.C) void {
|
|
|
|
|
fn handleUnmap(listener: ?*c.wl_listener, data: ?*c_void) callconv(.C) void {
|
|
|
|
|
const self = @fieldParentPtr(Self, "listen_unmap", listener.?);
|
|
|
|
|
|
|
|
|
|
Log.Debug.log("Layer surface '{}' unmapped.", .{self.wlr_layer_surface.namespace});
|
|
|
|
@ -135,9 +135,9 @@ pub const LayerSurface = struct {
|
|
|
|
|
const seat = &node.data;
|
|
|
|
|
seat.focus(null);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn handleCommit(listener: ?*c.wl_listener, data: ?*c_void) callconv(.C) void {
|
|
|
|
|
fn handleCommit(listener: ?*c.wl_listener, data: ?*c_void) callconv(.C) void {
|
|
|
|
|
const self = @fieldParentPtr(Self, "listen_commit", listener.?);
|
|
|
|
|
const wlr_layer_surface = self.wlr_layer_surface;
|
|
|
|
|
|
|
|
|
@ -162,12 +162,11 @@ pub const LayerSurface = struct {
|
|
|
|
|
// TODO: only reconfigure if things haven't changed
|
|
|
|
|
// https://github.com/swaywm/wlroots/issues/1079
|
|
|
|
|
self.output.arrangeLayers();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn handleNewPopup(listener: ?*c.wl_listener, data: ?*c_void) callconv(.C) void {
|
|
|
|
|
fn handleNewPopup(listener: ?*c.wl_listener, data: ?*c_void) callconv(.C) void {
|
|
|
|
|
const self = @fieldParentPtr(Self, "listen_new_popup", listener.?);
|
|
|
|
|
Log.Debug.log("new layer surface popup.", .{});
|
|
|
|
|
// TODO: handle popups
|
|
|
|
|
unreachable;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|