X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FApplications%2Faxwin3_src%2FWM%2Fwm_hotkeys.c;h=2a93b541a13af7aa2288f7d9cc691eb0a5db11b8;hb=910b87da7338937ace686848fb915908df0bf09b;hp=3fbe4f762342fdac0b3f57473bf38f993488e5ce;hpb=305bad29632e0cf47307e010ae7dea55617f2dfd;p=tpg%2Facess2.git diff --git a/Usermode/Applications/axwin3_src/WM/wm_hotkeys.c b/Usermode/Applications/axwin3_src/WM/wm_hotkeys.c index 3fbe4f76..2a93b541 100644 --- a/Usermode/Applications/axwin3_src/WM/wm_hotkeys.c +++ b/Usermode/Applications/axwin3_src/WM/wm_hotkeys.c @@ -40,6 +40,11 @@ void WM_Hotkey_Register(int nKeys, uint32_t *Keys, const char *ActionName) h->Target = (void*)( h->Keys + nKeys ); strcpy((char*)h->Target, ActionName); memcpy(h->Keys, Keys, nKeys * sizeof(uint32_t)); + + h->Next = NULL; + if( gpWM_Hotkeys ) + gpWM_Hotkeys->Next = h; + gpWM_Hotkeys = h; } void WM_Hotkey_RegisterAction(const char *ActionName, tWindow *Target, uint16_t Index) @@ -59,6 +64,7 @@ void WM_Hotkey_RegisterAction(const char *ActionName, tWindow *Target, uint16_t strcpy((char*)t->Name, ActionName); t->Window = Target; t->Index = Index; + t->Next = NULL; // TODO: Register to be informed when the window dies/closes? @@ -82,6 +88,8 @@ void WM_Hotkey_KeyUp(uint32_t Scancode) { _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 ; @@ -94,7 +102,8 @@ void WM_Hotkey_KeyUp(uint32_t Scancode) 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 @@ -108,6 +117,7 @@ void WM_Hotkey_KeyUp(uint32_t Scancode) void WM_Hotkey_FireEvent(const char *Target) { +// _SysDebug("WM_Hotkey_FireEvent: (%s)", Target); // - Internal events (Alt-Tab, Close, Maximize, etc...) // TODO: Internal event handling @@ -133,11 +143,13 @@ void WM_Hotkey_FireEvent(const char *Target) 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)); }