dmusic: Avoid swallowing collection Load failures.
[wine.git] / dlls / winemac.drv / cocoa_app.h
blobc4c8bbd16f296fc76b98185e8a90ea892558303c
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 #define NSWindowStyleMaskNonactivatingPanel NSNonactivatingPanelMask
60 #endif
62 #define ERR(...) do { if (macdrv_err_on) LogError(__func__, __VA_ARGS__); } while (false)
65 enum {
66 WineApplicationEventWakeQuery,
70 @class WineEventQueue;
71 @class WineWindow;
72 @protocol WineClipCursorHandler;
75 @interface WineApplicationController : NSObject <NSApplicationDelegate>
77 CFRunLoopSourceRef requestSource;
78 NSMutableArray* requests;
79 dispatch_queue_t requestsManipQueue;
81 NSMutableArray* eventQueues;
82 NSLock* eventQueuesLock;
84 NSTimeInterval eventTimeAdjustment;
86 NSMutableArray* keyWindows;
87 NSMutableSet* triedWindows;
88 unsigned long windowFocusSerial;
90 TISInputSourceRef lastKeyboardInputSource;
91 TISInputSourceRef lastKeyboardLayoutInputSource;
92 CGEventSourceKeyboardType keyboardType;
93 NSEvent* lastFlagsChanged;
94 BOOL inputSourceIsInputMethod;
95 BOOL inputSourceIsInputMethodValid;
96 uint32_t pressedKeyCodes[128 / 32];
98 CGFloat primaryScreenHeight;
99 BOOL primaryScreenHeightValid;
100 NSMutableData* screenFrameCGRects;
102 WineWindow* lastTargetWindow;
103 WineWindow* mouseCaptureWindow;
104 BOOL forceNextMouseMoveAbsolute;
105 double mouseMoveDeltaX, mouseMoveDeltaY;
106 NSUInteger unmatchedMouseDowns;
108 NSTimeInterval lastScrollTime;
109 double accumScrollX, accumScrollY;
111 NSMutableDictionary* originalDisplayModes;
112 NSMutableDictionary* latentDisplayModes;
113 BOOL displaysCapturedForFullscreen;
115 NSArray* cursorFrames;
116 int cursorFrame;
117 NSTimer* cursorTimer;
118 NSCursor* cursor;
119 BOOL cursorIsCurrent;
120 BOOL cursorHidden;
121 BOOL clientWantsCursorHidden;
123 NSTimeInterval lastSetCursorPositionTime;
125 id<WineClipCursorHandler> clipCursorHandler;
127 NSImage* applicationIcon;
129 BOOL beenActive;
131 NSMutableSet* windowsBeingDragged;
132 BOOL useDragNotifications;
135 @property (nonatomic) CGEventSourceKeyboardType keyboardType;
136 @property (readonly, copy, nonatomic) NSEvent* lastFlagsChanged;
137 @property (readonly, nonatomic) BOOL areDisplaysCaptured;
139 @property (readonly) BOOL clippingCursor;
140 @property (nonatomic) NSTimeInterval lastSetCursorPositionTime;
142 + (WineApplicationController*) sharedController;
144 - (void) transformProcessToForeground:(BOOL)activateIfTransformed;
145 - (void) tryToActivateIgnoringOtherApps:(BOOL)ignore;
147 - (BOOL) registerEventQueue:(WineEventQueue*)queue;
148 - (void) unregisterEventQueue:(WineEventQueue*)queue;
150 - (void) computeEventTimeAdjustmentFromTicks:(unsigned long long)tickcount uptime:(uint64_t)uptime_ns;
151 - (double) ticksForEventTime:(NSTimeInterval)eventTime;
153 - (void) windowGotFocus:(WineWindow*)window;
155 - (BOOL) waitUntilQueryDone:(int*)done timeout:(NSDate*)timeout processEvents:(BOOL)processEvents;
157 - (void) noteKey:(uint16_t)keyCode pressed:(BOOL)pressed;
159 - (void) window:(WineWindow*)window isBeingDragged:(BOOL)dragged;
160 - (void) windowWillOrderOut:(WineWindow*)window;
162 - (void) flipRect:(NSRect*)rect;
163 - (NSPoint) flippedMouseLocation:(NSPoint)point;
165 - (WineWindow*) frontWineWindow;
166 - (void) adjustWindowLevels;
167 - (void) updateFullscreenWindows;
169 - (BOOL) handleEvent:(NSEvent*)anEvent;
170 - (void) didSendEvent:(NSEvent*)anEvent;
172 @end
175 @interface WineApplication : NSApplication
177 WineApplicationController* wineController;
180 @property (readwrite, assign, nonatomic) WineApplicationController* wineController;
182 @end
185 void OnMainThreadAsync(dispatch_block_t block);
187 void LogError(const char* func, NSString* format, ...);
188 void LogErrorv(const char* func, NSString* format, va_list args);