Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 379827 | Differences between
and this patch

Collapse All | Expand All

(-)xorg-server-1.19.1/xkb/xkbActions.c.orig (-10 / +70 lines)
Lines 351-376 Link Here
351
    return 1;
351
    return 1;
352
}
352
}
353
353
354
static int xkbSwitchGroupOnRelease(void)
355
{
356
    /* TODO: user configuring */
357
    return TRUE;
358
}
359
360
static void xkbUpdateLockedGroup(XkbSrvInfoPtr xkbi, XkbAction* pAction)
361
{
362
    XkbGroupAction ga = pAction->group;
363
    if (ga.flags&XkbSA_GroupAbsolute)
364
       xkbi->state.locked_group= XkbSAGroup(&ga);
365
    else
366
       xkbi->state.locked_group+= XkbSAGroup(&ga);
367
}
368
369
static XkbFilterPtr _XkbNextFreeFilter(XkbSrvInfoPtr xkbi);
370
354
static int
371
static int
355
_XkbFilterLockState(XkbSrvInfoPtr xkbi,
372
_XkbFilterLockGroup(XkbSrvInfoPtr xkbi,
356
                    XkbFilterPtr filter, unsigned keycode, XkbAction *pAction)
373
                    XkbFilterPtr filter, unsigned keycode, XkbAction *pAction)
357
{
374
{
375
    int sendEvent = 1;
376
358
    if (filter->keycode == 0) /* initial press */
377
    if (filter->keycode == 0) /* initial press */
359
        AccessXCancelRepeatKey(xkbi, keycode);
378
        AccessXCancelRepeatKey(xkbi, keycode);
360
379
    if (!xkbSwitchGroupOnRelease()) {
361
    if (pAction && (pAction->type == XkbSA_LockGroup)) {
380
       xkbUpdateLockedGroup(xkbi, pAction);
362
        if (pAction->group.flags & XkbSA_GroupAbsolute)
381
       return sendEvent;
363
            xkbi->state.locked_group = XkbSAGroup(&pAction->group);
382
    }
364
        else
383
    
365
            xkbi->state.locked_group += XkbSAGroup(&pAction->group);
384
    /* Delay switch till button release */
366
        return 1;
385
    if (filter->keycode==0) {          /* initial press */
386
       filter->keycode = keycode;
387
       filter->active = 1;
388
       filter->filterOthers = 0; /* for what? */
389
       filter->filter = _XkbFilterLockGroup;
390
391
       /* filter->priv = 0; */
392
       filter->upAction = *pAction;
393
394
       /* Ok, now we need to simulate the action which would go if this action didn't block it.
395
          XkbSA_SetMods is the one: it is to set modifier' flag up. */
396
       {
397
           XkbStateRec fake_state = xkbi->state;
398
           XkbAction act;
399
400
           fake_state.mods = 0;
401
           act = XkbGetKeyAction(xkbi, &fake_state, keycode);
402
403
           /* KLUDGE: XkbSA_SetMods only? */
404
           if (act.type == XkbSA_SetMods) { 
405
               XkbFilterPtr filter = _XkbNextFreeFilter(xkbi);
406
               sendEvent = _XkbFilterSetState(xkbi,filter,keycode,&act);
407
           }
408
       }
409
    }
410
    else {
411
       /* do nothing if some button else is pressed */
412
       if (!pAction)
413
           xkbUpdateLockedGroup(xkbi, &filter->upAction);
414
       filter->active = 0;
367
    }
415
    }
416
    return sendEvent;
417
}
418
419
static int
420
_XkbFilterLockMods(    XkbSrvInfoPtr   xkbi,
421
                       XkbFilterPtr    filter,
422
                       unsigned        keycode,
423
                       XkbAction *     pAction)
424
{
368
    if (filter->keycode == 0) { /* initial press */
425
    if (filter->keycode == 0) { /* initial press */
369
        filter->keycode = keycode;
426
        filter->keycode = keycode;
370
        filter->active = 1;
427
        filter->active = 1;
371
        filter->filterOthers = 0;
428
        filter->filterOthers = 0;
372
        filter->priv = xkbi->state.locked_mods & pAction->mods.mask;
429
        filter->priv = xkbi->state.locked_mods & pAction->mods.mask;
373
        filter->filter = _XkbFilterLockState;
430
        filter->filter = _XkbFilterLockMods;
374
        filter->upAction = *pAction;
431
        filter->upAction = *pAction;
375
        if (!(filter->upAction.mods.flags & XkbSA_LockNoLock))
432
        if (!(filter->upAction.mods.flags & XkbSA_LockNoLock))
376
            xkbi->state.locked_mods |= pAction->mods.mask;
433
            xkbi->state.locked_mods |= pAction->mods.mask;
Lines 1244-1252 Link Here
1244
        *sendEvent = _XkbFilterLatchState(xkbi, filter, key, act);
1301
        *sendEvent = _XkbFilterLatchState(xkbi, filter, key, act);
1245
        break;
1302
        break;
1246
    case XkbSA_LockMods:
1303
    case XkbSA_LockMods:
1304
        filter = _XkbNextFreeFilter(xkbi);
1305
        *sendEvent = _XkbFilterLockMods(xkbi, filter, key, act);
1306
        break;
1247
    case XkbSA_LockGroup:
1307
    case XkbSA_LockGroup:
1248
        filter = _XkbNextFreeFilter(xkbi);
1308
        filter = _XkbNextFreeFilter(xkbi);
1249
        *sendEvent = _XkbFilterLockState(xkbi, filter, key, act);
1309
        *sendEvent = _XkbFilterLockGroup(xkbi, filter, key, act);
1250
        break;
1310
        break;
1251
    case XkbSA_ISOLock:
1311
    case XkbSA_ISOLock:
1252
        filter = _XkbNextFreeFilter(xkbi);
1312
        filter = _XkbNextFreeFilter(xkbi);

Return to bug 379827