+//-----------------------------------------------------------------------------
+
+bool wxGetFrameExtents(GdkWindow* window, int* left, int* right, int* top, int* bottom)
+{
+#ifdef GDK_WINDOWING_X11
+ static GdkAtom property = gdk_atom_intern("_NET_FRAME_EXTENTS", false);
+ GdkDisplay* display = gdk_window_get_display(window);
+ Atom xproperty = gdk_x11_atom_to_xatom_for_display(display, property);
+ Atom type;
+ int format;
+ gulong nitems, bytes_after;
+ guchar* data;
+ Status status = XGetWindowProperty(
+ GDK_DISPLAY_XDISPLAY(display),
+ GDK_WINDOW_XID(window),
+ xproperty,
+ 0, 4, false, XA_CARDINAL,
+ &type, &format, &nitems, &bytes_after, &data);
+ const bool success = status == Success && data && nitems == 4;
+ if (success)
+ {
+ long* p = (long*)data;
+ if (left) *left = int(p[0]);
+ if (right) *right = int(p[1]);
+ if (top) *top = int(p[2]);
+ if (bottom) *bottom = int(p[3]);
+ }
+ if (data)
+ XFree(data);
+ return success;
+#else
+ return false;
+#endif
+}
+