macOS: Remove workaround for grabbing child NSWindows
The code was introduced in 28c9c2ea50, but child NSWindows are no longer supported, so we can simplify the code by removing it. Change-Id: Ic98b8b0e0a84d5f2adba1840bd8318de2be031b6 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
parent
b0e4c8f427
commit
9b54447e45
@ -77,14 +77,10 @@ typedef NSWindow<QNSWindowProtocol> QCocoaNSWindow;
|
|||||||
{
|
{
|
||||||
QCocoaNSWindow *_window;
|
QCocoaNSWindow *_window;
|
||||||
QPointer<QCocoaWindow> _platformWindow;
|
QPointer<QCocoaWindow> _platformWindow;
|
||||||
BOOL _grabbingMouse;
|
|
||||||
BOOL _releaseOnMouseUp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@property (nonatomic, readonly) QCocoaNSWindow *window;
|
@property (nonatomic, readonly) QCocoaNSWindow *window;
|
||||||
@property (nonatomic, readonly) QCocoaWindow *platformWindow;
|
@property (nonatomic, readonly) QCocoaWindow *platformWindow;
|
||||||
@property (nonatomic) BOOL grabbingMouse;
|
|
||||||
@property (nonatomic) BOOL releaseOnMouseUp;
|
|
||||||
|
|
||||||
- (id)initWithNSWindow:(QCocoaNSWindow *)window platformWindow:(QCocoaWindow *)platformWindow;
|
- (id)initWithNSWindow:(QCocoaNSWindow *)window platformWindow:(QCocoaWindow *)platformWindow;
|
||||||
- (void)handleWindowEvent:(NSEvent *)theEvent;
|
- (void)handleWindowEvent:(NSEvent *)theEvent;
|
||||||
|
@ -90,8 +90,6 @@ static bool isMouseEvent(NSEvent *ev)
|
|||||||
@implementation QNSWindowHelper
|
@implementation QNSWindowHelper
|
||||||
|
|
||||||
@synthesize window = _window;
|
@synthesize window = _window;
|
||||||
@synthesize grabbingMouse = _grabbingMouse;
|
|
||||||
@synthesize releaseOnMouseUp = _releaseOnMouseUp;
|
|
||||||
|
|
||||||
- (QCocoaWindow *)platformWindow
|
- (QCocoaWindow *)platformWindow
|
||||||
{
|
{
|
||||||
@ -118,17 +116,6 @@ static bool isMouseEvent(NSEvent *ev)
|
|||||||
|
|
||||||
- (void)handleWindowEvent:(NSEvent *)theEvent
|
- (void)handleWindowEvent:(NSEvent *)theEvent
|
||||||
{
|
{
|
||||||
if (theEvent.type == NSLeftMouseDown) {
|
|
||||||
self.grabbingMouse = YES;
|
|
||||||
} else if (theEvent.type == NSLeftMouseUp) {
|
|
||||||
self.grabbingMouse = NO;
|
|
||||||
if (self.releaseOnMouseUp) {
|
|
||||||
[self detachFromPlatformWindow];
|
|
||||||
[self.window release];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// The call to -[NSWindow sendEvent] may result in the window being deleted
|
// The call to -[NSWindow sendEvent] may result in the window being deleted
|
||||||
// (e.g., when closing the window by pressing the title bar close button).
|
// (e.g., when closing the window by pressing the title bar close button).
|
||||||
[self retain];
|
[self retain];
|
||||||
@ -242,14 +229,9 @@ static const bool kNoDefer = NO;
|
|||||||
{
|
{
|
||||||
qCDebug(lcQpaCocoaWindow) << "closeAndRelease" << self;
|
qCDebug(lcQpaCocoaWindow) << "closeAndRelease" << self;
|
||||||
|
|
||||||
|
[self.helper detachFromPlatformWindow];
|
||||||
[self close];
|
[self close];
|
||||||
|
[self release];
|
||||||
if (self.helper.grabbingMouse) {
|
|
||||||
self.helper.releaseOnMouseUp = YES;
|
|
||||||
} else {
|
|
||||||
[self.helper detachFromPlatformWindow];
|
|
||||||
[self release];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc
|
- (void)dealloc
|
||||||
|
Loading…
x
Reference in New Issue
Block a user