Commit 1aa6fdb6 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: re-write the resize control used in the black window style to use the...

macosx: re-write the resize control used in the black window style to use the MouseDown event instead of the MouseDragged event which is ignored on Leopard (should fix #5822)
(cherry picked from commit f2a677c05602a0f7cf3fd31d93491126ad8fcd8f)
parent b00b902e
......@@ -271,29 +271,51 @@
@implementation VLCResizeControl
- (void)mouseDragged:(NSEvent *)theEvent
{
NSRect windowFrame = [[self window] frame];
CGFloat deltaX, deltaY, oldOriginY;
deltaX = [theEvent deltaX];
deltaY = [theEvent deltaY];
oldOriginY = windowFrame.origin.y;
windowFrame.origin.y = (oldOriginY + windowFrame.size.height) - (windowFrame.size.height + deltaY);
windowFrame.size.width += deltaX;
windowFrame.size.height += deltaY;
NSSize winMinSize = [self window].minSize;
if (windowFrame.size.width < winMinSize.width)
windowFrame.size.width = winMinSize.width;
- (void)mouseDown:(NSEvent *)theEvent {
BOOL keepOn = YES;
while (keepOn) {
theEvent = [[self window] nextEventMatchingMask: NSLeftMouseUpMask |
NSLeftMouseDraggedMask];
switch ([theEvent type]) {
case NSLeftMouseDragged:
{
NSRect windowFrame = [[self window] frame];
CGFloat deltaX, deltaY, oldOriginY;
deltaX = [theEvent deltaX];
deltaY = [theEvent deltaY];
oldOriginY = windowFrame.origin.y;
windowFrame.origin.y = (oldOriginY + windowFrame.size.height) - (windowFrame.size.height + deltaY);
windowFrame.size.width += deltaX;
windowFrame.size.height += deltaY;
NSSize winMinSize = [self window].minSize;
if (windowFrame.size.width < winMinSize.width)
windowFrame.size.width = winMinSize.width;
if (windowFrame.size.height < winMinSize.height)
{
windowFrame.size.height = winMinSize.height;
windowFrame.origin.y = oldOriginY;
}
[[self window] setFrame: windowFrame display: YES animate: NO];
break;
}
break;
case NSLeftMouseUp:
keepOn = NO;
break;
default:
/* Ignore any other kind of event. */
break;
}
if (windowFrame.size.height < winMinSize.height)
{
windowFrame.size.height = winMinSize.height;
windowFrame.origin.y = oldOriginY;
}
};
[[self window] setFrame: windowFrame display: YES animate: NO];
return;
}
@end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment