mouseDown mouseUp clickCount threshold #1664

Closed
BlairDuncan opened this Issue Aug 28, 2012 · 9 comments

Projects

None yet

4 participants

@BlairDuncan
Contributor

https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/nsevent_Class/Reference/Reference.html#//apple_ref/doc/uid/20000016-BBCCAJIG
In cocoa, if the mouse is held down (without moving it) for an extended period of time and then released, the clickCount is reset to 0 and the clickCount of the next mouseDown is 1.
In cappuccino, no matter how long you hold the mouse down, the clickCount is always incremented.

Moving the mouse resets the clickCount to zero.

It can been seen in the following example:

@implementation AppController : CPObject
{

}

- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
    var window = [[CPWindow alloc] initWithContentRect:CPRectMake(30, 30, 200, 200) styleMask:CPTitledWindowMask | CPClosableWindowMask];
    [window orderFront:self];
}    


@end

@implementation CPView (logClickCount)

- (void)mouseDown:(CPEvent)anEvent
{
console.log(_cmd + " clickCount=" + [anEvent clickCount]);
    if ([self mouseDownCanMoveWindow])
        [super mouseDown:anEvent];
}

@end
@cappbot
cappbot commented Aug 28, 2012

Milestone: Someday. Label: #new. What's next? A reviewer should examine this issue.

@aljungberg
Member

This is probably the same issue as #1666. The clickCount of mouseDown depends on the time since the previous mouseDown (not since the mouseUp), so this should work like in Cocoa.

+bug
+AppKit
+#needs-confirmation

@cappbot
cappbot commented Aug 31, 2012

Milestone: Someday. Labels: #needs-confirmation, #new, AppKit, bug. What's next? This issue needs a volunteer to independently reproduce the issue.

@BlairDuncan
Contributor

The fix for issue #1666 although it has made it work better it has not completely fixed this issue. The documents clearly state that when the user holds down the mouse for an extended period of time and then releases it, the clickCount should return 0. With the new fix it returns it still returns 1 and not 0 on mouseUp.

@aljungberg
Member

I find that a little strange since there has been exactly 1 mouseUp in recent times when you release the button. But the documentation does agree with you.

@aparajita
Contributor

#accepted

@cappbot
cappbot commented Feb 11, 2013

Milestone: Someday. Labels: #accepted, AppKit, bug. What's next? A reviewer should examine this issue.

@aparajita
Contributor

I am not seeing the behavior you described in the latest master. What you did uncover is that CPView -mouseDown is being called twice for each click, which is wrong.

#fixed

@cappbot
cappbot commented Feb 19, 2013

Milestone: Someday. Labels: #fixed, AppKit, bug. What's next? This issue is considered successfully resolved.

@cappbot cappbot closed this Feb 19, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment