1.1 --- a/src/drivers/video_osx.c Tue Sep 02 03:34:00 2008 +0000
1.2 +++ b/src/drivers/video_osx.c Mon Sep 08 07:56:33 2008 +0000
1.5 @interface LxdreamOSXView : LxdreamVideoView
1.8 int flagsMask[MAX_MASK_KEYCODE];
1.12 if( [super initWithFrame: contentRect] != nil ) {
1.16 for( i=0; i<MAX_MASK_KEYCODE; i++ ) {
1.19 @@ -155,74 +153,87 @@
1.20 flagsMask[keycode] = 0;
1.23 -- (void)emitButtonEvent: (NSEvent *)event buttons: (int)buttons
1.24 +- (void)emitMouseDownEvent: (NSEvent *)event button: (int)button
1.27 - input_event_mouse( buttons, 0, 0, FALSE );
1.28 + input_event_mousedown( button, 0, 0, FALSE );
1.30 NSPoint pt = [event locationInWindow];
1.31 - input_event_mouse( buttonMask, (int)pt.x, (int)pt.y, TRUE );
1.32 + input_event_mousedown( button, (int)(pt.x * DISPLAY_WIDTH) / video_width,
1.33 + DISPLAY_HEIGHT - ((int)(pt.y * DISPLAY_HEIGHT) / video_height), TRUE );
1.36 +- (void)emitMouseUpEvent: (NSEvent *)event button: (int)button
1.39 + input_event_mouseup( button, 0, 0, FALSE );
1.41 + NSPoint pt = [event locationInWindow];
1.42 + input_event_mouseup( button, (int)(pt.x * DISPLAY_WIDTH) / video_width,
1.43 + DISPLAY_HEIGHT - ((int)(pt.y * DISPLAY_HEIGHT) / video_height), TRUE );
1.46 +- (void)emitMouseMoveEvent: (NSEvent *)event
1.49 + input_event_mousemove( [event deltaX] * MOUSE_X_SCALE, [event deltaY] * MOUSE_Y_SCALE, FALSE );
1.51 + NSPoint pt = [event locationInWindow];
1.52 + input_event_mousemove( (int)(pt.x * DISPLAY_WIDTH) / video_width,
1.53 + DISPLAY_HEIGHT - ((int)(pt.y * DISPLAY_HEIGHT) / video_height), TRUE );
1.56 +- (void)mouseExited: (NSEvent *)event
1.58 + if( !isGrabbed ) {
1.59 + input_event_mousemove( -1, -1, TRUE );
1.63 - (void)mouseDown: (NSEvent *) event
1.66 // If using grab but not grabbed yet, the first click should be consumed
1.67 // by the grabber. In all other circumstances we process normally.
1.68 if( isGrabbed || ![self requestGrab] ) {
1.69 - [self emitButtonEvent: event buttons: buttonMask];
1.70 + [self emitMouseDownEvent: event button: 0];
1.73 - (void)mouseUp: (NSEvent *)event
1.76 - [self emitButtonEvent: event buttons: buttonMask];
1.77 + [self emitMouseUpEvent: event button: 0];
1.80 - (void)rightMouseDown: (NSEvent *) event
1.83 - [self emitButtonEvent: event buttons: buttonMask];
1.84 + [self emitMouseDownEvent: event button: 1];
1.86 - (void)rightMouseUp: (NSEvent *)event
1.89 - [self emitButtonEvent: event buttons: buttonMask];
1.90 + [self emitMouseUpEvent: event button: 1];
1.92 - (void)otherMouseDown: (NSEvent *) event
1.94 - buttonMask |= (1<< [event buttonNumber] );
1.95 - [self emitButtonEvent: event buttons: buttonMask];
1.96 + [self emitMouseDownEvent: event button: [event buttonNumber]];
1.98 - (void)otherMouseUp: (NSEvent *) event
1.100 - buttonMask &= ~(1<< [event buttonNumber] );
1.101 - [self emitButtonEvent: event buttons: buttonMask];
1.102 + [self emitMouseUpEvent: event button: [event buttonNumber]];
1.104 - (void)mouseMoved: (NSEvent *) event
1.106 - if( isGrabbed ) {
1.107 - input_event_mouse( buttonMask, [event deltaX] * MOUSE_X_SCALE, [event deltaY] * MOUSE_Y_SCALE, FALSE );
1.109 + [self emitMouseMoveEvent: event];
1.111 - (void)mouseDragged: (NSEvent *) event
1.113 - if( isGrabbed ) {
1.114 - input_event_mouse( buttonMask, [event deltaX] * MOUSE_X_SCALE, [event deltaY] * MOUSE_Y_SCALE, FALSE );
1.116 + [self emitMouseMoveEvent: event];
1.118 - (void)rightMouseDragged: (NSEvent *) event
1.120 - if( isGrabbed ) {
1.121 - input_event_mouse( buttonMask, [event deltaX] * MOUSE_X_SCALE, [event deltaY] * MOUSE_Y_SCALE, FALSE );
1.123 + [self emitMouseMoveEvent: event];
1.125 - (void)otherMouseDragged: (NSEvent *) event
1.127 - if( isGrabbed ) {
1.128 - input_event_mouse( buttonMask, [event deltaX] * MOUSE_X_SCALE, [event deltaY] * MOUSE_Y_SCALE, FALSE );
1.130 + [self emitMouseMoveEvent: event];