+}
+
+bool wxTopLevelWindowGTK::SetTransparent(wxByte alpha)
+{
+ GdkWindow* window = NULL;
+ if (m_widget)
+ window = gtk_widget_get_window(m_widget);
+ if (window == NULL)
+ return false;
+
+#ifdef GDK_WINDOWING_X11
+ Display* dpy = GDK_WINDOW_XDISPLAY(window);
+ Window win = GDK_WINDOW_XID(window);
+
+ // Using pure Xlib to not have a GTK version check mess due to gtk2.0 not having GdkDisplay
+ if (alpha == 0xff)
+ XDeleteProperty(dpy, win, XInternAtom(dpy, "_NET_WM_WINDOW_OPACITY", False));
+ else
+ {
+ long opacity = alpha * 0x1010101L;
+ XChangeProperty(dpy, win, XInternAtom(dpy, "_NET_WM_WINDOW_OPACITY", False),
+ XA_CARDINAL, 32, PropModeReplace,
+ (unsigned char *) &opacity, 1L);
+ }
+ XSync(dpy, False);
+ return true;
+#else // !GDK_WINDOWING_X11
+ return false;
+#endif // GDK_WINDOWING_X11 / !GDK_WINDOWING_X11
+}
+
+bool wxTopLevelWindowGTK::CanSetTransparent()
+{
+ // allow to override automatic detection as it's far from perfect
+ const wxString SYSOPT_TRANSPARENT = "gtk.tlw.can-set-transparent";
+ if ( wxSystemOptions::HasOption(SYSOPT_TRANSPARENT) )
+ {
+ return wxSystemOptions::GetOptionInt(SYSOPT_TRANSPARENT) != 0;
+ }
+
+#ifdef __WXGTK3__
+ return gtk_widget_is_composited(m_widget) != 0;
+#else
+#if GTK_CHECK_VERSION(2,10,0)
+ if (!gtk_check_version(2,10,0))
+ {
+ return gtk_widget_is_composited(m_widget) != 0;
+ }
+ else
+#endif // In case of lower versions than gtk+-2.10.0 we could look for _NET_WM_CM_Sn ourselves
+ {
+ return false;
+ }
+#endif // !__WXGTK3__
+
+#if 0 // Don't be optimistic here for the sake of wxAUI
+ int opcode, event, error;
+ // Check for the existence of a RGBA visual instead?
+ return XQueryExtension(gdk_x11_get_default_xdisplay (),
+ "Composite", &opcode, &event, &error);
+#endif