91334d
From 47f913ccf293665bd8c7737917c8284f16f95166 Mon Sep 17 00:00:00 2001
91334d
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
91334d
Date: Fri, 3 Nov 2017 15:53:22 +0000
91334d
Subject: [PATCH] gtk3: fix popover placement in RTL
91334d
91334d
Change-Id: I8c20b277ce943f915941b2af9353f98c66f9065c
91334d
---
91334d
 vcl/unx/gtk3/gtk3gtkframe.cxx | 9 ++++++---
91334d
 1 file changed, 6 insertions(+), 3 deletions(-)
91334d
91334d
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
91334d
index cdbd1b3..61446c7 100644
91334d
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
91334d
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
91334d
@@ -2480,7 +2480,7 @@ bool GtkSalFrame::ShowTooltip(const OUString& rHelpText, const Rectangle& rHelpA
91334d
 #if GTK_CHECK_VERSION(3,12,0)
91334d
 namespace
91334d
 {
91334d
-    void set_pointing_to(GtkPopover *pPopOver, const Rectangle& rHelpArea)
91334d
+    void set_pointing_to(GtkPopover *pPopOver, const Rectangle& rHelpArea, const SalFrameGeometry& rGeometry)
91334d
     {
91334d
         GdkRectangle aRect;
91334d
         aRect.x = rHelpArea.Left();
91334d
@@ -2501,6 +2501,9 @@ namespace
91334d
                 break;
91334d
         }
91334d
 
91334d
+        if (AllSettings::GetLayoutRTL())
91334d
+            aRect.x = rGeometry.nWidth-aRect.width-1-aRect.x;
91334d
+
91334d
         gtk_popover_set_pointing_to(pPopOver, &aRect);
91334d
     }
91334d
 }
91334d
@@ -2523,7 +2526,7 @@ sal_uIntPtr GtkSalFrame::ShowPopover(const OUString& rHelpText, const Rectangle&
91334d
     else if (nFlags & QuickHelpFlags::Right)
91334d
         gtk_popover_set_position(GTK_POPOVER(pWidget), GTK_POS_LEFT);
91334d
 
91334d
-    set_pointing_to(GTK_POPOVER(pWidget), rHelpArea);
91334d
+    set_pointing_to(GTK_POPOVER(pWidget), rHelpArea, maGeometry);
91334d
 
91334d
     gtk_popover_set_modal(GTK_POPOVER(pWidget), false);
91334d
 
91334d
@@ -2543,7 +2546,7 @@ bool GtkSalFrame::UpdatePopover(sal_uIntPtr nId, const OUString& rHelpText, cons
91334d
 #if GTK_CHECK_VERSION(3,12,0)
91334d
     GtkWidget *pWidget = reinterpret_cast<GtkWidget*>(nId);
91334d
 
91334d
-    set_pointing_to(GTK_POPOVER(pWidget), rHelpArea);
91334d
+    set_pointing_to(GTK_POPOVER(pWidget), rHelpArea, maGeometry);
91334d
 
91334d
     GtkWidget *pLabel = gtk_bin_get_child(GTK_BIN(pWidget));
91334d
     OString sUTF = OUStringToOString(rHelpText, RTL_TEXTENCODING_UTF8);
91334d
-- 
91334d
2.9.5
91334d