X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=ioncore%2Fkey.c;h=57ada801f313f85d8f3515f6611e638876e62a2c;hb=20070203;hp=00848a44e227ec46d25998c947da255d63efc4f7;hpb=8366314611bf30a0f31d25bf5f5023186fa87692;p=ion3.git diff --git a/ioncore/key.c b/ioncore/key.c index 00848a4..57ada80 100644 --- a/ioncore/key.c +++ b/ioncore/key.c @@ -1,7 +1,7 @@ /* * ion/ioncore/key.c * - * Copyright (c) Tuomo Valkonen 1999-2006. + * Copyright (c) Tuomo Valkonen 1999-2007. * * Ion is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by @@ -172,11 +172,20 @@ static bool add_sub(WRegion *reg, uint key, uint state) static XKeyEvent *current_key_event=NULL; +static uint current_kcb, current_state; +static bool current_submap; - -XKeyEvent *ioncore_current_key_event() +/* Note: state set to AnyModifier for submaps */ +bool ioncore_current_key(uint *kcb, uint *state, bool *sub) { - return current_key_event; + if(current_kcb==0) + return FALSE; + + *kcb=current_kcb; + *state=current_state; + *sub=current_submap; + + return TRUE; } @@ -227,15 +236,16 @@ static bool do_key(WRegion *reg, XKeyEvent *ev) if(grabbed) XUngrabKeyboard(ioncore_g.dpy, CurrentTime); - if(!subs) - current_key_event=ev; - + current_kcb=ev->keycode; + current_state=ev->state; + current_submap=subs; + /* TODO: having to pass both mgd and subreg for some handlers * to work is ugly and complex. */ extl_call(binding->func, "ooo", NULL, binding_owner, mgd, subreg); - current_key_event=NULL; + current_kcb=0; if(ev->state!=0 && !subs && binding->wait) waitrelease(oreg);