Skip to content

Commit

Permalink
Don't use compositor trick in Gtk+3 3.16.1 or higher.
Browse files Browse the repository at this point in the history
This causes negative side effects, as described in the following bug:
<https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=824616>
As the reimplementation of gtk_window_set_titlebar is sufficient in
newer versions, this is not required anymore.
  • Loading branch information
chris-se committed May 20, 2016
1 parent e9a1e5b commit c96202d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,15 @@ re-login is required to have CSDs disabled on non-GNOME desktops.
#How it works:

`$LD_PRELOAD` is used to override several Gdk and glib/gobject APIs to
intercept related calls Gtk+ 3 uses to setup CSDs. While Gtk+ 3 is
trying to initialize CSDs, it is led to believe that there is no
compositor available, so CSDs are not added. For later Gtk+ 3 versions,
the `gtk_window_set_titlebar` method is re-implemented, as they do not
allow for the disabling of CSDs via the compositor trick. Since X
compositing is never really disabled (nor are other parts of Gtk+ 3 led
to believe so), this does not have adverse consequences. This appears
to be the simplest way to disable CSDs without obvious side effects.
intercept related calls Gtk+ 3 uses to setup CSDs. For older versions
of Gtk+ 3, while it is trying to initialize CSDs, it is led to believe
that there is no compositor available, so CSDs are not added. For later
Gtk+ 3 versions (3.16.1+), the `gtk_window_set_titlebar` method is
reimplemented, as tricking Gtk+ 3 into thinking the compositor is
disabled has side effects and is not sufficent anymore.

Additionally, as gtk_window_set_titlebar is also called from Gtk+
internally (and LD_PRELOAD cannot override function calls within a
library), several other places in Gtk+3 (e.g. buildable interfaces for
GtkWindow and GtkDialog) are also overridden to ensure that CSDs are
disabled.
5 changes: 4 additions & 1 deletion gtk3-nocsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,10 @@ extern void gtk_header_bar_set_show_close_button (GtkHeaderBar *bar, gboolean se
}

extern gboolean gdk_screen_is_composited (GdkScreen *screen) {
if(is_compatible_gtk_version() && are_csd_disabled()) {
/* With Gtk+3 3.16.1+ we reimplement gtk_window_set_titlebar ourselves, hence
* we don't want to re-use the compositing hack, especially since it causes
* problems in newer Gtk versions. */
if(is_compatible_gtk_version() && are_csd_disabled() && !is_gtk_version_larger_or_equal(3, 16, 1)) {
if(TLSD->disable_composite)
return FALSE;
}
Expand Down

0 comments on commit c96202d

Please sign in to comment.