Commit ea5a42d2 authored by Jon Lech Johansen's avatar Jon Lech Johansen

* ./modules/gui/macosx/vout.m: mouse coordinates support.

parent 531ca620
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* intf.m: MacOS X interface plugin * intf.m: MacOS X interface plugin
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: intf.m,v 1.5 2002/11/28 17:35:01 sam Exp $ * $Id: intf.m,v 1.6 2002/12/04 20:51:23 jlj Exp $
* *
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net> * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr> * Christophe Massiot <massiot@via.ecp.fr>
...@@ -902,7 +902,6 @@ static void Run( intf_thread_t *p_intf ) ...@@ -902,7 +902,6 @@ static void Run( intf_thread_t *p_intf )
[p_req->p_vout->p_sys->o_window setTitle: [NSString [p_req->p_vout->p_sys->o_window setTitle: [NSString
stringWithCString: VOUT_TITLE " (QuickTime)"]]; stringWithCString: VOUT_TITLE " (QuickTime)"]];
[p_req->p_vout->p_sys->o_window setAcceptsMouseMovedEvents: YES];
[p_req->p_vout->p_sys->o_window makeKeyAndOrderFront: nil]; [p_req->p_vout->p_sys->o_window makeKeyAndOrderFront: nil];
p_req->i_result = 1; p_req->i_result = 1;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vout.m: MacOS X video output plugin * vout.m: MacOS X video output plugin
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001, 2002 VideoLAN
* $Id: vout.m,v 1.4 2002/11/18 23:00:41 massiot Exp $ * $Id: vout.m,v 1.5 2002/12/04 20:51:23 jlj Exp $
* *
* Authors: Colin Delacroix <colin@zoy.org> * Authors: Colin Delacroix <colin@zoy.org>
* Florian G. Pflug <fgp@phlo.org> * Florian G. Pflug <fgp@phlo.org>
...@@ -816,4 +816,75 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -816,4 +816,75 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
p_vout->i_changes |= VOUT_SIZE_CHANGE; p_vout->i_changes |= VOUT_SIZE_CHANGE;
} }
- (BOOL)acceptsFirstResponder
{
return( YES );
}
- (BOOL)becomeFirstResponder
{
[[self window] setAcceptsMouseMovedEvents: YES];
return( YES );
}
- (BOOL)resignFirstResponder
{
[[self window] setAcceptsMouseMovedEvents: NO];
return( YES );
}
- (void)mouseUp:(NSEvent *)o_event
{
switch( [o_event type] )
{
case NSLeftMouseUp:
{
vlc_value_t val;
val.b_bool = VLC_TRUE;
var_Set( p_vout, "mouse-clicked", val );
}
break;
default:
[super mouseUp: o_event];
break;
}
}
- (void)mouseMoved:(NSEvent *)o_event
{
NSPoint ml;
NSRect s_rect;
BOOL b_inside;
s_rect = [self bounds];
ml = [self convertPoint: [o_event locationInWindow] fromView: nil];
b_inside = [self mouse: ml inRect: s_rect];
if( b_inside )
{
vlc_value_t val;
int i_width, i_height, i_x, i_y;
vout_PlacePicture( p_vout, (unsigned int)s_rect.size.width,
(unsigned int)s_rect.size.height,
&i_x, &i_y, &i_width, &i_height );
val.i_int = ( ((int)ml.x) - i_x ) *
p_vout->render.i_width / i_width;
var_Set( p_vout, "mouse-x", val );
val.i_int = ( ((int)ml.y) - i_y ) *
p_vout->render.i_height / i_height;
var_Set( p_vout, "mouse-y", val );
val.b_bool = VLC_TRUE;
var_Set( p_vout, "mouse-moved", val );
}
else
{
[super mouseMoved: o_event];
}
}
@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