From 6bb62b7fddaf40139d75cc733511d1ec3f231c7e Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Fri, 4 Mar 2022 19:05:45 +0200 Subject: [PATCH 45/45] gtk4: Detect map canvas size changes Listen to "resize" signal instead of "size-allocate" that does not exist in gtk4. See osdn #44024 Signed-off-by: Marko Lindqvist --- client/gui-gtk-4.0/gui_main.c | 4 ++-- client/gui-gtk-4.0/mapview.c | 6 +++--- client/gui-gtk-4.0/mapview.h | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/client/gui-gtk-4.0/gui_main.c b/client/gui-gtk-4.0/gui_main.c index a5356b18e1..7726aabbac 100644 --- a/client/gui-gtk-4.0/gui_main.c +++ b/client/gui-gtk-4.0/gui_main.c @@ -1507,8 +1507,8 @@ static void setup_widgets(void) gtk_drawing_area_set_draw_func(GTK_DRAWING_AREA(map_canvas), map_canvas_draw, NULL, NULL); - g_signal_connect(map_canvas, "size-allocate", - G_CALLBACK(map_canvas_configure), NULL); + g_signal_connect(map_canvas, "resize", + G_CALLBACK(map_canvas_resize), NULL); g_signal_connect(map_canvas, "motion_notify_event", G_CALLBACK(move_mapcanvas), NULL); diff --git a/client/gui-gtk-4.0/mapview.c b/client/gui-gtk-4.0/mapview.c index ef684fa02e..0f60e6437f 100644 --- a/client/gui-gtk-4.0/mapview.c +++ b/client/gui-gtk-4.0/mapview.c @@ -387,10 +387,10 @@ bool mapview_is_frozen(void) /**********************************************************************//** Update on canvas widget size change **************************************************************************/ -void map_canvas_configure(GtkWidget *w, GdkRectangle *allocation, - gpointer data) +void map_canvas_resize(GtkWidget *w, int width, int height, + gpointer data) { - map_canvas_resized(allocation->width, allocation->height); + map_canvas_resized(width, height); } /**********************************************************************//** diff --git a/client/gui-gtk-4.0/mapview.h b/client/gui-gtk-4.0/mapview.h index c250fea9a5..379c08decb 100644 --- a/client/gui-gtk-4.0/mapview.h +++ b/client/gui-gtk-4.0/mapview.h @@ -35,8 +35,8 @@ void overview_canvas_draw(GtkDrawingArea *w, cairo_t *cr, int width, int height, gpointer data); void map_canvas_draw(GtkDrawingArea *w, cairo_t *cr, int width, int height, gpointer data); -void map_canvas_configure(GtkWidget *w, GdkRectangle *allocation, - gpointer data); +void map_canvas_resize(GtkWidget *w, int width, int height, + gpointer data); void put_unit_image(struct unit *punit, GtkImage *p, int height); -- 2.34.1