From 8ad788e914492cd1a48861550e99b010bfa6e24f Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 5 Dec 2003 23:31:51 +0000 Subject: [PATCH] Implement RTL flipping for GtkViewport: Adjust the "gravity" when resizing Sat Dec 6 00:23:46 2003 Matthias Clasen * gtk/gtkviewport.c: Implement RTL flipping for GtkViewport: Adjust the "gravity" when resizing This is a bit flickery in RTL mode. (#107526) Sat Dec 6 00:22:14 2003 Matthias Clasen * gtk/gtkscrolledwindow.c: Implement RTL flipping for GtkScrolledWindow: the vertical scrollbar shows up on the left side in RTL mode. (#107526) --- ChangeLog | 18 ++++++++++++++++++ ChangeLog.pre-2-10 | 18 ++++++++++++++++++ ChangeLog.pre-2-4 | 18 ++++++++++++++++++ ChangeLog.pre-2-6 | 18 ++++++++++++++++++ ChangeLog.pre-2-8 | 18 ++++++++++++++++++ gtk/gtkscrolledwindow.c | 19 +++++++++++++++---- gtk/gtkviewport.c | 14 ++++++++++++-- 7 files changed, 117 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4a0e26ed35..f4fd015fd1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +Sat Dec 6 00:23:46 2003 Matthias Clasen + + * gtk/gtkviewport.c: Implement RTL flipping for + GtkViewport: Adjust the "gravity" when resizing + This is a bit flickery in RTL mode. (#107526) + +Sat Dec 6 00:22:14 2003 Matthias Clasen + + * gtk/gtkscrolledwindow.c: Implement RTL flipping for + GtkScrolledWindow: the vertical scrollbar shows up on the left + side in RTL mode. (#107526) + +Fri Dec 5 01:58:33 2003 Matthias Clasen + + * gtk/gtknotebook.c: Implement RTL flipping for GtkNotebook: + tabs displayed at the top/bottom are rearranged, and tabs on + the left/right are displayed at the opposite edge. (#96630) + 2003-12-04 Mark McLoughlin * gtk/gtklabel.c: (gtk_label_set_attributes_internal): Allow diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 4a0e26ed35..f4fd015fd1 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,21 @@ +Sat Dec 6 00:23:46 2003 Matthias Clasen + + * gtk/gtkviewport.c: Implement RTL flipping for + GtkViewport: Adjust the "gravity" when resizing + This is a bit flickery in RTL mode. (#107526) + +Sat Dec 6 00:22:14 2003 Matthias Clasen + + * gtk/gtkscrolledwindow.c: Implement RTL flipping for + GtkScrolledWindow: the vertical scrollbar shows up on the left + side in RTL mode. (#107526) + +Fri Dec 5 01:58:33 2003 Matthias Clasen + + * gtk/gtknotebook.c: Implement RTL flipping for GtkNotebook: + tabs displayed at the top/bottom are rearranged, and tabs on + the left/right are displayed at the opposite edge. (#96630) + 2003-12-04 Mark McLoughlin * gtk/gtklabel.c: (gtk_label_set_attributes_internal): Allow diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 4a0e26ed35..f4fd015fd1 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,21 @@ +Sat Dec 6 00:23:46 2003 Matthias Clasen + + * gtk/gtkviewport.c: Implement RTL flipping for + GtkViewport: Adjust the "gravity" when resizing + This is a bit flickery in RTL mode. (#107526) + +Sat Dec 6 00:22:14 2003 Matthias Clasen + + * gtk/gtkscrolledwindow.c: Implement RTL flipping for + GtkScrolledWindow: the vertical scrollbar shows up on the left + side in RTL mode. (#107526) + +Fri Dec 5 01:58:33 2003 Matthias Clasen + + * gtk/gtknotebook.c: Implement RTL flipping for GtkNotebook: + tabs displayed at the top/bottom are rearranged, and tabs on + the left/right are displayed at the opposite edge. (#96630) + 2003-12-04 Mark McLoughlin * gtk/gtklabel.c: (gtk_label_set_attributes_internal): Allow diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 4a0e26ed35..f4fd015fd1 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,21 @@ +Sat Dec 6 00:23:46 2003 Matthias Clasen + + * gtk/gtkviewport.c: Implement RTL flipping for + GtkViewport: Adjust the "gravity" when resizing + This is a bit flickery in RTL mode. (#107526) + +Sat Dec 6 00:22:14 2003 Matthias Clasen + + * gtk/gtkscrolledwindow.c: Implement RTL flipping for + GtkScrolledWindow: the vertical scrollbar shows up on the left + side in RTL mode. (#107526) + +Fri Dec 5 01:58:33 2003 Matthias Clasen + + * gtk/gtknotebook.c: Implement RTL flipping for GtkNotebook: + tabs displayed at the top/bottom are rearranged, and tabs on + the left/right are displayed at the opposite edge. (#96630) + 2003-12-04 Mark McLoughlin * gtk/gtklabel.c: (gtk_label_set_attributes_internal): Allow diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 4a0e26ed35..f4fd015fd1 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,21 @@ +Sat Dec 6 00:23:46 2003 Matthias Clasen + + * gtk/gtkviewport.c: Implement RTL flipping for + GtkViewport: Adjust the "gravity" when resizing + This is a bit flickery in RTL mode. (#107526) + +Sat Dec 6 00:22:14 2003 Matthias Clasen + + * gtk/gtkscrolledwindow.c: Implement RTL flipping for + GtkScrolledWindow: the vertical scrollbar shows up on the left + side in RTL mode. (#107526) + +Fri Dec 5 01:58:33 2003 Matthias Clasen + + * gtk/gtknotebook.c: Implement RTL flipping for GtkNotebook: + tabs displayed at the top/bottom are rearranged, and tabs on + the left/right are displayed at the opposite edge. (#96630) + 2003-12-04 Mark McLoughlin * gtk/gtklabel.c: (gtk_label_set_attributes_internal): Allow diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c index 7a49d0df43..c2fbfc555a 100644 --- a/gtk/gtkscrolledwindow.c +++ b/gtk/gtkscrolledwindow.c @@ -1029,11 +1029,18 @@ gtk_scrolled_window_relative_allocation (GtkWidget *widget, if (scrolled_window->vscrollbar_visible) { GtkRequisition vscrollbar_requisition; + gboolean is_rtl; + gtk_widget_get_child_requisition (scrolled_window->vscrollbar, &vscrollbar_requisition); + is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL; - if (scrolled_window->window_placement == GTK_CORNER_TOP_RIGHT || - scrolled_window->window_placement == GTK_CORNER_BOTTOM_RIGHT) + if ((!is_rtl && + (scrolled_window->window_placement == GTK_CORNER_TOP_RIGHT || + scrolled_window->window_placement == GTK_CORNER_BOTTOM_RIGHT)) || + (is_rtl && + (scrolled_window->window_placement == GTK_CORNER_TOP_LEFT || + scrolled_window->window_placement == GTK_CORNER_BOTTOM_LEFT))) allocation->x += (vscrollbar_requisition.width + scrollbar_spacing); allocation->width = MAX (1, allocation->width - (vscrollbar_requisition.width + scrollbar_spacing)); @@ -1170,8 +1177,12 @@ gtk_scrolled_window_size_allocate (GtkWidget *widget, gtk_widget_get_child_requisition (scrolled_window->vscrollbar, &vscrollbar_requisition); - if (scrolled_window->window_placement == GTK_CORNER_TOP_LEFT || - scrolled_window->window_placement == GTK_CORNER_BOTTOM_LEFT) + if ((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL && + (scrolled_window->window_placement == GTK_CORNER_TOP_RIGHT || + scrolled_window->window_placement == GTK_CORNER_BOTTOM_RIGHT)) || + (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR && + (scrolled_window->window_placement == GTK_CORNER_TOP_LEFT || + scrolled_window->window_placement == GTK_CORNER_BOTTOM_LEFT))) child_allocation.x = (relative_allocation.x + relative_allocation.width + scrollbar_spacing + diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c index 2a63f4e114..4977865ff5 100644 --- a/gtk/gtkviewport.c +++ b/gtk/gtkviewport.c @@ -382,9 +382,11 @@ viewport_set_hadjustment_values (GtkViewport *viewport, GtkBin *bin = GTK_BIN (viewport); GtkAllocation view_allocation; GtkAdjustment *hadjustment = gtk_viewport_get_hadjustment (viewport); - + gdouble old_page_size; + viewport_get_view_allocation (viewport, &view_allocation); + old_page_size = hadjustment->page_size; hadjustment->page_size = view_allocation.width; hadjustment->step_increment = view_allocation.width * 0.1; hadjustment->page_increment = view_allocation.width * 0.9; @@ -401,7 +403,15 @@ viewport_set_hadjustment_values (GtkViewport *viewport, else hadjustment->upper = view_allocation.width; - viewport_reclamp_adjustment (hadjustment, value_changed); + if (gtk_widget_get_direction (GTK_WIDGET (viewport)) == GTK_TEXT_DIR_RTL) + { + gdouble old_value = hadjustment->value; + hadjustment->value = hadjustment->value + old_page_size - hadjustment->page_size; + viewport_reclamp_adjustment (hadjustment, value_changed); + *value_changed = (old_value != hadjustment->value); + } + else + viewport_reclamp_adjustment (hadjustment, value_changed); } static void