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-01-07 21:44:31 +01:00
|
|
|
@interface WineApplication : NSApplication <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-02-07 02:32:22 +01:00
|
|
|
|
|
|
|
CGFloat primaryScreenHeight;
|
|
|
|
BOOL primaryScreenHeightValid;
|
2013-02-18 02:28:27 +01:00
|
|
|
|
2013-02-25 05:53:32 +01:00
|
|
|
WineWindow* lastTargetWindow;
|
|
|
|
BOOL forceNextMouseMoveAbsolute;
|
|
|
|
|
2013-02-18 02:28:27 +01:00
|
|
|
NSMutableArray* orderedWineWindows;
|
2013-02-18 02:28:49 +01:00
|
|
|
|
|
|
|
NSMutableDictionary* originalDisplayModes;
|
2013-02-25 05:53:21 +01:00
|
|
|
|
|
|
|
NSArray* cursorFrames;
|
|
|
|
int cursorFrame;
|
|
|
|
NSTimer* cursorTimer;
|
|
|
|
BOOL cursorHidden;
|
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-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:27 +01:00
|
|
|
@property (readonly, nonatomic) NSArray* orderedWineWindows;
|
2013-02-18 02:28:49 +01:00
|
|
|
@property (readonly, nonatomic) BOOL areDisplaysCaptured;
|
2013-02-04 00:20:11 +01:00
|
|
|
|
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-02-25 05:53:51 +01:00
|
|
|
- (void) flipRect:(NSRect*)rect;
|
|
|
|
|
2013-02-18 02:28:27 +01:00
|
|
|
- (void) wineWindow:(WineWindow*)window
|
|
|
|
ordered:(NSWindowOrderingMode)order
|
|
|
|
relativeTo:(WineWindow*)otherWindow;
|
|
|
|
|
2013-01-07 21:44:31 +01:00
|
|
|
@end
|
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);
|