Commit 573ea994 authored by Sam Lantinga's avatar Sam Lantinga

*** empty log message ***

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40783
parent 846597a0
...@@ -303,6 +303,13 @@ static void QZ_DoModifiers (_THIS, unsigned int newMods) { ...@@ -303,6 +303,13 @@ static void QZ_DoModifiers (_THIS, unsigned int newMods) {
current_mods = newMods; current_mods = newMods;
} }
static void QZ_GetMouseLocation (_THIS, NSPoint *p) {
*p = [ NSEvent mouseLocation ]; /* global coordinates */
if (qz_window)
QZ_PrivateGlobalToLocal (this, p);
QZ_PrivateCocoaToSDL (this, p);
}
static void QZ_DoActivate (_THIS) static void QZ_DoActivate (_THIS)
{ {
/* Hide the cursor if it was hidden by SDL_ShowCursor() */ /* Hide the cursor if it was hidden by SDL_ShowCursor() */
...@@ -321,10 +328,7 @@ static void QZ_DoActivate (_THIS) ...@@ -321,10 +328,7 @@ static void QZ_DoActivate (_THIS)
static void QZ_DoDeactivate (_THIS) { static void QZ_DoDeactivate (_THIS) {
/* Get the current cursor location, for restore on activate */ /* Get the current cursor location, for restore on activate */
cursor_loc = [ NSEvent mouseLocation ]; /* global coordinates */ QZ_GetMouseLocation (this, &cursor_loc);
if (qz_window)
QZ_PrivateGlobalToLocal (this, &cursor_loc);
QZ_PrivateCocoaToSDL (this, &cursor_loc);
/* Reassociate mouse and cursor */ /* Reassociate mouse and cursor */
CGAssociateMouseAndMouseCursorPosition (1); CGAssociateMouseAndMouseCursorPosition (1);
...@@ -432,7 +436,6 @@ void QZ_PumpEvents (_THIS) ...@@ -432,7 +436,6 @@ void QZ_PumpEvents (_THIS)
int button; int button;
unsigned int type; unsigned int type;
BOOL isForGameWin;
BOOL isInGameWin; BOOL isInGameWin;
#define DO_MOUSE_DOWN(button) do { \ #define DO_MOUSE_DOWN(button) do { \
...@@ -457,8 +460,8 @@ void QZ_PumpEvents (_THIS) ...@@ -457,8 +460,8 @@ void QZ_PumpEvents (_THIS)
} while(0) } while(0)
type = [ event type ]; type = [ event type ];
isForGameWin = (qz_window == [ event window ]);
isInGameWin = QZ_IsMouseInWindow (this); isInGameWin = QZ_IsMouseInWindow (this);
switch (type) { switch (type) {
case NSLeftMouseDown: case NSLeftMouseDown:
if ( getenv("SDL_HAS3BUTTONMOUSE") ) { if ( getenv("SDL_HAS3BUTTONMOUSE") ) {
...@@ -534,11 +537,11 @@ void QZ_PumpEvents (_THIS) ...@@ -534,11 +537,11 @@ void QZ_PumpEvents (_THIS)
provides the first known mouse position, provides the first known mouse position,
since everything after this uses deltas since everything after this uses deltas
*/ */
NSPoint p = [ qz_window mouseLocationOutsideOfEventStream ]; NSPoint p;
QZ_PrivateCocoaToSDL (this, &p); QZ_GetMouseLocation (this, &p);
SDL_PrivateMouseMotion (0, 0, p.x, p.y); SDL_PrivateMouseMotion (0, 0, p.x, p.y);
firstMouseEvent = 0; firstMouseEvent = 0;
} }
else { else {
/* /*
...@@ -557,8 +560,8 @@ void QZ_PumpEvents (_THIS) ...@@ -557,8 +560,8 @@ void QZ_PumpEvents (_THIS)
if ( grab_state == QZ_VISIBLE_GRAB && if ( grab_state == QZ_VISIBLE_GRAB &&
!isInGameWin ) { !isInGameWin ) {
NSPoint p = [ qz_window mouseLocationOutsideOfEventStream ]; NSPoint p;
QZ_PrivateCocoaToSDL (this, &p); QZ_GetMouseLocation (this, &p);
if ( p.x < 0.0 ) if ( p.x < 0.0 )
p.x = 0.0; p.x = 0.0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment