From beb08eb751fa8e1f72042f263316ab5e5ddb596d Mon Sep 17 00:00:00 2001 From: Unit 193 Date: Wed, 10 Nov 2021 00:54:13 -0500 Subject: New upstream version 2.4.0+dfsg. --- src/lib/platform/OSXDragSimulator.m | 102 ------------------------------------ 1 file changed, 102 deletions(-) delete mode 100644 src/lib/platform/OSXDragSimulator.m (limited to 'src/lib/platform/OSXDragSimulator.m') diff --git a/src/lib/platform/OSXDragSimulator.m b/src/lib/platform/OSXDragSimulator.m deleted file mode 100644 index affed38..0000000 --- a/src/lib/platform/OSXDragSimulator.m +++ /dev/null @@ -1,102 +0,0 @@ -/* - * barrier -- mouse and keyboard sharing utility - * Copyright (C) 2013-2016 Symless Ltd. - * - * This package is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * found in the file LICENSE that should have accompanied this file. - * - * This package is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#import "platform/OSXDragSimulator.h" - -#import "platform/OSXDragView.h" - -#import -#import -#import - -#if defined(MAC_OS_X_VERSION_10_7) - -NSWindow* g_dragWindow = NULL; -OSXDragView* g_dragView = NULL; -NSString* g_ext = NULL; - -void -runCocoaApp() -{ - NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; - - [NSApplication sharedApplication]; - - NSWindow* window = [[NSWindow alloc] - initWithContentRect: NSMakeRect(0, 0, 3, 3) - styleMask: NSBorderlessWindowMask - backing: NSBackingStoreBuffered - defer: NO]; - [window setTitle: @""]; - [window setAlphaValue:0.1]; - [window makeKeyAndOrderFront:nil]; - - OSXDragView* dragView = [[OSXDragView alloc] initWithFrame:NSMakeRect(0, 0, 3, 3)]; - - g_dragWindow = window; - g_dragView = dragView; - [window setContentView: dragView]; - - NSLog(@"starting cocoa loop"); - [NSApp run]; - - NSLog(@"cocoa: release"); - [pool release]; -} - -void -stopCocoaLoop() -{ - [NSApp stop: g_dragWindow]; -} - -void -fakeDragging(const char* str, int cursorX, int cursorY) -{ - g_ext = [NSString stringWithUTF8String:str]; - - dispatch_async(dispatch_get_main_queue(), ^{ - NSRect screen = [[NSScreen mainScreen] frame]; - NSLog ( @"screen size: witdh = %f height = %f", screen.size.width, screen.size.height); - NSLog ( @"mouseLocation: %d %d", cursorX, cursorY); - - int newPosX = 0; - int newPosY = 0; - newPosX = cursorX - 1; - newPosY = screen.size.height - cursorY - 1; - - NSRect rect = NSMakeRect(newPosX, newPosY, 3, 3); - NSLog ( @"newPosX: %d", newPosX); - NSLog ( @"newPosY: %d", newPosY); - - [g_dragWindow setFrame:rect display:NO]; - [g_dragWindow makeKeyAndOrderFront:nil]; - [NSApp activateIgnoringOtherApps:YES]; - - [g_dragView setFileExt:g_ext]; - - CGEventRef down = CGEventCreateMouseEvent(CGEventSourceCreate(kCGEventSourceStateHIDSystemState), kCGEventLeftMouseDown, CGPointMake(cursorX, cursorY), kCGMouseButtonLeft); - CGEventPost(kCGHIDEventTap, down); - }); -} - -CFStringRef -getCocoaDropTarget() -{ - // HACK: sleep, wait for cocoa drop target updated first - usleep(1000000); - return [g_dragView getDropTarget]; -} - -#endif -- cgit v1.2.3