Allow the standard Windows PrtSc action (i.e. copy to clipboard) if HOTKEY_SCREENSHOT has been redefined
This was SVN commit r951.
This commit is contained in:
parent
0b3361b6f5
commit
230731c69d
@ -35,6 +35,7 @@
|
||||
#include "win_internal.h"
|
||||
|
||||
#include "SDL_vkeys.h"
|
||||
#include "ps/Hotkey.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
@ -445,6 +446,10 @@ LRESULT CALLBACK keyboard_ll_hook(int nCode, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
// replace Windows PrintScreen handler
|
||||
if(vk == VK_SNAPSHOT)
|
||||
{
|
||||
// check whether PrintScreen should be taking screenshots -- if
|
||||
// not, allow the standard Windows clipboard to work
|
||||
if(keyRespondsTo(HOTKEY_SCREENSHOT, SDLK_PRINT))
|
||||
{
|
||||
// send to wndproc
|
||||
UINT msg = (UINT)wParam;
|
||||
@ -456,6 +461,7 @@ LRESULT CALLBACK keyboard_ll_hook(int nCode, WPARAM wParam, LPARAM lParam)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// pass it on to other hook handlers
|
||||
return CallNextHookEx(hKeyboard_LL_Hook, nCode, wParam, lParam);
|
||||
|
@ -478,3 +478,15 @@ int hotkeyInputHandler( const SDL_Event* ev )
|
||||
}
|
||||
return( EV_PASS );
|
||||
}
|
||||
|
||||
|
||||
// Returns true if the specified HOTKEY_* responds to the specified SDLK_*
|
||||
// (mainly for the screenshot system to know whether it needs to override
|
||||
// the printscreen screen). Ignores modifier keys.
|
||||
bool keyRespondsTo( int hotkey, int sdlkey )
|
||||
{
|
||||
for (KeyMapping::iterator it = hotkeyMap[sdlkey].begin(); it != hotkeyMap[sdlkey].end(); ++it)
|
||||
if (it->mapsTo == hotkey)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
@ -102,4 +102,6 @@ void initKeyNameMap();
|
||||
CStr getKeyName( int keycode );
|
||||
int getKeyCode( CStr keyname );
|
||||
|
||||
bool keyRespondsTo( int hotkey, int sdlkey );
|
||||
|
||||
extern bool hotkeys[HOTKEY_LAST];
|
||||
|
Loading…
Reference in New Issue
Block a user