Bug 72906 - TimeLeft widget listens to too many signals
Summary: TimeLeft widget listens to too many signals
Status: RESOLVED FIXED
Alias: None
Product: juk
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Scott Wheeler
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-01-18 21:46 UTC by Thomas Zander
Modified: 2004-01-22 17:40 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Fix (689 bytes, patch)
2004-01-18 22:52 UTC, Thomas Zander
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Zander 2004-01-18 21:46:59 UTC
Version:           2.0 (using KDE 3.2.90 (CVS >= 20040117), compiled sources)
Compiler:          gcc version 3.3.2 (Debian)
OS:          Linux (i686) release 2.6.1dell-optiplex

The widget that shows the time / time-left toggles on mouse click.
The problem is that it also listens to mouse move and mouse-released.

So if I do a mouse-down, move mouse around, and then mouse release I could have triggered 10 or more state changes between the time-left and played-time states.
This is certainly not intuitive...

I suggest to only toggle on mouse-release.
Comment 1 Scott Wheeler 2004-01-18 22:04:34 UTC
Subject: Re:  New: TimeLeft widget listens to too many signals

On Sunday 18 January 2004 21:47, zander@kde.org wrote:
> So if I do a mouse-down, move mouse around, and then mouse release I could 
> have triggered 10 or more state changes between the time-left and 
> played-time states.  This is certainly not intuitive...

Huh?  It only toggles on pressing the left mouse button.

Line 164 in statuslabel.cpp:

    if(mouseEvent && mouseEvent->state() == LeftButton) {
    [...]

-Scott

Comment 2 Thomas Zander 2004-01-18 22:51:46 UTC
Looking at the docs you might see that button() will return NoButton on mouse move events. So you did not filter out mouse move or mouse down events, you listen to ALL events generated by the left mouse button.

Please try to 'drag' over the label to see my point, or simply insert a kdDebug() after the if you mentioned.

I'll attach a patch that fixes this for me.
Comment 3 Thomas Zander 2004-01-18 22:52:14 UTC
Created attachment 4231 [details]
Fix
Comment 4 Scott Wheeler 2004-01-18 23:12:00 UTC
Subject: Re:  TimeLeft widget listens to too many signals

On Sunday 18 January 2004 22:51, zander@kde.org wrote:
> Please try to 'drag' over the label to see my point, or simply insert a 
> kdDebug() after the if you mentioned. 

Ah, got it.  Had never done that on accident before.  :-)

- -Scott
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQFACwSRQu0ByfY5QTkRAslCAJ4uhdYTjnKumjQ2nvHCWaBzDHhy2gCeN+8S
3KzJ96H1b45sAYEF5Q/66lw=
=Udb4
-----END PGP SIGNATURE-----

Comment 5 Scott Wheeler 2004-01-22 17:40:09 UTC
Subject: kdemultimedia/juk

CVS commit by wheeler: 

Only toggle the time played / remaining on mouse release.

Thanks to Thomas Zander for the patch.

(I'll backport this after 3.2.0 is out.)

CCMAIL:72906-done@bugs.kde.org


  M +4 -1      statuslabel.cpp   1.19


--- kdemultimedia/juk/statuslabel.cpp  #1.18:1.19
@@ -162,5 +162,8 @@ bool StatusLabel::eventFilter(QObject *o
 
     QMouseEvent *mouseEvent = dynamic_cast<QMouseEvent *>(e);
-    if(mouseEvent && mouseEvent->state() == LeftButton) {
+    if(mouseEvent &&
+       mouseEvent->state() == LeftButton &&
+       mouseEvent->button() == LeftButton)
+    {
 
         if(o == m_itemTimeLabel) {