+- (void)mouseUp:(NSEvent *)o_event
+{
+ vlc_value_t val;
+
+ if( p_vout && [o_event type] == NSLeftMouseUp )
+ {
+ vlc_value_t b_val;
+ b_val.b_bool = true;
+ var_Set( p_vout, "mouse-clicked", b_val );
+
+ var_Get( p_vout, "mouse-button-down", &val );
+ val.i_int &= ~1;
+ var_Set( p_vout, "mouse-button-down", val );
+ }
+
+ [super mouseUp: o_event];
+}
+
+- (void)otherMouseUp:(NSEvent *)o_event
+{
+ vlc_value_t val;
+
+ if( p_vout && [o_event type] == NSOtherMouseUp )
+ {
+ var_Get( p_vout, "mouse-button-down", &val );
+ val.i_int &= ~2;
+ var_Set( p_vout, "mouse-button-down", val );
+ }
+
+ [super mouseUp: o_event];
+}
+
+- (void)rightMouseUp:(NSEvent *)o_event
+{
+ if( p_vout && [o_event type] == NSRightMouseUp )
+ {
+ /* FIXME: this isn't the appropriate place, but we can't receive
+ * NSRightMouseDown some how */
+ msg_Dbg( p_vout, "received NSRightMouseUp" );
+ [NSMenu popUpContextMenu: [[VLCMain sharedInstance] getVoutMenu] withEvent: o_event forView: [[[VLCMain sharedInstance] getControls] getVoutView]];
+ }
+
+ [super mouseUp: o_event];
+}
+
+- (void)mouseDragged:(NSEvent *)o_event
+{
+ [self mouseMoved: o_event];
+}
+
+- (void)otherMouseDragged:(NSEvent *)o_event
+{
+ [self mouseMoved: o_event];
+}
+
+- (void)rightMouseDragged:(NSEvent *)o_event
+{
+ [self mouseMoved: o_event];
+}
+
+- (void)mouseMoved:(NSEvent *)o_event
+{
+ NSPoint ml;
+ NSRect s_rect;
+ BOOL b_inside;
+
+ if( p_vout )
+ {
+ s_rect = [o_view bounds];
+ ml = [o_view convertPoint: [o_event locationInWindow] fromView: nil];
+ b_inside = [o_view mouse: ml inRect: s_rect];
+
+ if( b_inside )
+ {
+ vlc_value_t val;
+ unsigned 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 );
+
+ if( [[o_view className] isEqualToString: @"VLCGLView"] )
+ {
+ val.i_int = ( ((int)(s_rect.size.height - ml.y)) - i_y ) *
+ p_vout->render.i_height / i_height;
+ }
+ else
+ {
+ 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 = true;
+ var_Set( p_vout, "mouse-moved", val );
+ }
+ if( [self isFullscreen] )
+ [[[[VLCMain sharedInstance] getControls] getFSPanel] fadeIn];
+ }
+
+ [super mouseMoved: o_event];