apprt/gtk: only create window header bar with window decorations

Fixes #737
This commit is contained in:
Mitchell Hashimoto
2023-10-27 10:08:59 -07:00
parent a01562a52b
commit cf6ee6ed14

View File

@ -72,7 +72,9 @@ pub fn init(self: *Window, app: *App) !void {
c.gtk_widget_set_opacity(@ptrCast(window), app.config.@"background-opacity"); c.gtk_widget_set_opacity(@ptrCast(window), app.config.@"background-opacity");
} }
// Use the new GTK4 header bar // Use the new GTK4 header bar. We only create a header bar if we have
// window decorations.
if (app.config.@"window-decoration") {
const header = c.gtk_header_bar_new(); const header = c.gtk_header_bar_new();
c.gtk_window_set_titlebar(gtk_window, header); c.gtk_window_set_titlebar(gtk_window, header);
{ {
@ -88,10 +90,9 @@ pub fn init(self: *Window, app: *App) !void {
c.gtk_header_bar_pack_end(@ptrCast(header), btn); c.gtk_header_bar_pack_end(@ptrCast(header), btn);
_ = c.g_signal_connect_data(btn, "clicked", c.G_CALLBACK(&gtkActionNewTab), self, null, c.G_CONNECT_DEFAULT); _ = c.g_signal_connect_data(btn, "clicked", c.G_CALLBACK(&gtkActionNewTab), self, null, c.G_CONNECT_DEFAULT);
} }
} else {
// Hide window decoration if configured. This has to happen before // Hide window decoration if configured. This has to happen before
// `gtk_widget_show`. // `gtk_widget_show`.
if (!app.config.@"window-decoration") {
c.gtk_window_set_decorated(gtk_window, 0); c.gtk_window_set_decorated(gtk_window, 0);
} }