Add support for toggling windowed mode other than alt-enter. E.g. from a menu item.
This commit is contained in:
@@ -1349,16 +1349,12 @@ bool HandleGlobalInputs( const InputEventPlus &input )
|
|||||||
return true; // handled
|
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)) ||
|
||||||
if( INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_RALT)) ||
|
INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_LALT))) )
|
||||||
INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_LALT)) )
|
|
||||||
{
|
{
|
||||||
/* alt-enter */
|
/* alt-enter */
|
||||||
PREFSMAN->m_bWindowed.Set( !PREFSMAN->m_bWindowed );
|
ArchHooks::SetToggleWindowed();
|
||||||
StepMania::ApplyGraphicOptions();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -1446,6 +1442,12 @@ void HandleInputEvents(float fDeltaTime)
|
|||||||
|
|
||||||
SCREENMAN->Input( input );
|
SCREENMAN->Input( input );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( ArchHooks::GetAndClearToggleWindowed() )
|
||||||
|
{
|
||||||
|
PREFSMAN->m_bWindowed.Set( !PREFSMAN->m_bWindowed );
|
||||||
|
StepMania::ApplyGraphicOptions();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void StepMania::FocusChanged( bool bHasFocus )
|
void StepMania::FocusChanged( bool bHasFocus )
|
||||||
|
|||||||
@@ -1,9 +1,28 @@
|
|||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "ArchHooks.h"
|
#include "ArchHooks.h"
|
||||||
|
#include "RageThreads.h"
|
||||||
|
|
||||||
bool ArchHooks::s_bQuitting = false;
|
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;
|
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"
|
#include "Selector_ArchHooks.h"
|
||||||
ArchHooks *MakeArchHooks()
|
ArchHooks *MakeArchHooks()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
class ArchHooks
|
class ArchHooks
|
||||||
{
|
{
|
||||||
static bool s_bQuitting;
|
static bool s_bQuitting;
|
||||||
|
static bool s_bToggleWindowed;
|
||||||
public:
|
public:
|
||||||
virtual ~ArchHooks() { }
|
virtual ~ArchHooks() { }
|
||||||
|
|
||||||
@@ -51,6 +52,13 @@ public:
|
|||||||
static bool UserQuit() { return s_bQuitting; }
|
static bool UserQuit() { return s_bQuitting; }
|
||||||
static void SetUserQuit() { s_bQuitting = true; }
|
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
|
* Return the amount of time since the program started. (This may actually be
|
||||||
* since the initialization of HOOKS.
|
* since the initialization of HOOKS.
|
||||||
|
|||||||
Reference in New Issue
Block a user