- attempt to fix mouse cyrsor issues
This commit is contained in:
parent
0509b5d643
commit
6907d7d063
|
@ -818,7 +818,7 @@ void sleep(int millis) {
|
|||
}
|
||||
|
||||
void showCursor(bool b) {
|
||||
int x,y;
|
||||
//int x,y;
|
||||
if(b) {
|
||||
//SDL_GetMouseState( &x, &y );
|
||||
}
|
||||
|
@ -828,12 +828,12 @@ void showCursor(bool b) {
|
|||
return;
|
||||
}
|
||||
|
||||
SDL_ShowCursor(b ? SDL_ENABLE : SDL_DISABLE);
|
||||
SDL_ShowCursor(b == true ? SDL_ENABLE : SDL_DISABLE);
|
||||
//SDL_WM_GrabInput(SDL_GRAB_OFF);
|
||||
if(b) {
|
||||
//if(b) {
|
||||
//SDL_WM_GrabInput(SDL_GRAB_OFF);
|
||||
//SDL_WarpMouse(x,y);
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
bool isKeyDown(int virtualKey) {
|
||||
|
|
|
@ -201,12 +201,30 @@ bool Window::handleEvent() {
|
|||
codeLocation = "k";
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] SDL_ACTIVEEVENT.\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
// Check if the program has lost keyboard focus
|
||||
// Check if the program has lost keyboard focus
|
||||
/*
|
||||
if (event.active.state == SDL_APPINPUTFOCUS) {
|
||||
if (event.active.gain == 0) {
|
||||
Window::isActive = false;
|
||||
}
|
||||
else if (event.active.gain == 1) {
|
||||
//else if (event.active.gain == 1) {
|
||||
else {
|
||||
Window::isActive = true;
|
||||
}
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Window::isActive = %d\n",__FILE__,__FUNCTION__,__LINE__,Window::isActive);
|
||||
|
||||
bool willShowCursor = (!Window::isActive || (Window::lastShowMouseState == SDL_ENABLE) || Window::getUseDefaultCursorOnly());
|
||||
showCursor(willShowCursor);
|
||||
}
|
||||
*/
|
||||
// Check if the program has lost window focus
|
||||
if (event.active.state == SDL_APPACTIVE) {
|
||||
if (event.active.gain == 0) {
|
||||
Window::isActive = false;
|
||||
}
|
||||
//else if (event.active.gain == 1) {
|
||||
else {
|
||||
Window::isActive = true;
|
||||
}
|
||||
|
||||
|
@ -215,38 +233,30 @@ bool Window::handleEvent() {
|
|||
bool willShowCursor = (!Window::isActive || (Window::lastShowMouseState == SDL_ENABLE) || Window::getUseDefaultCursorOnly());
|
||||
showCursor(willShowCursor);
|
||||
}
|
||||
// Check if the program has lost window focus
|
||||
else if (event.active.state == SDL_APPACTIVE) {
|
||||
// Check if the program has lost window focus
|
||||
/*
|
||||
if (event.active.state == SDL_APPMOUSEFOCUS) {
|
||||
if (event.active.gain == 0) {
|
||||
Window::isActive = false;
|
||||
}
|
||||
else if (event.active.gain == 1) {
|
||||
Window::isActive = true;
|
||||
}
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Window::isActive = %d\n",__FILE__,__FUNCTION__,__LINE__,Window::isActive);
|
||||
|
||||
bool willShowCursor = (!Window::isActive || (Window::lastShowMouseState == SDL_ENABLE) || Window::getUseDefaultCursorOnly());
|
||||
showCursor(willShowCursor);
|
||||
}
|
||||
// Check if the program has lost window focus
|
||||
else if (event.active.state == SDL_APPMOUSEFOCUS) {
|
||||
if (event.active.gain == 0) {
|
||||
Window::isActive = false;
|
||||
}
|
||||
else if (event.active.gain == 1) {
|
||||
//else if (event.active.gain == 1) {
|
||||
else {
|
||||
Window::isActive = true;
|
||||
}
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Window::isActive = %d\n",__FILE__,__FUNCTION__,__LINE__,Window::isActive);
|
||||
bool willShowCursor = (!Window::isActive || (Window::lastShowMouseState == SDL_ENABLE) || Window::getUseDefaultCursorOnly());
|
||||
showCursor(willShowCursor);
|
||||
}
|
||||
else {
|
||||
}
|
||||
*/
|
||||
if (event.active.state != SDL_APPMOUSEFOCUS &&
|
||||
event.active.state != SDL_APPINPUTFOCUS &&
|
||||
event.active.state != SDL_APPACTIVE) {
|
||||
if (event.active.gain == 0) {
|
||||
Window::isActive = false;
|
||||
}
|
||||
else if (event.active.gain == 1) {
|
||||
//else if (event.active.gain == 1) {
|
||||
else {
|
||||
Window::isActive = true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user