+ // Watch for changes to _NET_FRAME_EXTENTS property
+ static GdkAtom property = gdk_atom_intern("_NET_FRAME_EXTENTS", false);
+ if (event->state == GDK_PROPERTY_NEW_VALUE && event->atom == property &&
+ win->IsDecorCacheable() && !win->IsFullScreen())
+ {
+ Atom xproperty = gdk_x11_atom_to_xatom_for_display(
+ gdk_drawable_get_display(event->window), property);
+ Atom type;
+ int format;
+ gulong nitems, bytes_after;
+ long* data = NULL;
+ Status status = XGetWindowProperty(
+ gdk_x11_drawable_get_xdisplay(event->window),
+ gdk_x11_drawable_get_xid(event->window),
+ xproperty,
+ 0, 4, false, XA_CARDINAL,
+ &type, &format, &nitems, &bytes_after, (guchar**)&data);
+ if (status == Success && data && nitems == 4)
+ {
+ const wxSize decorSize =
+ wxSize(int(data[0] + data[1]), int(data[2] + data[3]));
+ if (win->m_decorSize != decorSize)
+ {
+ const wxSize diff = win->m_decorSize - decorSize;
+ win->m_decorSize = decorSize;
+ GetDecorSize(win->m_gdkDecor) = decorSize;
+ if (GTK_WIDGET_VISIBLE(win->m_widget))
+ {
+ // adjust overall size to match change in frame extents
+ win->m_width -= diff.x;
+ win->m_height -= diff.y;
+ if (win->m_width < 0) win->m_width = 0;
+ if (win->m_height < 0) win->m_height = 0;
+ win->m_oldClientWidth = 0;
+ gtk_widget_queue_resize(win->m_wxwindow);
+ }
+ else
+ {
+ // Window not yet visible, adjust client size. This would
+ // cause an obvious size change if window was visible.
+ int w, h;
+ win->GTKDoGetSize(&w, &h);
+ gtk_window_resize(GTK_WINDOW(win->m_widget), w, h);
+ }
+ }
+ if (!GTK_WIDGET_VISIBLE(win->m_widget))
+ {
+ // gtk_widget_show() was deferred, do it now
+ wxSizeEvent sizeEvent(win->GetSize(), win->GetId());
+ sizeEvent.SetEventObject(win);
+ win->HandleWindowEvent(sizeEvent);
+ gtk_widget_show(win->m_widget);
+ wxShowEvent showEvent(win->GetId(), true);
+ showEvent.SetEventObject(win);
+ win->HandleWindowEvent(showEvent);
+ }
+ }
+ if (data)
+ XFree(data);
+ }
+ return false;