mirror of
https://github.com/glest/glest-source.git
synced 2025-08-16 05:13:59 +02:00
- attempt to fix mouse cyrsor issues
This commit is contained in:
@@ -818,7 +818,7 @@ void sleep(int millis) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void showCursor(bool b) {
|
void showCursor(bool b) {
|
||||||
int x,y;
|
//int x,y;
|
||||||
if(b) {
|
if(b) {
|
||||||
//SDL_GetMouseState( &x, &y );
|
//SDL_GetMouseState( &x, &y );
|
||||||
}
|
}
|
||||||
@@ -828,12 +828,12 @@ void showCursor(bool b) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_ShowCursor(b ? SDL_ENABLE : SDL_DISABLE);
|
SDL_ShowCursor(b == true ? SDL_ENABLE : SDL_DISABLE);
|
||||||
//SDL_WM_GrabInput(SDL_GRAB_OFF);
|
//SDL_WM_GrabInput(SDL_GRAB_OFF);
|
||||||
if(b) {
|
//if(b) {
|
||||||
//SDL_WM_GrabInput(SDL_GRAB_OFF);
|
//SDL_WM_GrabInput(SDL_GRAB_OFF);
|
||||||
//SDL_WarpMouse(x,y);
|
//SDL_WarpMouse(x,y);
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isKeyDown(int virtualKey) {
|
bool isKeyDown(int virtualKey) {
|
||||||
|
@@ -202,11 +202,29 @@ bool Window::handleEvent() {
|
|||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] SDL_ACTIVEEVENT.\n",__FILE__,__FUNCTION__,__LINE__);
|
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.state == SDL_APPINPUTFOCUS) {
|
||||||
if (event.active.gain == 0) {
|
if (event.active.gain == 0) {
|
||||||
Window::isActive = false;
|
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;
|
Window::isActive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,25 +234,13 @@ bool Window::handleEvent() {
|
|||||||
showCursor(willShowCursor);
|
showCursor(willShowCursor);
|
||||||
}
|
}
|
||||||
// Check if the program has lost window focus
|
// Check if the program has lost window focus
|
||||||
else if (event.active.state == SDL_APPACTIVE) {
|
/*
|
||||||
|
if (event.active.state == SDL_APPMOUSEFOCUS) {
|
||||||
if (event.active.gain == 0) {
|
if (event.active.gain == 0) {
|
||||||
Window::isActive = false;
|
Window::isActive = false;
|
||||||
}
|
}
|
||||||
else if (event.active.gain == 1) {
|
//else if (event.active.gain == 1) {
|
||||||
Window::isActive = true;
|
else {
|
||||||
}
|
|
||||||
|
|
||||||
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) {
|
|
||||||
Window::isActive = true;
|
Window::isActive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,11 +248,15 @@ bool Window::handleEvent() {
|
|||||||
bool willShowCursor = (!Window::isActive || (Window::lastShowMouseState == SDL_ENABLE) || Window::getUseDefaultCursorOnly());
|
bool willShowCursor = (!Window::isActive || (Window::lastShowMouseState == SDL_ENABLE) || Window::getUseDefaultCursorOnly());
|
||||||
showCursor(willShowCursor);
|
showCursor(willShowCursor);
|
||||||
}
|
}
|
||||||
else {
|
*/
|
||||||
|
if (event.active.state != SDL_APPMOUSEFOCUS &&
|
||||||
|
event.active.state != SDL_APPINPUTFOCUS &&
|
||||||
|
event.active.state != SDL_APPACTIVE) {
|
||||||
if (event.active.gain == 0) {
|
if (event.active.gain == 0) {
|
||||||
Window::isActive = false;
|
Window::isActive = false;
|
||||||
}
|
}
|
||||||
else if (event.active.gain == 1) {
|
//else if (event.active.gain == 1) {
|
||||||
|
else {
|
||||||
Window::isActive = true;
|
Window::isActive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user