From 1a55ceb93a22fd83fcec31c414fb57c729b8790f Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Fri, 11 Mar 2022 22:41:54 +0200 Subject: [PATCH 43/43] gtk4: Replace "size-allocate" signal uses with "resize" Former does not exist in gtk4. See osdn #44078 Signed-off-by: Marko Lindqvist --- client/gui-gtk-4.0/gui_main.c | 17 ++++++++--------- client/gui-gtk-4.0/luaconsole.c | 23 +++++++++++------------ 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/client/gui-gtk-4.0/gui_main.c b/client/gui-gtk-4.0/gui_main.c index 7726aabbac..fd6be23164 100644 --- a/client/gui-gtk-4.0/gui_main.c +++ b/client/gui-gtk-4.0/gui_main.c @@ -348,17 +348,16 @@ static gboolean toplevel_focus(GtkWidget *w, GtkDirectionType arg) prevents users from accidentally missing messages when the chatline gets scrolled up a small amount and stops scrolling down automatically. **************************************************************************/ -static void main_message_area_size_allocate(GtkWidget *widget, - GtkAllocation *allocation, - gpointer data) +static void main_message_area_resize(GtkWidget *widget, int width, int height, + gpointer data) { static int old_width = 0, old_height = 0; - if (allocation->width != old_width - || allocation->height != old_height) { + if (width != old_width + || height != old_height) { chatline_scroll_to_bottom(TRUE); - old_width = allocation->width; - old_height = allocation->height; + old_width = width; + old_height = height; } } @@ -1594,8 +1593,8 @@ static void setup_widgets(void) set_message_buffer_view_link_handlers(text); gtk_text_view_set_editable(GTK_TEXT_VIEW(text), FALSE); gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(sw), text); - g_signal_connect(text, "size-allocate", - G_CALLBACK(main_message_area_size_allocate), NULL); + g_signal_connect(text, "resize", + G_CALLBACK(main_message_area_resize), NULL); gtk_widget_set_name(text, "chatline"); diff --git a/client/gui-gtk-4.0/luaconsole.c b/client/gui-gtk-4.0/luaconsole.c index c18e2c07b6..ef0306c8a5 100644 --- a/client/gui-gtk-4.0/luaconsole.c +++ b/client/gui-gtk-4.0/luaconsole.c @@ -63,9 +63,8 @@ static void luaconsole_dialog_create(struct luaconsole_data *pdialog); static void luaconsole_dialog_refresh(struct luaconsole_data *pdialog); static void luaconsole_dialog_destroy(struct luaconsole_data *pdialog); -static void luaconsole_dialog_area_size_allocate(GtkWidget *widget, - GtkAllocation *allocation, - gpointer data); +static void luaconsole_dialog_area_resize(GtkWidget *widget, int width, int height, + gpointer data); static void luaconsole_dialog_scroll_to_bottom(void); static void luaconsole_input_return(GtkEntry *w, gpointer data); @@ -213,8 +212,8 @@ static void luaconsole_dialog_create(struct luaconsole_data *pdialog) set_message_buffer_view_link_handlers(text); gtk_text_view_set_editable(GTK_TEXT_VIEW(text), FALSE); gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(sw), text); - g_signal_connect(text, "size-allocate", - G_CALLBACK(luaconsole_dialog_area_size_allocate), NULL); + g_signal_connect(text, "resize", + G_CALLBACK(luaconsole_dialog_area_resize), NULL); gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text), GTK_WRAP_WORD); gtk_widget_realize(text); @@ -399,16 +398,16 @@ static gboolean luaconsole_input_handler(GtkWidget *w, GdkEvent *ev) prevents users from accidentally missing messages when the chatline gets scrolled up a small amount and stops scrolling down automatically. *****************************************************************************/ -static void luaconsole_dialog_area_size_allocate(GtkWidget *widget, - GtkAllocation *allocation, - gpointer data) +static void luaconsole_dialog_area_resize(GtkWidget *widget, int width, int height, + gpointer data) { static int old_width = 0, old_height = 0; - if (allocation->width != old_width - || allocation->height != old_height) { + + if (width != old_width + || height != old_height) { luaconsole_dialog_scroll_to_bottom(); - old_width = allocation->width; - old_height = allocation->height; + old_width = width; + old_height = height; } } -- 2.34.1