winemac: While a window is being dragged, suppress mouse events and disable cursor clipping and warping.
This commit is contained in:
parent
cd10a0df5e
commit
b3cc34e5b0
|
@ -89,6 +89,8 @@ @interface WineApplicationController : NSObject <NSApplicationDelegate>
|
||||||
NSImage* applicationIcon;
|
NSImage* applicationIcon;
|
||||||
|
|
||||||
BOOL beenActive;
|
BOOL beenActive;
|
||||||
|
|
||||||
|
NSMutableSet* windowsBeingDragged;
|
||||||
}
|
}
|
||||||
|
|
||||||
@property (nonatomic) CGEventSourceKeyboardType keyboardType;
|
@property (nonatomic) CGEventSourceKeyboardType keyboardType;
|
||||||
|
|
|
@ -154,6 +154,8 @@ - (id) init
|
||||||
|
|
||||||
warpRecords = [[NSMutableArray alloc] init];
|
warpRecords = [[NSMutableArray alloc] init];
|
||||||
|
|
||||||
|
windowsBeingDragged = [[NSMutableSet alloc] init];
|
||||||
|
|
||||||
if (!requests || !requestsManipQueue || !eventQueues || !eventQueuesLock ||
|
if (!requests || !requestsManipQueue || !eventQueues || !eventQueuesLock ||
|
||||||
!keyWindows || !originalDisplayModes || !latentDisplayModes || !warpRecords)
|
!keyWindows || !originalDisplayModes || !latentDisplayModes || !warpRecords)
|
||||||
{
|
{
|
||||||
|
@ -173,6 +175,7 @@ - (id) init
|
||||||
|
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
|
[windowsBeingDragged release];
|
||||||
[cursor release];
|
[cursor release];
|
||||||
[screenFrameCGRects release];
|
[screenFrameCGRects release];
|
||||||
[applicationIcon release];
|
[applicationIcon release];
|
||||||
|
@ -1258,7 +1261,9 @@ - (BOOL) setCursorPosition:(CGPoint)pos
|
||||||
{
|
{
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
|
|
||||||
if (clippingCursor)
|
if ([windowsBeingDragged count])
|
||||||
|
ret = FALSE;
|
||||||
|
else if (clippingCursor)
|
||||||
{
|
{
|
||||||
[self clipCursorLocation:&pos];
|
[self clipCursorLocation:&pos];
|
||||||
|
|
||||||
|
@ -1335,7 +1340,7 @@ - (void) deactivateCursorClipping
|
||||||
|
|
||||||
- (void) updateCursorClippingState
|
- (void) updateCursorClippingState
|
||||||
{
|
{
|
||||||
if (clippingCursor && [NSApp isActive])
|
if (clippingCursor && [NSApp isActive] && ![windowsBeingDragged count])
|
||||||
[self activateCursorClipping];
|
[self activateCursorClipping];
|
||||||
else
|
else
|
||||||
[self deactivateCursorClipping];
|
[self deactivateCursorClipping];
|
||||||
|
@ -1395,7 +1400,9 @@ - (void) handleMouseMove:(NSEvent*)anEvent
|
||||||
WineWindow* targetWindow;
|
WineWindow* targetWindow;
|
||||||
BOOL drag = [anEvent type] != NSMouseMoved;
|
BOOL drag = [anEvent type] != NSMouseMoved;
|
||||||
|
|
||||||
if (mouseCaptureWindow)
|
if ([windowsBeingDragged count])
|
||||||
|
targetWindow = nil;
|
||||||
|
else if (mouseCaptureWindow)
|
||||||
targetWindow = mouseCaptureWindow;
|
targetWindow = mouseCaptureWindow;
|
||||||
else if (drag)
|
else if (drag)
|
||||||
targetWindow = (WineWindow*)[anEvent window];
|
targetWindow = (WineWindow*)[anEvent window];
|
||||||
|
@ -1620,7 +1627,9 @@ - (void) handleMouseButton:(NSEvent*)theEvent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mouseCaptureWindow)
|
if ([windowsBeingDragged count])
|
||||||
|
window = nil;
|
||||||
|
else if (mouseCaptureWindow)
|
||||||
window = mouseCaptureWindow;
|
window = mouseCaptureWindow;
|
||||||
|
|
||||||
if ([window isKindOfClass:[WineWindow class]])
|
if ([window isKindOfClass:[WineWindow class]])
|
||||||
|
@ -1861,6 +1870,26 @@ - (BOOL) handleEvent:(NSEvent*)anEvent
|
||||||
[window postKeyEvent:anEvent];
|
[window postKeyEvent:anEvent];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (type == NSAppKitDefined)
|
||||||
|
{
|
||||||
|
short subtype = [anEvent subtype];
|
||||||
|
|
||||||
|
// These subtypes are not documented but they appear to mean
|
||||||
|
// "a window is being dragged" and "a window is no longer being
|
||||||
|
// dragged", respectively.
|
||||||
|
if (subtype == 20 || subtype == 21)
|
||||||
|
{
|
||||||
|
WineWindow* window = (WineWindow*)[anEvent window];
|
||||||
|
if ([window isKindOfClass:[WineWindow class]])
|
||||||
|
{
|
||||||
|
if (subtype == 20)
|
||||||
|
[windowsBeingDragged addObject:window];
|
||||||
|
else
|
||||||
|
[windowsBeingDragged removeObject:window];
|
||||||
|
[self updateCursorClippingState];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1917,6 +1946,8 @@ - (void) setupObservations
|
||||||
[self updateFullscreenWindows];
|
[self updateFullscreenWindows];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
[windowsBeingDragged removeObject:window];
|
||||||
|
[self updateCursorClippingState];
|
||||||
}];
|
}];
|
||||||
|
|
||||||
[nc addObserver:self
|
[nc addObserver:self
|
||||||
|
|
Loading…
Reference in New Issue