2013-01-07 21:44:31 +01: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 07:07:47 +01:00
|
|
|
#define ERR(...) do { if (macdrv_err_on) LogError(__func__, __VA_ARGS__); } while (false)
|
|
|
|
|
|
|
|
|
2013-03-13 22:52:57 +01:00
|
|
|
enum {
|
|
|
|
WineApplicationEventWakeQuery,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-01-21 07:07:51 +01:00
|
|
|
@class WineEventQueue;
|
2013-01-27 23:19:48 +01:00
|
|
|
@class WineWindow;
|
2013-01-21 07:07:51 +01:00
|
|
|
|
|
|
|
|
2013-04-16 07:38:01 +02:00
|
|
|
@interface WineApplicationController : NSObject <NSApplicationDelegate>
|
2013-01-21 07:07:51 +01:00
|
|
|
{
|
2013-03-11 04:58:26 +01:00
|
|
|
CFRunLoopSourceRef requestSource;
|
|
|
|
NSMutableArray* requests;
|
|
|
|
dispatch_queue_t requestsManipQueue;
|
|
|
|
|
2013-01-21 07:07:51 +01:00
|
|
|
NSMutableArray* eventQueues;
|
|
|
|
NSLock* eventQueuesLock;
|
2013-01-27 23:19:33 +01:00
|
|
|
|
|
|
|
NSTimeInterval eventTimeAdjustment;
|
2013-01-27 23:19:45 +01:00
|
|
|
|
|
|
|
NSMutableArray* keyWindows;
|
2013-01-27 23:19:48 +01:00
|
|
|
NSMutableSet* triedWindows;
|
|
|
|
unsigned long windowFocusSerial;
|
2013-02-04 00:20:11 +01:00
|
|
|
|
|
|
|
CGEventSourceKeyboardType keyboardType;
|
2013-02-04 00:20:18 +01:00
|
|
|
NSEvent* lastFlagsChanged;
|
2013-04-22 04:32:26 +02:00
|
|
|
BOOL inputSourceIsInputMethod;
|
|
|
|
BOOL inputSourceIsInputMethodValid;
|
2013-07-09 09:49:59 +02:00
|
|
|
uint32_t pressedKeyCodes[128 / 32];
|
2013-02-07 02:32:22 +01:00
|
|
|
|
|
|
|
CGFloat primaryScreenHeight;
|
|
|
|
BOOL primaryScreenHeightValid;
|
2013-05-07 10:00:49 +02:00
|
|
|
NSMutableData* screenFrameCGRects;
|
2013-02-18 02:28:27 +01:00
|
|
|
|
2013-02-25 05:53:32 +01:00
|
|
|
WineWindow* lastTargetWindow;
|
2013-05-07 10:00:55 +02:00
|
|
|
WineWindow* mouseCaptureWindow;
|
2013-02-25 05:53:32 +01:00
|
|
|
BOOL forceNextMouseMoveAbsolute;
|
2013-05-07 10:00:39 +02:00
|
|
|
double mouseMoveDeltaX, mouseMoveDeltaY;
|
2013-05-07 10:00:42 +02:00
|
|
|
NSUInteger unmatchedMouseDowns;
|
2013-02-25 05:53:32 +01:00
|
|
|
|
2013-02-18 02:28:49 +01:00
|
|
|
NSMutableDictionary* originalDisplayModes;
|
2013-10-02 06:24:13 +02:00
|
|
|
NSMutableDictionary* latentDisplayModes;
|
2013-06-07 00:43:06 +02:00
|
|
|
BOOL displaysCapturedForFullscreen;
|
2013-02-25 05:53:21 +01:00
|
|
|
|
|
|
|
NSArray* cursorFrames;
|
|
|
|
int cursorFrame;
|
|
|
|
NSTimer* cursorTimer;
|
2013-10-18 06:45:52 +02:00
|
|
|
NSCursor* cursor;
|
|
|
|
BOOL cursorIsCurrent;
|
2013-02-25 05:53:21 +01:00
|
|
|
BOOL cursorHidden;
|
2013-10-18 06:45:52 +02:00
|
|
|
BOOL clientWantsCursorHidden;
|
2013-02-25 05:53:47 +01:00
|
|
|
|
2013-02-25 05:53:51 +01:00
|
|
|
BOOL clippingCursor;
|
|
|
|
CGRect cursorClipRect;
|
|
|
|
CFMachPortRef cursorClippingEventTap;
|
|
|
|
NSMutableArray* warpRecords;
|
|
|
|
CGPoint synthesizedLocation;
|
2013-02-25 05:53:47 +01:00
|
|
|
NSTimeInterval lastSetCursorPositionTime;
|
2013-02-25 05:53:51 +01:00
|
|
|
NSTimeInterval lastEventTapEventTime;
|
2013-03-18 04:40:49 +01:00
|
|
|
|
|
|
|
NSImage* applicationIcon;
|
2013-06-04 11:59:37 +02:00
|
|
|
|
|
|
|
BOOL beenActive;
|
2013-01-21 07:07:51 +01:00
|
|
|
}
|
2013-01-07 21:44:31 +01:00
|
|
|
|
2013-02-04 00:20:11 +01:00
|
|
|
@property (nonatomic) CGEventSourceKeyboardType keyboardType;
|
2013-02-04 00:20:18 +01:00
|
|
|
@property (readonly, copy, nonatomic) NSEvent* lastFlagsChanged;
|
2013-02-18 02:28:49 +01:00
|
|
|
@property (readonly, nonatomic) BOOL areDisplaysCaptured;
|
2013-02-04 00:20:11 +01:00
|
|
|
|
2013-04-16 07:38:01 +02:00
|
|
|
+ (WineApplicationController*) sharedController;
|
|
|
|
|
2013-01-07 21:44:31 +01:00
|
|
|
- (void) transformProcessToForeground;
|
|
|
|
|
2013-01-21 07:07:51 +01:00
|
|
|
- (BOOL) registerEventQueue:(WineEventQueue*)queue;
|
|
|
|
- (void) unregisterEventQueue:(WineEventQueue*)queue;
|
|
|
|
|
2013-01-27 23:19:33 +01:00
|
|
|
- (void) computeEventTimeAdjustmentFromTicks:(unsigned long long)tickcount uptime:(uint64_t)uptime_ns;
|
|
|
|
- (double) ticksForEventTime:(NSTimeInterval)eventTime;
|
|
|
|
|
2013-01-27 23:19:48 +01:00
|
|
|
- (void) windowGotFocus:(WineWindow*)window;
|
|
|
|
|
2013-03-13 22:52:57 +01:00
|
|
|
- (BOOL) waitUntilQueryDone:(int*)done timeout:(NSDate*)timeout processEvents:(BOOL)processEvents;
|
2013-03-11 04:58:26 +01:00
|
|
|
|
2013-02-04 00:20:18 +01:00
|
|
|
- (void) keyboardSelectionDidChange;
|
2013-07-09 09:49:59 +02:00
|
|
|
- (void) noteKey:(uint16_t)keyCode pressed:(BOOL)pressed;
|
2013-02-04 00:20:18 +01:00
|
|
|
|
2013-02-25 05:53:51 +01:00
|
|
|
- (void) flipRect:(NSRect*)rect;
|
|
|
|
|
2013-05-17 01:43:16 +02:00
|
|
|
- (WineWindow*) frontWineWindow;
|
2013-05-17 01:43:33 +02:00
|
|
|
- (void) adjustWindowLevels;
|
2013-06-07 00:43:06 +02:00
|
|
|
- (void) updateFullscreenWindows;
|
2013-02-18 02:28:27 +01:00
|
|
|
|
2013-04-16 07:38:01 +02:00
|
|
|
- (BOOL) handleEvent:(NSEvent*)anEvent;
|
|
|
|
- (void) didSendEvent:(NSEvent*)anEvent;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
|
|
@interface WineApplication : NSApplication
|
|
|
|
{
|
|
|
|
WineApplicationController* wineController;
|
|
|
|
}
|
|
|
|
|
|
|
|
@property (readwrite, assign, nonatomic) WineApplicationController* wineController;
|
|
|
|
|
2013-01-07 21:44:31 +01:00
|
|
|
@end
|
2013-01-07 21:44:44 +01:00
|
|
|
|
2013-04-16 07:38:01 +02:00
|
|
|
|
2013-01-07 21:44:44 +01:00
|
|
|
void OnMainThreadAsync(dispatch_block_t block);
|
2013-01-21 07:07:47 +01:00
|
|
|
|
|
|
|
void LogError(const char* func, NSString* format, ...);
|
|
|
|
void LogErrorv(const char* func, NSString* format, va_list args);
|