Mercurial > sdl-ios-xcode
annotate src/video/cocoa/SDL_cocoamouse.m @ 5282:8e421890cdb8
Fixed bug #1117
There's a new event that's always sent when the window changes size, and that event is what the renderers listen for to determine if they need to rebind their context.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 12 Feb 2011 19:02:14 -0800 |
parents | b530ef003506 |
children |
rev | line source |
---|---|
1931
103c6fec2a60
The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1 /* |
103c6fec2a60
The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
5267 | 3 Copyright (C) 1997-2011 Sam Lantinga |
1931
103c6fec2a60
The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4 |
103c6fec2a60
The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
103c6fec2a60
The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
103c6fec2a60
The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
103c6fec2a60
The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
103c6fec2a60
The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
9 |
103c6fec2a60
The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
103c6fec2a60
The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
103c6fec2a60
The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
103c6fec2a60
The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
13 Lesser General Public License for more details. |
103c6fec2a60
The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
14 |
103c6fec2a60
The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
103c6fec2a60
The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
103c6fec2a60
The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
103c6fec2a60
The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
18 |
103c6fec2a60
The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
19 Sam Lantinga |
103c6fec2a60
The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
20 slouken@libsdl.org |
103c6fec2a60
The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
21 */ |
103c6fec2a60
The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
22 #include "SDL_config.h" |
103c6fec2a60
The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
23 |
3517
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
24 #include "SDL_events.h" |
1931
103c6fec2a60
The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
25 #include "SDL_cocoavideo.h" |
103c6fec2a60
The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
26 |
103c6fec2a60
The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
27 #include "../../events/SDL_mouse_c.h" |
103c6fec2a60
The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
28 |
103c6fec2a60
The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
29 void |
103c6fec2a60
The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
30 Cocoa_InitMouse(_THIS) |
103c6fec2a60
The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
31 { |
103c6fec2a60
The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
32 } |
103c6fec2a60
The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
33 |
3517
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
34 static int |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
35 ConvertMouseButtonToSDL(int button) |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
36 { |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
37 switch (button) |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
38 { |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
39 case 0: |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
40 return(SDL_BUTTON_LEFT); /* 1 */ |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
41 case 1: |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
42 return(SDL_BUTTON_RIGHT); /* 3 */ |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
43 case 2: |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
44 return(SDL_BUTTON_MIDDLE); /* 2 */ |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
45 } |
5060
2170edcdfbd0
Fixed mouse button index for additional mouse buttons
Sam Lantinga <slouken@libsdl.org>
parents:
5058
diff
changeset
|
46 return button+1; |
3517
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
47 } |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
48 |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
49 void |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
50 Cocoa_HandleMouseEvent(_THIS, NSEvent *event) |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
51 { |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
52 int i; |
4465
3e69e077cb95
Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents:
3685
diff
changeset
|
53 NSPoint point = { 0, 0 }; |
3517
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
54 SDL_Window *window; |
4484
9322f7db8603
Cleaned up the mouse window focus handling: you always pass in the relative window when sending a mouse event.
Sam Lantinga <slouken@libsdl.org>
parents:
4465
diff
changeset
|
55 SDL_Window *focus = SDL_GetMouseFocus(); |
3517
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
56 |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
57 /* See if there are any fullscreen windows that might handle this event */ |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
58 window = NULL; |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
59 for (i = 0; i < _this->num_displays; ++i) { |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
60 SDL_VideoDisplay *display = &_this->displays[i]; |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
61 SDL_Window *candidate = display->fullscreen_window; |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
62 |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
63 if (candidate) { |
3528
59ff7a2beb57
Added an API function to query geometry of multiple monitors:
Sam Lantinga <slouken@libsdl.org>
parents:
3525
diff
changeset
|
64 SDL_Rect bounds; |
3517
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
65 |
3528
59ff7a2beb57
Added an API function to query geometry of multiple monitors:
Sam Lantinga <slouken@libsdl.org>
parents:
3525
diff
changeset
|
66 Cocoa_GetDisplayBounds(_this, display, &bounds); |
3517
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
67 point = [NSEvent mouseLocation]; |
3528
59ff7a2beb57
Added an API function to query geometry of multiple monitors:
Sam Lantinga <slouken@libsdl.org>
parents:
3525
diff
changeset
|
68 point.x = point.x - bounds.x; |
59ff7a2beb57
Added an API function to query geometry of multiple monitors:
Sam Lantinga <slouken@libsdl.org>
parents:
3525
diff
changeset
|
69 point.y = CGDisplayPixelsHigh(kCGDirectMainDisplay) - point.y - bounds.y; |
4484
9322f7db8603
Cleaned up the mouse window focus handling: you always pass in the relative window when sending a mouse event.
Sam Lantinga <slouken@libsdl.org>
parents:
4465
diff
changeset
|
70 if ((point.x >= 0 && point.x < candidate->w) && |
4465
3e69e077cb95
Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents:
3685
diff
changeset
|
71 (point.y >= 0 && point.y < candidate->h)) { |
3517
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
72 /* This is it! */ |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
73 window = candidate; |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
74 break; |
4484
9322f7db8603
Cleaned up the mouse window focus handling: you always pass in the relative window when sending a mouse event.
Sam Lantinga <slouken@libsdl.org>
parents:
4465
diff
changeset
|
75 } else if (candidate == focus) { |
9322f7db8603
Cleaned up the mouse window focus handling: you always pass in the relative window when sending a mouse event.
Sam Lantinga <slouken@libsdl.org>
parents:
4465
diff
changeset
|
76 SDL_SetMouseFocus(NULL); |
3517
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
77 } |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
78 } |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
79 } |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
80 |
4484
9322f7db8603
Cleaned up the mouse window focus handling: you always pass in the relative window when sending a mouse event.
Sam Lantinga <slouken@libsdl.org>
parents:
4465
diff
changeset
|
81 if (!window) { |
4465
3e69e077cb95
Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents:
3685
diff
changeset
|
82 return; |
3517
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
83 } |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
84 |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
85 switch ([event type]) { |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
86 case NSLeftMouseDown: |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
87 case NSOtherMouseDown: |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
88 case NSRightMouseDown: |
4484
9322f7db8603
Cleaned up the mouse window focus handling: you always pass in the relative window when sending a mouse event.
Sam Lantinga <slouken@libsdl.org>
parents:
4465
diff
changeset
|
89 SDL_SendMouseButton(window, SDL_PRESSED, ConvertMouseButtonToSDL([event buttonNumber])); |
3517
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
90 break; |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
91 case NSLeftMouseUp: |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
92 case NSOtherMouseUp: |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
93 case NSRightMouseUp: |
4484
9322f7db8603
Cleaned up the mouse window focus handling: you always pass in the relative window when sending a mouse event.
Sam Lantinga <slouken@libsdl.org>
parents:
4465
diff
changeset
|
94 SDL_SendMouseButton(window, SDL_RELEASED, ConvertMouseButtonToSDL([event buttonNumber])); |
3517
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
95 break; |
5057
bdff53ed6c8b
Fix mouse wheel events in fullscreen mode for OS X
Jjgod Jiang <gzjjgod@gmail.com>
parents:
4498
diff
changeset
|
96 case NSScrollWheel: |
bdff53ed6c8b
Fix mouse wheel events in fullscreen mode for OS X
Jjgod Jiang <gzjjgod@gmail.com>
parents:
4498
diff
changeset
|
97 Cocoa_HandleMouseWheel(window, event); |
bdff53ed6c8b
Fix mouse wheel events in fullscreen mode for OS X
Jjgod Jiang <gzjjgod@gmail.com>
parents:
4498
diff
changeset
|
98 break; |
3517
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
99 case NSLeftMouseDragged: |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
100 case NSRightMouseDragged: |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
101 case NSOtherMouseDragged: /* usually middle mouse dragged */ |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
102 case NSMouseMoved: |
4484
9322f7db8603
Cleaned up the mouse window focus handling: you always pass in the relative window when sending a mouse event.
Sam Lantinga <slouken@libsdl.org>
parents:
4465
diff
changeset
|
103 SDL_SendMouseMotion(window, 0, (int)point.x, (int)point.y); |
3517
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
104 break; |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
105 default: /* just to avoid compiler warnings */ |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
106 break; |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
107 } |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
108 } |
e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents:
2940
diff
changeset
|
109 |
1931
103c6fec2a60
The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
110 void |
5057
bdff53ed6c8b
Fix mouse wheel events in fullscreen mode for OS X
Jjgod Jiang <gzjjgod@gmail.com>
parents:
4498
diff
changeset
|
111 Cocoa_HandleMouseWheel(SDL_Window *window, NSEvent *event) |
bdff53ed6c8b
Fix mouse wheel events in fullscreen mode for OS X
Jjgod Jiang <gzjjgod@gmail.com>
parents:
4498
diff
changeset
|
112 { |
bdff53ed6c8b
Fix mouse wheel events in fullscreen mode for OS X
Jjgod Jiang <gzjjgod@gmail.com>
parents:
4498
diff
changeset
|
113 float x = [event deltaX]; |
bdff53ed6c8b
Fix mouse wheel events in fullscreen mode for OS X
Jjgod Jiang <gzjjgod@gmail.com>
parents:
4498
diff
changeset
|
114 float y = [event deltaY]; |
bdff53ed6c8b
Fix mouse wheel events in fullscreen mode for OS X
Jjgod Jiang <gzjjgod@gmail.com>
parents:
4498
diff
changeset
|
115 |
bdff53ed6c8b
Fix mouse wheel events in fullscreen mode for OS X
Jjgod Jiang <gzjjgod@gmail.com>
parents:
4498
diff
changeset
|
116 if (x > 0) { |
bdff53ed6c8b
Fix mouse wheel events in fullscreen mode for OS X
Jjgod Jiang <gzjjgod@gmail.com>
parents:
4498
diff
changeset
|
117 x += 0.9f; |
bdff53ed6c8b
Fix mouse wheel events in fullscreen mode for OS X
Jjgod Jiang <gzjjgod@gmail.com>
parents:
4498
diff
changeset
|
118 } else if (x < 0) { |
bdff53ed6c8b
Fix mouse wheel events in fullscreen mode for OS X
Jjgod Jiang <gzjjgod@gmail.com>
parents:
4498
diff
changeset
|
119 x -= 0.9f; |
bdff53ed6c8b
Fix mouse wheel events in fullscreen mode for OS X
Jjgod Jiang <gzjjgod@gmail.com>
parents:
4498
diff
changeset
|
120 } |
bdff53ed6c8b
Fix mouse wheel events in fullscreen mode for OS X
Jjgod Jiang <gzjjgod@gmail.com>
parents:
4498
diff
changeset
|
121 if (y > 0) { |
bdff53ed6c8b
Fix mouse wheel events in fullscreen mode for OS X
Jjgod Jiang <gzjjgod@gmail.com>
parents:
4498
diff
changeset
|
122 y += 0.9f; |
bdff53ed6c8b
Fix mouse wheel events in fullscreen mode for OS X
Jjgod Jiang <gzjjgod@gmail.com>
parents:
4498
diff
changeset
|
123 } else if (y < 0) { |
bdff53ed6c8b
Fix mouse wheel events in fullscreen mode for OS X
Jjgod Jiang <gzjjgod@gmail.com>
parents:
4498
diff
changeset
|
124 y -= 0.9f; |
bdff53ed6c8b
Fix mouse wheel events in fullscreen mode for OS X
Jjgod Jiang <gzjjgod@gmail.com>
parents:
4498
diff
changeset
|
125 } |
bdff53ed6c8b
Fix mouse wheel events in fullscreen mode for OS X
Jjgod Jiang <gzjjgod@gmail.com>
parents:
4498
diff
changeset
|
126 SDL_SendMouseWheel(window, (int)x, (int)y); |
bdff53ed6c8b
Fix mouse wheel events in fullscreen mode for OS X
Jjgod Jiang <gzjjgod@gmail.com>
parents:
4498
diff
changeset
|
127 } |
bdff53ed6c8b
Fix mouse wheel events in fullscreen mode for OS X
Jjgod Jiang <gzjjgod@gmail.com>
parents:
4498
diff
changeset
|
128 |
5058
03db7d4b02b4
Moved function for consistency
Sam Lantinga <slouken@libsdl.org>
parents:
5057
diff
changeset
|
129 void |
03db7d4b02b4
Moved function for consistency
Sam Lantinga <slouken@libsdl.org>
parents:
5057
diff
changeset
|
130 Cocoa_QuitMouse(_THIS) |
03db7d4b02b4
Moved function for consistency
Sam Lantinga <slouken@libsdl.org>
parents:
5057
diff
changeset
|
131 { |
03db7d4b02b4
Moved function for consistency
Sam Lantinga <slouken@libsdl.org>
parents:
5057
diff
changeset
|
132 } |
03db7d4b02b4
Moved function for consistency
Sam Lantinga <slouken@libsdl.org>
parents:
5057
diff
changeset
|
133 |
1931
103c6fec2a60
The Mac OS X Cocoa video driver is under construction...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
134 /* vi: set ts=4 sw=4 expandtab: */ |