fix color swatch when dragging color on Windows

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@39201 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Doug Simons 2015-11-25 20:09:24 +00:00
parent 04f41a193a
commit b7f61f3fea
2 changed files with 12 additions and 5 deletions

View file

@ -1,4 +1,10 @@
2015-11-23 Doug Simons <doug.simons@testplant.com>
2015-11-25 Doug Simons <doug.simons@testplant.com>
* Source/NSColorPanel.m: Fix -dragColor:withEvent:fromView: to
show a correct color swatch while dragging on Windows (previously
the dragged swatch always appeared black).
2015-11-23 Doug Simons <doug.simons@testplant.com>
* Source/NSColorPanel.m: Improve the user experience when using
the magnifying glass to select a color from the screen. Also,

View file

@ -533,16 +533,17 @@ static int _gs_gui_color_picker_mode = NSRGBModeColorPanel;
fromView: (NSView *)sourceView
{
NSPasteboard *pb = [NSPasteboard pasteboardWithName: NSDragPboard];
NSImage *image = [NSImage imageNamed: @"common_ColorSwatch"];
NSSize size;
NSSize size = NSMakeSize(10,10);
NSPoint point;
NSImage *image = [[[NSImage alloc] initWithSize:size] autorelease];
[image lockFocus];
[aColor drawSwatchInRect:NSMakeRect(0, 0, size.width, size.height)];
[image unlockFocus];
[pb declareTypes: [NSArray arrayWithObjects: NSColorPboardType, nil]
owner: aColor];
[aColor writeToPasteboard: pb];
[image setBackgroundColor: aColor];
size = [image size];
point = [sourceView convertPoint: [anEvent locationInWindow] fromView: nil];
point.x -= size.width/2;
point.y -= size.width/2;