206 if (mouse->focus != _data->windowID) { |
206 if (mouse->focus != _data->windowID) { |
207 SDL_SetMouseFocus(index, _data->windowID); |
207 SDL_SetMouseFocus(index, _data->windowID); |
208 } |
208 } |
209 |
209 |
210 point = [NSEvent mouseLocation]; |
210 point = [NSEvent mouseLocation]; |
211 if (point.x < rect.origin.x || |
|
212 point.x > (rect.origin.x + rect.size.width) || |
|
213 point.y < rect.origin.y || |
|
214 point.y > (rect.origin.y + rect.size.height)) { |
|
215 if (window->flags & SDL_WINDOW_MOUSE_FOCUS) { |
|
216 SDL_SendWindowEvent(_data->windowID, SDL_WINDOWEVENT_LEAVE, 0, 0); |
|
217 } |
|
218 } else { |
|
219 if (!(window->flags & SDL_WINDOW_MOUSE_FOCUS)) { |
|
220 SDL_SendWindowEvent(_data->windowID, SDL_WINDOWEVENT_ENTER, 0, 0); |
|
221 } |
|
222 } |
|
223 point.x = point.x - rect.origin.x; |
211 point.x = point.x - rect.origin.x; |
224 point.y = rect.size.height - (point.y - rect.origin.y); |
212 point.y = rect.size.height - (point.y - rect.origin.y); |
225 SDL_SendMouseMotion(index, 0, (int)point.x, (int)point.y); |
213 SDL_SendMouseMotion(index, 0, (int)point.x, (int)point.y); |
226 } |
214 } |
227 |
215 |
|
216 - (void)mouseDragged:(NSEvent *)theEvent |
|
217 { |
|
218 [self mouseMoved:theEvent]; |
|
219 } |
|
220 |
228 - (void)scrollWheel:(NSEvent *)theEvent |
221 - (void)scrollWheel:(NSEvent *)theEvent |
229 { |
222 { |
230 fprintf(stderr, "scrollWheel\n"); |
223 int index; |
|
224 |
|
225 index = _data->videodata->mouse; |
|
226 SDL_SendMouseWheel(index, (int)([theEvent deltaY]+0.9f)); |
231 } |
227 } |
232 |
228 |
233 - (void)keyDown:(NSEvent *)theEvent |
229 - (void)keyDown:(NSEvent *)theEvent |
234 { |
230 { |
235 fprintf(stderr, "keyDown\n"); |
231 fprintf(stderr, "keyDown\n"); |