[vlc-commits] 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)
Felix Paul Kühne
git at videolan.org
Sat Feb 11 15:29:44 CET 2012
vlc/vlc-2.0 | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Sat Feb 11 15:25:34 2012 +0100| [1aa6fdb6de791d9b3a4c06d950cb5da0d7db9843] | committer: Felix Paul Kühne
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)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=1aa6fdb6de791d9b3a4c06d950cb5da0d7db9843
---
modules/gui/macosx/MainWindowTitle.m | 64 +++++++++++++++++++++++-----------
1 files changed, 43 insertions(+), 21 deletions(-)
diff --git a/modules/gui/macosx/MainWindowTitle.m b/modules/gui/macosx/MainWindowTitle.m
index e01c6f1..b5bfa97 100644
--- a/modules/gui/macosx/MainWindowTitle.m
+++ b/modules/gui/macosx/MainWindowTitle.m
@@ -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
More information about the vlc-commits
mailing list