CPEvent - send a valid timestamp for periodic events

This commit is contained in:
Blair Duncan
2012-04-23 18:19:37 -04:00
parent 5b6779a3a9
commit 5b5034da63
3 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -634,7 +634,7 @@ var _CPEventPeriodicEventPeriod = 0,
function _CPEventFirePeriodEvent()
{
[CPApp sendEvent:[CPEvent otherEventWithType:CPPeriodic location:_CGPointMakeZero() modifierFlags:0 timestamp:0 windowNumber:0 context:nil subtype:0 data1:0 data2:0]];
[CPApp sendEvent:[CPEvent otherEventWithType:CPPeriodic location:_CGPointMakeZero() modifierFlags:0 timestamp:[CPEvent currentTimestamp] windowNumber:0 context:nil subtype:0 data1:0 data2:0]];
}
var CPEventClass = [CPEvent class];
+4 -4
View File
@@ -126,8 +126,8 @@ var STICKY_TIME_INTERVAL = 0.5,
}
if (_keyBuffer)
{ // periodic events have a timestamp of 0 so use the currentTimestamp
if (([CPEvent currentTimestamp] - _startTime) > (STICKY_TIME_INTERVAL + [activeMenu numberOfItems] / 2))
{
if (([anEvent timestamp] - _startTime) > (STICKY_TIME_INTERVAL + [activeMenu numberOfItems] / 2))
[self selectNextItemBeginningWith:_keyBuffer inMenu:menu clearBuffer:YES];
if (type === CPPeriodic)
@@ -245,7 +245,7 @@ var STICKY_TIME_INTERVAL = 0.5,
3. The user clicks, drags and then releases. Tracking ends.
*/
if (_mouseWasDragged || ([CPEvent currentTimestamp] - _startTime > STICKY_TIME_INTERVAL))
if (_mouseWasDragged || ([anEvent timestamp] - _startTime > STICKY_TIME_INTERVAL))
{
/*
Close the menu if:
@@ -485,7 +485,7 @@ var STICKY_TIME_INTERVAL = 0.5,
{
if (!_keyBuffer)
{
_startTime = [CPEvent currentTimestamp];
_startTime = [anEvent timestamp];
_keyBuffer = character;
[CPEvent stopPeriodicEvents];
+1 -1
View File
@@ -1,6 +1,6 @@
/*
* AppController.j
* CPMenu
* CPMenuTest
*
* Created by Blair Duncan on April 23, 2012.
* Copyright 2012, SGL Studio, BBDO Toronto All rights reserved.