gtk: add devel class to window in debug builds

This commit is contained in:
Paul Berg
2024-06-10 17:43:33 +02:00
parent 439988930d
commit 05e7bf7634

View File

@ -113,13 +113,14 @@ pub fn init(self: *Window, app: *App) !void {
// Create our box which will hold our widgets. // Create our box which will hold our widgets.
const box = c.gtk_box_new(c.GTK_ORIENTATION_VERTICAL, 0); const box = c.gtk_box_new(c.GTK_ORIENTATION_VERTICAL, 0);
// In debug we show a warning. This is a really common issue where // In debug we show a warning and apply the 'devel' class to the window.
// people build from source in debug and performance is really bad. // This is a really common issue where people build from source in debug and performance is really bad.
if (comptime std.debug.runtime_safety) { if (comptime std.debug.runtime_safety) {
const warning = c.gtk_label_new("⚠️ You're running a debug build of Ghostty! Performance will be degraded."); const warning = c.gtk_label_new("⚠️ You're running a debug build of Ghostty! Performance will be degraded.");
c.gtk_widget_set_margin_top(warning, 10); c.gtk_widget_set_margin_top(warning, 10);
c.gtk_widget_set_margin_bottom(warning, 10); c.gtk_widget_set_margin_bottom(warning, 10);
c.gtk_box_append(@ptrCast(box), warning); c.gtk_box_append(@ptrCast(box), warning);
c.gtk_widget_add_css_class(@ptrCast(gtk_window), "devel");
} }
self.notebook = Notebook.create(self, box); self.notebook = Notebook.create(self, box);