From: Matthias Clasen Date: Thu, 6 Feb 2020 07:07:22 +0000 (-0500) Subject: notebook: Update arrows when text direction changes X-Git-Tag: archive/raspbian/4.4.1+ds1-2+rpi1^2~18^2~20^2~87 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=b6e2699409185e973a858168080f07bf5e58c6d6;p=gtk4.git notebook: Update arrows when text direction changes Fixes https://gitlab.gnome.org/GNOME/gtk/issues/103 --- diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index b3feea7fe3..70fa1a92bc 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -693,6 +693,8 @@ static void gtk_notebook_grab_notify (GtkWidget *widget, gboolean was_grabbed); static void gtk_notebook_state_flags_changed (GtkWidget *widget, GtkStateFlags previous_state); +static void gtk_notebook_direction_changed (GtkWidget *widget, + GtkTextDirection previous_direction); static gboolean gtk_notebook_focus (GtkWidget *widget, GtkDirectionType direction); @@ -958,6 +960,7 @@ gtk_notebook_class_init (GtkNotebookClass *class) widget_class->popup_menu = gtk_notebook_popup_menu; widget_class->grab_notify = gtk_notebook_grab_notify; widget_class->state_flags_changed = gtk_notebook_state_flags_changed; + widget_class->direction_changed = gtk_notebook_direction_changed; widget_class->focus = gtk_notebook_focus; widget_class->compute_expand = gtk_notebook_compute_expand; @@ -3016,11 +3019,16 @@ update_arrow_nodes (GtkNotebook *notebook) up_icon_name = "pan-down-symbolic"; down_icon_name = "pan-up-symbolic"; } - else + else if (gtk_widget_get_direction (GTK_WIDGET (notebook)) == GTK_TEXT_DIR_LTR) { up_icon_name = "pan-end-symbolic"; down_icon_name = "pan-start-symbolic"; } + else + { + up_icon_name = "pan-start-symbolic"; + down_icon_name = "pan-end-symbolic"; + } arrow[0] = TRUE; arrow[1] = FALSE; @@ -3105,6 +3113,13 @@ update_arrow_nodes (GtkNotebook *notebook) } } +static void +gtk_notebook_direction_changed (GtkWidget *widget, + GtkTextDirection previous_direction) +{ + update_arrow_nodes (GTK_NOTEBOOK (widget)); +} + static void gtk_notebook_dnd_finished_cb (GdkDrag *drag, GtkWidget *widget)