summaryrefslogtreecommitdiff
path: root/apps/plugins/puzzles/gtk.c
diff options
context:
space:
mode:
authorFranklin Wei <git@fwei.tk>2017-01-01 14:57:30 -0500
committerFranklin Wei <git@fwei.tk>2017-01-01 15:00:09 -0500
commit6e5f287606a3039ee26eb4fc8c8f7a05deebe9f0 (patch)
treea5bb5bc9ec91b2fd8630c082f362952393f71bdb /apps/plugins/puzzles/gtk.c
parent985f6e6935357b13a43b6c30f0f1e99786b185b0 (diff)
Fixes and re-sync for puzzles
- Updates to latest upstream (7cae89fb4b22c305b3fd98b4e1be065ad527a9f7). - Also fixes a bug relating to updating parts of the display. - Adds some docs. Change-Id: Idfcce66e0cf3c59e467bab42eafc161df2e495bb
Diffstat (limited to 'apps/plugins/puzzles/gtk.c')
-rw-r--r--apps/plugins/puzzles/gtk.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/apps/plugins/puzzles/gtk.c b/apps/plugins/puzzles/gtk.c
index aa3ba06eed..e132c3db58 100644
--- a/apps/plugins/puzzles/gtk.c
+++ b/apps/plugins/puzzles/gtk.c
@@ -1935,6 +1935,24 @@ static gint configure_window(GtkWidget *widget,
return FALSE;
}
+#if GTK_CHECK_VERSION(3,0,0)
+static int window_extra_height(frontend *fe)
+{
+ int ret = 0;
+ if (fe->menubar) {
+ GtkRequisition req;
+ gtk_widget_get_preferred_size(fe->menubar, &req, NULL);
+ ret += req.height;
+ }
+ if (fe->statusbar) {
+ GtkRequisition req;
+ gtk_widget_get_preferred_size(fe->statusbar, &req, NULL);
+ ret += req.height;
+ }
+ return ret;
+}
+#endif
+
static void resize_fe(frontend *fe)
{
int x, y;
@@ -1942,7 +1960,7 @@ static void resize_fe(frontend *fe)
get_size(fe, &x, &y);
#if GTK_CHECK_VERSION(3,0,0)
- gtk_window_resize_to_geometry(GTK_WINDOW(fe->window), x, y);
+ gtk_window_resize(GTK_WINDOW(fe->window), x, y + window_extra_height(fe));
#else
fe->drawing_area_shrink_pending = FALSE;
gtk_drawing_area_size(GTK_DRAWING_AREA(fe->area), x, y);
@@ -1970,6 +1988,7 @@ static void menu_preset_event(GtkMenuItem *menuitem, gpointer data)
midend_new_game(fe->me);
changed_preset(fe);
resize_fe(fe);
+ midend_redraw(fe->me);
}
GdkAtom compound_text_atom, utf8_string_atom;
@@ -2213,6 +2232,7 @@ static void menu_load_event(GtkMenuItem *menuitem, gpointer data)
changed_preset(fe);
resize_fe(fe);
+ midend_redraw(fe->me);
}
}
@@ -2250,6 +2270,7 @@ static void menu_config_event(GtkMenuItem *menuitem, gpointer data)
midend_new_game(fe->me);
resize_fe(fe);
+ midend_redraw(fe->me);
}
static void menu_about_event(GtkMenuItem *menuitem, gpointer data)
@@ -2648,15 +2669,23 @@ static frontend *new_window(char *arg, int argtype, char **error)
#endif
{
GdkGeometry geom;
- geom.base_width = geom.base_height = 0;
+ geom.base_width = 0;
+#if GTK_CHECK_VERSION(3,0,0)
+ geom.base_height = window_extra_height(fe);
+ gtk_window_set_geometry_hints(GTK_WINDOW(fe->window), NULL,
+ &geom, GDK_HINT_BASE_SIZE);
+#else
+ geom.base_height = 0;
gtk_window_set_geometry_hints(GTK_WINDOW(fe->window), fe->area,
&geom, GDK_HINT_BASE_SIZE);
+#endif
}
fe->w = -1;
fe->h = -1;
get_size(fe, &x, &y);
#if GTK_CHECK_VERSION(3,0,0)
- gtk_window_set_default_geometry(GTK_WINDOW(fe->window), x, y);
+ gtk_window_set_default_size(GTK_WINDOW(fe->window),
+ x, y + window_extra_height(fe));
#else
fe->drawing_area_shrink_pending = FALSE;
gtk_drawing_area_size(GTK_DRAWING_AREA(fe->area), x, y);