- // if WM supports _NET_REQUEST_FRAME_EXTENTS
- GdkAtom request_extents =
- gdk_atom_intern("_NET_REQUEST_FRAME_EXTENTS", false);
- GdkScreen* screen = gdk_drawable_get_screen(m_widget->window);
- if (gdk_x11_screen_supports_net_wm_hint(screen, request_extents))
- {
- // send _NET_REQUEST_FRAME_EXTENTS
- XClientMessageEvent xevent;
- memset(&xevent, 0, sizeof(xevent));
- xevent.type = ClientMessage;
- xevent.window = gdk_x11_drawable_get_xid(m_widget->window);
- xevent.message_type = gdk_x11_atom_to_xatom_for_display(
- gdk_drawable_get_display(m_widget->window), request_extents);
- xevent.format = 32;
- Display* display = gdk_x11_drawable_get_xdisplay(m_widget->window);
- XSendEvent(display, DefaultRootWindow(display), false,
- SubstructureNotifyMask | SubstructureRedirectMask,
- (XEvent*)&xevent);
-
- // defer calling gtk_widget_show()
- m_isShown = true;
- return true;
- }
- // WM does not support _NET_REQUEST_FRAME_EXTENTS, overall size may
- // change when correct frame extents become known.
+ m_deferShow =
+ deferShow = gdk_x11_screen_supports_net_wm_hint(
+ gdk_drawable_get_screen(m_widget->window),
+ gdk_atom_intern("_NET_REQUEST_FRAME_EXTENTS", false)) != 0;
+ }
+ if (deferShow)
+ {
+ // send _NET_REQUEST_FRAME_EXTENTS
+ XClientMessageEvent xevent;
+ memset(&xevent, 0, sizeof(xevent));
+ xevent.type = ClientMessage;
+ xevent.window = gdk_x11_drawable_get_xid(m_widget->window);
+ xevent.message_type = gdk_x11_atom_to_xatom_for_display(
+ gdk_drawable_get_display(m_widget->window),
+ gdk_atom_intern("_NET_REQUEST_FRAME_EXTENTS", false));
+ xevent.format = 32;
+ Display* display = gdk_x11_drawable_get_xdisplay(m_widget->window);
+ XSendEvent(display, DefaultRootWindow(display), false,
+ SubstructureNotifyMask | SubstructureRedirectMask,
+ (XEvent*)&xevent);
+
+ // defer calling gtk_widget_show()
+ m_isShown = true;
+ return true;
+ }