2013-01-07 21:44:44 +01:00
|
|
|
/*
|
|
|
|
* MACDRV Cocoa window declarations
|
|
|
|
*
|
|
|
|
* 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>
|
|
|
|
|
|
|
|
|
2013-01-21 07:07:58 +01:00
|
|
|
@class WineEventQueue;
|
|
|
|
|
|
|
|
|
2013-01-07 21:44:44 +01:00
|
|
|
@interface WineWindow : NSPanel <NSWindowDelegate>
|
2013-01-11 13:18:05 +01:00
|
|
|
{
|
|
|
|
BOOL disabled;
|
2022-01-19 20:13:43 +01:00
|
|
|
BOOL noForeground;
|
2022-01-19 20:13:45 +01:00
|
|
|
BOOL preventsAppActivation;
|
2013-01-11 13:18:55 +01:00
|
|
|
BOOL floating;
|
2013-12-30 04:34:48 +01:00
|
|
|
BOOL resizable;
|
|
|
|
BOOL maximized;
|
2013-06-07 00:43:06 +02:00
|
|
|
BOOL fullscreen;
|
2013-06-04 11:59:42 +02:00
|
|
|
BOOL pendingMinimize;
|
2017-04-24 20:07:13 +02:00
|
|
|
BOOL pendingOrderOut;
|
2013-12-31 08:05:09 +01:00
|
|
|
BOOL savedVisibleState;
|
winemac: Set windows to transparent until they have content to draw, to reduce flicker.
When a window is shown, it may not have drawn its content into the backing
surface, yet. Cocoa will draw the window, starting with its standard light
gray background and then the content view. However, the content view won't
have anything to draw, yet, though, so the window background is not drawn over.
A short while later, usually, the app will paint its content into the window
backing surface and Cocoa will be told to redraw the window. This works, but
the user can often see the flash of the window background color first. This
is especially visible for windows with dark content.
Part of the fix is to set the window background to transparent until the
content view has actually drawn once since the window was shown.
That's not sufficient on its own, though. We had disabled Cocoa's automatic
display mechanism for windows and put display on a display-link timer. This
meant that the window was not actually cleared to its transparent color. When
the window was shown, the Window Server displayed a white backing buffer. It
is the app process which should fill that backing buffer with clear color but,
because we had disabled auto-display, that wasn't getting done at the same
time the window was displayed. It was happening some time after. Again, the
result was a visible flicker of white.
So, we now temporarily re-enable auto-display just before showing a window.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-09-02 10:08:01 +02:00
|
|
|
BOOL drawnSinceShown;
|
2022-01-04 15:35:03 +01:00
|
|
|
BOOL closing;
|
2013-01-11 13:19:36 +01:00
|
|
|
WineWindow* latentParentWindow;
|
2013-08-30 07:00:56 +02:00
|
|
|
NSMutableArray* latentChildWindows;
|
2013-01-15 03:23:55 +01:00
|
|
|
|
2013-01-21 07:08:03 +01:00
|
|
|
void* hwnd;
|
2013-01-21 07:07:58 +01:00
|
|
|
WineEventQueue* queue;
|
|
|
|
|
2013-01-15 03:23:55 +01:00
|
|
|
void* surface;
|
|
|
|
pthread_mutex_t* surface_mutex;
|
2013-01-15 03:23:58 +01:00
|
|
|
|
winemac: Use CVDisplayLink to limit window redrawing to the display refresh rate.
Some Windows apps cause user32 to flush the window surface much faster than the
display refresh rate. The Mac driver only marks its window as needing to be
redrawn and lets Cocoa decide how often to actually redraw. Unfortunately,
Cocoa redraws each time through the run loop and, since the Mac driver uses a
run loop source to convey messages from background threads to the main thread,
it redraws after every batch of messages.
On some versions of OS X, this excessive drawing provokes synchronization with
the window server's buffer swaps, preventing the main thread from being
responsive. Even when that doesn't happen, it's wasteful.
So, we set our windows' autodisplay property to false so that Cocoa never
displays windows itself. Then, we arrange to call -displayIfNeeded once per
display refresh cycle using a CVDisplayLink. We maintain one CVDisplayLink per
display (on demand), move windows among them as the windows change screens,
start them when they acquire their first window, and stop them when they have
none left.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2015-11-06 13:57:53 +01:00
|
|
|
CGDirectDisplayID _lastDisplayID;
|
2015-11-10 03:31:22 +01:00
|
|
|
NSTimeInterval _lastDisplayTime;
|
winemac: Use CVDisplayLink to limit window redrawing to the display refresh rate.
Some Windows apps cause user32 to flush the window surface much faster than the
display refresh rate. The Mac driver only marks its window as needing to be
redrawn and lets Cocoa decide how often to actually redraw. Unfortunately,
Cocoa redraws each time through the run loop and, since the Mac driver uses a
run loop source to convey messages from background threads to the main thread,
it redraws after every batch of messages.
On some versions of OS X, this excessive drawing provokes synchronization with
the window server's buffer swaps, preventing the main thread from being
responsive. Even when that doesn't happen, it's wasteful.
So, we set our windows' autodisplay property to false so that Cocoa never
displays windows itself. Then, we arrange to call -displayIfNeeded once per
display refresh cycle using a CVDisplayLink. We maintain one CVDisplayLink per
display (on demand), move windows among them as the windows change screens,
start them when they acquire their first window, and stop them when they have
none left.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2015-11-06 13:57:53 +01:00
|
|
|
|
2016-05-05 20:53:36 +02:00
|
|
|
NSRect wineFrame;
|
|
|
|
NSRect roundedWineFrame;
|
|
|
|
|
2013-01-15 03:23:58 +01:00
|
|
|
BOOL shapeChangedSinceLastDraw;
|
2013-01-15 03:24:02 +01:00
|
|
|
|
|
|
|
BOOL colorKeyed;
|
|
|
|
CGFloat colorKeyRed, colorKeyGreen, colorKeyBlue;
|
|
|
|
|
|
|
|
BOOL usePerPixelAlpha;
|
2013-01-27 23:19:41 +01:00
|
|
|
|
2013-02-04 00:20:18 +01:00
|
|
|
NSUInteger lastModifierFlags;
|
|
|
|
|
2014-04-24 03:00:29 +02:00
|
|
|
NSRect frameAtResizeStart;
|
|
|
|
BOOL resizingFromLeft, resizingFromTop;
|
2013-04-02 10:17:48 +02:00
|
|
|
|
2013-04-22 04:32:26 +02:00
|
|
|
void* imeData;
|
|
|
|
BOOL commandDone;
|
|
|
|
|
2013-09-18 20:00:37 +02:00
|
|
|
NSSize savedContentMinSize;
|
|
|
|
NSSize savedContentMaxSize;
|
|
|
|
|
2013-10-10 21:22:08 +02:00
|
|
|
BOOL enteringFullScreen;
|
|
|
|
BOOL exitingFullScreen;
|
|
|
|
NSRect nonFullscreenFrame;
|
|
|
|
NSTimeInterval enteredFullScreenTime;
|
|
|
|
|
2015-03-24 00:58:11 +01:00
|
|
|
int draggingPhase;
|
|
|
|
NSPoint dragStartPosition;
|
|
|
|
NSPoint dragWindowStartPosition;
|
|
|
|
|
2015-10-23 09:48:34 +02:00
|
|
|
NSTimeInterval lastDockIconSnapshot;
|
|
|
|
|
2017-03-10 09:22:02 +01:00
|
|
|
BOOL allowKeyRepeats;
|
|
|
|
|
2013-02-04 00:20:07 +01:00
|
|
|
BOOL ignore_windowDeminiaturize;
|
2013-11-15 03:52:07 +01:00
|
|
|
BOOL ignore_windowResize;
|
2013-09-27 06:46:31 +02:00
|
|
|
BOOL fakingClose;
|
2013-01-11 13:18:05 +01:00
|
|
|
}
|
|
|
|
|
2013-01-27 23:19:48 +01:00
|
|
|
@property (retain, readonly, nonatomic) WineEventQueue* queue;
|
2013-06-18 06:35:56 +02:00
|
|
|
@property (readonly, nonatomic) BOOL disabled;
|
2022-01-19 20:13:43 +01:00
|
|
|
@property (readonly, nonatomic) BOOL noForeground;
|
2022-01-19 20:13:45 +01:00
|
|
|
@property (readonly, nonatomic) BOOL preventsAppActivation;
|
2013-02-18 02:28:30 +01:00
|
|
|
@property (readonly, nonatomic) BOOL floating;
|
2013-06-07 00:43:06 +02:00
|
|
|
@property (readonly, getter=isFullscreen, nonatomic) BOOL fullscreen;
|
2013-09-27 06:46:31 +02:00
|
|
|
@property (readonly, getter=isFakingClose, nonatomic) BOOL fakingClose;
|
2016-05-05 20:53:36 +02:00
|
|
|
@property (readonly, nonatomic) NSRect wine_fractionalFrame;
|
2013-01-27 23:19:48 +01:00
|
|
|
|
2013-05-17 01:43:33 +02:00
|
|
|
- (NSInteger) minimumLevelForActive:(BOOL)active;
|
2013-06-07 00:43:06 +02:00
|
|
|
- (void) updateFullscreen;
|
2013-02-18 02:28:49 +01:00
|
|
|
|
2013-07-09 09:49:59 +02:00
|
|
|
- (void) postKeyEvent:(NSEvent *)theEvent;
|
2013-10-08 09:21:34 +02:00
|
|
|
- (void) postBroughtForwardEvent;
|
|
|
|
|
|
|
|
- (WineWindow*) ancestorWineWindow;
|
2013-07-09 09:49:59 +02:00
|
|
|
|
2014-04-28 22:09:28 +02:00
|
|
|
- (void) updateForCursorClipping;
|
|
|
|
|
2016-05-05 20:53:36 +02:00
|
|
|
- (void) setRetinaMode:(int)mode;
|
|
|
|
|
2013-01-07 21:44:44 +01:00
|
|
|
@end
|