Improve tooltips behavior
ClosedPublic

Authored by aleksejshilin on Apr 21 2018, 1:44 PM.

Details

Summary

Window buttons tooltips used to appear on hover immediately. As
the result, they mostly appeared when not needed e.g. when user
was closing a window, or when the mouse pointer slightly touched
a button while being moved elsewhere.

This commit changes the tooltips behavior to WakeUp-FallAsleep
approach used by Widgets.

BUG: 392765
FIXED-IN: 5.13

Diff Detail

Repository
R108 KWin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
aleksejshilin created this revision.Apr 21 2018, 1:44 PM
Restricted Application added a project: KWin. · View Herald TranscriptApr 21 2018, 1:44 PM
Restricted Application added a subscriber: kwin. · View Herald Transcript
aleksejshilin requested review of this revision.Apr 21 2018, 1:44 PM
cfeck edited the summary of this revision. (Show Details)Apr 21 2018, 2:38 PM
hein added a comment.Apr 21 2018, 2:50 PM

Thank you for protecting my sanity! This was so annoying.

broulik requested changes to this revision.Apr 22 2018, 10:56 AM
broulik added a subscriber: broulik.

Thanks a lot!

It works fine initially but when you move quickly between buttons some timer seems to not be reset properly and all subsequent invocations are instant again until you restart Kwin.

This revision now requires changes to proceed.Apr 22 2018, 10:56 AM
broulik resigned from this revision.Apr 22 2018, 1:35 PM

Nevermind. Works as intended.

broulik removed a reviewer: Plasma.Apr 22 2018, 1:36 PM
broulik added a reviewer: Plasma.
graesslin requested changes to this revision.Apr 22 2018, 1:40 PM
graesslin added inline comments.
decorations/decoratedclient.h
117

I don't understand the need of this timer. It's not connected to anything. If you want to measure elapsed time, please use QElapsedTimer.

zzag added a subscriber: zzag.Apr 22 2018, 2:09 PM
zzag added inline comments.
decorations/decoratedclient.cpp
220

IMHO, 20 msecs is too instantaneous. Can't it be like a half of wakeUpDelay?

zzag added inline comments.Apr 22 2018, 2:12 PM
decorations/decoratedclient.cpp
220

QStyle has appropriate SH_ToolTip_FallAsleepDelay, so maybe you should use that.

zzag added a comment.EditedApr 22 2018, 2:42 PM

Forget what I said in inline comments, that was wrong.

aleksejshilin marked 3 inline comments as done.Apr 22 2018, 5:43 PM
aleksejshilin added inline comments.
decorations/decoratedclient.cpp
220

IMHO, 20 msecs is too instantaneous. Can't it be like a half of wakeUpDelay?

In case someone else questions this: 20 msec is the value Qt Widgets use for "instantaneous" tooltip activation (see QApplication implementation for details).

decorations/decoratedclient.h
117

If you want to measure elapsed time, please use QElapsedTimer.

I changed it to QDeadlineTimer which seems to be better suited for this use case.

aleksejshilin marked an inline comment as done.
  • Use QDeadlineTimer
graesslin accepted this revision.Apr 22 2018, 7:21 PM
graesslin added inline comments.
decorations/decoratedclient.h
117

very nice. I haven't knew that class yet.

This revision is now accepted and ready to land.Apr 22 2018, 7:21 PM
aleksejshilin edited the summary of this revision. (Show Details)Apr 22 2018, 8:43 PM
This revision was automatically updated to reflect the committed changes.