- update for windows mouse pointer in fullscreen mode. Alt-Enter enables mouse pointer so user can scroll off screen.

This commit is contained in:
Mark Vejvoda
2010-06-29 07:39:05 +00:00
parent 9508dad51b
commit 340d637ae1
3 changed files with 8 additions and 13 deletions

View File

@@ -783,6 +783,7 @@ void showCursor(bool b) {
//SDL_GetMouseState( &x, &y ); //SDL_GetMouseState( &x, &y );
} }
SDL_ShowCursor(b ? SDL_ENABLE : SDL_DISABLE); SDL_ShowCursor(b ? SDL_ENABLE : SDL_DISABLE);
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);

View File

@@ -91,6 +91,8 @@ void PlatformContextGl::init(int colorBits, int depthBits, int stencilBits) {
<< depthBits << " depth-buffer). SDL Error is: " << SDL_GetError(); << depthBits << " depth-buffer). SDL Error is: " << SDL_GetError();
throw std::runtime_error(msg.str()); throw std::runtime_error(msg.str());
} }
SDL_WM_GrabInput(SDL_GRAB_OFF);
} }
void PlatformContextGl::end() { void PlatformContextGl::end() {

View File

@@ -186,9 +186,7 @@ bool Window::handleEvent() {
} }
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Window::isActive = %d\n",__FILE__,__FUNCTION__,__LINE__,Window::isActive); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Window::isActive = %d\n",__FILE__,__FUNCTION__,__LINE__,Window::isActive);
if(Window::isActive && Window::getUseDefaultCursorOnly() == false) { showCursor(!Window::isActive || Window::getUseDefaultCursorOnly());
showCursor(!Window::isActive);
}
} }
// Check if the program has lost window focus // Check if the program has lost window focus
else if (event.active.state == SDL_APPACTIVE) { else if (event.active.state == SDL_APPACTIVE) {
@@ -200,9 +198,7 @@ bool Window::handleEvent() {
} }
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Window::isActive = %d\n",__FILE__,__FUNCTION__,__LINE__,Window::isActive); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Window::isActive = %d\n",__FILE__,__FUNCTION__,__LINE__,Window::isActive);
if(Window::isActive && Window::getUseDefaultCursorOnly() == false) { showCursor(!Window::isActive || Window::getUseDefaultCursorOnly());
showCursor(!Window::isActive);
}
} }
// Check if the program has lost window focus // Check if the program has lost window focus
else if (event.active.state == SDL_APPMOUSEFOCUS) { else if (event.active.state == SDL_APPMOUSEFOCUS) {
@@ -214,9 +210,7 @@ bool Window::handleEvent() {
} }
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Window::isActive = %d\n",__FILE__,__FUNCTION__,__LINE__,Window::isActive); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Window::isActive = %d\n",__FILE__,__FUNCTION__,__LINE__,Window::isActive);
if(Window::isActive && Window::getUseDefaultCursorOnly() == false) { showCursor(!Window::isActive || Window::getUseDefaultCursorOnly());
showCursor(!Window::isActive);
}
} }
else { else {
if (event.active.gain == 0) { if (event.active.gain == 0) {
@@ -227,9 +221,7 @@ bool Window::handleEvent() {
} }
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Window::isActive = %d, event.active.state = %d\n",__FILE__,__FUNCTION__,__LINE__,Window::isActive,event.active.state); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Window::isActive = %d, event.active.state = %d\n",__FILE__,__FUNCTION__,__LINE__,Window::isActive,event.active.state);
if(Window::isActive && Window::getUseDefaultCursorOnly() == false) { showCursor(!Window::isActive || Window::getUseDefaultCursorOnly());
showCursor(!Window::isActive);
}
} }
} }
@@ -431,7 +423,7 @@ void Window::toggleFullscreen() {
if(Window::isFullScreen == true) { if(Window::isFullScreen == true) {
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d] Window::isFullScreen == true [%d]\n",__FILE__,__FUNCTION__,__LINE__,handle); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d] Window::isFullScreen == true [%d]\n",__FILE__,__FUNCTION__,__LINE__,handle);
ShowWindow(handle, SW_MAXIMIZE); ShowWindow(handle, SW_MAXIMIZE);
if(Window::isActive && Window::getUseDefaultCursorOnly() == false) { if(Window::getUseDefaultCursorOnly() == false) {
showCursor(false); showCursor(false);
} }
} }