[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/unx
Caolán McNamara
caolanm at redhat.com
Thu May 31 08:14:01 UTC 2018
vcl/unx/gtk3/gtk3gtkinst.cxx | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
New commits:
commit f5f182e6d0894576d9e16d3de26eaacb2236a171
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed May 30 21:28:22 2018 +0100
RTL support for custom widgets
Change-Id: I34038f047c002a1ec1276f8c523db0e1c4d29065
Reviewed-on: https://gerrit.libreoffice.org/55102
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 54444d801c5c..d13cb73df419 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1689,6 +1689,8 @@ public:
{
GdkRectangle aRect{static_cast<int>(rRect.Left()), static_cast<int>(rRect.Top()),
static_cast<int>(rRect.GetWidth()), static_cast<int>(rRect.GetHeight())};
+ if (AllSettings::GetLayoutRTL())
+ aRect.x = gtk_widget_get_allocated_width(pWidget) - aRect.width - 1 - aRect.x;
gtk_menu_popup_at_rect(m_pMenu, gtk_widget_get_window(pWidget), &aRect, GDK_GRAVITY_NORTH_WEST, GDK_GRAVITY_NORTH_WEST, nullptr);
}
else
@@ -3741,7 +3743,7 @@ private:
{
m_aStyleUpdatedHdl.Call(*this);
}
- static gboolean signalQueryTooltip(GtkWidget*, gint x, gint y,
+ static gboolean signalQueryTooltip(GtkWidget* pGtkWidget, gint x, gint y,
gboolean /*keyboard_mode*/, GtkTooltip *tooltip,
gpointer widget)
{
@@ -3756,6 +3758,8 @@ private:
aGdkHelpArea.y = aHelpArea.Top();
aGdkHelpArea.width = aHelpArea.GetWidth();
aGdkHelpArea.height = aHelpArea.GetHeight();
+ if (AllSettings::GetLayoutRTL())
+ aGdkHelpArea.x = gtk_widget_get_allocated_width(pGtkWidget) - aGdkHelpArea.width - 1 - aGdkHelpArea.x;
gtk_tooltip_set_tip_area(tooltip, &aGdkHelpArea);
return true;
}
@@ -3816,6 +3820,8 @@ private:
}
Point aPos(pEvent->x, pEvent->y);
+ if (AllSettings::GetLayoutRTL())
+ aPos.setX(gtk_widget_get_allocated_width(m_pWidget) - 1 - aPos.X());
sal_uInt32 nModCode = GtkSalFrame::GetMouseModCode(pEvent->state);
sal_uInt16 nCode = m_nLastMouseButton | (nModCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2));
MouseEvent aMEvt(aPos, nClicks, ImplGetMouseButtonMode(m_nLastMouseButton, nModCode), nCode, nCode);
@@ -3836,6 +3842,8 @@ private:
bool signal_motion(GdkEventMotion* pEvent)
{
Point aPos(pEvent->x, pEvent->y);
+ if (AllSettings::GetLayoutRTL())
+ aPos.setX(gtk_widget_get_allocated_width(m_pWidget) - 1 - aPos.X());
sal_uInt32 nModCode = GtkSalFrame::GetMouseModCode(pEvent->state);
sal_uInt16 nCode = m_nLastMouseButton | (nModCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2));
MouseEvent aMEvt(aPos, 0, ImplGetMouseMoveMode(nModCode), nCode, nCode);
@@ -3890,6 +3898,7 @@ public:
{
gtk_widget_set_has_tooltip(m_pWidget, true);
g_object_set_data(G_OBJECT(m_pDrawingArea), "g-lo-GtkInstanceDrawingArea", this);
+ m_xDevice->EnableRTL(get_direction());
}
AtkObject* GetAtkObject(AtkObject* pDefaultAccessible)
@@ -3903,6 +3912,12 @@ public:
return m_pAccessible;
}
+ virtual void set_direction(bool bRTL) override
+ {
+ GtkInstanceWidget::set_direction(bRTL);
+ m_xDevice->EnableRTL(bRTL);
+ }
+
virtual void queue_draw() override
{
gtk_widget_queue_draw(GTK_WIDGET(m_pDrawingArea));
More information about the Libreoffice-commits
mailing list