mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-29 02:33:55 +00:00
The way we originally handled globals gradually escalated into an unholy mess of ad-hoc helper functions and special-case handlers, which proved to be hard to scale. Using a type-erased EnumMap like this makes everything *far* easier to work and reason with, I think. Also nuked the `xdg_wm_dialog_v1` hack that was necessary to prevent old versions of gtk4-layer-shell crashing. If by the time of 1.4's release people are still using those versions, it's on them.
75 lines
1.6 KiB
Zig
75 lines
1.6 KiB
Zig
const std = @import("std");
|
|
const Allocator = std.mem.Allocator;
|
|
|
|
const gdk = @import("gdk");
|
|
|
|
const Config = @import("../../../config.zig").Config;
|
|
const input = @import("../../../input.zig");
|
|
const ApprtWindow = @import("../class/window.zig").Window;
|
|
|
|
const log = std.log.scoped(.winproto_noop);
|
|
|
|
pub const App = struct {
|
|
pub fn init(
|
|
_: Allocator,
|
|
_: *gdk.Display,
|
|
_: [:0]const u8,
|
|
_: *const Config,
|
|
) !?App {
|
|
return null;
|
|
}
|
|
|
|
pub fn deinit(self: *App) void {
|
|
_ = self;
|
|
}
|
|
|
|
pub fn eventMods(
|
|
_: *App,
|
|
_: ?*gdk.Device,
|
|
_: gdk.ModifierType,
|
|
) ?input.Mods {
|
|
return null;
|
|
}
|
|
|
|
pub fn supportsQuickTerminal(_: App) bool {
|
|
return false;
|
|
}
|
|
pub fn initQuickTerminal(_: *App, _: *ApprtWindow) !void {}
|
|
};
|
|
|
|
pub const Window = struct {
|
|
pub fn init(
|
|
_: Allocator,
|
|
_: *App,
|
|
_: *ApprtWindow,
|
|
) !Window {
|
|
return .{};
|
|
}
|
|
|
|
pub fn deinit(self: Window, alloc: Allocator) void {
|
|
_ = self;
|
|
_ = alloc;
|
|
}
|
|
|
|
pub fn updateConfigEvent(
|
|
_: *Window,
|
|
_: *const ApprtWindow.DerivedConfig,
|
|
) !void {}
|
|
|
|
pub fn resizeEvent(_: *Window) !void {}
|
|
|
|
pub fn syncAppearance(_: *Window) !void {}
|
|
|
|
/// This returns true if CSD is enabled for this window. This
|
|
/// should be the actual present state of the window, not the
|
|
/// desired state.
|
|
pub fn clientSideDecorationEnabled(self: Window) bool {
|
|
_ = self;
|
|
return true;
|
|
}
|
|
|
|
pub fn addSubprocessEnv(_: *Window, _: *std.process.EnvMap) !void {}
|
|
|
|
pub fn setUrgent(_: *Window, _: bool) !void {}
|
|
};
|