mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 02:10:48 +00:00
Fix issue where color was being continuously updated.
This commit is contained in:
parent
407df1188d
commit
6b086ca150
1 changed files with 11 additions and 7 deletions
|
@ -54,7 +54,8 @@
|
|||
styleMask: 0
|
||||
backing: NSBackingStoreBuffered
|
||||
defer: NO];
|
||||
|
||||
NSColor *color = nil;
|
||||
|
||||
[w _captureMouse: self];
|
||||
|
||||
/**
|
||||
|
@ -73,7 +74,8 @@
|
|||
NSPoint mouseLoc;
|
||||
NSImage *img;
|
||||
CREATE_AUTORELEASE_POOL(pool);
|
||||
|
||||
|
||||
RELEASE(color);
|
||||
currentEvent = [NSApp nextEventMatchingMask: NSLeftMouseDownMask | NSLeftMouseUpMask | NSMouseMovedMask
|
||||
untilDate: [NSDate distantFuture]
|
||||
inMode: NSEventTrackingRunLoopMode
|
||||
|
@ -87,9 +89,9 @@
|
|||
if (img != nil)
|
||||
{
|
||||
NSBitmapImageRep *rep = (NSBitmapImageRep *)[img bestRepresentationForDevice: nil];
|
||||
NSColor *color = [rep colorAtX: 0 y: 0];
|
||||
CALL_BLOCK(selectionHandler, color);
|
||||
}
|
||||
color = [rep colorAtX: 0 y: 0];
|
||||
RETAIN(color);
|
||||
}
|
||||
[pool drain];
|
||||
} while ([currentEvent type] != NSLeftMouseUp &&
|
||||
[currentEvent type] != NSLeftMouseDown);
|
||||
|
@ -99,8 +101,10 @@
|
|||
NSLog(@"Exception occurred in -[NSColorSampler showSamplerWithSelectionHandler:] : %@",
|
||||
localException);
|
||||
}
|
||||
NS_ENDHANDLER
|
||||
|
||||
NS_ENDHANDLER;
|
||||
|
||||
CALL_BLOCK(selectionHandler, color);
|
||||
[color release];
|
||||
[NSCursor pop];
|
||||
[w _releaseMouse: self];
|
||||
[w close];
|
||||
|
|
Loading…
Reference in a new issue