[Libreoffice-commits] core.git: vcl/inc vcl/source vcl/unx
Maxim Monastirsky
momonasmon at gmail.com
Sat Jun 16 23:26:06 UTC 2018
vcl/inc/salframe.hxx | 4 ++--
vcl/inc/unx/gtk/gtkframe.hxx | 4 ++--
vcl/source/app/help.cxx | 4 ++--
vcl/unx/gtk3/gtk3gtkframe.cxx | 15 ++++++---------
4 files changed, 12 insertions(+), 15 deletions(-)
New commits:
commit 6fcc60b49215acb28edac46bb605767840abd122
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Sun Jun 17 00:10:27 2018 +0300
gtk3: Correctly mirror popovers in rtl ui
e.g. formula prompt or fill series in Calc. The reason is that for
this particular vcl::Window, HasMirroredGraphics() != IsRTLEnabled().
Change-Id: Icd4bb2d22ba77d64c32b243d9c07745824e5e558
Reviewed-on: https://gerrit.libreoffice.org/55936
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky <momonasmon at gmail.com>
diff --git a/vcl/inc/salframe.hxx b/vcl/inc/salframe.hxx
index 4d8d9b5db9ff..f1d4a05e5662 100644
--- a/vcl/inc/salframe.hxx
+++ b/vcl/inc/salframe.hxx
@@ -247,13 +247,13 @@ public:
}
// return !0 to indicate popovers are shown natively, 0 otherwise
- virtual void* ShowPopover(const OUString& /*rHelpText*/, const tools::Rectangle& /*rHelpArea*/, QuickHelpFlags /*nFlags*/)
+ virtual void* ShowPopover(const OUString& /*rHelpText*/, vcl::Window* /*pParent*/, const tools::Rectangle& /*rHelpArea*/, QuickHelpFlags /*nFlags*/)
{
return nullptr;
}
// return true to indicate popovers are shown natively, false otherwise
- virtual bool UpdatePopover(void* /*nId*/, const OUString& /*rHelpText*/, const tools::Rectangle& /*rHelpArea*/)
+ virtual bool UpdatePopover(void* /*nId*/, const OUString& /*rHelpText*/, vcl::Window* /*pParent*/, const tools::Rectangle& /*rHelpArea*/)
{
return false;
}
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index b69b14bb002a..04ec68a7854e 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -538,8 +538,8 @@ public:
virtual void PositionByToolkit(const tools::Rectangle& rRect, FloatWinPopupFlags nFlags) override;
virtual void SetModal(bool bModal) override;
virtual bool ShowTooltip(const OUString& rHelpText, const tools::Rectangle& rHelpArea) override;
- virtual void* ShowPopover(const OUString& rHelpText, const tools::Rectangle& rHelpArea, QuickHelpFlags nFlags) override;
- virtual bool UpdatePopover(void* nId, const OUString& rHelpText, const tools::Rectangle& rHelpArea) override;
+ virtual void* ShowPopover(const OUString& rHelpText, vcl::Window* pParent, const tools::Rectangle& rHelpArea, QuickHelpFlags nFlags) override;
+ virtual bool UpdatePopover(void* nId, const OUString& rHelpText, vcl::Window* pParent, const tools::Rectangle& rHelpArea) override;
virtual bool HidePopover(void* nId) override;
virtual weld::Window* GetFrameWeld() const override;
#endif
diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx
index 91a7356fe43e..7ce441686355 100644
--- a/vcl/source/app/help.cxx
+++ b/vcl/source/app/help.cxx
@@ -198,7 +198,7 @@ void Help::HideBalloonAndQuickHelp()
void* Help::ShowPopover(vcl::Window* pParent, const tools::Rectangle& rScreenRect,
const OUString& rText, QuickHelpFlags nStyle)
{
- void* nId = pParent->ImplGetFrame()->ShowPopover(rText, rScreenRect, nStyle);
+ void* nId = pParent->ImplGetFrame()->ShowPopover(rText, pParent, rScreenRect, nStyle);
if (nId)
{
//popovers are handled natively, return early
@@ -218,7 +218,7 @@ void* Help::ShowPopover(vcl::Window* pParent, const tools::Rectangle& rScreenRec
void Help::UpdatePopover(void* nId, vcl::Window* pParent, const tools::Rectangle& rScreenRect,
const OUString& rText)
{
- if (pParent->ImplGetFrame()->UpdatePopover(nId, rText, rScreenRect))
+ if (pParent->ImplGetFrame()->UpdatePopover(nId, rText, pParent, rScreenRect))
{
//popovers are handled natively, return early
return;
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 69f02adc7473..7e07f0efced8 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -2497,10 +2497,10 @@ bool GtkSalFrame::ShowTooltip(const OUString& rHelpText, const tools::Rectangle&
namespace
{
- void set_pointing_to(GtkPopover *pPopOver, const tools::Rectangle& rHelpArea, const SalFrameGeometry& rGeometry)
+ void set_pointing_to(GtkPopover *pPopOver, vcl::Window* pParent, const tools::Rectangle& rHelpArea, const SalFrameGeometry& rGeometry)
{
GdkRectangle aRect;
- aRect.x = rHelpArea.Left();
+ aRect.x = FloatingWindow::ImplConvertToAbsPos(pParent, rHelpArea).Left() - rGeometry.nX;
aRect.y = rHelpArea.Top();
aRect.width = 1;
aRect.height = 1;
@@ -2518,14 +2518,11 @@ namespace
break;
}
- if (AllSettings::GetLayoutRTL())
- aRect.x = rGeometry.nWidth-aRect.width-1-aRect.x;
-
gtk_popover_set_pointing_to(pPopOver, &aRect);
}
}
-void* GtkSalFrame::ShowPopover(const OUString& rHelpText, const tools::Rectangle& rHelpArea, QuickHelpFlags nFlags)
+void* GtkSalFrame::ShowPopover(const OUString& rHelpText, vcl::Window* pParent, const tools::Rectangle& rHelpArea, QuickHelpFlags nFlags)
{
GtkWidget *pWidget = gtk_popover_new(getMouseEventWidget());
OString sUTF = OUStringToOString(rHelpText, RTL_TEXTENCODING_UTF8);
@@ -2541,7 +2538,7 @@ void* GtkSalFrame::ShowPopover(const OUString& rHelpText, const tools::Rectangle
else if (nFlags & QuickHelpFlags::Right)
gtk_popover_set_position(GTK_POPOVER(pWidget), GTK_POS_LEFT);
- set_pointing_to(GTK_POPOVER(pWidget), rHelpArea, maGeometry);
+ set_pointing_to(GTK_POPOVER(pWidget), pParent, rHelpArea, maGeometry);
gtk_popover_set_modal(GTK_POPOVER(pWidget), false);
@@ -2550,11 +2547,11 @@ void* GtkSalFrame::ShowPopover(const OUString& rHelpText, const tools::Rectangle
return pWidget;
}
-bool GtkSalFrame::UpdatePopover(void* nId, const OUString& rHelpText, const tools::Rectangle& rHelpArea)
+bool GtkSalFrame::UpdatePopover(void* nId, const OUString& rHelpText, vcl::Window* pParent, const tools::Rectangle& rHelpArea)
{
GtkWidget *pWidget = static_cast<GtkWidget*>(nId);
- set_pointing_to(GTK_POPOVER(pWidget), rHelpArea, maGeometry);
+ set_pointing_to(GTK_POPOVER(pWidget), pParent, rHelpArea, maGeometry);
GtkWidget *pLabel = gtk_bin_get_child(GTK_BIN(pWidget));
OString sUTF = OUStringToOString(rHelpText, RTL_TEXTENCODING_UTF8);
More information about the Libreoffice-commits
mailing list