From 8ad788e914492cd1a48861550e99b010bfa6e24f Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 5 Dec 2003 23:31:51 +0000 Subject: 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) --- gtk/gtkviewport.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'gtk/gtkviewport.c') 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 -- cgit v1.2.1