From c7397423f1151eb5f2424c1d58672f388d6e2fc9 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sat, 3 Feb 2024 09:24:49 +0300 Subject: GTK: allow disabling client-side decorations by setting $GTK_CSD=0 * This is the same variable used by gtk3-nocsd, but we will now work even without preloading any libraries. Also, it turns out that gtk3-nocsd does not ship as a FreeBSD port and hasn't been updated in a long time. * Setting this in .teco_ini wouldn't have been easy since the teco_interface_init() is called before any TECO code. Also, you might not even want disable this globally but depending on the window manager. * Therefore, you are advised to `export GTK_CSD=0` in ~/.xsession. * The --no-csd command line option is kept for the time being, but probably serves no more purpose. --- doc/sciteco.1.in | 4 ++++ src/interface-gtk/interface.c | 9 ++------- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/doc/sciteco.1.in b/doc/sciteco.1.in index 1ebb4de..73303a1 100644 --- a/doc/sciteco.1.in +++ b/doc/sciteco.1.in @@ -305,6 +305,10 @@ for details. environment before initializing Curses, so these variables can be modified in the profile macro. . +.LP +On GTK+, you may turn off the infamous client-side window decorations +by setting the environment variable \fBGTK_CSD\fP to \(lq0\(rq. +. . .SH SIGNALS . diff --git a/src/interface-gtk/interface.c b/src/interface-gtk/interface.c index 547b2c8..bddd51f 100644 --- a/src/interface-gtk/interface.c +++ b/src/interface-gtk/interface.c @@ -279,7 +279,8 @@ teco_interface_init(void) "type-label"); gtk_header_bar_pack_start(GTK_HEADER_BAR(teco_interface.info_bar_widget), teco_interface.info_type_widget); - if (teco_interface.xembed_id || teco_interface.no_csd) { + if (teco_interface.xembed_id || teco_interface.no_csd || + !g_strcmp0(g_getenv("GTK_CSD"), "0")) { /* fall back to adding the info bar as an ordinary widget */ gtk_box_pack_start(GTK_BOX(vbox), teco_interface.info_bar_widget, FALSE, FALSE, 0); @@ -390,12 +391,6 @@ teco_interface_init(void) GOptionGroup * teco_interface_get_options(void) { - /* - * FIXME: On platforms where you want to disable CSD, you usually - * want to disable it always, so it should be configurable in the SciTECO - * profile. - * On the other hand, you could just install gtk3-nocsd. - */ static const GOptionEntry entries[] = { {"no-csd", 0, G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &teco_interface.no_csd, -- cgit v1.2.3