From dbc7659776086eceb69dc8670b40cdce21e09e66 Mon Sep 17 00:00:00 2001 From: jerry Date: Thu, 12 Sep 2013 11:43:34 +0000 Subject: [PATCH] changed the transparency of the window where drag is from on mac. --- src/lib/client/CClient.cpp | 3 ++- src/lib/platform/COSXDragSimulator.m | 15 +++++++++------ src/lib/platform/COSXDragView.m | 1 + src/lib/platform/COSXScreen.cpp | 1 + 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/lib/client/CClient.cpp b/src/lib/client/CClient.cpp index 0932358c..d5d6235c 100644 --- a/src/lib/client/CClient.cpp +++ b/src/lib/client/CClient.cpp @@ -762,8 +762,9 @@ CClient::fileChunkReceived(CString data) void CClient::dragInfoReceived(UInt32 fileNum, CString data) { - CDragInformation::parseDragInfo(m_dragFileList, fileNum, data); LOG((CLOG_DEBUG "drag information received")); + LOG((CLOG_DEBUG "parsing drag info data: %s", data.c_str())); + CDragInformation::parseDragInfo(m_dragFileList, fileNum, data); LOG((CLOG_DEBUG "total drag file number: %i", m_dragFileList.size())); for(int i = 0; i < m_dragFileList.size(); ++i) { diff --git a/src/lib/platform/COSXDragSimulator.m b/src/lib/platform/COSXDragSimulator.m index c1dbb2d7..4c36d684 100644 --- a/src/lib/platform/COSXDragSimulator.m +++ b/src/lib/platform/COSXDragSimulator.m @@ -30,14 +30,16 @@ runCocoaApp() NSApplication* app = [[NSApplication alloc] init]; NSWindow* window = [[NSWindow alloc] - initWithContentRect: NSMakeRect(-100, -100, 100, 100) - styleMask: NSTitledWindowMask | NSMiniaturizableWindowMask + initWithContentRect: NSMakeRect(0, 0, 100, 4) + styleMask: NSBorderlessWindowMask backing: NSBackingStoreBuffered defer: NO]; [window setTitle: @""]; + [window setAlphaValue:0.1]; [window makeKeyAndOrderFront:nil]; - COSXDragView* dragView = [[COSXDragView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100)]; + COSXDragView* dragView = [[COSXDragView alloc] initWithFrame:NSMakeRect(0, 0, 100, 4)]; + g_dragWindow = window; g_dragView = dragView; [window setContentView: dragView]; @@ -53,9 +55,10 @@ fakeDragging(const char* str, int length, int cursorX, int cursorY) dispatch_async(dispatch_get_main_queue(), ^{ NSRect screen = [[NSScreen mainScreen] frame]; NSLog ( @"mouseLocation: %d %d", cursorX, cursorY); - NSRect rect = NSMakeRect(cursorX - 50, screen.size.height - cursorY - 50, 100, 100); - [g_dragWindow setFrame:rect display:YES]; - [g_dragWindow makeKeyWindow]; + NSRect rect = NSMakeRect(cursorX - 99, screen.size.height - cursorY - 2, 100, 4); + [g_dragWindow setFrame:rect display:NO]; + + [g_dragWindow makeKeyAndOrderFront:nil]; }); } diff --git a/src/lib/platform/COSXDragView.m b/src/lib/platform/COSXDragView.m index 13eb8afc..18dec727 100644 --- a/src/lib/platform/COSXDragView.m +++ b/src/lib/platform/COSXDragView.m @@ -43,6 +43,7 @@ acceptsFirstMouse:(NSEvent *)theEvent - (void) mouseDown:(NSEvent *)theEvent { + NSLog ( @"cocoa mouse down"); NSPoint dragPosition; NSRect imageLocation; dragPosition = [self convertPoint:[theEvent locationInWindow] diff --git a/src/lib/platform/COSXScreen.cpp b/src/lib/platform/COSXScreen.cpp index a58d9256..948c4774 100644 --- a/src/lib/platform/COSXScreen.cpp +++ b/src/lib/platform/COSXScreen.cpp @@ -589,6 +589,7 @@ COSXScreen::fakeMouseButton(ButtonID id, bool press) m_lastSingleClickYCursor = m_yCursor; } if (!press && (id == kButtonLeft)) { + // fake ctrl key up fakeKeyUp(29); if (m_fakeDraggingStarted) {