mirror of
https://github.com/glest/glest-source.git
synced 2025-08-08 09:26:27 +02:00
alt+enter #138
Fast toggle on alt+enter and key repeat are different things. This here should fix the alt+enter issue.
This commit is contained in:
@@ -106,6 +106,10 @@ private:
|
|||||||
static bool isFullScreen;
|
static bool isFullScreen;
|
||||||
static SDL_keysym keystate;
|
static SDL_keysym keystate;
|
||||||
static bool tryVSynch;
|
static bool tryVSynch;
|
||||||
|
static int64 lastToggle ;
|
||||||
|
|
||||||
|
static void setLastToggle(int64 lastToggle) {Window::lastToggle = lastToggle;}
|
||||||
|
static int64 getLastToggle() {return Window::lastToggle;}
|
||||||
|
|
||||||
static void setLastMouseEvent(int64 lastMouseEvent) {Window::lastMouseEvent = lastMouseEvent;}
|
static void setLastMouseEvent(int64 lastMouseEvent) {Window::lastMouseEvent = lastMouseEvent;}
|
||||||
static int64 getLastMouseEvent() {return Window::lastMouseEvent;}
|
static int64 getLastMouseEvent() {return Window::lastMouseEvent;}
|
||||||
|
@@ -48,6 +48,7 @@ MouseState Window::mouseState;
|
|||||||
bool Window::isKeyPressedDown = false;
|
bool Window::isKeyPressedDown = false;
|
||||||
bool Window::isFullScreen = false;
|
bool Window::isFullScreen = false;
|
||||||
SDL_keysym Window::keystate;
|
SDL_keysym Window::keystate;
|
||||||
|
int64 Window::lastToggle = -1000;
|
||||||
|
|
||||||
bool Window::isActive = false;
|
bool Window::isActive = false;
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
@@ -315,7 +316,7 @@ bool Window::handleEvent() {
|
|||||||
case SDL_KEYDOWN: {
|
case SDL_KEYDOWN: {
|
||||||
//printf("In SDL_KEYDOWN\n");
|
//printf("In SDL_KEYDOWN\n");
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] =================================== START OF SDL SDL_KEYDOWN ================================\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] =================================== START OF SDL SDL_KEYDOWN ================================\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
if(event.key.repeat!=0) break;
|
||||||
keystate = event.key.keysym;
|
keystate = event.key.keysym;
|
||||||
bool keyDownConsumed=false;
|
bool keyDownConsumed=false;
|
||||||
if(global_window) {
|
if(global_window) {
|
||||||
@@ -365,7 +366,10 @@ bool Window::handleEvent() {
|
|||||||
// handle ALT+Return
|
// handle ALT+Return
|
||||||
if( (keyName == "Return" || keyName == "Enter")
|
if( (keyName == "Return" || keyName == "Enter")
|
||||||
&& (event.key.keysym.mod & (KMOD_LALT | KMOD_RALT))) {
|
&& (event.key.keysym.mod & (KMOD_LALT | KMOD_RALT))) {
|
||||||
toggleFullscreen();
|
if (Chrono::getCurMillis() - getLastToggle() > 100) {
|
||||||
|
toggleFullscreen();
|
||||||
|
setLastToggle(Chrono::getCurMillis());
|
||||||
|
};
|
||||||
keyDownConsumed=true;
|
keyDownConsumed=true;
|
||||||
}
|
}
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
Reference in New Issue
Block a user