mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 12:50:40 +00:00
* Source/NSMenuView.m ([NSMenuView -trackWithEvent:]):
new tracking code. The menu feels snappier now (at least for me). * Source/NSColorWell.m ([-activate:], [-deactivate]) register/unregister for NSColorPanelColorChangedNotification. ([NSColorWell _takeColorFromPanel:]): new method to prevent endless loop when setting the well's color from the color panel. ([NSColorWell -initWithCoder:]): register for NSColorPboardType. * Source/NSColorPanel.m ([NSColorPanel -_bottomWellAction:]): called when hitting one of the well at the bottom of the panel. Previous behaviour would not send a NSColorPanelColorChangedNotification. ([NSColorPanel -initWithCoder:]): update bottom wells construction to call _bottomWellAction: instead of takeColorFrom:. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@14853 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
bd896cbb66
commit
118c53a894
4 changed files with 50 additions and 36 deletions
|
@ -885,7 +885,7 @@ _addLeftBorderOffsetToRect(NSRect aRect, BOOL isHorizontal)
|
|||
}
|
||||
|
||||
#define MOVE_THRESHOLD_DELTA 2.0
|
||||
#define DELAY_MULTIPLIER 6
|
||||
#define DELAY_MULTIPLIER 10
|
||||
|
||||
- (BOOL) trackWithEvent: (NSEvent*)event
|
||||
{
|
||||
|
@ -899,7 +899,6 @@ _addLeftBorderOffsetToRect(NSRect aRect, BOOL isHorizontal)
|
|||
BOOL delayedSelect = NO;
|
||||
int delayCount = 0;
|
||||
float xDelta = MOVE_THRESHOLD_DELTA;
|
||||
float yDelta = 0.0;
|
||||
NSEvent *original;
|
||||
NSEventType type = [event type];
|
||||
NSEventType end;
|
||||
|
@ -951,45 +950,18 @@ _addLeftBorderOffsetToRect(NSRect aRect, BOOL isHorizontal)
|
|||
if (delayedSelect && mouseMoved && [event type] == NSPeriodic)
|
||||
{
|
||||
float xDiff = location.x - lastLocation.x;
|
||||
float yDiff = location.y - lastLocation.y;
|
||||
|
||||
/*
|
||||
* Once the mouse movement has started in one vertical
|
||||
* direction, it must continue in the same direction if
|
||||
* selection is to be delayed.
|
||||
*/
|
||||
if (yDelta == 0.0)
|
||||
if (xDiff > xDelta)
|
||||
{
|
||||
if (yDiff < 0.0)
|
||||
yDelta = -MOVE_THRESHOLD_DELTA;
|
||||
else if (yDiff > 0.0)
|
||||
yDelta = MOVE_THRESHOLD_DELTA;
|
||||
}
|
||||
/*
|
||||
* Check to see if movement is less than the threshold.
|
||||
*/
|
||||
if (xDiff < xDelta
|
||||
|| (yDelta < 0.0 && yDiff > yDelta)
|
||||
|| (yDelta > 0.0 && yDiff < yDelta))
|
||||
{
|
||||
/*
|
||||
* if we have had too many successive small movements, or
|
||||
* a single movement too far in the wrong direction, we
|
||||
* leave 'delayedSelect' mode.
|
||||
*/
|
||||
delayCount++;
|
||||
if (delayCount >= DELAY_MULTIPLIER
|
||||
|| (xDiff < 0)
|
||||
|| (yDelta < 0.0 && yDiff > -yDelta)
|
||||
|| (yDelta > 0.0 && yDiff < -yDelta))
|
||||
{
|
||||
delayedSelect = NO;
|
||||
}
|
||||
if (delayCount >= DELAY_MULTIPLIER)
|
||||
delayedSelect = NO;
|
||||
}
|
||||
else
|
||||
{
|
||||
delayCount = 0;
|
||||
delayedSelect = NO;
|
||||
}
|
||||
|
||||
lastLocation = location;
|
||||
}
|
||||
}
|
||||
|
@ -1047,7 +1019,6 @@ _addLeftBorderOffsetToRect(NSRect aRect, BOOL isHorizontal)
|
|||
mouseMoved = NO;
|
||||
delayedSelect = YES;
|
||||
delayCount = 0;
|
||||
yDelta = 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue