2013-01-07 20:44:31 +00:00
|
|
|
/*
|
|
|
|
* MACDRV Cocoa application class declaration
|
|
|
|
*
|
|
|
|
* Copyright 2011, 2012, 2013 Ken Thomases for CodeWeavers Inc.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library 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
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#import <AppKit/AppKit.h>
|
|
|
|
|
|
|
|
#include "macdrv_cocoa.h"
|
|
|
|
|
|
|
|
|
2013-01-21 06:07:47 +00:00
|
|
|
#define ERR(...) do { if (macdrv_err_on) LogError(__func__, __VA_ARGS__); } while (false)
|
|
|
|
|
|
|
|
|
2013-03-13 21:52:57 +00:00
|
|
|
enum {
|
|
|
|
WineApplicationEventWakeQuery,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-01-21 06:07:51 +00:00
|
|
|
@class WineEventQueue;
|
2013-01-27 22:19:48 +00:00
|
|
|
@class WineWindow;
|
2013-01-21 06:07:51 +00:00
|
|
|
|
|
|
|
|
2013-04-16 05:38:01 +00:00
|
|
|
@interface WineApplicationController : NSObject <NSApplicationDelegate>
|
2013-01-21 06:07:51 +00:00
|
|
|
{
|
2013-03-11 03:58:26 +00:00
|
|
|
CFRunLoopSourceRef requestSource;
|
|
|
|
NSMutableArray* requests;
|
|
|
|
dispatch_queue_t requestsManipQueue;
|
|
|
|
|
2013-01-21 06:07:51 +00:00
|
|
|
NSMutableArray* eventQueues;
|
|
|
|
NSLock* eventQueuesLock;
|
2013-01-27 22:19:33 +00:00
|
|
|
|
|
|
|
NSTimeInterval eventTimeAdjustment;
|
2013-01-27 22:19:45 +00:00
|
|
|
|
|
|
|
NSMutableArray* keyWindows;
|
2013-01-27 22:19:48 +00:00
|
|
|
NSMutableSet* triedWindows;
|
|
|
|
unsigned long windowFocusSerial;
|
2013-02-03 23:20:11 +00:00
|
|
|
|
|
|
|
CGEventSourceKeyboardType keyboardType;
|
2013-02-03 23:20:18 +00:00
|
|
|
NSEvent* lastFlagsChanged;
|
2013-04-22 02:32:26 +00:00
|
|
|
BOOL inputSourceIsInputMethod;
|
|
|
|
BOOL inputSourceIsInputMethodValid;
|
2013-07-09 07:49:59 +00:00
|
|
|
uint32_t pressedKeyCodes[128 / 32];
|
2013-02-07 01:32:22 +00:00
|
|
|
|
|
|
|
CGFloat primaryScreenHeight;
|
|
|
|
BOOL primaryScreenHeightValid;
|
2013-05-07 08:00:49 +00:00
|
|
|
NSMutableData* screenFrameCGRects;
|
2013-02-18 01:28:27 +00:00
|
|
|
|
2013-02-25 04:53:32 +00:00
|
|
|
WineWindow* lastTargetWindow;
|
2013-05-07 08:00:55 +00:00
|
|
|
WineWindow* mouseCaptureWindow;
|
2013-02-25 04:53:32 +00:00
|
|
|
BOOL forceNextMouseMoveAbsolute;
|
2013-05-07 08:00:39 +00:00
|
|
|
double mouseMoveDeltaX, mouseMoveDeltaY;
|
2013-05-07 08:00:42 +00:00
|
|
|
NSUInteger unmatchedMouseDowns;
|
2013-02-25 04:53:32 +00:00
|
|
|
|
2014-05-15 01:15:35 +00:00
|
|
|
NSTimeInterval lastScrollTime;
|
|
|
|
double accumScrollX, accumScrollY;
|
|
|
|
|
2013-02-18 01:28:49 +00:00
|
|
|
NSMutableDictionary* originalDisplayModes;
|
2013-10-02 04:24:13 +00:00
|
|
|
NSMutableDictionary* latentDisplayModes;
|
2013-06-06 22:43:06 +00:00
|
|
|
BOOL displaysCapturedForFullscreen;
|
2013-02-25 04:53:21 +00:00
|
|
|
|
|
|
|
NSArray* cursorFrames;
|
|
|
|
int cursorFrame;
|
|
|
|
NSTimer* cursorTimer;
|
2013-10-18 04:45:52 +00:00
|
|
|
NSCursor* cursor;
|
|
|
|
BOOL cursorIsCurrent;
|
2013-02-25 04:53:21 +00:00
|
|
|
BOOL cursorHidden;
|
2013-10-18 04:45:52 +00:00
|
|
|
BOOL clientWantsCursorHidden;
|
2013-02-25 04:53:47 +00:00
|
|
|
|
2013-02-25 04:53:51 +00:00
|
|
|
BOOL clippingCursor;
|
|
|
|
CGRect cursorClipRect;
|
|
|
|
CFMachPortRef cursorClippingEventTap;
|
|
|
|
NSMutableArray* warpRecords;
|
|
|
|
CGPoint synthesizedLocation;
|
2013-02-25 04:53:47 +00:00
|
|
|
NSTimeInterval lastSetCursorPositionTime;
|
2013-02-25 04:53:51 +00:00
|
|
|
NSTimeInterval lastEventTapEventTime;
|
2013-03-18 03:40:49 +00:00
|
|
|
|
|
|
|
NSImage* applicationIcon;
|
2013-06-04 09:59:37 +00:00
|
|
|
|
|
|
|
BOOL beenActive;
|
2013-12-11 18:50:47 +00:00
|
|
|
|
|
|
|
NSMutableSet* windowsBeingDragged;
|
2013-01-21 06:07:51 +00:00
|
|
|
}
|
2013-01-07 20:44:31 +00:00
|
|
|
|
2013-02-03 23:20:11 +00:00
|
|
|
@property (nonatomic) CGEventSourceKeyboardType keyboardType;
|
2013-02-03 23:20:18 +00:00
|
|
|
@property (readonly, copy, nonatomic) NSEvent* lastFlagsChanged;
|
2013-02-18 01:28:49 +00:00
|
|
|
@property (readonly, nonatomic) BOOL areDisplaysCaptured;
|
2013-02-03 23:20:11 +00:00
|
|
|
|
2014-04-28 20:09:28 +00:00
|
|
|
@property (readonly) BOOL clippingCursor;
|
|
|
|
|
2013-04-16 05:38:01 +00:00
|
|
|
+ (WineApplicationController*) sharedController;
|
|
|
|
|
2013-01-07 20:44:31 +00:00
|
|
|
- (void) transformProcessToForeground;
|
|
|
|
|
2013-01-21 06:07:51 +00:00
|
|
|
- (BOOL) registerEventQueue:(WineEventQueue*)queue;
|
|
|
|
- (void) unregisterEventQueue:(WineEventQueue*)queue;
|
|
|
|
|
2013-01-27 22:19:33 +00:00
|
|
|
- (void) computeEventTimeAdjustmentFromTicks:(unsigned long long)tickcount uptime:(uint64_t)uptime_ns;
|
|
|
|
- (double) ticksForEventTime:(NSTimeInterval)eventTime;
|
|
|
|
|
2013-01-27 22:19:48 +00:00
|
|
|
- (void) windowGotFocus:(WineWindow*)window;
|
|
|
|
|
2013-03-13 21:52:57 +00:00
|
|
|
- (BOOL) waitUntilQueryDone:(int*)done timeout:(NSDate*)timeout processEvents:(BOOL)processEvents;
|
2013-03-11 03:58:26 +00:00
|
|
|
|
2013-02-03 23:20:18 +00:00
|
|
|
- (void) keyboardSelectionDidChange;
|
2013-07-09 07:49:59 +00:00
|
|
|
- (void) noteKey:(uint16_t)keyCode pressed:(BOOL)pressed;
|
2013-02-03 23:20:18 +00:00
|
|
|
|
2013-02-25 04:53:51 +00:00
|
|
|
- (void) flipRect:(NSRect*)rect;
|
|
|
|
|
2013-05-16 23:43:16 +00:00
|
|
|
- (WineWindow*) frontWineWindow;
|
2013-05-16 23:43:33 +00:00
|
|
|
- (void) adjustWindowLevels;
|
2013-06-06 22:43:06 +00:00
|
|
|
- (void) updateFullscreenWindows;
|
2013-02-18 01:28:27 +00:00
|
|
|
|
2013-04-16 05:38:01 +00:00
|
|
|
- (BOOL) handleEvent:(NSEvent*)anEvent;
|
|
|
|
- (void) didSendEvent:(NSEvent*)anEvent;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
|
|
@interface WineApplication : NSApplication
|
|
|
|
{
|
|
|
|
WineApplicationController* wineController;
|
|
|
|
}
|
|
|
|
|
|
|
|
@property (readwrite, assign, nonatomic) WineApplicationController* wineController;
|
|
|
|
|
2013-01-07 20:44:31 +00:00
|
|
|
@end
|
2013-01-07 20:44:44 +00:00
|
|
|
|
2013-04-16 05:38:01 +00:00
|
|
|
|
2013-01-07 20:44:44 +00:00
|
|
|
void OnMainThreadAsync(dispatch_block_t block);
|
2013-01-21 06:07:47 +00:00
|
|
|
|
|
|
|
void LogError(const char* func, NSString* format, ...);
|
|
|
|
void LogErrorv(const char* func, NSString* format, va_list args);
|