From a95a6eb4aae5bf15be0eef80d0247595cf3874b3 Mon Sep 17 00:00:00 2001
From: Vadim Zeitlin <vadim@wxwidgets.org>
Date: Sat, 31 Mar 2007 14:51:10 +0000
Subject: [PATCH] added gtk.tlw.can-set-transparency system option (replaces
 patch 1527017)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45187 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 docs/changes.txt         |  1 +
 docs/latex/wx/sysopt.tex | 13 +++++++++++++
 src/gtk/toplevel.cpp     |  8 ++++++++
 3 files changed, 22 insertions(+)

diff --git a/docs/changes.txt b/docs/changes.txt
index 244c410e7f..b608898d23 100644
--- a/docs/changes.txt
+++ b/docs/changes.txt
@@ -109,6 +109,7 @@ wxGTK:
 - wxTopLevelWindow::GetClientSize() returns 0x0 when the window is minimized.
 - Added support for colour cursors (Pascal Monasse).
 - Setting foreground colour of single line wxTextCtrl now works
+- Added gtk.tlw.can-set-transparency system option
 
 wxMac:
 
diff --git a/docs/latex/wx/sysopt.tex b/docs/latex/wx/sysopt.tex
index cd945711a4..12b8b11bf8 100644
--- a/docs/latex/wx/sysopt.tex
+++ b/docs/latex/wx/sysopt.tex
@@ -33,6 +33,19 @@ Setting this to 0 causes more flicker, but allows applications to paint graphics
 used.}
 \end{twocollist}
 
+\wxheading{GTK}
+
+\twocolwidtha{7cm}
+\begin{twocollist}\itemsep=0pt
+\twocolitem{{\bf Option}}{{\bf Value}}
+\twocolitem{gtk.tlw.can-set-transparent}{\helpref{wxTopLevelWindow::CanSetTransparent()}{wxtoplevelwindowcansettransparent} 
+method normally tries to detect automatically whether transparency for top
+level windows is currently supported, however this may sometimes fail and this
+option allows to override the automatic detection. Setting it to $1$ makes the
+transparency be always available (setting it can still fail, of course) and
+setting it to $0$ makes it always unavailable.}
+\end{twocollist}
+
 \wxheading{Mac}
 
 \twocolwidtha{7cm}
diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp
index 7227e4887f..f47a53f8b8 100644
--- a/src/gtk/toplevel.cpp
+++ b/src/gtk/toplevel.cpp
@@ -33,6 +33,7 @@
 
 #include "wx/gtk/private.h"
 #include "wx/evtloop.h"
+#include "wx/sysopt.h"
 
 #include <gtk/gtk.h>
 #include <gdk/gdkx.h>
@@ -1415,6 +1416,13 @@ bool wxTopLevelWindowGTK::SetTransparent(wxByte alpha)
 
 bool wxTopLevelWindowGTK::CanSetTransparent()
 {
+    // allow to override automatic detection as it's far from perfect
+    static const wxChar *SYSOPT_TRANSPARENT = wxT("gtk.tlw.can-set-transparent");
+    if ( wxSystemOptions::HasOption(SYSOPT_TRANSPARENT) )
+    {
+        return wxSystemOptions::GetOptionInt(SYSOPT_TRANSPARENT) != 0;
+    }
+
 #if GTK_CHECK_VERSION(2,10,0)
     if (!gtk_check_version(2,10,0))
     {
-- 
2.50.0

