+#if GTK_CHECK_VERSION(3,0,0)
+ /*
+ * And if we're running a gtkapp.c based program and
+ * GtkApplicationWindow has given us a menu bar inside the window,
+ * then we must take that into account as well.
+ *
+ * In its unbounded wisdom, GtkApplicationWindow doesn't actually
+ * give us a direct function call to _find_ the menu bar widget.
+ * Fortunately, we can find it by enumerating the children of the
+ * top-level window and looking for one we didn't put there
+ * ourselves.
+ */
+ {
+ struct find_app_menu_bar_ctx actx, *ctx = &actx;
+ ctx->area = inst->area;
+ ctx->menubar = NULL;
+ gtk_container_foreach(GTK_CONTAINER(inst->window),
+ find_app_menu_bar, ctx);
+
+ if (ctx->menubar) {
+ GtkRequisition req;
+ int min_menu_width;
+ gtk_widget_get_preferred_size(ctx->menubar, NULL, &req);
+
+ /*
+ * This time, the height adjustment is easy (the menu bar
+ * sits above everything), but we have to take care with
+ * the _width_ to ensure we keep min_width and base_width
+ * congruent modulo width_inc.
+ */
+ geom->min_height += req.height;
+ geom->base_height += req.height;
+
+ min_menu_width = req.width;
+ min_menu_width += geom->width_inc - 1;
+ min_menu_width -=
+ ((min_menu_width - geom->base_width%geom->width_inc)
+ % geom->width_inc);
+ if (geom->min_width < min_menu_width)
+ geom->min_width = min_menu_width;
+ }
+ }
+#endif
+}
+
+void set_geom_hints(struct gui_data *inst)
+{
+ GdkGeometry geom;
+ gint flags = GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE | GDK_HINT_RESIZE_INC;
+ compute_geom_hints(inst, &geom);
+#if GTK_CHECK_VERSION(2,0,0)
+ if (inst->gotpos)
+ flags |= GDK_HINT_USER_POS;
+#endif