Sweden-Number/dlls/winemac.drv/cocoa_window.h

112 lines
2.9 KiB
C
Raw Normal View History

/*
* 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>
@class WineEventQueue;
@interface WineWindow : NSPanel <NSWindowDelegate>
{
BOOL disabled;
BOOL noActivate;
BOOL floating;
BOOL resizable;
BOOL maximized;
BOOL fullscreen;
BOOL pendingMinimize;
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;
WineWindow* latentParentWindow;
NSMutableArray* latentChildWindows;
void* hwnd;
WineEventQueue* queue;
void* surface;
pthread_mutex_t* surface_mutex;
2013-01-15 03:23:58 +01:00
CGDirectDisplayID _lastDisplayID;
NSTimeInterval _lastDisplayTime;
NSRect wineFrame;
NSRect roundedWineFrame;
2013-01-15 03:23:58 +01:00
NSBezierPath* shape;
NSData* shapeData;
2013-01-15 03:23:58 +01:00
BOOL shapeChangedSinceLastDraw;
BOOL colorKeyed;
CGFloat colorKeyRed, colorKeyGreen, colorKeyBlue;
BOOL usePerPixelAlpha;
NSUInteger lastModifierFlags;
NSRect frameAtResizeStart;
BOOL resizingFromLeft, resizingFromTop;
void* imeData;
BOOL commandDone;
NSSize savedContentMinSize;
NSSize savedContentMaxSize;
BOOL enteringFullScreen;
BOOL exitingFullScreen;
NSRect nonFullscreenFrame;
NSTimeInterval enteredFullScreenTime;
int draggingPhase;
NSPoint dragStartPosition;
NSPoint dragWindowStartPosition;
winemac: Use a snapshot of an owned window when a zero-sized owner window is minimized. Some apps create a zero-sized window as their "main" window and then create all of the other top-level windows as owned windows with that main window as the owner. The user interacts with these owned windows. When the user attempts to minimize one of these owned windows, the app instead minimizes the zero-sized owner window. When an owner window is minimized, all of its owned windows are hidden. The Mac driver faithfully carries out these window operations. The only visible windows are hidden and the zero-sized window is minimized. This results in an invisible animation of the window down to a slot in the Dock - a slot which appears mostly empty. The invisible window thumbnail is badged with the app icon, but it still looks strange. On Windows, the Alt-Tab switcher uses the image of the owned window to represent the zero-sized owner. This commit attempts to do something similar. It takes over drawing of the Dock icon for minimized, zero-sized window. It grabs a snapshot of one of the owned windows and draws the app badge onto it. Since the owned windows are hidden before the zero-sized owner is minimized and we can't take snapshots of hidden windows, we use heuristics to guess when it may be useful to grab the snapshot. If the user minimizes an owned window from the Cocoa side, we grab that window's snapshot. If an owned window is being hidden and no snapshot has been taken recently, we grab its snapshot on the theory that this may be the beginning of hiding all of the owned windows before minimizing the owner. Unfortunately, this doesn't address the invisible animations when minimizing and unminimizing the zero-sized owner window. Signed-off-by: Ken Thomases <ken@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2015-10-23 09:48:34 +02:00
NSTimeInterval lastDockIconSnapshot;
BOOL allowKeyRepeats;
BOOL ignore_windowDeminiaturize;
BOOL ignore_windowResize;
BOOL fakingClose;
}
@property (retain, readonly, nonatomic) WineEventQueue* queue;
@property (readonly, nonatomic) BOOL disabled;
@property (readonly, nonatomic) BOOL noActivate;
@property (readonly, nonatomic) BOOL floating;
@property (readonly, getter=isFullscreen, nonatomic) BOOL fullscreen;
@property (readonly, getter=isFakingClose, nonatomic) BOOL fakingClose;
@property (readonly, nonatomic) NSRect wine_fractionalFrame;
- (NSInteger) minimumLevelForActive:(BOOL)active;
- (void) updateFullscreen;
- (void) postKeyEvent:(NSEvent *)theEvent;
- (void) postBroughtForwardEvent;
- (WineWindow*) ancestorWineWindow;
- (void) updateForCursorClipping;
- (void) setRetinaMode:(int)mode;
@end