From e9cf35f2a0814e5e958f04b63bc97ec351d61d5e Mon Sep 17 00:00:00 2001 From: Andre Pang Date: Wed, 20 Oct 2004 07:17:46 +0000 Subject: Mac OS X video output: Remove superfluous point flip in mouseMoved: Added mouseDown:, rightMouseDown:, and otherMouseDown: event handlers CVS patchset: 7056 CVS date: 2004/10/20 07:17:46 --- src/video_out/macosx/video_window.h | 2 +- src/video_out/macosx/video_window.m | 54 +++++++++++++++++++++++++++---------- 2 files changed, 41 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/video_out/macosx/video_window.h b/src/video_out/macosx/video_window.h index 4d4dba37c..5b2dc9dcf 100644 --- a/src/video_out/macosx/video_window.h +++ b/src/video_out/macosx/video_window.h @@ -32,7 +32,7 @@ typedef enum { } XineVideoWindowFullScreenMode; @interface XineOpenGLView : NSOpenGLView { - IBOutlet id delegate; + IBOutlet id delegate; int video_width, video_height; char *texture_buffer; unsigned long i_texture; diff --git a/src/video_out/macosx/video_window.m b/src/video_out/macosx/video_window.m index 6aa189ba0..d04ad139b 100644 --- a/src/video_out/macosx/video_window.m +++ b/src/video_out/macosx/video_window.m @@ -41,8 +41,10 @@ NSString *XineViewDidResizeNotification = @"XineViewDidResizeNotification"; @protocol XineOpenGLViewDelegate -- (void) mouseMoved:(NSEvent *)theEvent inXineView:(XineOpenGLView *)view; -- (BOOL) respondsToSelector:(SEL)selector; +- (void) mouseDown:(NSEvent *)theEvent inXineView:(XineOpenGLView *)theView; +- (void) mouseMoved:(NSEvent *)theEvent inXineView:(XineOpenGLView *)theView; +- (void) otherMouseDown:(NSEvent *)theEvent inXineView:(XineOpenGLView *)theView; +- (void) rightMouseDown:(NSEvent *)theEvent inXineView:(XineOpenGLView *)theView; - (NSSize) xineViewWillResize:(NSSize)oldSize toSize:(NSSize)proposedSize; - (void) xineViewDidResize:(NSNotification *)note; @@ -193,28 +195,52 @@ NSString *XineViewDidResizeNotification = @"XineViewDidResizeNotification"; return YES; } -- (void)mouseMoved:(NSEvent *)theEvent +- (void)passEventToDelegate:(NSEvent *)theEvent withSelector:(SEL)selector { NSPoint point = [self convertPoint:[theEvent locationInWindow] fromView:nil]; - NSRect bounds = [self bounds]; - - if (!NSMouseInRect(point, bounds, [self isFlipped])) return; + if (!NSMouseInRect(point, [self bounds], [self isFlipped])) return; - /* flip the y axis */ - point.y = bounds.size.height - point.y; -#ifdef LOG_MOUSE - NSLog(@"XineOpenGLView: mouse at x:%f y:%f", point.x, point.y); -#endif - - if ([delegate respondsToSelector:@selector(mouseMoved:inXineView:)]) { - (void) [delegate mouseMoved:theEvent inXineView:self]; + if ([delegate respondsToSelector:selector]) { + [delegate performSelector:selector + withObject:theEvent + withObject:self]; } +} + +- (void)mouseMoved:(NSEvent *)theEvent +{ + [self passEventToDelegate:theEvent + withSelector:@selector(mouseMoved:inXineView:)]; [super mouseMoved:theEvent]; } +- (void)mouseDown:(NSEvent *)theEvent +{ + [self passEventToDelegate:theEvent + withSelector:@selector(mouseDown:inXineView:)]; + + [super mouseDown:theEvent]; +} + +- (void)rightMouseDown:(NSEvent *)theEvent +{ + [self passEventToDelegate:theEvent + withSelector:@selector(rightMouseDown:inXineView:)]; + + [super rightMouseDown:theEvent]; +} + +- (void)otherMouseDown:(NSEvent *)theEvent +{ + [self passEventToDelegate:theEvent + withSelector:@selector(otherMouseDown:inXineView:)]; + + [super otherMouseDown:theEvent]; +} + - (NSSize)videoSize { return NSMakeSize(video_width, video_height); } -- cgit v1.2.3