+ bool success = false;
+ Atom property = 0;
+ if (gdk_x11_screen_supports_net_wm_hint(
+ gdk_drawable_get_screen(window),
+ gdk_atom_intern("_NET_FRAME_EXTENTS", false)))
+ {
+ success = true;
+ property = gdk_x11_get_xatom_by_name_for_display(
+ gdk_drawable_get_display(window),
+ "_NET_FRAME_EXTENTS");
+ }
+
+ if (success)
+ {
+ Atom type;
+ int format;
+ gulong nitems, bytes_after;
+ guchar* data;
+ success = XGetWindowProperty(
+ gdk_x11_drawable_get_xdisplay(window),
+ gdk_x11_drawable_get_xid(window),
+ property,
+ 0, 4,
+ false,
+ XA_CARDINAL,
+ &type, &format, &nitems, &bytes_after, &data
+ ) == Success;
+ if (success)
+ {
+ 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;
+}
+
+// helper: return the GtkSettings either for the screen the current window is
+// on or for the default screen if window is NULL
+static GtkSettings *GetSettingsForWindowScreen(GdkWindow *window)
+{
+ return window ? gtk_settings_get_for_screen(gdk_drawable_get_screen(window))
+ : gtk_settings_get_default();
+}
+
+int wxSystemSettingsNative::GetMetric( wxSystemMetric index, wxWindow* win )
+{
+ GdkWindow *window = NULL;
+ if(win && GTK_WIDGET_REALIZED(win->GetHandle()))
+ window = win->GetHandle()->window;
+