LCtrl+LAlt+Delete = reboot

This commit is contained in:
penfold42 2018-08-03 15:39:48 +10:00
parent c55c5169dd
commit 98961a9421
2 changed files with 16 additions and 11 deletions

View File

@ -23,6 +23,7 @@
extern "C"
{
#include "rpi-aux.h"
extern void reboot_now(void);
}
// If disk swaps can be done via multiple cores then directDiskSwapRequest needs to be volatile. WARNING: volatile acesses can be very expensive.
@ -152,6 +153,9 @@ bool InputMappings::CheckKeyboardBrowseMode()
keyboardFlags = 0;
if (keyboard->KeyHeld(KEY_DELETE) && keyboard->KeyLCtrlAlt() )
reboot_now();
if (keyboard->KeyHeld(KEY_ESC))
SetKeyboardFlag(ESC_FLAG);
else if (keyboard->KeyHeld(KEY_ENTER))
@ -245,6 +249,10 @@ void InputMappings::CheckKeyboardEmulationMode(unsigned numberOfImages, unsigned
keyboardFlags = 0;
if (keyboard->CheckChanged())
{
if (keyboard->KeyHeld(KEY_DELETE) && keyboard->KeyLCtrlAlt() )
reboot_now();
if (keyboard->KeyHeld(KEY_ESC))
SetKeyboardFlag(ESC_FLAG);
else if (keyboard->KeyHeld(KEY_PAGEUP))

View File

@ -340,17 +340,14 @@ public:
u64 mask = 1ULL << (rawKey & 0x3f);
return (keyStatus[keyStatusIndex] & mask);
}
inline bool KeyAnyHeld()
{
return (keyStatus[0] | keyStatus[1]);
}
inline bool KeyEitherAlt()
{
return (modifier & (KEY_MOD_LALT | KEY_MOD_RALT) );
}
inline bool KeyNoModifiers()
{
return (!modifier );
}
{ return (keyStatus[0] | keyStatus[1]); }
inline bool KeyEitherAlt() { return (modifier & (KEY_MOD_LALT | KEY_MOD_RALT) ); }
inline bool KeyNoModifiers() { return (!modifier ); }
inline bool KeyLCtrlAlt() { return (modifier == (KEY_MOD_LALT | KEY_MOD_LCTRL) ); }
};
#endif