Commit c2566086 authored by Mike Gorchak's avatar Mike Gorchak

Added handler for all window events.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403595
parent 59e09f90
This diff is collapsed.
...@@ -369,7 +369,8 @@ void photon_movecursor(SDL_Cursor* cursor) ...@@ -369,7 +369,8 @@ void photon_movecursor(SDL_Cursor* cursor)
{ {
SDL_VideoDisplay* display; SDL_VideoDisplay* display;
SDL_DisplayData* didata; SDL_DisplayData* didata;
SDL_Window* window; SDL_Window* window;
SDL_WindowData* wdata;
SDL_WindowID window_id; SDL_WindowID window_id;
int32_t status; int32_t status;
...@@ -389,7 +390,15 @@ void photon_movecursor(SDL_Cursor* cursor) ...@@ -389,7 +390,15 @@ void photon_movecursor(SDL_Cursor* cursor)
if (display!=NULL) if (display!=NULL)
{ {
didata=(SDL_DisplayData*)display->driverdata; didata=(SDL_DisplayData*)display->driverdata;
if (didata==NULL) if (didata!=NULL)
{
wdata=(SDL_WindowData*)window->driverdata;
if (wdata==NULL)
{
return;
}
}
else
{ {
return; return;
} }
...@@ -405,7 +414,9 @@ void photon_movecursor(SDL_Cursor* cursor) ...@@ -405,7 +414,9 @@ void photon_movecursor(SDL_Cursor* cursor)
} }
} }
/* cursor->mouse->x, cursor->mouse->y */ /* No need to move mouse cursor manually in the photon */
return;
} }
void photon_freecursor(SDL_Cursor* cursor) void photon_freecursor(SDL_Cursor* cursor)
...@@ -427,8 +438,10 @@ void photon_warpmouse(SDL_Mouse* mouse, SDL_WindowID windowID, int x, int y) ...@@ -427,8 +438,10 @@ void photon_warpmouse(SDL_Mouse* mouse, SDL_WindowID windowID, int x, int y)
{ {
SDL_VideoDisplay* display; SDL_VideoDisplay* display;
SDL_DisplayData* didata; SDL_DisplayData* didata;
SDL_Window* window; SDL_Window* window;
int32_t status; SDL_WindowData* wdata;
int16_t wx;
int16_t wy;
/* Sanity checks */ /* Sanity checks */
window=SDL_GetWindowFromID(windowID); window=SDL_GetWindowFromID(windowID);
...@@ -438,7 +451,15 @@ void photon_warpmouse(SDL_Mouse* mouse, SDL_WindowID windowID, int x, int y) ...@@ -438,7 +451,15 @@ void photon_warpmouse(SDL_Mouse* mouse, SDL_WindowID windowID, int x, int y)
if (display!=NULL) if (display!=NULL)
{ {
didata=(SDL_DisplayData*)display->driverdata; didata=(SDL_DisplayData*)display->driverdata;
if (didata==NULL) if (didata!=NULL)
{
wdata=(SDL_WindowData*)window->driverdata;
if (wdata==NULL)
{
return;
}
}
else
{ {
return; return;
} }
...@@ -453,6 +474,10 @@ void photon_warpmouse(SDL_Mouse* mouse, SDL_WindowID windowID, int x, int y) ...@@ -453,6 +474,10 @@ void photon_warpmouse(SDL_Mouse* mouse, SDL_WindowID windowID, int x, int y)
return; return;
} }
PtGetAbsPosition(wdata->window, &wx, &wy);
PhMoveCursorAbs(PhInputGroup(NULL), wx+x, wy+y);
return;
} }
void photon_freemouse(SDL_Mouse* mouse) void photon_freemouse(SDL_Mouse* mouse)
......
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