Commit f2a677c0 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)
parent ce572957
...@@ -271,29 +271,51 @@ ...@@ -271,29 +271,51 @@
@implementation VLCResizeControl @implementation VLCResizeControl
- (void)mouseDragged:(NSEvent *)theEvent - (void)mouseDown:(NSEvent *)theEvent {
{ BOOL keepOn = YES;
NSRect windowFrame = [[self window] frame];
CGFloat deltaX, deltaY, oldOriginY; while (keepOn) {
deltaX = [theEvent deltaX]; theEvent = [[self window] nextEventMatchingMask: NSLeftMouseUpMask |
deltaY = [theEvent deltaY]; NSLeftMouseDraggedMask];
oldOriginY = windowFrame.origin.y;
switch ([theEvent type]) {
windowFrame.origin.y = (oldOriginY + windowFrame.size.height) - (windowFrame.size.height + deltaY); case NSLeftMouseDragged:
windowFrame.size.width += deltaX; {
windowFrame.size.height += deltaY; NSRect windowFrame = [[self window] frame];
CGFloat deltaX, deltaY, oldOriginY;
NSSize winMinSize = [self window].minSize; deltaX = [theEvent deltaX];
if (windowFrame.size.width < winMinSize.width) deltaY = [theEvent deltaY];
windowFrame.size.width = winMinSize.width; 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 @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