Search
lxdream.org :: lxdream/src/drivers/video_osx.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/drivers/video_osx.c
changeset 854:130928a3cdcb
prev850:28782ebbd01d
author nkeynes
date Tue Sep 09 00:51:43 2008 +0000 (11 years ago)
permissions -rw-r--r--
last change Add general gl_window_to_system_coords function to convert window system coordinates
back into something in the DC range of 640x480, update mouse events to use it
file annotate diff log raw
1.1 --- a/src/drivers/video_osx.c Mon Sep 08 07:56:33 2008 +0000
1.2 +++ b/src/drivers/video_osx.c Tue Sep 09 00:51:43 2008 +0000
1.3 @@ -159,8 +159,10 @@
1.4 input_event_mousedown( button, 0, 0, FALSE );
1.5 } else {
1.6 NSPoint pt = [event locationInWindow];
1.7 - input_event_mousedown( button, (int)(pt.x * DISPLAY_WIDTH) / video_width,
1.8 - DISPLAY_HEIGHT - ((int)(pt.y * DISPLAY_HEIGHT) / video_height), TRUE );
1.9 + int x = (int)pt.x;
1.10 + int y = video_height - (int)pt.y;
1.11 + gl_window_to_system_coords(&x,&y);
1.12 + input_event_mousedown( button, x, y, TRUE );
1.13 }
1.14 }
1.15 - (void)emitMouseUpEvent: (NSEvent *)event button: (int)button
1.16 @@ -169,8 +171,10 @@
1.17 input_event_mouseup( button, 0, 0, FALSE );
1.18 } else {
1.19 NSPoint pt = [event locationInWindow];
1.20 - input_event_mouseup( button, (int)(pt.x * DISPLAY_WIDTH) / video_width,
1.21 - DISPLAY_HEIGHT - ((int)(pt.y * DISPLAY_HEIGHT) / video_height), TRUE );
1.22 + int x = (int)pt.x;
1.23 + int y = video_height - (int)pt.y;
1.24 + gl_window_to_system_coords(&x,&y);
1.25 + input_event_mouseup( button, x, y, TRUE );
1.26 }
1.27 }
1.28 - (void)emitMouseMoveEvent: (NSEvent *)event
1.29 @@ -179,8 +183,10 @@
1.30 input_event_mousemove( [event deltaX] * MOUSE_X_SCALE, [event deltaY] * MOUSE_Y_SCALE, FALSE );
1.31 } else {
1.32 NSPoint pt = [event locationInWindow];
1.33 - input_event_mousemove( (int)(pt.x * DISPLAY_WIDTH) / video_width,
1.34 - DISPLAY_HEIGHT - ((int)(pt.y * DISPLAY_HEIGHT) / video_height), TRUE );
1.35 + int x = (int)pt.x;
1.36 + int y = video_height - (int)pt.y;
1.37 + gl_window_to_system_coords(&x,&y);
1.38 + input_event_mousemove( x, y, TRUE );
1.39 }
1.40 }
1.41 - (void)mouseExited: (NSEvent *)event
.