summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorPatrick Luby <guibmacdev@gmail.com>2024-03-17 19:04:21 -0400
committerAndras Timar <andras.timar@collabora.com>2024-03-27 14:33:18 +0100
commitc253cf4b44615170144a25d18df4b059cb43f4a3 (patch)
tree77a749e6b5326396398057a9bca4fb2152919a1d /vcl
parent5c8577e59b9672867480bff6ddf87b4e5e826baa (diff)
tdf#93352 Fix horizontal swiping and scrolling when using an RTL UI
Starting with commit bfa21ce5fa08f2c634ccb6162914be55aef9f3c2, horizontal swiping in Calc moved in the wrong direction scrollbars were drawn mirrored. So, revert parts of commit bfa21ce5fa08f2c634ccb6162914be55aef9f3c2 so that we are using Calc's previous "negative scrollbar range" implementation for RTL UIs, but only for horizontal scrollbars since vertical scrollbars are the same in LTR and RTL UIs. Also, always disable RTL for scrollbars. Enabling RTL causes the following bugs when clicking or dragging the mouse in scrollbars in Calc's RTL UI: - Click or drag events get mirrored so you must click or drag in unexpected locations to move the scrollbar thumb in the desired direction - Repeatedly dragging the scrollbar thumb leftward can only move no highter than the R, S, or T columns Note: even though RTL is always disabled for Calc scrollbars, the arrows must still be swapped in vcl's ScrollBar class. Change-Id: I85aac94ffaf7df2eeb251a3ff150cc0363b5d770 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164959 Reviewed-by: Stéphane Guillou <stephane.guillou@libreoffice.org> Tested-by: Jenkins Reviewed-by: Patrick Luby <guibomacdev@gmail.com> (cherry picked from commit ac1024765d203496bc7d28cb3ed3a6d2215c53ad) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165116 Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/app/salvtables.cxx2
-rw-r--r--vcl/source/control/scrbar.cxx6
-rw-r--r--vcl/unx/gtk3/gtkinst.cxx5
3 files changed, 11 insertions, 2 deletions
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 9ed790a2b6ec..46dbcd72f9d3 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -2591,6 +2591,8 @@ public:
else
m_xScrollBar->set_width_request(nThickness);
}
+
+ virtual void set_scroll_swap_arrows(bool bSwap) override { m_xScrollBar->SetSwapArrows(bSwap); }
};
}
diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx
index b652360139c4..7218b1485bbb 100644
--- a/vcl/source/control/scrbar.cxx
+++ b/vcl/source/control/scrbar.cxx
@@ -85,6 +85,7 @@ void ScrollBar::ImplInit( vcl::Window* pParent, WinBits nStyle )
meScrollType = ScrollType::DontKnow;
mbCalcSize = true;
mbFullDrag = false;
+ mbSwapArrows = false;
ImplInitStyle( nStyle );
Control::ImplInit( pParent, nStyle, nullptr );
@@ -240,6 +241,7 @@ void ScrollBar::ImplCalc( bool bUpdate )
const tools::Rectangle aControlRegion( Point(0,0), aSize );
tools::Rectangle aBtn1Region, aBtn2Region, aTrackRegion, aBoundingRegion;
+ const bool bSwapArrows = mbSwapArrows || IsRTLEnabled();
// reset rectangles to empty *and* (0,0) position
maThumbRect = tools::Rectangle();
@@ -248,9 +250,9 @@ void ScrollBar::ImplCalc( bool bUpdate )
if ( GetStyle() & WB_HORZ )
{
- if ( GetNativeControlRegion( ControlType::Scrollbar, IsRTLEnabled()? ControlPart::ButtonRight: ControlPart::ButtonLeft,
+ if ( GetNativeControlRegion( ControlType::Scrollbar, bSwapArrows? ControlPart::ButtonRight: ControlPart::ButtonLeft,
aControlRegion, ControlState::NONE, ImplControlValue(), aBoundingRegion, aBtn1Region ) &&
- GetNativeControlRegion( ControlType::Scrollbar, IsRTLEnabled()? ControlPart::ButtonLeft: ControlPart::ButtonRight,
+ GetNativeControlRegion( ControlType::Scrollbar, bSwapArrows? ControlPart::ButtonLeft: ControlPart::ButtonRight,
aControlRegion, ControlState::NONE, ImplControlValue(), aBoundingRegion, aBtn2Region ) )
{
maBtn1Rect = aBtn1Region;
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index b8da4f7b7a27..036493239217 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -8745,6 +8745,11 @@ public:
gtk_widget_set_size_request(GTK_WIDGET(m_pScrollbar), nThickness, -1);
}
+ virtual void set_scroll_swap_arrows(bool /* bSwap */) override
+ {
+ // Related: tdf#93352 do nothing since GtkScrollbar has no arrows
+ }
+
virtual ~GtkInstanceScrollbar() override
{
g_signal_handler_disconnect(m_pAdjustment, m_nAdjustChangedSignalId);