Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 439654 Details for
Bug 379827
x11-base/xorg-server Patch for Hotkey Release Layout Switching (unofficial solution to bug on freedesktop.org #865) (xkb/xkbActions.c)
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
xorg-server-1.12.2-xkb-switch-on-release.patch
xorg-server-1.12.2-xkb-switch-on-release.patch (text/plain), 3.74 KB, created by
Yuriy Taraday
on 2016-07-04 08:14:52 UTC
(
hide
)
Description:
xorg-server-1.12.2-xkb-switch-on-release.patch
Filename:
MIME Type:
Creator:
Yuriy Taraday
Created:
2016-07-04 08:14:52 UTC
Size:
3.74 KB
patch
obsolete
>diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c >index 5ec1ed5..3acc894 100644 >--- a/xkb/xkbActions.c >+++ b/xkb/xkbActions.c >@@ -340,23 +340,81 @@ _XkbFilterLatchState(XkbSrvInfoPtr xkbi, > return 1; > } > >+static int xkbSwitchGroupOnRelease(void) >+{ >+ /* TODO: user configuring */ >+ return TRUE; >+} >+ >+static void xkbUpdateLockedGroup(XkbSrvInfoPtr xkbi, XkbAction* pAction) >+{ >+ XkbGroupAction ga = pAction->group; >+ if (ga.flags&XkbSA_GroupAbsolute) >+ xkbi->state.locked_group= XkbSAGroup(&ga); >+ else >+ xkbi->state.locked_group+= XkbSAGroup(&ga); >+} >+ >+static XkbFilterPtr _XkbNextFreeFilter(XkbSrvInfoPtr xkbi); >+ > static int >-_XkbFilterLockState(XkbSrvInfoPtr xkbi, >+_XkbFilterLockGroup(XkbSrvInfoPtr xkbi, > XkbFilterPtr filter, unsigned keycode, XkbAction *pAction) > { >- if (pAction && (pAction->type == XkbSA_LockGroup)) { >- if (pAction->group.flags & XkbSA_GroupAbsolute) >- xkbi->state.locked_group = XkbSAGroup(&pAction->group); >- else >- xkbi->state.locked_group += XkbSAGroup(&pAction->group); >- return 1; >+ int sendEvent = 1; >+ >+ if (!xkbSwitchGroupOnRelease()) { >+ xkbUpdateLockedGroup(xkbi, pAction); >+ return sendEvent; >+ } >+ >+ /* Delay switch till button release */ >+ if (filter->keycode==0) { /* initial press */ >+ filter->keycode = keycode; >+ filter->active = 1; >+ filter->filterOthers = 0; /* for what? */ >+ filter->filter = _XkbFilterLockGroup; >+ >+ /* filter->priv = 0; */ >+ filter->upAction = *pAction; >+ >+ /* Ok, now we need to simulate the action which would go if this action didn't block it. >+ XkbSA_SetMods is the one: it is to set modifier' flag up. */ >+ { >+ XkbStateRec fake_state = xkbi->state; >+ XkbAction act; >+ >+ fake_state.mods = 0; >+ act = XkbGetKeyAction(xkbi, &fake_state, keycode); >+ >+ /* KLUDGE: XkbSA_SetMods only? */ >+ if (act.type == XkbSA_SetMods) { >+ XkbFilterPtr filter = _XkbNextFreeFilter(xkbi); >+ sendEvent = _XkbFilterSetState(xkbi,filter,keycode,&act); >+ } >+ } >+ } >+ else { >+ /* do nothing if some button else is pressed */ >+ if (!pAction) >+ xkbUpdateLockedGroup(xkbi, &filter->upAction); >+ filter->active = 0; > } >+ >+ return sendEvent; >+} >+ >+static int >+_XkbFilterLockMods(XkbSrvInfoPtr xkbi, >+ XkbFilterPtr filter, unsigned keycode, >+ XkbAction *pAction) >+{ > if (filter->keycode == 0) { /* initial press */ > filter->keycode = keycode; > filter->active = 1; > filter->filterOthers = 0; > filter->priv = xkbi->state.locked_mods & pAction->mods.mask; >- filter->filter = _XkbFilterLockState; >+ filter->filter = _XkbFilterLockMods; > filter->upAction = *pAction; > if (!(filter->upAction.mods.flags & XkbSA_LockNoLock)) > xkbi->state.locked_mods |= pAction->mods.mask; >@@ -1142,9 +1200,12 @@ XkbHandleActions(DeviceIntPtr dev, DeviceIntPtr kbd, DeviceEvent *event) > sendEvent = _XkbFilterLatchState(xkbi, filter, key, &act); > break; > case XkbSA_LockMods: >+ filter = _XkbNextFreeFilter(xkbi); >+ sendEvent = _XkbFilterLockMods(xkbi,filter,key,&act); >+ break; > case XkbSA_LockGroup: > filter = _XkbNextFreeFilter(xkbi); >- sendEvent = _XkbFilterLockState(xkbi, filter, key, &act); >+ sendEvent = _XkbFilterLockGroup(xkbi, filter, key, &act); > break; > case XkbSA_ISOLock: > filter = _XkbNextFreeFilter(xkbi);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 379827
:
283857
|
283859
|
283999
| 439654 |
439658
|
467432