wined3d: Pass a wined3d_device_context to wined3d_cs_emit_set_index_buffer().
[wine.git] / dlls / winemac.drv / cocoa_app.h
blob7abea0990e9ee25ab3abf530ac43da47150e542d
1 /*
2 * MACDRV Cocoa application class declaration
4 * Copyright 2011, 2012, 2013 Ken Thomases for CodeWeavers Inc.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #import <AppKit/AppKit.h>
23 #include "macdrv_cocoa.h"
25 #if !defined(MAC_OS_X_VERSION_10_12) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12
26 /* For older SDKs, #define the new names of constants deprecated/renamed in macOS 10.12. */
27 #define NSCompositingOperationSourceOver NSCompositeSourceOver
28 #define NSEventMaskAny NSAnyEventMask
29 #define NSEventMaskLeftMouseDown NSLeftMouseDownMask
30 #define NSEventMaskOtherMouseDown NSOtherMouseDownMask
31 #define NSEventMaskRightMouseDown NSRightMouseDownMask
32 #define NSEventModifierFlagCommand NSCommandKeyMask
33 #define NSEventModifierFlagControl NSControlKeyMask
34 #define NSEventModifierFlagOption NSAlternateKeyMask
35 #define NSEventModifierFlagShift NSShiftKeyMask
36 #define NSEventTypeAppKitDefined NSAppKitDefined
37 #define NSEventTypeApplicationDefined NSApplicationDefined
38 #define NSEventTypeFlagsChanged NSFlagsChanged
39 #define NSEventTypeKeyDown NSKeyDown
40 #define NSEventTypeKeyUp NSKeyUp
41 #define NSEventTypeLeftMouseDown NSLeftMouseDown
42 #define NSEventTypeLeftMouseDragged NSLeftMouseDragged
43 #define NSEventTypeLeftMouseUp NSLeftMouseUp
44 #define NSEventTypeMouseMoved NSMouseMoved
45 #define NSEventTypeOtherMouseDown NSOtherMouseDown
46 #define NSEventTypeOtherMouseDragged NSOtherMouseDragged
47 #define NSEventTypeOtherMouseUp NSOtherMouseUp
48 #define NSEventTypeRightMouseDown NSRightMouseDown
49 #define NSEventTypeRightMouseUp NSRightMouseUp
50 #define NSEventTypeRightMouseDragged NSRightMouseDragged
51 #define NSEventTypeScrollWheel NSScrollWheel
52 #define NSWindowStyleMaskBorderless NSBorderlessWindowMask
53 #define NSWindowStyleMaskClosable NSClosableWindowMask
54 #define NSWindowStyleMaskFullScreen NSFullScreenWindowMask
55 #define NSWindowStyleMaskMiniaturizable NSMiniaturizableWindowMask
56 #define NSWindowStyleMaskResizable NSResizableWindowMask
57 #define NSWindowStyleMaskTitled NSTitledWindowMask
58 #define NSWindowStyleMaskUtilityWindow NSUtilityWindowMask
59 #endif
61 #define ERR(...) do { if (macdrv_err_on) LogError(__func__, __VA_ARGS__); } while (false)
64 enum {
65 WineApplicationEventWakeQuery,
69 @class WineEventQueue;
70 @class WineWindow;
73 @interface WineApplicationController : NSObject <NSApplicationDelegate>
75 CFRunLoopSourceRef requestSource;
76 NSMutableArray* requests;
77 dispatch_queue_t requestsManipQueue;
79 NSMutableArray* eventQueues;
80 NSLock* eventQueuesLock;
82 NSTimeInterval eventTimeAdjustment;
84 NSMutableArray* keyWindows;
85 NSMutableSet* triedWindows;
86 unsigned long windowFocusSerial;
88 TISInputSourceRef lastKeyboardInputSource;
89 TISInputSourceRef lastKeyboardLayoutInputSource;
90 CGEventSourceKeyboardType keyboardType;
91 NSEvent* lastFlagsChanged;
92 BOOL inputSourceIsInputMethod;
93 BOOL inputSourceIsInputMethodValid;
94 uint32_t pressedKeyCodes[128 / 32];
96 CGFloat primaryScreenHeight;
97 BOOL primaryScreenHeightValid;
98 NSMutableData* screenFrameCGRects;
100 WineWindow* lastTargetWindow;
101 WineWindow* mouseCaptureWindow;
102 BOOL forceNextMouseMoveAbsolute;
103 double mouseMoveDeltaX, mouseMoveDeltaY;
104 NSUInteger unmatchedMouseDowns;
106 NSTimeInterval lastScrollTime;
107 double accumScrollX, accumScrollY;
109 NSMutableDictionary* originalDisplayModes;
110 NSMutableDictionary* latentDisplayModes;
111 BOOL displaysCapturedForFullscreen;
113 NSArray* cursorFrames;
114 int cursorFrame;
115 NSTimer* cursorTimer;
116 NSCursor* cursor;
117 BOOL cursorIsCurrent;
118 BOOL cursorHidden;
119 BOOL clientWantsCursorHidden;
121 BOOL clippingCursor;
122 CGRect cursorClipRect;
123 CFMachPortRef cursorClippingEventTap;
124 NSMutableArray* warpRecords;
125 CGPoint synthesizedLocation;
126 NSTimeInterval lastSetCursorPositionTime;
127 NSTimeInterval lastEventTapEventTime;
129 NSImage* applicationIcon;
131 BOOL beenActive;
133 NSMutableSet* windowsBeingDragged;
136 @property (nonatomic) CGEventSourceKeyboardType keyboardType;
137 @property (readonly, copy, nonatomic) NSEvent* lastFlagsChanged;
138 @property (readonly, nonatomic) BOOL areDisplaysCaptured;
140 @property (readonly) BOOL clippingCursor;
142 + (WineApplicationController*) sharedController;
144 - (void) transformProcessToForeground;
146 - (BOOL) registerEventQueue:(WineEventQueue*)queue;
147 - (void) unregisterEventQueue:(WineEventQueue*)queue;
149 - (void) computeEventTimeAdjustmentFromTicks:(unsigned long long)tickcount uptime:(uint64_t)uptime_ns;
150 - (double) ticksForEventTime:(NSTimeInterval)eventTime;
152 - (void) windowGotFocus:(WineWindow*)window;
154 - (BOOL) waitUntilQueryDone:(int*)done timeout:(NSDate*)timeout processEvents:(BOOL)processEvents;
156 - (void) noteKey:(uint16_t)keyCode pressed:(BOOL)pressed;
158 - (void) window:(WineWindow*)window isBeingDragged:(BOOL)dragged;
159 - (void) windowWillOrderOut:(WineWindow*)window;
161 - (void) flipRect:(NSRect*)rect;
163 - (WineWindow*) frontWineWindow;
164 - (void) adjustWindowLevels;
165 - (void) updateFullscreenWindows;
167 - (BOOL) handleEvent:(NSEvent*)anEvent;
168 - (void) didSendEvent:(NSEvent*)anEvent;
170 @end
173 @interface WineApplication : NSApplication
175 WineApplicationController* wineController;
178 @property (readwrite, assign, nonatomic) WineApplicationController* wineController;
180 @end
183 void OnMainThreadAsync(dispatch_block_t block);
185 void LogError(const char* func, NSString* format, ...);
186 void LogErrorv(const char* func, NSString* format, va_list args);