diff options
| author | Can Celik <ogulcancelik@gmail.com> | 2026-04-04 19:22:04 +0300 |
|---|---|---|
| committer | Can Celik <ogulcancelik@gmail.com> | 2026-04-05 01:23:06 +0300 |
| commit | 41dd733ca7123c9ac4bfc6c781697a660e95b052 (patch) | |
| tree | 3fc91815ca139ef2e0b281bba0abda4ef15175f4 /vendor/libghostty-vt/src/apprt/gtk/class/debug_warning.zig | |
| parent | 55c138263e190a1e79d4b997bfb9397306c0ec1f (diff) | |
feat: finish ghostty pane backend integration
Diffstat (limited to 'vendor/libghostty-vt/src/apprt/gtk/class/debug_warning.zig')
| -rw-r--r-- | vendor/libghostty-vt/src/apprt/gtk/class/debug_warning.zig | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/vendor/libghostty-vt/src/apprt/gtk/class/debug_warning.zig b/vendor/libghostty-vt/src/apprt/gtk/class/debug_warning.zig new file mode 100644 index 00000000..0ad32033 --- /dev/null +++ b/vendor/libghostty-vt/src/apprt/gtk/class/debug_warning.zig @@ -0,0 +1,50 @@ +const adw = @import("adw"); +const gobject = @import("gobject"); +const gtk = @import("gtk"); + +const adw_version = @import("../adw_version.zig"); +const gresource = @import("../build/gresource.zig"); +const Common = @import("../class.zig").Common; + +/// Debug warning banner. It will be based on adw.Banner if we're using Adwaita +/// 1.3 or newer. Otherwise it will use a gtk.Label. +pub const DebugWarning = extern struct { + const Self = @This(); + parent_instance: Parent, + pub const Parent = if (adw_version.supportsBanner()) adw.Bin else gtk.Box; + pub const getGObjectType = gobject.ext.defineClass(Self, .{ + .name = "GhosttyDebugWarning", + .instanceInit = &init, + .classInit = &Class.init, + .parent_class = &Class.parent, + }); + + fn init(self: *Self, _: *Class) callconv(.c) void { + gtk.Widget.initTemplate(self.as(gtk.Widget)); + } + + const C = Common(Self, null); + pub const as = C.as; + pub const ref = C.ref; + pub const unref = C.unref; + const private = C.private; + + pub const Class = extern struct { + parent_class: Parent.Class, + var parent: *Parent.Class = undefined; + pub const Instance = Self; + + fn init(class: *Class) callconv(.c) void { + gtk.Widget.Class.setTemplateFromResource( + class.as(gtk.Widget.Class), + comptime gresource.blueprint(.{ + .major = 1, + .minor = if (adw_version.supportsBanner()) 3 else 2, + .name = "debug-warning", + }), + ); + } + + pub const as = C.Class.as; + }; +}; |
