Lines 350-372
Link Here
|
350 |
return 1; |
350 |
return 1; |
351 |
} |
351 |
} |
352 |
|
352 |
|
|
|
353 |
static void xkbUpdateLockedGroup(XkbSrvInfoPtr xkbi, XkbAction* pAction) |
354 |
{ |
355 |
XkbGroupAction ga = pAction->group; |
356 |
|
357 |
if (ga.flags&XkbSA_GroupAbsolute) { |
358 |
xkbi->state.locked_group = XkbSAGroup(&ga); |
359 |
} else { |
360 |
xkbi->state.locked_group += XkbSAGroup(&ga); |
361 |
} |
362 |
} |
363 |
|
364 |
static XkbFilterPtr _XkbNextFreeFilter(XkbSrvInfoPtr xkbi); |
365 |
|
353 |
static int |
366 |
static int |
354 |
_XkbFilterLockState(XkbSrvInfoPtr xkbi, |
367 |
_XkbFilterLockGroup(XkbSrvInfoPtr xkbi, |
355 |
XkbFilterPtr filter, unsigned keycode, XkbAction *pAction) |
368 |
XkbFilterPtr filter, unsigned keycode, XkbAction *pAction) |
356 |
{ |
369 |
{ |
357 |
if (pAction && (pAction->type == XkbSA_LockGroup)) { |
370 |
int sendEvent = 1; |
358 |
if (pAction->group.flags & XkbSA_GroupAbsolute) |
371 |
|
359 |
xkbi->state.locked_group = XkbSAGroup(&pAction->group); |
372 |
if (filter->keycode == 0) { |
360 |
else |
373 |
filter->keycode = keycode; |
361 |
xkbi->state.locked_group += XkbSAGroup(&pAction->group); |
374 |
filter->active = 1; |
362 |
return 1; |
375 |
filter->filterOthers = 0; |
|
|
376 |
filter->filter = _XkbFilterLockGroup; |
377 |
filter->upAction = *pAction; |
378 |
|
379 |
{ |
380 |
XkbStateRec fake_state = xkbi->state; |
381 |
XkbAction act; |
382 |
|
383 |
fake_state.mods = 0; |
384 |
act = XkbGetKeyAction(xkbi, &fake_state, keycode); |
385 |
|
386 |
if (act.type == XkbSA_SetMods) { |
387 |
XkbFilterPtr filter = _XkbNextFreeFilter(xkbi); |
388 |
sendEvent = _XkbFilterSetState(xkbi,filter,keycode,&act); |
389 |
} |
390 |
} |
391 |
} else { |
392 |
if (!pAction) |
393 |
xkbUpdateLockedGroup(xkbi, &filter->upAction); |
394 |
filter->active = 0; |
363 |
} |
395 |
} |
|
|
396 |
|
397 |
return sendEvent; |
398 |
} |
399 |
|
400 |
static int |
401 |
_XkbFilterLockMods( XkbSrvInfoPtr xkbi, |
402 |
XkbFilterPtr filter, |
403 |
unsigned keycode, |
404 |
XkbAction * pAction) |
405 |
{ |
406 |
|
364 |
if (filter->keycode == 0) { /* initial press */ |
407 |
if (filter->keycode == 0) { /* initial press */ |
365 |
filter->keycode = keycode; |
408 |
filter->keycode = keycode; |
366 |
filter->active = 1; |
409 |
filter->active = 1; |
367 |
filter->filterOthers = 0; |
410 |
filter->filterOthers = 0; |
368 |
filter->priv = xkbi->state.locked_mods & pAction->mods.mask; |
411 |
filter->priv = xkbi->state.locked_mods & pAction->mods.mask; |
369 |
filter->filter = _XkbFilterLockState; |
412 |
filter->filter = _XkbFilterLockMods; |
370 |
filter->upAction = *pAction; |
413 |
filter->upAction = *pAction; |
371 |
if (!(filter->upAction.mods.flags & XkbSA_LockNoLock)) |
414 |
if (!(filter->upAction.mods.flags & XkbSA_LockNoLock)) |
372 |
xkbi->state.locked_mods |= pAction->mods.mask; |
415 |
xkbi->state.locked_mods |= pAction->mods.mask; |
Lines 1243-1251
Link Here
|
1243 |
sendEvent = _XkbFilterLatchState(xkbi, filter, key, &act); |
1286 |
sendEvent = _XkbFilterLatchState(xkbi, filter, key, &act); |
1244 |
break; |
1287 |
break; |
1245 |
case XkbSA_LockMods: |
1288 |
case XkbSA_LockMods: |
|
|
1289 |
filter = _XkbNextFreeFilter(xkbi); |
1290 |
sendEvent = _XkbFilterLockMods(xkbi, filter, key, &act); |
1291 |
break; |
1246 |
case XkbSA_LockGroup: |
1292 |
case XkbSA_LockGroup: |
1247 |
filter = _XkbNextFreeFilter(xkbi); |
1293 |
filter = _XkbNextFreeFilter(xkbi); |
1248 |
sendEvent = _XkbFilterLockState(xkbi, filter, key, &act); |
1294 |
sendEvent = _XkbFilterLockGroup(xkbi, filter, key, &act); |
1249 |
break; |
1295 |
break; |
1250 |
case XkbSA_ISOLock: |
1296 |
case XkbSA_ISOLock: |
1251 |
filter = _XkbNextFreeFilter(xkbi); |
1297 |
filter = _XkbNextFreeFilter(xkbi); |