Blob Blame History Raw
From 47f913ccf293665bd8c7737917c8284f16f95166 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Fri, 3 Nov 2017 15:53:22 +0000
Subject: [PATCH] gtk3: fix popover placement in RTL

Change-Id: I8c20b277ce943f915941b2af9353f98c66f9065c
---
 vcl/unx/gtk3/gtk3gtkframe.cxx | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index cdbd1b3..61446c7 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -2480,7 +2480,7 @@ bool GtkSalFrame::ShowTooltip(const OUString& rHelpText, const Rectangle& rHelpA
 #if GTK_CHECK_VERSION(3,12,0)
 namespace
 {
-    void set_pointing_to(GtkPopover *pPopOver, const Rectangle& rHelpArea)
+    void set_pointing_to(GtkPopover *pPopOver, const Rectangle& rHelpArea, const SalFrameGeometry& rGeometry)
     {
         GdkRectangle aRect;
         aRect.x = rHelpArea.Left();
@@ -2501,6 +2501,9 @@ namespace
                 break;
         }
 
+        if (AllSettings::GetLayoutRTL())
+            aRect.x = rGeometry.nWidth-aRect.width-1-aRect.x;
+
         gtk_popover_set_pointing_to(pPopOver, &aRect);
     }
 }
@@ -2523,7 +2526,7 @@ sal_uIntPtr GtkSalFrame::ShowPopover(const OUString& rHelpText, const Rectangle&
     else if (nFlags & QuickHelpFlags::Right)
         gtk_popover_set_position(GTK_POPOVER(pWidget), GTK_POS_LEFT);
 
-    set_pointing_to(GTK_POPOVER(pWidget), rHelpArea);
+    set_pointing_to(GTK_POPOVER(pWidget), rHelpArea, maGeometry);
 
     gtk_popover_set_modal(GTK_POPOVER(pWidget), false);
 
@@ -2543,7 +2546,7 @@ bool GtkSalFrame::UpdatePopover(sal_uIntPtr nId, const OUString& rHelpText, cons
 #if GTK_CHECK_VERSION(3,12,0)
     GtkWidget *pWidget = reinterpret_cast<GtkWidget*>(nId);
 
-    set_pointing_to(GTK_POPOVER(pWidget), rHelpArea);
+    set_pointing_to(GTK_POPOVER(pWidget), rHelpArea, maGeometry);
 
     GtkWidget *pLabel = gtk_bin_get_child(GTK_BIN(pWidget));
     OString sUTF = OUStringToOString(rHelpText, RTL_TEXTENCODING_UTF8);
-- 
2.9.5