h->Target = (void*)( h->Keys + nKeys );
strcpy((char*)h->Target, ActionName);
memcpy(h->Keys, Keys, nKeys * sizeof(uint32_t));
+
+ h->Next = gpWM_Hotkeys;
+ gpWM_Hotkeys = h;
}
void WM_Hotkey_RegisterAction(const char *ActionName, tWindow *Target, uint16_t Index)
strcpy((char*)t->Name, ActionName);
t->Window = Target;
t->Index = Index;
+ t->Next = NULL;
// TODO: Register to be informed when the window dies/closes?
{
_UnsetKey(Scancode);
+ // Ensure that hotkeys are triggered on the longest sequence
+ // (so Win-Shift-R doesn't trigger Win-R if shift is released)
if( !gbWM_HasBeenKeyDown )
return ;
if( _IsKeySet(hk->Keys[i]) ) continue ;
break;
}
- if( i == hk->nKeys )
+ //_SysDebug("%i/%i satisfied for %s", i, hk->nKeys, hk->Target);
+ if( i != hk->nKeys )
continue ;
// Fire shortcut
void WM_Hotkey_FireEvent(const char *Target)
{
+// _SysDebug("WM_Hotkey_FireEvent: (%s)", Target);
// - Internal events (Alt-Tab, Close, Maximize, etc...)
// TODO: Internal event handling
static void _SetKey(uint32_t sc)
{
+// _SysDebug("_SetKey: (%x)", sc);
if( sc >= MAX_STATE_SCANCODE ) return;
gWM_KeyStates[sc/8] |= 1 << (sc % 8);
}
static void _UnsetKey(uint32_t sc)
{
+// _SysDebug("_UnsetKey: (%x)", sc);
if( sc >= MAX_STATE_SCANCODE ) return;
gWM_KeyStates[sc/8] &= ~(1 << (sc % 8));
}