[evince/abderrahim/dual-rtl: 94/95] ev-view: follow the text direction for laying out pages in dual mode
- From: Germán Poo-Caamaño <gpoo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince/abderrahim/dual-rtl: 94/95] ev-view: follow the text direction for laying out pages in dual mode
- Date: Sat, 23 Nov 2019 22:18:11 +0000 (UTC)
commit 479a91a37ae08cf1c0469605a149786bd78f0540
Author: Abderrahim Kitouni <akitouni gnome org>
Date: Fri Feb 22 21:31:50 2019 +0100
ev-view: follow the text direction for laying out pages in dual mode
This reverses the meaning of "Odd Pages Left" for RTL locales
libview/ev-view.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/libview/ev-view.c b/libview/ev-view.c
index e085df0c..852fbfc5 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -1305,9 +1305,14 @@ real_ev_view_get_page_extents (EvView *view,
max_width = max_width + border->left + border->right;
/* Get the location of the bounding box */
if (is_dual_page (view, &odd_left)) {
- x = view->spacing + ((page % 2 == !odd_left) ? 0 : 1) * (max_width + view->spacing);
+ gboolean right_page;
+
+ right_page = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR && page % 2 ==
!odd_left) ||
+ (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL && page % 2 ==
odd_left);
+
+ x = view->spacing + (right_page ? 0 : 1) * (max_width + view->spacing);
x = x + MAX (0, allocation.width - (max_width * 2 + view->spacing * 3)) / 2;
- if (page % 2 == !odd_left)
+ if (right_page)
x = x + (max_width - width - border->left - border->right);
} else {
x = view->spacing;
@@ -1351,7 +1356,8 @@ real_ev_view_get_page_extents (EvView *view,
y = view->spacing;
/* Adjust for being the left or right page */
- if (page % 2 == !odd_left)
+ if ((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR && page % 2 == !odd_left)
||
+ (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL && page % 2 == odd_left))
x = x + max_width - width;
else
x = x + (max_width + overall_border.left + overall_border.right) +
view->spacing;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]