+
+// X11 ICCCM values for window layers
+#define WIN_LAYER_NORMAL 4
+#define WIN_LAYER_ABOVE_DOCK 10
+
+// X11 window manager property name
+#define XA_WIN_LAYER "_WIN_LAYER"
+
+// X11 window manager property name atom
+static Atom gs_XA_WIN_LAYER = 0;
+
+
+static void wx_win_hints_set_layer(GtkWidget *window, int layer)
+{
+#ifndef __WXGTK20__
+ XEvent xev;
+ GdkWindowPrivate *priv;
+ gint prev_error;
+
+ prev_error = gdk_error_warnings;
+ gdk_error_warnings = 0;
+ priv = (GdkWindowPrivate*)(GTK_WIDGET(window)->window);
+
+ if (GTK_WIDGET_MAPPED(window))
+ {
+ xev.type = ClientMessage;
+ xev.xclient.type = ClientMessage;
+ xev.xclient.window = priv->xwindow;
+ xev.xclient.message_type = gs_XA_WIN_LAYER;
+ xev.xclient.format = 32;
+ xev.xclient.data.l[0] = (long)layer;
+ xev.xclient.data.l[1] = gdk_time_get();
+
+ XSendEvent(GDK_DISPLAY(), GDK_ROOT_WINDOW(), False,
+ SubstructureNotifyMask, (XEvent*) &xev);
+ }
+ else
+ {
+ long data[1];
+
+ data[0] = layer;
+ XChangeProperty(GDK_DISPLAY(), priv->xwindow, gs_XA_WIN_LAYER,
+ XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 1);
+ }
+ gdk_error_warnings = prev_error;
+#endif
+}
+