[Libreoffice-commits] core.git: sc/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Sun Mar 7 16:34:46 UTC 2021
sc/source/ui/inc/hdrcont.hxx | 6 +++++
sc/source/ui/view/hdrcont.cxx | 44 +++++++++++++++++++++++++++++++-----------
2 files changed, 39 insertions(+), 11 deletions(-)
New commits:
commit e3c25c2425781a3414d8014244eac6ae3a82ba21
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat Mar 6 21:34:22 2021 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Sun Mar 7 17:34:01 2021 +0100
tdf#140833 show ScHeaderControl help tip after double click time has expired
so under gtk the popover isn't active when the double click is processed
by gtk because under load on wayland the double click is getting handled
by something else and getting sent to the the window underneath our
window
Change-Id: Ie3afcf45c69b7b947b1aeb787478f947deca9307
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112104
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sc/source/ui/inc/hdrcont.hxx b/sc/source/ui/inc/hdrcont.hxx
index f9ef17c32eee..777d2e9746df 100644
--- a/sc/source/ui/inc/hdrcont.hxx
+++ b/sc/source/ui/inc/hdrcont.hxx
@@ -21,6 +21,7 @@
#define INCLUDED_SC_SOURCE_UI_INC_HDRCONT_HXX
#include <vcl/window.hxx>
+#include <vcl/timer.hxx>
#include <types.hxx>
#define HDR_SIZE_OPTIMUM 0xFFFF
@@ -35,6 +36,7 @@ class ScHeaderControl : public vcl::Window
{
private:
SelectionEngine* pSelEngine;
+ Timer aShowHelpTimer;
vcl::Font aNormFont;
vcl::Font aBoldFont;
bool bBoldSet;
@@ -66,9 +68,12 @@ private:
SCCOLROW GetMousePos( const MouseEvent& rMEvt, bool& rBorder ) const;
bool IsSelectionAllowed(SCCOLROW nPos) const;
void ShowDragHelp();
+ void HideDragHelp();
void DoPaint( SCCOLROW nStart, SCCOLROW nEnd );
+ DECL_LINK(ShowDragHelpHdl, Timer*, void);
+
protected:
ScTabView* pTabView;
@@ -104,6 +109,7 @@ protected:
virtual void DrawInvert( tools::Long nDragPos );
virtual void Command( const CommandEvent& rCEvt ) override;
+ virtual void dispose() override;
public:
ScHeaderControl( vcl::Window* pParent, SelectionEngine* pSelectionEngine,
diff --git a/sc/source/ui/view/hdrcont.cxx b/sc/source/ui/view/hdrcont.cxx
index 12f4ad7c0a4b..78214cb9be68 100644
--- a/sc/source/ui/view/hdrcont.cxx
+++ b/sc/source/ui/view/hdrcont.cxx
@@ -48,6 +48,7 @@ ScHeaderControl::ScHeaderControl( vcl::Window* pParent, SelectionEngine* pSelect
SCCOLROW nNewSize, bool bNewVertical, ScTabView* pTab ) :
Window ( pParent ),
pSelEngine ( pSelectionEngine ),
+ aShowHelpTimer("sc HeaderControl Popover Timer"),
bVertical ( bNewVertical ),
nSize ( nNewSize ),
nMarkStart ( 0 ),
@@ -88,9 +89,18 @@ ScHeaderControl::ScHeaderControl( vcl::Window* pParent, SelectionEngine* pSelect
nWidth = nSmallWidth = aSize.Width();
nBigWidth = LogicToPixel( Size( GetTextWidth("8888888"), 0 ) ).Width() + 5;
+ aShowHelpTimer.SetInvokeHandler(LINK(this, ScHeaderControl, ShowDragHelpHdl));
+ aShowHelpTimer.SetTimeout(GetSettings().GetMouseSettings().GetDoubleClickTime());
+
SetBackground();
}
+void ScHeaderControl::dispose()
+{
+ aShowHelpTimer.Stop();
+ vcl::Window::dispose();
+}
+
void ScHeaderControl::SetWidth( tools::Long nNew )
{
OSL_ENSURE( bVertical, "SetWidth works only on row headers" );
@@ -652,7 +662,11 @@ void ScHeaderControl::MouseButtonDown( const MouseEvent& rMEvt )
else
nDragStart = rMEvt.GetPosPixel().X();
nDragPos = nDragStart;
- ShowDragHelp();
+ // tdf#140833 launch help tip to show after the double click time has expired
+ // so under gtk the popover isn't active when the double click is processed
+ // by gtk because under load on wayland the double click is getting handled
+ // by something else and getting sent to the the window underneath our window
+ aShowHelpTimer.Start();
DrawInvert( nDragPos );
StartTracking();
@@ -713,11 +727,7 @@ void ScHeaderControl::MouseButtonUp( const MouseEvent& rMEvt )
{
DrawInvert( nDragPos );
ReleaseMouse();
- if (nTipVisible)
- {
- Help::HidePopover(this, nTipVisible);
- nTipVisible = nullptr;
- }
+ HideDragHelp();
bDragging = false;
tools::Long nScrPos = GetScrPos( nDragNo );
@@ -885,11 +895,7 @@ void ScHeaderControl::StopMarking()
if ( bDragging )
{
DrawInvert( nDragPos );
- if (nTipVisible)
- {
- Help::HidePopover(this, nTipVisible);
- nTipVisible = nullptr;
- }
+ HideDragHelp();
bDragging = false;
}
@@ -902,8 +908,14 @@ void ScHeaderControl::StopMarking()
ReleaseMouse();
}
+IMPL_LINK_NOARG(ScHeaderControl, ShowDragHelpHdl, Timer*, void)
+{
+ ShowDragHelp();
+}
+
void ScHeaderControl::ShowDragHelp()
{
+ aShowHelpTimer.Stop();
if (!Help::IsQuickHelpEnabled())
return;
@@ -943,6 +955,16 @@ void ScHeaderControl::ShowDragHelp()
nTipVisible = Help::ShowPopover(this, aRect, aHelpStr, nAlign);
}
+void ScHeaderControl::HideDragHelp()
+{
+ aShowHelpTimer.Stop();
+ if (nTipVisible)
+ {
+ Help::HidePopover(this, nTipVisible);
+ nTipVisible = nullptr;
+ }
+}
+
void ScHeaderControl::RequestHelp( const HelpEvent& rHEvt )
{
// If the own QuickHelp is displayed, don't let RequestHelp remove it
More information about the Libreoffice-commits
mailing list