From 57bf0b08ffe04578feb087fab739a48543c0ac75 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 21 Apr 2024 10:17:27 -0700 Subject: [PATCH] Revert "Merge pull request #1690 from TheOnlyMrCat/gtk_opacity" This reverts commit cbd787c92d296fc4b990a2d1cbf5c901af5b08bc, reversing changes made to 74e8275e8ba38116a2f6a585902e7f8897c9b085. See: https://github.com/mitchellh/ghostty/issues/1704 --- src/apprt/gtk/Window.zig | 21 +++------------------ src/apprt/gtk/style-dark.css | 3 --- src/apprt/gtk/style-hc-dark.css | 3 --- src/apprt/gtk/style-hc.css | 3 --- src/apprt/gtk/style.css | 3 --- 5 files changed, 3 insertions(+), 30 deletions(-) diff --git a/src/apprt/gtk/Window.zig b/src/apprt/gtk/Window.zig index f046f4f72..4adccac4b 100644 --- a/src/apprt/gtk/Window.zig +++ b/src/apprt/gtk/Window.zig @@ -66,9 +66,9 @@ pub fn init(self: *Window, app: *App) !void { c.gtk_window_set_icon_name(gtk_window, "com.mitchellh.ghostty"); - // Remove the window's background if any of the widgets need to be transparent + // Apply background opacity if we have it if (app.config.@"background-opacity" < 1) { - c.gtk_widget_remove_css_class(@ptrCast(window), "background"); + c.gtk_widget_set_opacity(@ptrCast(window), app.config.@"background-opacity"); } // Use the new GTK4 header bar. We only create a header bar if we have @@ -119,31 +119,16 @@ pub fn init(self: *Window, app: *App) !void { c.gtk_widget_set_vexpand(notebook_widget, 1); c.gtk_widget_set_hexpand(notebook_widget, 1); - // Add the window background to the tab bar so it still has a background - // color when we're using a transparent window. - const tab_bar = c.gtk_widget_get_first_child(notebook_widget); - c.gtk_widget_add_css_class(tab_bar, "background"); - - // Remove the background from the stack so it doesn't become opaque - // when multiple tabs are open - const stack = c.gtk_widget_get_last_child(notebook_widget); - c.gtk_widget_add_css_class(stack, "transparent"); - // Create our box which will hold our widgets. const box = c.gtk_box_new(c.GTK_ORIENTATION_VERTICAL, 0); // In debug we show a warning. This is a really common issue where // people build from source in debug and performance is really bad. if (builtin.mode == .Debug) { - const warning_box = c.gtk_box_new(c.GTK_ORIENTATION_VERTICAL, 0); 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_bottom(warning, 10); - c.gtk_box_append(@ptrCast(warning_box), warning); - - c.gtk_widget_add_css_class(@ptrCast(warning_box), "background"); - c.gtk_box_append(@ptrCast(box), warning_box); + c.gtk_box_append(@ptrCast(box), warning); } c.gtk_box_append(@ptrCast(box), notebook_widget); diff --git a/src/apprt/gtk/style-dark.css b/src/apprt/gtk/style-dark.css index a9aa2dcc0..e69de29bb 100644 --- a/src/apprt/gtk/style-dark.css +++ b/src/apprt/gtk/style-dark.css @@ -1,3 +0,0 @@ -.transparent { - background-color: transparent; -} diff --git a/src/apprt/gtk/style-hc-dark.css b/src/apprt/gtk/style-hc-dark.css index a9aa2dcc0..e69de29bb 100644 --- a/src/apprt/gtk/style-hc-dark.css +++ b/src/apprt/gtk/style-hc-dark.css @@ -1,3 +0,0 @@ -.transparent { - background-color: transparent; -} diff --git a/src/apprt/gtk/style-hc.css b/src/apprt/gtk/style-hc.css index a9aa2dcc0..e69de29bb 100644 --- a/src/apprt/gtk/style-hc.css +++ b/src/apprt/gtk/style-hc.css @@ -1,3 +0,0 @@ -.transparent { - background-color: transparent; -} diff --git a/src/apprt/gtk/style.css b/src/apprt/gtk/style.css index a9aa2dcc0..e69de29bb 100644 --- a/src/apprt/gtk/style.css +++ b/src/apprt/gtk/style.css @@ -1,3 +0,0 @@ -.transparent { - background-color: transparent; -}