diff options
author | Keith Packard <keithp@keithp.com> | 2012-03-21 12:55:09 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2012-03-21 13:54:42 -0700 |
commit | 9838b7032ea9792bec21af424c53c07078636d21 (patch) | |
tree | b72d0827dac50f0f3b8eab29b3b7639546d735d7 /xkb/xkbPrKeyEv.c | |
parent | 75199129c603fc8567185ac31866c9518193cb78 (diff) |
Introduce a consistent coding style
This is strictly the application of the script 'x-indent-all.sh'
from util/modular. Compared to the patch that Daniel posted in
January, I've added a few indent flags:
-bap
-psl
-T PrivatePtr
-T pmWait
-T _XFUNCPROTOBEGIN
-T _XFUNCPROTOEND
-T _X_EXPORT
The typedefs were needed to make the output of sdksyms.sh match the
previous output, otherwise, the code is formatted badly enough that
sdksyms.sh generates incorrect output.
The generated code was compared with the previous version and found to
be essentially identical -- "assert" line numbers and BUILD_TIME were
the only differences found.
The comparison was done with this script:
dir1=$1
dir2=$2
for dir in $dir1 $dir2; do
(cd $dir && find . -name '*.o' | while read file; do
dir=`dirname $file`
base=`basename $file .o`
dump=$dir/$base.dump
objdump -d $file > $dump
done)
done
find $dir1 -name '*.dump' | while read dump; do
otherdump=`echo $dump | sed "s;$dir1;$dir2;"`
diff -u $dump $otherdump
done
Signed-off-by: Keith Packard <keithp@keithp.com>
Acked-by: Daniel Stone <daniel@fooishbar.org>
Acked-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'xkb/xkbPrKeyEv.c')
-rw-r--r-- | xkb/xkbPrKeyEv.c | 151 |
1 files changed, 79 insertions, 72 deletions
diff --git a/xkb/xkbPrKeyEv.c b/xkb/xkbPrKeyEv.c index 630f17c23..32411838d 100644 --- a/xkb/xkbPrKeyEv.c +++ b/xkb/xkbPrKeyEv.c @@ -46,20 +46,21 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. void XkbProcessKeyboardEvent(DeviceEvent *event, DeviceIntPtr keybd) { -KeyClassPtr keyc = keybd->key; -XkbSrvInfoPtr xkbi; -int key; -XkbBehavior behavior; -unsigned ndx; + KeyClassPtr keyc = keybd->key; + XkbSrvInfoPtr xkbi; + int key; + XkbBehavior behavior; + unsigned ndx; xkbi = keyc->xkbInfo; key = event->detail.key; if (xkbDebugFlags & 0x8) - DebugF("[xkb] XkbPKE: Key %d %s\n",key,(event->type == ET_KeyPress?"down":"up")); + DebugF("[xkb] XkbPKE: Key %d %s\n", key, + (event->type == ET_KeyPress ? "down" : "up")); - if (xkbi->repeatKey == key && event->type== ET_KeyRelease && + if (xkbi->repeatKey == key && event->type == ET_KeyRelease && !(xkbi->desc->ctrls->enabled_ctrls & XkbRepeatKeysMask)) - AccessXCancelRepeatKey(xkbi, key); + AccessXCancelRepeatKey(xkbi, key); behavior = xkbi->desc->server->behaviors[key]; /* The "permanent" flag indicates a hard-wired behavior that occurs */ @@ -68,73 +69,79 @@ unsigned ndx; /* key is hardwired */ if (!(behavior.type & XkbKB_Permanent)) { - switch (behavior.type) { - case XkbKB_Default: - /* Neither of these should happen in practice, but ignore them - anyway. */ - if (event->type == ET_KeyPress && !event->key_repeat && - key_is_down(keybd, key, KEY_PROCESSED)) + switch (behavior.type) { + case XkbKB_Default: + /* Neither of these should happen in practice, but ignore them + anyway. */ + if (event->type == ET_KeyPress && !event->key_repeat && + key_is_down(keybd, key, KEY_PROCESSED)) + return; + else if (event->type == ET_KeyRelease && + !key_is_down(keybd, key, KEY_PROCESSED)) + return; + break; + case XkbKB_Lock: + if (event->type == ET_KeyRelease) + return; + else if (key_is_down(keybd, key, KEY_PROCESSED)) + event->type = ET_KeyRelease; + break; + case XkbKB_RadioGroup: + ndx = (behavior.data & (~XkbKB_RGAllowNone)); + if (ndx < xkbi->nRadioGroups) { + XkbRadioGroupPtr rg; + + if (event->type == ET_KeyRelease) return; - else if (event->type == ET_KeyRelease && - !key_is_down(keybd, key, KEY_PROCESSED)) + + rg = &xkbi->radioGroups[ndx]; + if (rg->currentDown == event->detail.key) { + if (behavior.data & XkbKB_RGAllowNone) { + event->type = ET_KeyRelease; + XkbHandleActions(keybd, keybd, event); + rg->currentDown = 0; + } return; - break; - case XkbKB_Lock: - if (event->type == ET_KeyRelease) - return; - else if (key_is_down(keybd, key, KEY_PROCESSED)) + } + if (rg->currentDown != 0) { + int key = event->detail.key; + event->type = ET_KeyRelease; - break; - case XkbKB_RadioGroup: - ndx= (behavior.data&(~XkbKB_RGAllowNone)); - if ( ndx<xkbi->nRadioGroups ) { - XkbRadioGroupPtr rg; - - if (event->type == ET_KeyRelease) - return; - - rg = &xkbi->radioGroups[ndx]; - if ( rg->currentDown == event->detail.key) { - if (behavior.data&XkbKB_RGAllowNone) { - event->type = ET_KeyRelease; - XkbHandleActions(keybd, keybd, event); - rg->currentDown= 0; - } - return; - } - if ( rg->currentDown!=0 ) { - int key = event->detail.key; - event->type = ET_KeyRelease; - event->detail.key = rg->currentDown; - XkbHandleActions(keybd, keybd, event); - event->type = ET_KeyPress; - event->detail.key = key; - } - rg->currentDown= key; - } - else ErrorF("[xkb] InternalError! Illegal radio group %d\n",ndx); - break; - case XkbKB_Overlay1: case XkbKB_Overlay2: - { - unsigned which; - if (behavior.type==XkbKB_Overlay1) which= XkbOverlay1Mask; - else which= XkbOverlay2Mask; - if ( (xkbi->desc->ctrls->enabled_ctrls&which)==0 ) - break; - if ((behavior.data>=xkbi->desc->min_key_code)&& - (behavior.data<=xkbi->desc->max_key_code)) { - event->detail.key = behavior.data; - /* 9/11/94 (ef) -- XXX! need to match release with */ - /* press even if the state of the */ - /* corresponding overlay control */ - /* changes while the key is down */ - } - } - break; - default: - ErrorF("[xkb] unknown key behavior 0x%04x\n",behavior.type); - break; - } + event->detail.key = rg->currentDown; + XkbHandleActions(keybd, keybd, event); + event->type = ET_KeyPress; + event->detail.key = key; + } + rg->currentDown = key; + } + else + ErrorF("[xkb] InternalError! Illegal radio group %d\n", ndx); + break; + case XkbKB_Overlay1: + case XkbKB_Overlay2: + { + unsigned which; + + if (behavior.type == XkbKB_Overlay1) + which = XkbOverlay1Mask; + else + which = XkbOverlay2Mask; + if ((xkbi->desc->ctrls->enabled_ctrls & which) == 0) + break; + if ((behavior.data >= xkbi->desc->min_key_code) && + (behavior.data <= xkbi->desc->max_key_code)) { + event->detail.key = behavior.data; + /* 9/11/94 (ef) -- XXX! need to match release with */ + /* press even if the state of the */ + /* corresponding overlay control */ + /* changes while the key is down */ + } + } + break; + default: + ErrorF("[xkb] unknown key behavior 0x%04x\n", behavior.type); + break; + } } XkbHandleActions(keybd, keybd, event); return; |