Add support for toggling windowed mode other than alt-enter. E.g. from a menu item.
This commit is contained in:
+12
-10
@@ -1348,17 +1348,13 @@ bool HandleGlobalInputs( const InputEventPlus &input )
|
||||
StepMania::SaveScreenshot( "Screenshots/", bSaveCompressed, false );
|
||||
return true; // handled
|
||||
}
|
||||
|
||||
if( input.DeviceI == DeviceInput(DEVICE_KEYBOARD, KEY_ENTER) )
|
||||
|
||||
if( input.DeviceI == DeviceInput(DEVICE_KEYBOARD, KEY_ENTER) &&
|
||||
(INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_RALT)) ||
|
||||
INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_LALT))) )
|
||||
{
|
||||
if( INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_RALT)) ||
|
||||
INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_LALT)) )
|
||||
{
|
||||
/* alt-enter */
|
||||
PREFSMAN->m_bWindowed.Set( !PREFSMAN->m_bWindowed );
|
||||
StepMania::ApplyGraphicOptions();
|
||||
return true;
|
||||
}
|
||||
/* alt-enter */
|
||||
ArchHooks::SetToggleWindowed();
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -1446,6 +1442,12 @@ void HandleInputEvents(float fDeltaTime)
|
||||
|
||||
SCREENMAN->Input( input );
|
||||
}
|
||||
|
||||
if( ArchHooks::GetAndClearToggleWindowed() )
|
||||
{
|
||||
PREFSMAN->m_bWindowed.Set( !PREFSMAN->m_bWindowed );
|
||||
StepMania::ApplyGraphicOptions();
|
||||
}
|
||||
}
|
||||
|
||||
void StepMania::FocusChanged( bool bHasFocus )
|
||||
|
||||
@@ -1,9 +1,28 @@
|
||||
#include "global.h"
|
||||
#include "ArchHooks.h"
|
||||
#include "RageThreads.h"
|
||||
|
||||
bool ArchHooks::s_bQuitting = false;
|
||||
bool ArchHooks::s_bToggleWindowed = false;
|
||||
// Keep from pulling RageThreads.h into ArchHooks.h
|
||||
static RageMutex s_AHLock( "ArchHooks lock" );
|
||||
ArchHooks *HOOKS = NULL;
|
||||
|
||||
bool ArchHooks::GetAndClearToggleWindowed()
|
||||
{
|
||||
LockMut( s_AHLock );
|
||||
bool bToggle = s_bToggleWindowed;
|
||||
|
||||
s_bToggleWindowed = false;
|
||||
return bToggle;
|
||||
}
|
||||
|
||||
void ArchHooks::SetToggleWindowed()
|
||||
{
|
||||
LockMut( s_AHLock );
|
||||
s_bToggleWindowed = true;
|
||||
}
|
||||
|
||||
#include "Selector_ArchHooks.h"
|
||||
ArchHooks *MakeArchHooks()
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
class ArchHooks
|
||||
{
|
||||
static bool s_bQuitting;
|
||||
static bool s_bToggleWindowed;
|
||||
public:
|
||||
virtual ~ArchHooks() { }
|
||||
|
||||
@@ -50,6 +51,13 @@ public:
|
||||
*/
|
||||
static bool UserQuit() { return s_bQuitting; }
|
||||
static void SetUserQuit() { s_bQuitting = true; }
|
||||
|
||||
/*
|
||||
* Returns true if the user wants to toggle windowed mode and atomically clears
|
||||
* the boolean.
|
||||
*/
|
||||
static bool GetAndClearToggleWindowed();
|
||||
static void SetToggleWindowed();
|
||||
|
||||
/*
|
||||
* Return the amount of time since the program started. (This may actually be
|
||||
|
||||
Reference in New Issue
Block a user