Lines Matching +full:3 +full:- +full:wire
28 #include <dix-config.h>
42 #include "protocol-versions.h"
62 client->errorValue = _XkbErrCode2(why, id);\
83 CHK_ATOM_ONLY2(a,client->errorValue,BadAtom)
99 CHK_ATOM_OR_NONE2(a,client->errorValue,BadAtom)
115 CHK_MASK_LEGAL2(err,mask,legal,client->errorValue,BadValue)
119 client->errorValue= _XkbErrCode2((err),((value)&(~(affect))));\
125 client->errorValue= _XkbErrCode2((err),((m1)&(m2)));\
130 if (((unsigned)(first)+(num)-1)>(x)->max_key_code) {\
131 (ev)=_XkbErrCode4(err,(first),(num),(x)->max_key_code);\
134 else if ( (first)<(x)->min_key_code ) {\
135 (ev)=_XkbErrCode3(err+1,(first),xkb->min_key_code);\
140 CHK_KEY_RANGE2(err,first,num,x,client->errorValue,BadValue)
143 if (((unsigned)(first)+(num)-1)>(r)->maxKeyCode) {\
144 (ev)=_XkbErrCode4(err,(first),(num),(r)->maxKeyCode);\
147 else if ( (first)<(r)->minKeyCode ) {\
148 (ev)=_XkbErrCode3(err+1,(first),(r)->minKeyCode);\
153 CHK_REQ_KEY_RANGE2(err,first,num,r,client->errorValue,BadValue)
163 cfrom < cstuff + ((size_t)client->req_len << 2) && in _XkbCheckRequestBounds()
165 cto <= cstuff + ((size_t)client->req_len << 2); in _XkbCheckRequestBounds()
178 if (stuff->wantedMajor != SERVER_XKB_MAJOR_VERSION) { in ProcXkbUseExtension()
179 /* pre-release version 0.65 is compatible with 1.00 */ in ProcXkbUseExtension()
181 (stuff->wantedMajor == 0) && (stuff->wantedMinor == 65)); in ProcXkbUseExtension()
186 if ((supported) && (!(client->xkbClientFlags & _XkbClientInitialized))) { in ProcXkbUseExtension()
187 client->xkbClientFlags = _XkbClientInitialized; in ProcXkbUseExtension()
188 if (stuff->wantedMajor == 0) in ProcXkbUseExtension()
189 client->xkbClientFlags |= _XkbClientIsAncient; in ProcXkbUseExtension()
194 client->index, (long) client->clientAsMask, stuff->wantedMajor, in ProcXkbUseExtension()
195 stuff->wantedMinor, SERVER_XKB_MAJOR_VERSION, in ProcXkbUseExtension()
201 .sequenceNumber = client->sequence, in ProcXkbUseExtension()
206 if (client->swapped) { in ProcXkbUseExtension()
228 if (!(client->xkbClientFlags & _XkbClientInitialized)) in ProcXkbSelectEvents()
231 CHK_ANY_DEVICE(dev, stuff->deviceSpec, client, DixUseAccess); in ProcXkbSelectEvents()
233 if (((stuff->affectWhich & XkbMapNotifyMask) != 0) && (stuff->affectMap)) { in ProcXkbSelectEvents()
234 client->mapNotifyMask &= ~stuff->affectMap; in ProcXkbSelectEvents()
235 client->mapNotifyMask |= (stuff->affectMap & stuff->map); in ProcXkbSelectEvents()
237 if ((stuff->affectWhich & (~XkbMapNotifyMask)) == 0) in ProcXkbSelectEvents()
242 XID id = FakeClientID(client->index); in ProcXkbSelectEvents()
257 dataLeft = (stuff->length * 4) - SIZEOF(xkbSelectEventsReq); in ProcXkbSelectEvents()
258 maskLeft = (stuff->affectWhich & (~XkbMapNotifyMask)); in ProcXkbSelectEvents()
265 to.c16 = &client->newKeyboardNotifyMask; in ProcXkbSelectEvents()
270 to.c16 = &masks->stateNotifyMask; in ProcXkbSelectEvents()
275 to.c32 = &masks->ctrlsNotifyMask; in ProcXkbSelectEvents()
280 to.c32 = &masks->iStateNotifyMask; in ProcXkbSelectEvents()
285 to.c32 = &masks->iMapNotifyMask; in ProcXkbSelectEvents()
290 to.c16 = &masks->namesNotifyMask; in ProcXkbSelectEvents()
295 to.c8 = &masks->compatNotifyMask; in ProcXkbSelectEvents()
300 to.c8 = &masks->bellNotifyMask; in ProcXkbSelectEvents()
305 to.c8 = &masks->actionMessageMask; in ProcXkbSelectEvents()
310 to.c16 = &masks->accessXNotifyMask; in ProcXkbSelectEvents()
315 to.c16 = &masks->extDevNotifyMask; in ProcXkbSelectEvents()
320 client->errorValue = _XkbErrCode2(33, bit); in ProcXkbSelectEvents()
324 if (stuff->clear & bit) { in ProcXkbSelectEvents()
332 else if (stuff->selectAll & bit) { in ProcXkbSelectEvents()
363 dataLeft -= (size * 2); in ProcXkbSelectEvents()
394 k = dev->kbdfeed; in _XkbBell()
396 for (k = dev->kbdfeed; k; k = k->next) { in _XkbBell()
397 if (k->ctrl.id == bellID) in _XkbBell()
402 client->errorValue = _XkbErrCode2(0x5, bellID); in _XkbBell()
405 base = k->ctrl.bell; in _XkbBell()
406 ctrl = (void *) &(k->ctrl); in _XkbBell()
407 oldPitch = k->ctrl.bell_pitch; in _XkbBell()
408 oldDuration = k->ctrl.bell_duration; in _XkbBell()
410 if (pitch == -1) in _XkbBell()
411 k->ctrl.bell_pitch = defaultKeyboardControl.bell_pitch; in _XkbBell()
413 k->ctrl.bell_pitch = pitch; in _XkbBell()
416 if (duration == -1) in _XkbBell()
417 k->ctrl.bell_duration = defaultKeyboardControl.bell_duration; in _XkbBell()
419 k->ctrl.bell_duration = duration; in _XkbBell()
426 b = dev->bell; in _XkbBell()
428 for (b = dev->bell; b; b = b->next) { in _XkbBell()
429 if (b->ctrl.id == bellID) in _XkbBell()
434 client->errorValue = _XkbErrCode2(0x6, bellID); in _XkbBell()
437 base = b->ctrl.percent; in _XkbBell()
438 ctrl = (void *) &(b->ctrl); in _XkbBell()
439 oldPitch = b->ctrl.pitch; in _XkbBell()
440 oldDuration = b->ctrl.duration; in _XkbBell()
442 if (pitch == -1) in _XkbBell()
443 b->ctrl.pitch = defaultKeyboardControl.bell_pitch; in _XkbBell()
445 b->ctrl.pitch = pitch; in _XkbBell()
448 if (duration == -1) in _XkbBell()
449 b->ctrl.duration = defaultKeyboardControl.bell_duration; in _XkbBell()
451 b->ctrl.duration = duration; in _XkbBell()
455 client->errorValue = _XkbErrCode2(0x7, bellClass); in _XkbBell()
463 newPercent = base - newPercent + percent; in _XkbBell()
473 k->ctrl.bell_pitch = oldPitch; in _XkbBell()
475 k->ctrl.bell_duration = oldDuration; in _XkbBell()
482 b->ctrl.pitch = oldPitch; in _XkbBell()
484 b->ctrl.duration = oldDuration; in _XkbBell()
501 if (!(client->xkbClientFlags & _XkbClientInitialized)) in ProcXkbBell()
504 CHK_BELL_DEVICE(dev, stuff->deviceSpec, client, DixBellAccess); in ProcXkbBell()
505 CHK_ATOM_OR_NONE(stuff->name); in ProcXkbBell()
507 /* device-independent checks request for sane values */ in ProcXkbBell()
508 if ((stuff->forceSound) && (stuff->eventOnly)) { in ProcXkbBell()
509 client->errorValue = in ProcXkbBell()
510 _XkbErrCode3(0x1, stuff->forceSound, stuff->eventOnly); in ProcXkbBell()
513 if (stuff->percent < -100 || stuff->percent > 100) { in ProcXkbBell()
514 client->errorValue = _XkbErrCode2(0x2, stuff->percent); in ProcXkbBell()
517 if (stuff->duration < -1) { in ProcXkbBell()
518 client->errorValue = _XkbErrCode2(0x3, stuff->duration); in ProcXkbBell()
521 if (stuff->pitch < -1) { in ProcXkbBell()
522 client->errorValue = _XkbErrCode2(0x4, stuff->pitch); in ProcXkbBell()
526 if (stuff->bellClass == XkbDfltXIClass) { in ProcXkbBell()
527 if (dev->kbdfeed != NULL) in ProcXkbBell()
528 stuff->bellClass = KbdFeedbackClass; in ProcXkbBell()
530 stuff->bellClass = BellFeedbackClass; in ProcXkbBell()
533 if (stuff->window != None) { in ProcXkbBell()
534 rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); in ProcXkbBell()
536 client->errorValue = stuff->window; in ProcXkbBell()
552 rc = _XkbBell(client, dev, pWin, stuff->bellClass, stuff->bellID, in ProcXkbBell()
553 stuff->pitch, stuff->duration, stuff->percent, in ProcXkbBell()
554 stuff->forceSound, stuff->eventOnly, stuff->name); in ProcXkbBell()
556 if ((rc == Success) && ((stuff->deviceSpec == XkbUseCoreKbd) || in ProcXkbBell()
557 (stuff->deviceSpec == XkbUseCorePtr))) { in ProcXkbBell()
560 for (other = inputInfo.devices; other; other = other->next) { in ProcXkbBell()
561 if ((other != dev) && other->key && !IsMaster(other) && in ProcXkbBell()
565 _XkbBell(client, other, pWin, stuff->bellClass, in ProcXkbBell()
566 stuff->bellID, stuff->pitch, stuff->duration, in ProcXkbBell()
567 stuff->percent, stuff->forceSound, in ProcXkbBell()
568 stuff->eventOnly, stuff->name); in ProcXkbBell()
589 if (!(client->xkbClientFlags & _XkbClientInitialized)) in ProcXkbGetState()
592 CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess); in ProcXkbGetState()
594 xkb = &dev->key->xkbInfo->state; in ProcXkbGetState()
597 .deviceID = dev->id, in ProcXkbGetState()
598 .sequenceNumber = client->sequence, in ProcXkbGetState()
601 .baseMods = xkb->base_mods, in ProcXkbGetState()
602 .latchedMods = xkb->latched_mods, in ProcXkbGetState()
603 .lockedMods = xkb->locked_mods, in ProcXkbGetState()
604 .group = xkb->group, in ProcXkbGetState()
605 .lockedGroup = xkb->locked_group, in ProcXkbGetState()
606 .baseGroup = xkb->base_group, in ProcXkbGetState()
607 .latchedGroup = xkb->latched_group, in ProcXkbGetState()
608 .compatState = xkb->compat_state, in ProcXkbGetState()
609 .ptrBtnState = xkb->ptr_buttons in ProcXkbGetState()
611 if (client->swapped) { in ProcXkbGetState()
634 if (!(client->xkbClientFlags & _XkbClientInitialized)) in ProcXkbLatchLockState()
637 CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixSetAttrAccess); in ProcXkbLatchLockState()
638 CHK_MASK_MATCH(0x01, stuff->affectModLocks, stuff->modLocks); in ProcXkbLatchLockState()
639 CHK_MASK_MATCH(0x01, stuff->affectModLatches, stuff->modLatches); in ProcXkbLatchLockState()
643 for (tmpd = inputInfo.devices; tmpd; tmpd = tmpd->next) { in ProcXkbLatchLockState()
646 if (!tmpd->key || !tmpd->key->xkbInfo) in ProcXkbLatchLockState()
649 oldState = tmpd->key->xkbInfo->state; in ProcXkbLatchLockState()
650 newState = &tmpd->key->xkbInfo->state; in ProcXkbLatchLockState()
651 if (stuff->affectModLocks) { in ProcXkbLatchLockState()
652 newState->locked_mods &= ~stuff->affectModLocks; in ProcXkbLatchLockState()
653 newState->locked_mods |= in ProcXkbLatchLockState()
654 (stuff->affectModLocks & stuff->modLocks); in ProcXkbLatchLockState()
656 if (status == Success && stuff->lockGroup) in ProcXkbLatchLockState()
657 newState->locked_group = stuff->groupLock; in ProcXkbLatchLockState()
658 if (status == Success && stuff->affectModLatches) in ProcXkbLatchLockState()
659 status = XkbLatchModifiers(tmpd, stuff->affectModLatches, in ProcXkbLatchLockState()
660 stuff->modLatches); in ProcXkbLatchLockState()
661 if (status == Success && stuff->latchGroup) in ProcXkbLatchLockState()
662 status = XkbLatchGroup(tmpd, stuff->groupLatch); in ProcXkbLatchLockState()
667 XkbComputeDerivedState(tmpd->key->xkbInfo); in ProcXkbLatchLockState()
701 if (!(client->xkbClientFlags & _XkbClientInitialized)) in ProcXkbGetControls()
704 CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess); in ProcXkbGetControls()
706 xkb = dev->key->xkbInfo->desc->ctrls; in ProcXkbGetControls()
709 .deviceID = ((DeviceIntPtr) dev)->id, in ProcXkbGetControls()
710 .sequenceNumber = client->sequence, in ProcXkbGetControls()
711 .length = bytes_to_int32(SIZEOF(xkbGetControlsReply) - in ProcXkbGetControls()
713 .mkDfltBtn = xkb->mk_dflt_btn, in ProcXkbGetControls()
714 .numGroups = xkb->num_groups, in ProcXkbGetControls()
715 .groupsWrap = xkb->groups_wrap, in ProcXkbGetControls()
716 .internalMods = xkb->internal.mask, in ProcXkbGetControls()
717 .ignoreLockMods = xkb->ignore_lock.mask, in ProcXkbGetControls()
718 .internalRealMods = xkb->internal.real_mods, in ProcXkbGetControls()
719 .ignoreLockRealMods = xkb->ignore_lock.real_mods, in ProcXkbGetControls()
720 .internalVMods = xkb->internal.vmods, in ProcXkbGetControls()
721 .ignoreLockVMods = xkb->ignore_lock.vmods, in ProcXkbGetControls()
722 .repeatDelay = xkb->repeat_delay, in ProcXkbGetControls()
723 .repeatInterval = xkb->repeat_interval, in ProcXkbGetControls()
724 .slowKeysDelay = xkb->slow_keys_delay, in ProcXkbGetControls()
725 .debounceDelay = xkb->debounce_delay, in ProcXkbGetControls()
726 .mkDelay = xkb->mk_delay, in ProcXkbGetControls()
727 .mkInterval = xkb->mk_interval, in ProcXkbGetControls()
728 .mkTimeToMax = xkb->mk_time_to_max, in ProcXkbGetControls()
729 .mkMaxSpeed = xkb->mk_max_speed, in ProcXkbGetControls()
730 .mkCurve = xkb->mk_curve, in ProcXkbGetControls()
731 .axOptions = xkb->ax_options, in ProcXkbGetControls()
732 .axTimeout = xkb->ax_timeout, in ProcXkbGetControls()
733 .axtOptsMask = xkb->axt_opts_mask, in ProcXkbGetControls()
734 .axtOptsValues = xkb->axt_opts_values, in ProcXkbGetControls()
735 .axtCtrlsMask = xkb->axt_ctrls_mask, in ProcXkbGetControls()
736 .axtCtrlsValues = xkb->axt_ctrls_values, in ProcXkbGetControls()
737 .enabledCtrls = xkb->enabled_ctrls, in ProcXkbGetControls()
739 memcpy(rep.perKeyRepeat, xkb->per_key_repeat, XkbPerKeyBitArraySize); in ProcXkbGetControls()
740 if (client->swapped) { in ProcXkbGetControls()
780 if (!(client->xkbClientFlags & _XkbClientInitialized)) in ProcXkbSetControls()
783 CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixManageAccess); in ProcXkbSetControls()
784 CHK_MASK_LEGAL(0x01, stuff->changeCtrls, XkbAllControlsMask); in ProcXkbSetControls()
786 for (tmpd = inputInfo.devices; tmpd; tmpd = tmpd->next) { in ProcXkbSetControls()
787 if (!tmpd->key || !tmpd->key->xkbInfo) in ProcXkbSetControls()
791 xkbi = tmpd->key->xkbInfo; in ProcXkbSetControls()
792 ctrl = xkbi->desc->ctrls; in ProcXkbSetControls()
796 if (stuff->changeCtrls & XkbInternalModsMask) { in ProcXkbSetControls()
797 CHK_MASK_MATCH(0x02, stuff->affectInternalMods, in ProcXkbSetControls()
798 stuff->internalMods); in ProcXkbSetControls()
799 CHK_MASK_MATCH(0x03, stuff->affectInternalVMods, in ProcXkbSetControls()
800 stuff->internalVMods); in ProcXkbSetControls()
802 new.internal.real_mods &= ~(stuff->affectInternalMods); in ProcXkbSetControls()
803 new.internal.real_mods |= (stuff->affectInternalMods & in ProcXkbSetControls()
804 stuff->internalMods); in ProcXkbSetControls()
805 new.internal.vmods &= ~(stuff->affectInternalVMods); in ProcXkbSetControls()
806 new.internal.vmods |= (stuff->affectInternalVMods & in ProcXkbSetControls()
807 stuff->internalVMods); in ProcXkbSetControls()
809 XkbMaskForVMask(xkbi->desc, new.internal.vmods); in ProcXkbSetControls()
812 if (stuff->changeCtrls & XkbIgnoreLockModsMask) { in ProcXkbSetControls()
813 CHK_MASK_MATCH(0x4, stuff->affectIgnoreLockMods, in ProcXkbSetControls()
814 stuff->ignoreLockMods); in ProcXkbSetControls()
815 CHK_MASK_MATCH(0x5, stuff->affectIgnoreLockVMods, in ProcXkbSetControls()
816 stuff->ignoreLockVMods); in ProcXkbSetControls()
818 new.ignore_lock.real_mods &= ~(stuff->affectIgnoreLockMods); in ProcXkbSetControls()
819 new.ignore_lock.real_mods |= (stuff->affectIgnoreLockMods & in ProcXkbSetControls()
820 stuff->ignoreLockMods); in ProcXkbSetControls()
821 new.ignore_lock.vmods &= ~(stuff->affectIgnoreLockVMods); in ProcXkbSetControls()
822 new.ignore_lock.vmods |= (stuff->affectIgnoreLockVMods & in ProcXkbSetControls()
823 stuff->ignoreLockVMods); in ProcXkbSetControls()
825 XkbMaskForVMask(xkbi->desc, new.ignore_lock.vmods); in ProcXkbSetControls()
828 CHK_MASK_MATCH(0x06, stuff->affectEnabledCtrls, in ProcXkbSetControls()
829 stuff->enabledCtrls); in ProcXkbSetControls()
830 if (stuff->affectEnabledCtrls) { in ProcXkbSetControls()
831 CHK_MASK_LEGAL(0x07, stuff->affectEnabledCtrls, in ProcXkbSetControls()
834 new.enabled_ctrls &= ~(stuff->affectEnabledCtrls); in ProcXkbSetControls()
835 new.enabled_ctrls |= (stuff->affectEnabledCtrls & in ProcXkbSetControls()
836 stuff->enabledCtrls); in ProcXkbSetControls()
839 if (stuff->changeCtrls & XkbRepeatKeysMask) { in ProcXkbSetControls()
840 if (stuff->repeatDelay < 1 || stuff->repeatInterval < 1) { in ProcXkbSetControls()
841 client->errorValue = _XkbErrCode3(0x08, stuff->repeatDelay, in ProcXkbSetControls()
842 stuff->repeatInterval); in ProcXkbSetControls()
846 new.repeat_delay = stuff->repeatDelay; in ProcXkbSetControls()
847 new.repeat_interval = stuff->repeatInterval; in ProcXkbSetControls()
850 if (stuff->changeCtrls & XkbSlowKeysMask) { in ProcXkbSetControls()
851 if (stuff->slowKeysDelay < 1) { in ProcXkbSetControls()
852 client->errorValue = _XkbErrCode2(0x09, in ProcXkbSetControls()
853 stuff->slowKeysDelay); in ProcXkbSetControls()
857 new.slow_keys_delay = stuff->slowKeysDelay; in ProcXkbSetControls()
860 if (stuff->changeCtrls & XkbBounceKeysMask) { in ProcXkbSetControls()
861 if (stuff->debounceDelay < 1) { in ProcXkbSetControls()
862 client->errorValue = _XkbErrCode2(0x0A, in ProcXkbSetControls()
863 stuff->debounceDelay); in ProcXkbSetControls()
867 new.debounce_delay = stuff->debounceDelay; in ProcXkbSetControls()
870 if (stuff->changeCtrls & XkbMouseKeysMask) { in ProcXkbSetControls()
871 if (stuff->mkDfltBtn > XkbMaxMouseKeysBtn) { in ProcXkbSetControls()
872 client->errorValue = _XkbErrCode2(0x0B, stuff->mkDfltBtn); in ProcXkbSetControls()
876 new.mk_dflt_btn = stuff->mkDfltBtn; in ProcXkbSetControls()
879 if (stuff->changeCtrls & XkbMouseKeysAccelMask) { in ProcXkbSetControls()
880 if (stuff->mkDelay < 1 || stuff->mkInterval < 1 || in ProcXkbSetControls()
881 stuff->mkTimeToMax < 1 || stuff->mkMaxSpeed < 1 || in ProcXkbSetControls()
882 stuff->mkCurve < -1000) { in ProcXkbSetControls()
883 client->errorValue = _XkbErrCode2(0x0C, 0); in ProcXkbSetControls()
887 new.mk_delay = stuff->mkDelay; in ProcXkbSetControls()
888 new.mk_interval = stuff->mkInterval; in ProcXkbSetControls()
889 new.mk_time_to_max = stuff->mkTimeToMax; in ProcXkbSetControls()
890 new.mk_max_speed = stuff->mkMaxSpeed; in ProcXkbSetControls()
891 new.mk_curve = stuff->mkCurve; in ProcXkbSetControls()
895 if (stuff->changeCtrls & XkbGroupsWrapMask) { in ProcXkbSetControls()
898 act = XkbOutOfRangeGroupAction(stuff->groupsWrap); in ProcXkbSetControls()
901 num = XkbOutOfRangeGroupNumber(stuff->groupsWrap); in ProcXkbSetControls()
903 client->errorValue = _XkbErrCode3(0x0D, new.num_groups, in ProcXkbSetControls()
911 client->errorValue = _XkbErrCode2(0x0E, act); in ProcXkbSetControls()
915 new.groups_wrap = stuff->groupsWrap; in ProcXkbSetControls()
918 CHK_MASK_LEGAL(0x0F, stuff->axOptions, XkbAX_AllOptionsMask); in ProcXkbSetControls()
919 if (stuff->changeCtrls & XkbAccessXKeysMask) { in ProcXkbSetControls()
920 new.ax_options = stuff->axOptions & XkbAX_AllOptionsMask; in ProcXkbSetControls()
923 if (stuff->changeCtrls & XkbStickyKeysMask) { in ProcXkbSetControls()
925 new.ax_options |= (stuff->axOptions & XkbAX_SKOptionsMask); in ProcXkbSetControls()
928 if (stuff->changeCtrls & XkbAccessXFeedbackMask) { in ProcXkbSetControls()
930 new.ax_options |= (stuff->axOptions & XkbAX_FBOptionsMask); in ProcXkbSetControls()
934 if (stuff->changeCtrls & XkbAccessXTimeoutMask) { in ProcXkbSetControls()
935 if (stuff->axTimeout < 1) { in ProcXkbSetControls()
936 client->errorValue = _XkbErrCode2(0x10, stuff->axTimeout); in ProcXkbSetControls()
939 CHK_MASK_MATCH(0x11, stuff->axtCtrlsMask, in ProcXkbSetControls()
940 stuff->axtCtrlsValues); in ProcXkbSetControls()
941 CHK_MASK_LEGAL(0x12, stuff->axtCtrlsMask, in ProcXkbSetControls()
943 CHK_MASK_MATCH(0x13, stuff->axtOptsMask, stuff->axtOptsValues); in ProcXkbSetControls()
944 CHK_MASK_LEGAL(0x14, stuff->axtOptsMask, XkbAX_AllOptionsMask); in ProcXkbSetControls()
945 new.ax_timeout = stuff->axTimeout; in ProcXkbSetControls()
946 new.axt_ctrls_mask = stuff->axtCtrlsMask; in ProcXkbSetControls()
947 new.axt_ctrls_values = (stuff->axtCtrlsValues & in ProcXkbSetControls()
948 stuff->axtCtrlsMask); in ProcXkbSetControls()
949 new.axt_opts_mask = stuff->axtOptsMask; in ProcXkbSetControls()
950 new.axt_opts_values = (stuff->axtOptsValues & in ProcXkbSetControls()
951 stuff->axtOptsMask); in ProcXkbSetControls()
954 if (stuff->changeCtrls & XkbPerKeyRepeatMask) { in ProcXkbSetControls()
955 memcpy(new.per_key_repeat, stuff->perKeyRepeat, in ProcXkbSetControls()
957 if (xkbi->repeatKey && in ProcXkbSetControls()
958 !BitIsOn(new.per_key_repeat, xkbi->repeatKey)) { in ProcXkbSetControls()
959 AccessXCancelRepeatKey(xkbi, xkbi->repeatKey); in ProcXkbSetControls()
977 XkbUpdateIndicators(tmpd, sli->usesControls, TRUE, NULL, in ProcXkbSetControls()
982 !(ctrl->enabled_ctrls & XkbStickyKeysMask)) in ProcXkbSetControls()
999 if (((rep->present & XkbKeyTypesMask) == 0) || (rep->nTypes < 1) || in XkbSizeKeyTypes()
1000 (!xkb) || (!xkb->map) || (!xkb->map->types)) { in XkbSizeKeyTypes()
1001 rep->present &= ~XkbKeyTypesMask; in XkbSizeKeyTypes()
1002 rep->firstType = rep->nTypes = 0; in XkbSizeKeyTypes()
1005 type = &xkb->map->types[rep->firstType]; in XkbSizeKeyTypes()
1006 for (i = 0; i < rep->nTypes; i++, type++) { in XkbSizeKeyTypes()
1008 if (type->map_count > 0) { in XkbSizeKeyTypes()
1009 len += (type->map_count * SIZEOF(xkbKTMapEntryWireDesc)); in XkbSizeKeyTypes()
1010 if (type->preserve) in XkbSizeKeyTypes()
1011 len += (type->map_count * SIZEOF(xkbModsWireDesc)); in XkbSizeKeyTypes()
1023 xkbKeyTypeWireDesc *wire; in XkbWriteKeyTypes() local
1025 type = &xkb->map->types[rep->firstType]; in XkbWriteKeyTypes()
1026 for (i = 0; i < rep->nTypes; i++, type++) { in XkbWriteKeyTypes()
1029 wire = (xkbKeyTypeWireDesc *) buf; in XkbWriteKeyTypes()
1030 wire->mask = type->mods.mask; in XkbWriteKeyTypes()
1031 wire->realMods = type->mods.real_mods; in XkbWriteKeyTypes()
1032 wire->virtualMods = type->mods.vmods; in XkbWriteKeyTypes()
1033 wire->numLevels = type->num_levels; in XkbWriteKeyTypes()
1034 wire->nMapEntries = type->map_count; in XkbWriteKeyTypes()
1035 wire->preserve = (type->preserve != NULL); in XkbWriteKeyTypes()
1036 if (client->swapped) { in XkbWriteKeyTypes()
1037 swaps(&wire->virtualMods); in XkbWriteKeyTypes()
1040 buf = (char *) &wire[1]; in XkbWriteKeyTypes()
1041 if (wire->nMapEntries > 0) { in XkbWriteKeyTypes()
1046 entry = type->map; in XkbWriteKeyTypes()
1047 for (n = 0; n < type->map_count; n++, ewire++, entry++) { in XkbWriteKeyTypes()
1048 ewire->active = entry->active; in XkbWriteKeyTypes()
1049 ewire->mask = entry->mods.mask; in XkbWriteKeyTypes()
1050 ewire->level = entry->level; in XkbWriteKeyTypes()
1051 ewire->realMods = entry->mods.real_mods; in XkbWriteKeyTypes()
1052 ewire->virtualMods = entry->mods.vmods; in XkbWriteKeyTypes()
1053 if (client->swapped) { in XkbWriteKeyTypes()
1054 swaps(&ewire->virtualMods); in XkbWriteKeyTypes()
1058 if (type->preserve != NULL) { in XkbWriteKeyTypes()
1063 preserve = type->preserve; in XkbWriteKeyTypes()
1064 for (n = 0; n < type->map_count; n++, pwire++, preserve++) { in XkbWriteKeyTypes()
1065 pwire->mask = preserve->mask; in XkbWriteKeyTypes()
1066 pwire->realMods = preserve->real_mods; in XkbWriteKeyTypes()
1067 pwire->virtualMods = preserve->vmods; in XkbWriteKeyTypes()
1068 if (client->swapped) { in XkbWriteKeyTypes()
1069 swaps(&pwire->virtualMods); in XkbWriteKeyTypes()
1086 if (((rep->present & XkbKeySymsMask) == 0) || (rep->nKeySyms < 1) || in XkbSizeKeySyms()
1087 (!xkb) || (!xkb->map) || (!xkb->map->key_sym_map)) { in XkbSizeKeySyms()
1088 rep->present &= ~XkbKeySymsMask; in XkbSizeKeySyms()
1089 rep->firstKeySym = rep->nKeySyms = 0; in XkbSizeKeySyms()
1090 rep->totalSyms = 0; in XkbSizeKeySyms()
1093 len = rep->nKeySyms * SIZEOF(xkbSymMapWireDesc); in XkbSizeKeySyms()
1094 symMap = &xkb->map->key_sym_map[rep->firstKeySym]; in XkbSizeKeySyms()
1095 for (i = nSyms = 0; i < rep->nKeySyms; i++, symMap++) { in XkbSizeKeySyms()
1096 if (symMap->offset != 0) { in XkbSizeKeySyms()
1097 nSymsThisKey = XkbNumGroups(symMap->group_info) * symMap->width; in XkbSizeKeySyms()
1102 rep->totalSyms = nSyms; in XkbSizeKeySyms()
1111 if (((rep->present & XkbVirtualModsMask) == 0) || (rep->virtualMods == 0) || in XkbSizeVirtualMods()
1112 (!xkb) || (!xkb->server)) { in XkbSizeVirtualMods()
1113 rep->present &= ~XkbVirtualModsMask; in XkbSizeVirtualMods()
1114 rep->virtualMods = 0; in XkbSizeVirtualMods()
1118 if (rep->virtualMods & bit) in XkbSizeVirtualMods()
1133 symMap = &xkb->map->key_sym_map[rep->firstKeySym]; in XkbWriteKeySyms()
1134 for (i = 0; i < rep->nKeySyms; i++, symMap++) { in XkbWriteKeySyms()
1136 outMap->ktIndex[0] = symMap->kt_index[0]; in XkbWriteKeySyms()
1137 outMap->ktIndex[1] = symMap->kt_index[1]; in XkbWriteKeySyms()
1138 outMap->ktIndex[2] = symMap->kt_index[2]; in XkbWriteKeySyms()
1139 outMap->ktIndex[3] = symMap->kt_index[3]; in XkbWriteKeySyms()
1140 outMap->groupInfo = symMap->group_info; in XkbWriteKeySyms()
1141 outMap->width = symMap->width; in XkbWriteKeySyms()
1142 outMap->nSyms = symMap->width * XkbNumGroups(symMap->group_info); in XkbWriteKeySyms()
1144 if (outMap->nSyms == 0) in XkbWriteKeySyms()
1147 pSym = &xkb->map->syms[symMap->offset]; in XkbWriteKeySyms()
1148 memcpy((char *) buf, (char *) pSym, outMap->nSyms * 4); in XkbWriteKeySyms()
1149 if (client->swapped) { in XkbWriteKeySyms()
1150 register int nSyms = outMap->nSyms; in XkbWriteKeySyms()
1152 swaps(&outMap->nSyms); in XkbWriteKeySyms()
1153 while (nSyms-- > 0) { in XkbWriteKeySyms()
1159 buf += outMap->nSyms * 4; in XkbWriteKeySyms()
1170 if (((rep->present & XkbKeyActionsMask) == 0) || (rep->nKeyActs < 1) || in XkbSizeKeyActions()
1171 (!xkb) || (!xkb->server) || (!xkb->server->key_acts)) { in XkbSizeKeyActions()
1172 rep->present &= ~XkbKeyActionsMask; in XkbSizeKeyActions()
1173 rep->firstKeyAct = rep->nKeyActs = 0; in XkbSizeKeyActions()
1174 rep->totalActs = 0; in XkbSizeKeyActions()
1177 firstKey = rep->firstKeyAct; in XkbSizeKeyActions()
1178 for (nActs = i = 0; i < rep->nKeyActs; i++) { in XkbSizeKeyActions()
1179 if (xkb->server->key_acts[i + firstKey] != 0) in XkbSizeKeyActions()
1182 len = XkbPaddedSize(rep->nKeyActs) + (nActs * SIZEOF(xkbActionWireDesc)); in XkbSizeKeyActions()
1183 rep->totalActs = nActs; in XkbSizeKeyActions()
1196 for (i = 0; i < rep->nKeyActs; i++) { in XkbWriteKeyActions()
1197 if (xkb->server->key_acts[i + rep->firstKeyAct] == 0) in XkbWriteKeyActions()
1200 numDesc[i] = XkbKeyNumActions(xkb, (i + rep->firstKeyAct)); in XkbWriteKeyActions()
1202 buf += XkbPaddedSize(rep->nKeyActs); in XkbWriteKeyActions()
1205 for (i = 0; i < rep->nKeyActs; i++) { in XkbWriteKeyActions()
1206 if (xkb->server->key_acts[i + rep->firstKeyAct] != 0) { in XkbWriteKeyActions()
1209 num = XkbKeyNumActions(xkb, (i + rep->firstKeyAct)); in XkbWriteKeyActions()
1211 (char *) XkbKeyActionsPtr(xkb, (i + rep->firstKeyAct)), in XkbWriteKeyActions()
1226 if (((rep->present & XkbKeyBehaviorsMask) == 0) || (rep->nKeyBehaviors < 1) in XkbSizeKeyBehaviors()
1227 || (!xkb) || (!xkb->server) || (!xkb->server->behaviors)) { in XkbSizeKeyBehaviors()
1228 rep->present &= ~XkbKeyBehaviorsMask; in XkbSizeKeyBehaviors()
1229 rep->firstKeyBehavior = rep->nKeyBehaviors = 0; in XkbSizeKeyBehaviors()
1230 rep->totalKeyBehaviors = 0; in XkbSizeKeyBehaviors()
1233 bhv = &xkb->server->behaviors[rep->firstKeyBehavior]; in XkbSizeKeyBehaviors()
1234 for (nBhvr = i = 0; i < rep->nKeyBehaviors; i++, bhv++) { in XkbSizeKeyBehaviors()
1235 if (bhv->type != XkbKB_Default) in XkbSizeKeyBehaviors()
1239 rep->totalKeyBehaviors = nBhvr; in XkbSizeKeyBehaviors()
1248 xkbBehaviorWireDesc *wire; in XkbWriteKeyBehaviors() local
1251 wire = (xkbBehaviorWireDesc *) buf; in XkbWriteKeyBehaviors()
1252 pBhvr = &xkb->server->behaviors[rep->firstKeyBehavior]; in XkbWriteKeyBehaviors()
1253 for (i = 0; i < rep->nKeyBehaviors; i++, pBhvr++) { in XkbWriteKeyBehaviors()
1254 if (pBhvr->type != XkbKB_Default) { in XkbWriteKeyBehaviors()
1255 wire->key = i + rep->firstKeyBehavior; in XkbWriteKeyBehaviors()
1256 wire->type = pBhvr->type; in XkbWriteKeyBehaviors()
1257 wire->data = pBhvr->data; in XkbWriteKeyBehaviors()
1258 wire++; in XkbWriteKeyBehaviors()
1261 buf = (char *) wire; in XkbWriteKeyBehaviors()
1270 if (((rep->present & XkbExplicitComponentsMask) == 0) || in XkbSizeExplicit()
1271 (rep->nKeyExplicit < 1) || (!xkb) || (!xkb->server) || in XkbSizeExplicit()
1272 (!xkb->server->explicit)) { in XkbSizeExplicit()
1273 rep->present &= ~XkbExplicitComponentsMask; in XkbSizeExplicit()
1274 rep->firstKeyExplicit = rep->nKeyExplicit = 0; in XkbSizeExplicit()
1275 rep->totalKeyExplicit = 0; in XkbSizeExplicit()
1278 for (nRtrn = i = 0; i < rep->nKeyExplicit; i++) { in XkbSizeExplicit()
1279 if (xkb->server->explicit[i + rep->firstKeyExplicit] != 0) in XkbSizeExplicit()
1282 rep->totalKeyExplicit = nRtrn; in XkbSizeExplicit()
1283 len = XkbPaddedSize(nRtrn * 2); /* two bytes per non-zero explicit component */ in XkbSizeExplicit()
1296 pExp = &xkb->server->explicit[rep->firstKeyExplicit]; in XkbWriteExplicit()
1297 for (i = 0; i < rep->nKeyExplicit; i++, pExp++) { in XkbWriteExplicit()
1299 *buf++ = i + rep->firstKeyExplicit; in XkbWriteExplicit()
1303 i = XkbPaddedSize(buf - start) - (buf - start); /* pad to word boundary */ in XkbWriteExplicit()
1312 if (((rep->present & XkbModifierMapMask) == 0) || (rep->nModMapKeys < 1) || in XkbSizeModifierMap()
1313 (!xkb) || (!xkb->map) || (!xkb->map->modmap)) { in XkbSizeModifierMap()
1314 rep->present &= ~XkbModifierMapMask; in XkbSizeModifierMap()
1315 rep->firstModMapKey = rep->nModMapKeys = 0; in XkbSizeModifierMap()
1316 rep->totalModMapKeys = 0; in XkbSizeModifierMap()
1319 for (nRtrn = i = 0; i < rep->nModMapKeys; i++) { in XkbSizeModifierMap()
1320 if (xkb->map->modmap[i + rep->firstModMapKey] != 0) in XkbSizeModifierMap()
1323 rep->totalModMapKeys = nRtrn; in XkbSizeModifierMap()
1324 len = XkbPaddedSize(nRtrn * 2); /* two bytes per non-zero modmap component */ in XkbSizeModifierMap()
1337 pMap = &xkb->map->modmap[rep->firstModMapKey]; in XkbWriteModifierMap()
1338 for (i = 0; i < rep->nModMapKeys; i++, pMap++) { in XkbWriteModifierMap()
1340 *buf++ = i + rep->firstModMapKey; in XkbWriteModifierMap()
1344 i = XkbPaddedSize(buf - start) - (buf - start); /* pad to word boundary */ in XkbWriteModifierMap()
1353 if (((rep->present & XkbVirtualModMapMask) == 0) || (rep->nVModMapKeys < 1) in XkbSizeVirtualModMap()
1354 || (!xkb) || (!xkb->server) || (!xkb->server->vmodmap)) { in XkbSizeVirtualModMap()
1355 rep->present &= ~XkbVirtualModMapMask; in XkbSizeVirtualModMap()
1356 rep->firstVModMapKey = rep->nVModMapKeys = 0; in XkbSizeVirtualModMap()
1357 rep->totalVModMapKeys = 0; in XkbSizeVirtualModMap()
1360 for (nRtrn = i = 0; i < rep->nVModMapKeys; i++) { in XkbSizeVirtualModMap()
1361 if (xkb->server->vmodmap[i + rep->firstVModMapKey] != 0) in XkbSizeVirtualModMap()
1364 rep->totalVModMapKeys = nRtrn; in XkbSizeVirtualModMap()
1374 xkbVModMapWireDesc *wire; in XkbWriteVirtualModMap() local
1377 wire = (xkbVModMapWireDesc *) buf; in XkbWriteVirtualModMap()
1378 pMap = &xkb->server->vmodmap[rep->firstVModMapKey]; in XkbWriteVirtualModMap()
1379 for (i = 0; i < rep->nVModMapKeys; i++, pMap++) { in XkbWriteVirtualModMap()
1381 wire->key = i + rep->firstVModMapKey; in XkbWriteVirtualModMap()
1382 wire->vmods = *pMap; in XkbWriteVirtualModMap()
1383 wire++; in XkbWriteVirtualModMap()
1386 return (char *) wire; in XkbWriteVirtualModMap()
1394 rep->minKeyCode = xkb->min_key_code; in XkbComputeGetMapReplySize()
1395 rep->maxKeyCode = xkb->max_key_code; in XkbComputeGetMapReplySize()
1404 rep->length += (len / 4); in XkbComputeGetMapReplySize()
1414 len = (rep->length * 4) - (SIZEOF(xkbGetMapReply) - SIZEOF(xGenericReply)); in XkbSendMap()
1418 if (rep->nTypes > 0) in XkbSendMap()
1420 if (rep->nKeySyms > 0) in XkbSendMap()
1422 if (rep->nKeyActs > 0) in XkbSendMap()
1424 if (rep->totalKeyBehaviors > 0) in XkbSendMap()
1426 if (rep->virtualMods) { in XkbSendMap()
1430 if (rep->virtualMods & bit) { in XkbSendMap()
1431 desc[sz++] = xkb->server->vmods[i]; in XkbSendMap()
1436 if (rep->totalKeyExplicit > 0) in XkbSendMap()
1438 if (rep->totalModMapKeys > 0) in XkbSendMap()
1440 if (rep->totalVModMapKeys > 0) in XkbSendMap()
1442 if ((desc - start) != (len)) { in XkbSendMap()
1445 len, (unsigned long) (desc - start)); in XkbSendMap()
1447 if (client->swapped) { in XkbSendMap()
1448 swaps(&rep->sequenceNumber); in XkbSendMap()
1449 swapl(&rep->length); in XkbSendMap()
1450 swaps(&rep->present); in XkbSendMap()
1451 swaps(&rep->totalSyms); in XkbSendMap()
1452 swaps(&rep->totalActs); in XkbSendMap()
1471 if (!(client->xkbClientFlags & _XkbClientInitialized)) in ProcXkbGetMap()
1474 CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess); in ProcXkbGetMap()
1475 CHK_MASK_OVERLAP(0x01, stuff->full, stuff->partial); in ProcXkbGetMap()
1476 CHK_MASK_LEGAL(0x02, stuff->full, XkbAllMapComponentsMask); in ProcXkbGetMap()
1477 CHK_MASK_LEGAL(0x03, stuff->partial, XkbAllMapComponentsMask); in ProcXkbGetMap()
1479 xkb = dev->key->xkbInfo->desc; in ProcXkbGetMap()
1482 .deviceID = dev->id, in ProcXkbGetMap()
1483 .sequenceNumber = client->sequence, in ProcXkbGetMap()
1484 .length = (SIZEOF(xkbGetMapReply) - SIZEOF(xGenericReply)) >> 2, in ProcXkbGetMap()
1485 .present = stuff->partial | stuff->full, in ProcXkbGetMap()
1486 .minKeyCode = xkb->min_key_code, in ProcXkbGetMap()
1487 .maxKeyCode = xkb->max_key_code in ProcXkbGetMap()
1490 if (stuff->full & XkbKeyTypesMask) { in ProcXkbGetMap()
1492 rep.nTypes = xkb->map->num_types; in ProcXkbGetMap()
1494 else if (stuff->partial & XkbKeyTypesMask) { in ProcXkbGetMap()
1495 if (((unsigned) stuff->firstType + stuff->nTypes) > xkb->map->num_types) { in ProcXkbGetMap()
1496 client->errorValue = _XkbErrCode4(0x04, xkb->map->num_types, in ProcXkbGetMap()
1497 stuff->firstType, stuff->nTypes); in ProcXkbGetMap()
1500 rep.firstType = stuff->firstType; in ProcXkbGetMap()
1501 rep.nTypes = stuff->nTypes; in ProcXkbGetMap()
1505 rep.totalTypes = xkb->map->num_types; in ProcXkbGetMap()
1508 if (stuff->full & XkbKeySymsMask) { in ProcXkbGetMap()
1509 rep.firstKeySym = xkb->min_key_code; in ProcXkbGetMap()
1512 else if (stuff->partial & XkbKeySymsMask) { in ProcXkbGetMap()
1513 CHK_KEY_RANGE(0x05, stuff->firstKeySym, stuff->nKeySyms, xkb); in ProcXkbGetMap()
1514 rep.firstKeySym = stuff->firstKeySym; in ProcXkbGetMap()
1515 rep.nKeySyms = stuff->nKeySyms; in ProcXkbGetMap()
1521 if (stuff->full & XkbKeyActionsMask) { in ProcXkbGetMap()
1522 rep.firstKeyAct = xkb->min_key_code; in ProcXkbGetMap()
1525 else if (stuff->partial & XkbKeyActionsMask) { in ProcXkbGetMap()
1526 CHK_KEY_RANGE(0x07, stuff->firstKeyAct, stuff->nKeyActs, xkb); in ProcXkbGetMap()
1527 rep.firstKeyAct = stuff->firstKeyAct; in ProcXkbGetMap()
1528 rep.nKeyActs = stuff->nKeyActs; in ProcXkbGetMap()
1534 if (stuff->full & XkbKeyBehaviorsMask) { in ProcXkbGetMap()
1535 rep.firstKeyBehavior = xkb->min_key_code; in ProcXkbGetMap()
1538 else if (stuff->partial & XkbKeyBehaviorsMask) { in ProcXkbGetMap()
1539 CHK_KEY_RANGE(0x09, stuff->firstKeyBehavior, stuff->nKeyBehaviors, xkb); in ProcXkbGetMap()
1540 rep.firstKeyBehavior = stuff->firstKeyBehavior; in ProcXkbGetMap()
1541 rep.nKeyBehaviors = stuff->nKeyBehaviors; in ProcXkbGetMap()
1547 if (stuff->full & XkbVirtualModsMask) in ProcXkbGetMap()
1549 else if (stuff->partial & XkbVirtualModsMask) in ProcXkbGetMap()
1550 rep.virtualMods = stuff->virtualMods; in ProcXkbGetMap()
1552 if (stuff->full & XkbExplicitComponentsMask) { in ProcXkbGetMap()
1553 rep.firstKeyExplicit = xkb->min_key_code; in ProcXkbGetMap()
1556 else if (stuff->partial & XkbExplicitComponentsMask) { in ProcXkbGetMap()
1557 CHK_KEY_RANGE(0x0B, stuff->firstKeyExplicit, stuff->nKeyExplicit, xkb); in ProcXkbGetMap()
1558 rep.firstKeyExplicit = stuff->firstKeyExplicit; in ProcXkbGetMap()
1559 rep.nKeyExplicit = stuff->nKeyExplicit; in ProcXkbGetMap()
1565 if (stuff->full & XkbModifierMapMask) { in ProcXkbGetMap()
1566 rep.firstModMapKey = xkb->min_key_code; in ProcXkbGetMap()
1569 else if (stuff->partial & XkbModifierMapMask) { in ProcXkbGetMap()
1570 CHK_KEY_RANGE(0x0D, stuff->firstModMapKey, stuff->nModMapKeys, xkb); in ProcXkbGetMap()
1571 rep.firstModMapKey = stuff->firstModMapKey; in ProcXkbGetMap()
1572 rep.nModMapKeys = stuff->nModMapKeys; in ProcXkbGetMap()
1578 if (stuff->full & XkbVirtualModMapMask) { in ProcXkbGetMap()
1579 rep.firstVModMapKey = xkb->min_key_code; in ProcXkbGetMap()
1582 else if (stuff->partial & XkbVirtualModMapMask) { in ProcXkbGetMap()
1583 CHK_KEY_RANGE(0x0F, stuff->firstVModMapKey, stuff->nVModMapKeys, xkb); in ProcXkbGetMap()
1584 rep.firstVModMapKey = stuff->firstVModMapKey; in ProcXkbGetMap()
1585 rep.nVModMapKeys = stuff->nVModMapKeys; in ProcXkbGetMap()
1608 register xkbKeyTypeWireDesc *wire = *wireRtrn; in CheckKeyTypes() local
1610 if (req->firstType > ((unsigned) xkb->map->num_types)) { in CheckKeyTypes()
1611 *nMapsRtrn = _XkbErrCode3(0x01, req->firstType, xkb->map->num_types); in CheckKeyTypes()
1614 if (req->flags & XkbSetMapResizeTypes) { in CheckKeyTypes()
1615 nMaps = req->firstType + req->nTypes; in CheckKeyTypes()
1617 *nMapsRtrn = _XkbErrCode4(0x02, req->firstType, req->nTypes, 4); in CheckKeyTypes()
1621 else if (req->present & XkbKeyTypesMask) { in CheckKeyTypes()
1622 nMaps = xkb->map->num_types; in CheckKeyTypes()
1623 if ((req->firstType + req->nTypes) > nMaps) { in CheckKeyTypes()
1624 *nMapsRtrn = req->firstType + req->nTypes; in CheckKeyTypes()
1629 *nMapsRtrn = xkb->map->num_types; in CheckKeyTypes()
1630 for (i = 0; i < xkb->map->num_types; i++) { in CheckKeyTypes()
1631 mapWidthRtrn[i] = xkb->map->types[i].num_levels; in CheckKeyTypes()
1636 for (i = 0; i < req->firstType; i++) { in CheckKeyTypes()
1637 mapWidthRtrn[i] = xkb->map->types[i].num_levels; in CheckKeyTypes()
1639 for (i = 0; i < req->nTypes; i++) { in CheckKeyTypes()
1642 if (client->swapped) { in CheckKeyTypes()
1643 swaps(&wire->virtualMods); in CheckKeyTypes()
1645 n = i + req->firstType; in CheckKeyTypes()
1646 width = wire->numLevels; in CheckKeyTypes()
1662 if (wire->nMapEntries > 0) { in CheckKeyTypes()
1666 mapWire = (xkbKTSetMapEntryWireDesc *) &wire[1]; in CheckKeyTypes()
1667 preWire = (xkbModsWireDesc *) &mapWire[wire->nMapEntries]; in CheckKeyTypes()
1668 for (n = 0; n < wire->nMapEntries; n++) { in CheckKeyTypes()
1669 if (client->swapped) { in CheckKeyTypes()
1672 if (mapWire[n].realMods & (~wire->realMods)) { in CheckKeyTypes()
1674 wire->realMods); in CheckKeyTypes()
1677 if (mapWire[n].virtualMods & (~wire->virtualMods)) { in CheckKeyTypes()
1681 if (mapWire[n].level >= wire->numLevels) { in CheckKeyTypes()
1682 *nMapsRtrn = _XkbErrCode4(0x08, n, wire->numLevels, in CheckKeyTypes()
1686 if (wire->preserve) { in CheckKeyTypes()
1687 if (client->swapped) { in CheckKeyTypes()
1702 if (wire->preserve) in CheckKeyTypes()
1703 map = (CARD8 *) &preWire[wire->nMapEntries]; in CheckKeyTypes()
1705 map = (CARD8 *) &mapWire[wire->nMapEntries]; in CheckKeyTypes()
1708 map = (CARD8 *) &wire[1]; in CheckKeyTypes()
1709 mapWidthRtrn[i + req->firstType] = wire->numLevels; in CheckKeyTypes()
1710 wire = (xkbKeyTypeWireDesc *) map; in CheckKeyTypes()
1712 for (i = req->firstType + req->nTypes; i < nMaps; i++) { in CheckKeyTypes()
1713 mapWidthRtrn[i] = xkb->map->types[i].num_levels; in CheckKeyTypes()
1716 *wireRtrn = wire; in CheckKeyTypes()
1730 xkbSymMapWireDesc *wire = *wireRtrn; in CheckKeySyms() local
1732 if (!(XkbKeySymsMask & req->present)) in CheckKeySyms()
1734 CHK_REQ_KEY_RANGE2(0x11, req->firstKeySym, req->nKeySyms, req, (*errorRtrn), in CheckKeySyms()
1736 for (i = 0; i < req->nKeySyms; i++) { in CheckKeySyms()
1740 if (client->swapped) { in CheckKeySyms()
1741 swaps(&wire->nSyms); in CheckKeySyms()
1743 nG = XkbNumGroups(wire->groupInfo); in CheckKeySyms()
1745 *errorRtrn = _XkbErrCode3(0x14, i + req->firstKeySym, nG); in CheckKeySyms()
1752 if (wire->ktIndex[g] >= (unsigned) nTypes) { in CheckKeySyms()
1753 *errorRtrn = _XkbErrCode4(0x15, i + req->firstKeySym, g, in CheckKeySyms()
1754 wire->ktIndex[g]); in CheckKeySyms()
1757 if (mapWidths[wire->ktIndex[g]] > w) in CheckKeySyms()
1758 w = mapWidths[wire->ktIndex[g]]; in CheckKeySyms()
1760 if (wire->width != w) { in CheckKeySyms()
1762 _XkbErrCode3(0x16, i + req->firstKeySym, wire->width); in CheckKeySyms()
1766 symsPerKey[i + req->firstKeySym] = w; in CheckKeySyms()
1767 if (w != wire->nSyms) { in CheckKeySyms()
1769 _XkbErrCode4(0x16, i + req->firstKeySym, wire->nSyms, w); in CheckKeySyms()
1773 else if (wire->nSyms != 0) { in CheckKeySyms()
1774 *errorRtrn = _XkbErrCode3(0x17, i + req->firstKeySym, wire->nSyms); in CheckKeySyms()
1777 pSyms = (KeySym *) &wire[1]; in CheckKeySyms()
1778 wire = (xkbSymMapWireDesc *) &pSyms[wire->nSyms]; in CheckKeySyms()
1781 map = &xkb->map->key_sym_map[i]; in CheckKeySyms()
1782 for (; i <= (unsigned) xkb->max_key_code; i++, map++) { in CheckKeySyms()
1787 if (map->kt_index[g] >= (unsigned) nTypes) { in CheckKeySyms()
1788 *errorRtrn = _XkbErrCode4(0x18, i, g, map->kt_index[g]); in CheckKeySyms()
1791 if (mapWidths[map->kt_index[g]] > w) in CheckKeySyms()
1792 w = mapWidths[map->kt_index[g]]; in CheckKeySyms()
1796 *wireRtrn = wire; in CheckKeySyms()
1808 CARD8 *wire = *wireRtrn; in CheckKeyActions() local
1811 if (!(XkbKeyActionsMask & req->present)) in CheckKeyActions()
1813 CHK_REQ_KEY_RANGE2(0x21, req->firstKeyAct, req->nKeyActs, req, (*nActsRtrn), in CheckKeyActions()
1815 for (nActs = i = 0; i < req->nKeyActs; i++) { in CheckKeyActions()
1816 if (wire[0] != 0) { in CheckKeyActions()
1817 if (wire[0] == symsPerKey[i + req->firstKeyAct]) in CheckKeyActions()
1818 nActs += wire[0]; in CheckKeyActions()
1820 *nActsRtrn = _XkbErrCode3(0x23, i + req->firstKeyAct, wire[0]); in CheckKeyActions()
1824 wire++; in CheckKeyActions()
1826 if (req->nKeyActs % 4) in CheckKeyActions()
1827 wire += 4 - (req->nKeyActs % 4); in CheckKeyActions()
1828 *wireRtrn = (CARD8 *) (((XkbAnyAction *) wire) + nActs); in CheckKeyActions()
1838 register xkbBehaviorWireDesc *wire = *wireRtrn; in CheckKeyBehaviors() local
1839 register XkbServerMapPtr server = xkb->server; in CheckKeyBehaviors()
1843 if (((req->present & XkbKeyBehaviorsMask) == 0) || (req->nKeyBehaviors < 1)) { in CheckKeyBehaviors()
1844 req->present &= ~XkbKeyBehaviorsMask; in CheckKeyBehaviors()
1845 req->nKeyBehaviors = 0; in CheckKeyBehaviors()
1848 first = req->firstKeyBehavior; in CheckKeyBehaviors()
1849 last = req->firstKeyBehavior + req->nKeyBehaviors - 1; in CheckKeyBehaviors()
1850 if (first < req->minKeyCode) { in CheckKeyBehaviors()
1851 *errorRtrn = _XkbErrCode3(0x31, first, req->minKeyCode); in CheckKeyBehaviors()
1854 if (last > req->maxKeyCode) { in CheckKeyBehaviors()
1855 *errorRtrn = _XkbErrCode3(0x32, last, req->maxKeyCode); in CheckKeyBehaviors()
1859 for (i = 0; i < req->totalKeyBehaviors; i++, wire++) { in CheckKeyBehaviors()
1860 if ((wire->key < first) || (wire->key > last)) { in CheckKeyBehaviors()
1861 *errorRtrn = _XkbErrCode4(0x33, first, last, wire->key); in CheckKeyBehaviors()
1864 if ((wire->type & XkbKB_Permanent) && in CheckKeyBehaviors()
1865 ((server->behaviors[wire->key].type != wire->type) || in CheckKeyBehaviors()
1866 (server->behaviors[wire->key].data != wire->data))) { in CheckKeyBehaviors()
1867 *errorRtrn = _XkbErrCode3(0x33, wire->key, wire->type); in CheckKeyBehaviors()
1870 if ((wire->type == XkbKB_RadioGroup) && in CheckKeyBehaviors()
1871 ((wire->data & (~XkbKB_RGAllowNone)) > XkbMaxRadioGroups)) { in CheckKeyBehaviors()
1872 *errorRtrn = _XkbErrCode4(0x34, wire->key, wire->data, in CheckKeyBehaviors()
1876 if ((wire->type == XkbKB_Overlay1) || (wire->type == XkbKB_Overlay2)) { in CheckKeyBehaviors()
1877 CHK_KEY_RANGE2(0x35, wire->key, 1, xkb, *errorRtrn, 0); in CheckKeyBehaviors()
1880 *wireRtrn = wire; in CheckKeyBehaviors()
1888 register CARD8 *wire = *wireRtrn; in CheckVirtualMods() local
1891 if (((req->present & XkbVirtualModsMask) == 0) || (req->virtualMods == 0)) in CheckVirtualMods()
1894 if (req->virtualMods & bit) in CheckVirtualMods()
1897 *wireRtrn = (wire + XkbPaddedSize(nMods)); in CheckVirtualMods()
1905 register CARD8 *wire = *wireRtrn; in CheckKeyExplicit() local
1910 if (((req->present & XkbExplicitComponentsMask) == 0) || in CheckKeyExplicit()
1911 (req->nKeyExplicit < 1)) { in CheckKeyExplicit()
1912 req->present &= ~XkbExplicitComponentsMask; in CheckKeyExplicit()
1913 req->nKeyExplicit = 0; in CheckKeyExplicit()
1916 first = req->firstKeyExplicit; in CheckKeyExplicit()
1917 last = first + req->nKeyExplicit - 1; in CheckKeyExplicit()
1918 if (first < req->minKeyCode) { in CheckKeyExplicit()
1919 *errorRtrn = _XkbErrCode3(0x51, first, req->minKeyCode); in CheckKeyExplicit()
1922 if (last > req->maxKeyCode) { in CheckKeyExplicit()
1923 *errorRtrn = _XkbErrCode3(0x52, last, req->maxKeyCode); in CheckKeyExplicit()
1926 start = wire; in CheckKeyExplicit()
1927 for (i = 0; i < req->totalKeyExplicit; i++, wire += 2) { in CheckKeyExplicit()
1928 if ((wire[0] < first) || (wire[0] > last)) { in CheckKeyExplicit()
1929 *errorRtrn = _XkbErrCode4(0x53, first, last, wire[0]); in CheckKeyExplicit()
1932 if (wire[1] & (~XkbAllExplicitMask)) { in CheckKeyExplicit()
1933 *errorRtrn = _XkbErrCode3(0x52, ~XkbAllExplicitMask, wire[1]); in CheckKeyExplicit()
1937 wire += XkbPaddedSize(wire - start) - (wire - start); in CheckKeyExplicit()
1938 *wireRtrn = wire; in CheckKeyExplicit()
1946 register CARD8 *wire = *wireRtrn; in CheckModifierMap() local
1951 if (((req->present & XkbModifierMapMask) == 0) || (req->nModMapKeys < 1)) { in CheckModifierMap()
1952 req->present &= ~XkbModifierMapMask; in CheckModifierMap()
1953 req->nModMapKeys = 0; in CheckModifierMap()
1956 first = req->firstModMapKey; in CheckModifierMap()
1957 last = first + req->nModMapKeys - 1; in CheckModifierMap()
1958 if (first < req->minKeyCode) { in CheckModifierMap()
1959 *errRtrn = _XkbErrCode3(0x61, first, req->minKeyCode); in CheckModifierMap()
1962 if (last > req->maxKeyCode) { in CheckModifierMap()
1963 *errRtrn = _XkbErrCode3(0x62, last, req->maxKeyCode); in CheckModifierMap()
1966 start = wire; in CheckModifierMap()
1967 for (i = 0; i < req->totalModMapKeys; i++, wire += 2) { in CheckModifierMap()
1968 if ((wire[0] < first) || (wire[0] > last)) { in CheckModifierMap()
1969 *errRtrn = _XkbErrCode4(0x63, first, last, wire[0]); in CheckModifierMap()
1973 wire += XkbPaddedSize(wire - start) - (wire - start); in CheckModifierMap()
1974 *wireRtrn = wire; in CheckModifierMap()
1983 register xkbVModMapWireDesc *wire = *wireRtrn; in CheckVirtualModMap() local
1987 if (((req->present & XkbVirtualModMapMask) == 0) || (req->nVModMapKeys < 1)) { in CheckVirtualModMap()
1988 req->present &= ~XkbVirtualModMapMask; in CheckVirtualModMap()
1989 req->nVModMapKeys = 0; in CheckVirtualModMap()
1992 first = req->firstVModMapKey; in CheckVirtualModMap()
1993 last = first + req->nVModMapKeys - 1; in CheckVirtualModMap()
1994 if (first < req->minKeyCode) { in CheckVirtualModMap()
1995 *errRtrn = _XkbErrCode3(0x71, first, req->minKeyCode); in CheckVirtualModMap()
1998 if (last > req->maxKeyCode) { in CheckVirtualModMap()
1999 *errRtrn = _XkbErrCode3(0x72, last, req->maxKeyCode); in CheckVirtualModMap()
2002 for (i = 0; i < req->totalVModMapKeys; i++, wire++) { in CheckVirtualModMap()
2003 if ((wire->key < first) || (wire->key > last)) { in CheckVirtualModMap()
2004 *errRtrn = _XkbErrCode4(0x73, first, last, wire->key); in CheckVirtualModMap()
2008 *wireRtrn = wire; in CheckVirtualModMap()
2015 xkbKeyTypeWireDesc * wire, XkbChangesPtr changes) in SetKeyTypes() argument
2021 if ((unsigned) (req->firstType + req->nTypes) > xkb->map->size_types) { in SetKeyTypes()
2022 i = req->firstType + req->nTypes; in SetKeyTypes()
2027 if ((unsigned) (req->firstType + req->nTypes) > xkb->map->num_types) in SetKeyTypes()
2028 xkb->map->num_types = req->firstType + req->nTypes; in SetKeyTypes()
2030 for (i = 0; i < req->nTypes; i++) { in SetKeyTypes()
2034 if (XkbResizeKeyType(xkb, i + req->firstType, wire->nMapEntries, in SetKeyTypes()
2035 wire->preserve, wire->numLevels) != Success) { in SetKeyTypes()
2038 pOld = &xkb->map->types[i + req->firstType]; in SetKeyTypes()
2039 map = (CARD8 *) &wire[1]; in SetKeyTypes()
2041 pOld->mods.real_mods = wire->realMods; in SetKeyTypes()
2042 pOld->mods.vmods = wire->virtualMods; in SetKeyTypes()
2043 pOld->num_levels = wire->numLevels; in SetKeyTypes()
2044 pOld->map_count = wire->nMapEntries; in SetKeyTypes()
2046 pOld->mods.mask = pOld->mods.real_mods | in SetKeyTypes()
2047 XkbMaskForVMask(xkb, pOld->mods.vmods); in SetKeyTypes()
2049 if (wire->nMapEntries) { in SetKeyTypes()
2055 preWire = (xkbModsWireDesc *) &mapWire[wire->nMapEntries]; in SetKeyTypes()
2056 for (n = 0; n < wire->nMapEntries; n++) { in SetKeyTypes()
2057 pOld->map[n].active = 1; in SetKeyTypes()
2058 pOld->map[n].mods.mask = mapWire[n].realMods; in SetKeyTypes()
2059 pOld->map[n].mods.real_mods = mapWire[n].realMods; in SetKeyTypes()
2060 pOld->map[n].mods.vmods = mapWire[n].virtualMods; in SetKeyTypes()
2061 pOld->map[n].level = mapWire[n].level; in SetKeyTypes()
2064 pOld->map[n].active = (tmp != 0); in SetKeyTypes()
2065 pOld->map[n].mods.mask |= tmp; in SetKeyTypes()
2067 if (wire->preserve) { in SetKeyTypes()
2068 pOld->preserve[n].real_mods = preWire[n].realMods; in SetKeyTypes()
2069 pOld->preserve[n].vmods = preWire[n].virtualMods; in SetKeyTypes()
2071 pOld->preserve[n].mask = preWire[n].realMods | tmp; in SetKeyTypes()
2074 if (wire->preserve) in SetKeyTypes()
2075 map = (CARD8 *) &preWire[wire->nMapEntries]; in SetKeyTypes()
2077 map = (CARD8 *) &mapWire[wire->nMapEntries]; in SetKeyTypes()
2080 map = (CARD8 *) &wire[1]; in SetKeyTypes()
2081 wire = (xkbKeyTypeWireDesc *) map; in SetKeyTypes()
2083 first = req->firstType; in SetKeyTypes()
2084 last = first + req->nTypes - 1; /* last changed type */ in SetKeyTypes()
2085 if (changes->map.changed & XkbKeyTypesMask) { in SetKeyTypes()
2088 oldLast = changes->map.first_type + changes->map.num_types - 1; in SetKeyTypes()
2089 if (changes->map.first_type < first) in SetKeyTypes()
2090 first = changes->map.first_type; in SetKeyTypes()
2094 changes->map.changed |= XkbKeyTypesMask; in SetKeyTypes()
2095 changes->map.first_type = first; in SetKeyTypes()
2096 changes->map.num_types = (last - first) + 1; in SetKeyTypes()
2097 return (char *) wire; in SetKeyTypes()
2104 xkbSymMapWireDesc * wire, XkbChangesPtr changes, DeviceIntPtr dev) in SetKeySyms() argument
2112 oldMap = &xkb->map->key_sym_map[req->firstKeySym]; in SetKeySyms()
2113 for (i = 0; i < req->nKeySyms; i++, oldMap++) { in SetKeySyms()
2114 pSyms = (KeySym *) &wire[1]; in SetKeySyms()
2115 if (wire->nSyms > 0) { in SetKeySyms()
2116 newSyms = XkbResizeKeySyms(xkb, i + req->firstKeySym, wire->nSyms); in SetKeySyms()
2117 for (s = 0; s < wire->nSyms; s++) { in SetKeySyms()
2120 if (client->swapped) { in SetKeySyms()
2121 for (s = 0; s < wire->nSyms; s++) { in SetKeySyms()
2126 if (XkbKeyHasActions(xkb, i + req->firstKeySym)) in SetKeySyms()
2127 XkbResizeKeyActions(xkb, i + req->firstKeySym, in SetKeySyms()
2128 XkbNumGroups(wire->groupInfo) * wire->width); in SetKeySyms()
2129 oldMap->kt_index[0] = wire->ktIndex[0]; in SetKeySyms()
2130 oldMap->kt_index[1] = wire->ktIndex[1]; in SetKeySyms()
2131 oldMap->kt_index[2] = wire->ktIndex[2]; in SetKeySyms()
2132 oldMap->kt_index[3] = wire->ktIndex[3]; in SetKeySyms()
2133 oldMap->group_info = wire->groupInfo; in SetKeySyms()
2134 oldMap->width = wire->width; in SetKeySyms()
2135 wire = (xkbSymMapWireDesc *) &pSyms[wire->nSyms]; in SetKeySyms()
2137 first = req->firstKeySym; in SetKeySyms()
2138 last = first + req->nKeySyms - 1; in SetKeySyms()
2139 if (changes->map.changed & XkbKeySymsMask) { in SetKeySyms()
2141 (changes->map.first_key_sym + changes->map.num_key_syms - 1); in SetKeySyms()
2142 if (changes->map.first_key_sym < first) in SetKeySyms()
2143 first = changes->map.first_key_sym; in SetKeySyms()
2147 changes->map.changed |= XkbKeySymsMask; in SetKeySyms()
2148 changes->map.first_key_sym = first; in SetKeySyms()
2149 changes->map.num_key_syms = (last - first + 1); in SetKeySyms()
2152 for (i = xkb->min_key_code; i <= xkb->max_key_code; i++) { in SetKeySyms()
2156 if (s != xkb->ctrls->num_groups) { in SetKeySyms()
2164 old = *xkb->ctrls; in SetKeySyms()
2165 xkb->ctrls->num_groups = s; in SetKeySyms()
2166 if (XkbComputeControlsNotify(dev, &old, xkb->ctrls, &cn, FALSE)) in SetKeySyms()
2169 return (char *) wire; in SetKeySyms()
2174 xkbSetMapReq * req, CARD8 *wire, XkbChangesPtr changes) in SetKeyActions() argument
2177 CARD8 *nActs = wire; in SetKeyActions()
2180 wire += XkbPaddedSize(req->nKeyActs); in SetKeyActions()
2181 for (i = 0; i < req->nKeyActs; i++) { in SetKeyActions()
2183 xkb->server->key_acts[i + req->firstKeyAct] = 0; in SetKeyActions()
2185 newActs = XkbResizeKeyActions(xkb, i + req->firstKeyAct, nActs[i]); in SetKeyActions()
2186 memcpy((char *) newActs, (char *) wire, in SetKeyActions()
2188 wire += nActs[i] * SIZEOF(xkbActionWireDesc); in SetKeyActions()
2191 first = req->firstKeyAct; in SetKeyActions()
2192 last = (first + req->nKeyActs - 1); in SetKeyActions()
2193 if (changes->map.changed & XkbKeyActionsMask) { in SetKeyActions()
2196 oldLast = changes->map.first_key_act + changes->map.num_key_acts - 1; in SetKeyActions()
2197 if (changes->map.first_key_act < first) in SetKeyActions()
2198 first = changes->map.first_key_act; in SetKeyActions()
2202 changes->map.changed |= XkbKeyActionsMask; in SetKeyActions()
2203 changes->map.first_key_act = first; in SetKeyActions()
2204 changes->map.num_key_acts = (last - first + 1); in SetKeyActions()
2205 return (char *) wire; in SetKeyActions()
2211 xkbBehaviorWireDesc * wire, XkbChangesPtr changes) in SetKeyBehaviors() argument
2214 int maxRG = -1; in SetKeyBehaviors()
2215 XkbDescPtr xkb = xkbi->desc; in SetKeyBehaviors()
2216 XkbServerMapPtr server = xkb->server; in SetKeyBehaviors()
2219 first = req->firstKeyBehavior; in SetKeyBehaviors()
2220 last = req->firstKeyBehavior + req->nKeyBehaviors - 1; in SetKeyBehaviors()
2221 memset(&server->behaviors[first], 0, in SetKeyBehaviors()
2222 req->nKeyBehaviors * sizeof(XkbBehavior)); in SetKeyBehaviors()
2223 for (i = 0; i < req->totalKeyBehaviors; i++) { in SetKeyBehaviors()
2224 if ((server->behaviors[wire->key].type & XkbKB_Permanent) == 0) { in SetKeyBehaviors()
2225 server->behaviors[wire->key].type = wire->type; in SetKeyBehaviors()
2226 server->behaviors[wire->key].data = wire->data; in SetKeyBehaviors()
2227 if ((wire->type == XkbKB_RadioGroup) && in SetKeyBehaviors()
2228 (((int) wire->data) > maxRG)) in SetKeyBehaviors()
2229 maxRG = wire->data + 1; in SetKeyBehaviors()
2231 wire++; in SetKeyBehaviors()
2234 if (maxRG > (int) xkbi->nRadioGroups) { in SetKeyBehaviors()
2235 if (xkbi->radioGroups) in SetKeyBehaviors()
2236 xkbi->radioGroups = reallocarray(xkbi->radioGroups, maxRG, in SetKeyBehaviors()
2239 xkbi->radioGroups = calloc(maxRG, sizeof(XkbRadioGroupRec)); in SetKeyBehaviors()
2240 if (xkbi->radioGroups) { in SetKeyBehaviors()
2241 if (xkbi->nRadioGroups) in SetKeyBehaviors()
2242 memset(&xkbi->radioGroups[xkbi->nRadioGroups], 0, in SetKeyBehaviors()
2243 (maxRG - xkbi->nRadioGroups) * sizeof(XkbRadioGroupRec)); in SetKeyBehaviors()
2244 xkbi->nRadioGroups = maxRG; in SetKeyBehaviors()
2247 xkbi->nRadioGroups = 0; in SetKeyBehaviors()
2250 if (changes->map.changed & XkbKeyBehaviorsMask) { in SetKeyBehaviors()
2253 oldLast = changes->map.first_key_behavior + in SetKeyBehaviors()
2254 changes->map.num_key_behaviors - 1; in SetKeyBehaviors()
2255 if (changes->map.first_key_behavior < req->firstKeyBehavior) in SetKeyBehaviors()
2256 first = changes->map.first_key_behavior; in SetKeyBehaviors()
2260 changes->map.changed |= XkbKeyBehaviorsMask; in SetKeyBehaviors()
2261 changes->map.first_key_behavior = first; in SetKeyBehaviors()
2262 changes->map.num_key_behaviors = (last - first + 1); in SetKeyBehaviors()
2263 return (char *) wire; in SetKeyBehaviors()
2267 SetVirtualMods(XkbSrvInfoPtr xkbi, xkbSetMapReq * req, CARD8 *wire, in SetVirtualMods() argument
2271 XkbServerMapPtr srv = xkbi->desc->server; in SetVirtualMods()
2273 if (((req->present & XkbVirtualModsMask) == 0) || (req->virtualMods == 0)) in SetVirtualMods()
2274 return (char *) wire; in SetVirtualMods()
2276 if (req->virtualMods & bit) { in SetVirtualMods()
2277 if (srv->vmods[i] != wire[nMods]) { in SetVirtualMods()
2278 changes->map.changed |= XkbVirtualModsMask; in SetVirtualMods()
2279 changes->map.vmods |= bit; in SetVirtualMods()
2280 srv->vmods[i] = wire[nMods]; in SetVirtualMods()
2285 return (char *) (wire + XkbPaddedSize(nMods)); in SetVirtualMods()
2289 SetKeyExplicit(XkbSrvInfoPtr xkbi, xkbSetMapReq * req, CARD8 *wire, in SetKeyExplicit() argument
2293 XkbServerMapPtr xkb = xkbi->desc->server; in SetKeyExplicit()
2296 start = wire; in SetKeyExplicit()
2297 first = req->firstKeyExplicit; in SetKeyExplicit()
2298 last = req->firstKeyExplicit + req->nKeyExplicit - 1; in SetKeyExplicit()
2299 memset(&xkb->explicit[first], 0, req->nKeyExplicit); in SetKeyExplicit()
2300 for (i = 0; i < req->totalKeyExplicit; i++, wire += 2) { in SetKeyExplicit()
2301 xkb->explicit[wire[0]] = wire[1]; in SetKeyExplicit()
2304 if (changes->map.changed & XkbExplicitComponentsMask) { in SetKeyExplicit()
2307 oldLast = changes->map.first_key_explicit + in SetKeyExplicit()
2308 changes->map.num_key_explicit - 1; in SetKeyExplicit()
2309 if (changes->map.first_key_explicit < first) in SetKeyExplicit()
2310 first = changes->map.first_key_explicit; in SetKeyExplicit()
2314 changes->map.first_key_explicit = first; in SetKeyExplicit()
2315 changes->map.num_key_explicit = (last - first) + 1; in SetKeyExplicit()
2317 wire += XkbPaddedSize(wire - start) - (wire - start); in SetKeyExplicit()
2318 return (char *) wire; in SetKeyExplicit()
2323 xkbSetMapReq * req, CARD8 *wire, XkbChangesPtr changes) in SetModifierMap() argument
2326 XkbClientMapPtr xkb = xkbi->desc->map; in SetModifierMap()
2329 start = wire; in SetModifierMap()
2330 first = req->firstModMapKey; in SetModifierMap()
2331 last = req->firstModMapKey + req->nModMapKeys - 1; in SetModifierMap()
2332 memset(&xkb->modmap[first], 0, req->nModMapKeys); in SetModifierMap()
2333 for (i = 0; i < req->totalModMapKeys; i++, wire += 2) { in SetModifierMap()
2334 xkb->modmap[wire[0]] = wire[1]; in SetModifierMap()
2337 if (changes->map.changed & XkbModifierMapMask) { in SetModifierMap()
2340 oldLast = changes->map.first_modmap_key + in SetModifierMap()
2341 changes->map.num_modmap_keys - 1; in SetModifierMap()
2342 if (changes->map.first_modmap_key < first) in SetModifierMap()
2343 first = changes->map.first_modmap_key; in SetModifierMap()
2347 changes->map.first_modmap_key = first; in SetModifierMap()
2348 changes->map.num_modmap_keys = (last - first) + 1; in SetModifierMap()
2350 wire += XkbPaddedSize(wire - start) - (wire - start); in SetModifierMap()
2351 return (char *) wire; in SetModifierMap()
2357 xkbVModMapWireDesc * wire, XkbChangesPtr changes) in SetVirtualModMap() argument
2360 XkbServerMapPtr srv = xkbi->desc->server; in SetVirtualModMap()
2362 first = req->firstVModMapKey; in SetVirtualModMap()
2363 last = req->firstVModMapKey + req->nVModMapKeys - 1; in SetVirtualModMap()
2364 memset(&srv->vmodmap[first], 0, req->nVModMapKeys * sizeof(unsigned short)); in SetVirtualModMap()
2365 for (i = 0; i < req->totalVModMapKeys; i++, wire++) { in SetVirtualModMap()
2366 srv->vmodmap[wire->key] = wire->vmods; in SetVirtualModMap()
2369 if (changes->map.changed & XkbVirtualModMapMask) { in SetVirtualModMap()
2372 oldLast = changes->map.first_vmodmap_key + in SetVirtualModMap()
2373 changes->map.num_vmodmap_keys - 1; in SetVirtualModMap()
2374 if (changes->map.first_vmodmap_key < first) in SetVirtualModMap()
2375 first = changes->map.first_vmodmap_key; in SetVirtualModMap()
2379 changes->map.first_vmodmap_key = first; in SetVirtualModMap()
2380 changes->map.num_vmodmap_keys = (last - first) + 1; in SetVirtualModMap()
2382 return (char *) wire; in SetVirtualModMap()
2386 if (len > UINT32_MAX - (new) || len > req_len - (new)) goto bad; \
2395 size_t len = sz_xkbSetMapReq, req_len = req->length << 2; in _XkbSetMapCheckLength()
2404 if (req->present & XkbKeyTypesMask) { in _XkbSetMapCheckLength()
2406 for (i = 0; i < req->nTypes; i++) { in _XkbSetMapCheckLength()
2408 if (req->flags & XkbSetMapResizeTypes) { in _XkbSetMapCheckLength()
2409 _add_check_len(keytype->nMapEntries in _XkbSetMapCheckLength()
2411 preserve = keytype->preserve; in _XkbSetMapCheckLength()
2412 map_count = keytype->nMapEntries; in _XkbSetMapCheckLength()
2426 if (req->present & XkbKeySymsMask) { in _XkbSetMapCheckLength()
2428 for (i = 0; i < req->nKeySyms; i++) { in _XkbSetMapCheckLength()
2430 nSyms = symmap->nSyms; in _XkbSetMapCheckLength()
2437 if (req->present & XkbKeyActionsMask) { in _XkbSetMapCheckLength()
2438 _add_check_len(req->totalActs * sz_xkbActionWireDesc in _XkbSetMapCheckLength()
2439 + XkbPaddedSize(req->nKeyActs)); in _XkbSetMapCheckLength()
2442 if (req->present & XkbKeyBehaviorsMask) { in _XkbSetMapCheckLength()
2443 _add_check_len(req->totalKeyBehaviors * sz_xkbBehaviorWireDesc); in _XkbSetMapCheckLength()
2446 if (req->present & XkbVirtualModsMask) { in _XkbSetMapCheckLength()
2447 _add_check_len(XkbPaddedSize(Ones(req->virtualMods))); in _XkbSetMapCheckLength()
2450 if (req->present & XkbExplicitComponentsMask) { in _XkbSetMapCheckLength()
2451 /* two bytes per non-zero explicit componen */ in _XkbSetMapCheckLength()
2452 _add_check_len(XkbPaddedSize(req->totalKeyExplicit * sizeof(CARD16))); in _XkbSetMapCheckLength()
2455 if (req->present & XkbModifierMapMask) { in _XkbSetMapCheckLength()
2456 /* two bytes per non-zero modmap component */ in _XkbSetMapCheckLength()
2457 _add_check_len(XkbPaddedSize(req->totalModMapKeys * sizeof(CARD16))); in _XkbSetMapCheckLength()
2460 if (req->present & XkbVirtualModMapMask) { in _XkbSetMapCheckLength()
2461 _add_check_len(req->totalVModMapKeys * sz_xkbVModMapWireDesc); in _XkbSetMapCheckLength()
2489 if (!dev->key) in _XkbSetMapChecks()
2492 xkbi = dev->key->xkbInfo; in _XkbSetMapChecks()
2493 xkb = xkbi->desc; in _XkbSetMapChecks()
2495 if ((xkb->min_key_code != req->minKeyCode) || in _XkbSetMapChecks()
2496 (xkb->max_key_code != req->maxKeyCode)) { in _XkbSetMapChecks()
2497 if (client->xkbClientFlags & _XkbClientIsAncient) { in _XkbSetMapChecks()
2499 req->minKeyCode = xkb->min_key_code; in _XkbSetMapChecks()
2500 req->maxKeyCode = xkb->max_key_code; in _XkbSetMapChecks()
2503 if (!XkbIsLegalKeycode(req->minKeyCode)) { in _XkbSetMapChecks()
2504 client->errorValue = in _XkbSetMapChecks()
2505 _XkbErrCode3(2, req->minKeyCode, req->maxKeyCode); in _XkbSetMapChecks()
2508 if (req->minKeyCode > req->maxKeyCode) { in _XkbSetMapChecks()
2509 client->errorValue = in _XkbSetMapChecks()
2510 _XkbErrCode3(3, req->minKeyCode, req->maxKeyCode); in _XkbSetMapChecks()
2516 if ((req->present & XkbKeyTypesMask) && in _XkbSetMapChecks()
2519 client->errorValue = nTypes; in _XkbSetMapChecks()
2523 /* symsPerKey/mapWidths must be filled regardless of client-side flags */ in _XkbSetMapChecks()
2524 map = &xkb->map->key_sym_map[xkb->min_key_code]; in _XkbSetMapChecks()
2525 for (i = xkb->min_key_code; i < xkb->max_key_code; i++, map++) { in _XkbSetMapChecks()
2528 ng = XkbNumGroups(map->group_info); in _XkbSetMapChecks()
2530 if (map->kt_index[g] >= (unsigned) nTypes) { in _XkbSetMapChecks()
2531 client->errorValue = _XkbErrCode4(0x13, i, g, map->kt_index[g]); in _XkbSetMapChecks()
2534 if (mapWidths[map->kt_index[g]] > w) in _XkbSetMapChecks()
2535 w = mapWidths[map->kt_index[g]]; in _XkbSetMapChecks()
2540 if ((req->present & XkbKeySymsMask) && in _XkbSetMapChecks()
2543 client->errorValue = error; in _XkbSetMapChecks()
2547 if ((req->present & XkbKeyActionsMask) && in _XkbSetMapChecks()
2550 client->errorValue = nActions; in _XkbSetMapChecks()
2554 if ((req->present & XkbKeyBehaviorsMask) && in _XkbSetMapChecks()
2557 client->errorValue = error; in _XkbSetMapChecks()
2561 if ((req->present & XkbVirtualModsMask) && in _XkbSetMapChecks()
2563 client->errorValue = error; in _XkbSetMapChecks()
2566 if ((req->present & XkbExplicitComponentsMask) && in _XkbSetMapChecks()
2568 client->errorValue = error; in _XkbSetMapChecks()
2571 if ((req->present & XkbModifierMapMask) && in _XkbSetMapChecks()
2573 client->errorValue = error; in _XkbSetMapChecks()
2576 if ((req->present & XkbVirtualModMapMask) && in _XkbSetMapChecks()
2579 client->errorValue = error; in _XkbSetMapChecks()
2583 if (((values - ((char *) req)) / 4) != req->length) { in _XkbSetMapChecks()
2585 client->errorValue = values - ((char *) &req[1]); in _XkbSetMapChecks()
2604 if (!dev->key) in _XkbSetMap()
2607 xkbi = dev->key->xkbInfo; in _XkbSetMap()
2608 xkb = xkbi->desc; in _XkbSetMap()
2613 if ((xkb->min_key_code != req->minKeyCode) || in _XkbSetMap()
2614 (xkb->max_key_code != req->maxKeyCode)) { in _XkbSetMap()
2618 nkn.deviceID = nkn.oldDeviceID = dev->id; in _XkbSetMap()
2619 nkn.oldMinKeyCode = xkb->min_key_code; in _XkbSetMap()
2620 nkn.oldMaxKeyCode = xkb->max_key_code; in _XkbSetMap()
2621 status = XkbChangeKeycodeRange(xkb, req->minKeyCode, in _XkbSetMap()
2622 req->maxKeyCode, &change); in _XkbSetMap()
2624 return status; /* oh-oh. what about the other keyboards? */ in _XkbSetMap()
2625 nkn.minKeyCode = xkb->min_key_code; in _XkbSetMap()
2626 nkn.maxKeyCode = xkb->max_key_code; in _XkbSetMap()
2634 if (req->present & XkbKeyTypesMask) { in _XkbSetMap()
2639 if (req->present & XkbKeySymsMask) { in _XkbSetMap()
2646 if (req->present & XkbKeyActionsMask) { in _XkbSetMap()
2651 if (req->present & XkbKeyBehaviorsMask) { in _XkbSetMap()
2657 if (req->present & XkbVirtualModsMask) in _XkbSetMap()
2659 if (req->present & XkbExplicitComponentsMask) in _XkbSetMap()
2661 if (req->present & XkbModifierMapMask) in _XkbSetMap()
2663 if (req->present & XkbVirtualModMapMask) in _XkbSetMap()
2666 if (((values - ((char *) req)) / 4) != req->length) { in _XkbSetMap()
2668 client->errorValue = values - ((char *) &req[1]); in _XkbSetMap()
2671 if (req->flags & XkbSetMapRecomputeActions) { in _XkbSetMap()
2676 last = first + change.map.num_key_syms - 1; in _XkbSetMap()
2682 lastMM = firstMM + change.map.num_modmap_keys - 1; in _XkbSetMap()
2699 XkbUpdateActions(dev, first, (last - first + 1), &change, &check, in _XkbSetMap()
2723 if (!(client->xkbClientFlags & _XkbClientInitialized)) in ProcXkbSetMap()
2726 CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixManageAccess); in ProcXkbSetMap()
2727 CHK_MASK_LEGAL(0x01, stuff->present, XkbAllMapComponentsMask); in ProcXkbSetMap()
2746 if (stuff->deviceSpec == XkbUseCoreKbd) { in ProcXkbSetMap()
2749 for (other = inputInfo.devices; other; other = other->next) { in ProcXkbSetMap()
2750 if ((other != dev) && other->key && !IsMaster(other) && in ProcXkbSetMap()
2764 for (other = inputInfo.devices; other; other = other->next) { in ProcXkbSetMap()
2766 (other != master || dev != master->lastSlave)) in ProcXkbSetMap()
2780 if (stuff->deviceSpec == XkbUseCoreKbd) { in ProcXkbSetMap()
2783 for (other = inputInfo.devices; other; other = other->next) { in ProcXkbSetMap()
2784 if ((other != dev) && other->key && !IsMaster(other) && in ProcXkbSetMap()
2799 for (other = inputInfo.devices; other; other = other->next) { in ProcXkbSetMap()
2801 (other != master || dev != master->lastSlave)) in ProcXkbSetMap()
2820 if (rep->groups != 0) { in XkbComputeGetCompatMapReplySize()
2824 if (rep->groups & bit) in XkbComputeGetCompatMapReplySize()
2829 size += (rep->nSI * SIZEOF(xkbSymInterpretWireDesc)); in XkbComputeGetCompatMapReplySize()
2830 rep->length = size / 4; in XkbComputeGetCompatMapReplySize()
2841 if (rep->length > 0) { in XkbSendCompatMap()
2842 data = xallocarray(rep->length, 4); in XkbSendCompatMap()
2846 XkbSymInterpretPtr sym = &compat->sym_interpret[rep->firstSI]; in XkbSendCompatMap()
2847 xkbSymInterpretWireDesc *wire = (xkbSymInterpretWireDesc *) data; in XkbSendCompatMap() local
2849 size = rep->length * 4; in XkbSendCompatMap()
2851 for (i = 0; i < rep->nSI; i++, sym++, wire++) { in XkbSendCompatMap()
2852 wire->sym = sym->sym; in XkbSendCompatMap()
2853 wire->mods = sym->mods; in XkbSendCompatMap()
2854 wire->match = sym->match; in XkbSendCompatMap()
2855 wire->virtualMod = sym->virtual_mod; in XkbSendCompatMap()
2856 wire->flags = sym->flags; in XkbSendCompatMap()
2857 memcpy((char *) &wire->act, (char *) &sym->act, in XkbSendCompatMap()
2859 if (client->swapped) { in XkbSendCompatMap()
2860 swapl(&wire->sym); in XkbSendCompatMap()
2863 if (rep->groups) { in XkbSendCompatMap()
2864 grp = (xkbModsWireDesc *) wire; in XkbSendCompatMap()
2866 if (rep->groups & bit) { in XkbSendCompatMap()
2867 grp->mask = compat->groups[i].mask; in XkbSendCompatMap()
2868 grp->realMods = compat->groups[i].real_mods; in XkbSendCompatMap()
2869 grp->virtualMods = compat->groups[i].vmods; in XkbSendCompatMap()
2870 if (client->swapped) { in XkbSendCompatMap()
2871 swaps(&grp->virtualMods); in XkbSendCompatMap()
2876 wire = (xkbSymInterpretWireDesc *) grp; in XkbSendCompatMap()
2885 if (client->swapped) { in XkbSendCompatMap()
2886 swaps(&rep->sequenceNumber); in XkbSendCompatMap()
2887 swapl(&rep->length); in XkbSendCompatMap()
2888 swaps(&rep->firstSI); in XkbSendCompatMap()
2889 swaps(&rep->nSI); in XkbSendCompatMap()
2890 swaps(&rep->nTotalSI); in XkbSendCompatMap()
2912 if (!(client->xkbClientFlags & _XkbClientInitialized)) in ProcXkbGetCompatMap()
2915 CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess); in ProcXkbGetCompatMap()
2917 xkb = dev->key->xkbInfo->desc; in ProcXkbGetCompatMap()
2918 compat = xkb->compat; in ProcXkbGetCompatMap()
2922 .sequenceNumber = client->sequence, in ProcXkbGetCompatMap()
2924 .deviceID = dev->id, in ProcXkbGetCompatMap()
2925 .firstSI = stuff->firstSI, in ProcXkbGetCompatMap()
2926 .nSI = stuff->nSI in ProcXkbGetCompatMap()
2928 if (stuff->getAllSI) { in ProcXkbGetCompatMap()
2930 rep.nSI = compat->num_si; in ProcXkbGetCompatMap()
2932 else if ((((unsigned) stuff->nSI) > 0) && in ProcXkbGetCompatMap()
2933 ((unsigned) (stuff->firstSI + stuff->nSI - 1) >= compat->num_si)) { in ProcXkbGetCompatMap()
2934 client->errorValue = _XkbErrCode2(0x05, compat->num_si); in ProcXkbGetCompatMap()
2937 rep.nTotalSI = compat->num_si; in ProcXkbGetCompatMap()
2938 rep.groups = stuff->groups; in ProcXkbGetCompatMap()
2958 xkbi = dev->key->xkbInfo; in _XkbSetCompatMap()
2959 xkb = xkbi->desc; in _XkbSetCompatMap()
2960 compat = xkb->compat; in _XkbSetCompatMap()
2962 if ((req->nSI > 0) || (req->truncateSI)) { in _XkbSetCompatMap()
2963 xkbSymInterpretWireDesc *wire; in _XkbSetCompatMap() local
2965 if (req->firstSI > compat->num_si) { in _XkbSetCompatMap()
2966 client->errorValue = _XkbErrCode2(0x02, compat->num_si); in _XkbSetCompatMap()
2969 wire = (xkbSymInterpretWireDesc *) data; in _XkbSetCompatMap()
2970 wire += req->nSI; in _XkbSetCompatMap()
2971 data = (char *) wire; in _XkbSetCompatMap()
2975 if (req->groups != 0) { in _XkbSetCompatMap()
2977 if (req->groups & bit) in _XkbSetCompatMap()
2982 if (((data - ((char *) req)) / 4) != req->length) { in _XkbSetCompatMap()
2991 if (req->nSI > 0) { in _XkbSetCompatMap()
2992 xkbSymInterpretWireDesc *wire = (xkbSymInterpretWireDesc *) data; in _XkbSetCompatMap() local
2996 if ((unsigned) (req->firstSI + req->nSI) > compat->num_si) { in _XkbSetCompatMap()
2997 compat->num_si = req->firstSI + req->nSI; in _XkbSetCompatMap()
2998 compat->sym_interpret = reallocarray(compat->sym_interpret, in _XkbSetCompatMap()
2999 compat->num_si, in _XkbSetCompatMap()
3001 if (!compat->sym_interpret) { in _XkbSetCompatMap()
3002 compat->num_si = 0; in _XkbSetCompatMap()
3006 else if (req->truncateSI) { in _XkbSetCompatMap()
3007 compat->num_si = req->firstSI + req->nSI; in _XkbSetCompatMap()
3009 sym = &compat->sym_interpret[req->firstSI]; in _XkbSetCompatMap()
3010 for (i = 0; i < req->nSI; i++, wire++) { in _XkbSetCompatMap()
3011 if (client->swapped) { in _XkbSetCompatMap()
3012 swapl(&wire->sym); in _XkbSetCompatMap()
3014 if (wire->sym == NoSymbol && wire->match == XkbSI_AnyOfOrNone && in _XkbSetCompatMap()
3015 (wire->mods & 0xff) == 0xff && in _XkbSetCompatMap()
3016 wire->act.type == XkbSA_XFree86Private) { in _XkbSetCompatMap()
3017 ErrorF("XKB: Skipping broken Any+AnyOfOrNone(All) -> Private " in _XkbSetCompatMap()
3022 sym->sym = wire->sym; in _XkbSetCompatMap()
3023 sym->mods = wire->mods; in _XkbSetCompatMap()
3024 sym->match = wire->match; in _XkbSetCompatMap()
3025 sym->flags = wire->flags; in _XkbSetCompatMap()
3026 sym->virtual_mod = wire->virtualMod; in _XkbSetCompatMap()
3027 memcpy((char *) &sym->act, (char *) &wire->act, in _XkbSetCompatMap()
3032 if (req->firstSI + req->nSI < compat->num_si) in _XkbSetCompatMap()
3034 (compat->num_si - req->firstSI - req->nSI) * in _XkbSetCompatMap()
3036 compat->num_si -= skipped; in _XkbSetCompatMap()
3038 data = (char *) wire; in _XkbSetCompatMap()
3040 else if (req->truncateSI) { in _XkbSetCompatMap()
3041 compat->num_si = req->firstSI; in _XkbSetCompatMap()
3044 if (req->groups != 0) { in _XkbSetCompatMap()
3045 xkbModsWireDesc *wire = (xkbModsWireDesc *) data; in _XkbSetCompatMap() local
3048 if (req->groups & bit) { in _XkbSetCompatMap()
3049 if (client->swapped) { in _XkbSetCompatMap()
3050 swaps(&wire->virtualMods); in _XkbSetCompatMap()
3052 compat->groups[i].mask = wire->realMods; in _XkbSetCompatMap()
3053 compat->groups[i].real_mods = wire->realMods; in _XkbSetCompatMap()
3054 compat->groups[i].vmods = wire->virtualMods; in _XkbSetCompatMap()
3055 if (wire->virtualMods != 0) { in _XkbSetCompatMap()
3058 tmp = XkbMaskForVMask(xkb, wire->virtualMods); in _XkbSetCompatMap()
3059 compat->groups[i].mask |= tmp; in _XkbSetCompatMap()
3062 wire = (xkbModsWireDesc *) data; in _XkbSetCompatMap()
3066 i = XkbPaddedSize((data - ((char *) req))); in _XkbSetCompatMap()
3067 if ((i / 4) != req->length) { in _XkbSetCompatMap()
3072 if (dev->xkb_interest) { in _XkbSetCompatMap()
3075 ev.deviceID = dev->id; in _XkbSetCompatMap()
3076 ev.changedGroups = req->groups; in _XkbSetCompatMap()
3077 ev.firstSI = req->firstSI; in _XkbSetCompatMap()
3078 ev.nSI = req->nSI; in _XkbSetCompatMap()
3079 ev.nTotalSI = compat->num_si; in _XkbSetCompatMap()
3083 if (req->recomputeActions) { in _XkbSetCompatMap()
3090 XkbUpdateActions(dev, xkb->min_key_code, XkbNumKeys(xkb), &change, in _XkbSetCompatMap()
3109 if (!(client->xkbClientFlags & _XkbClientInitialized)) in ProcXkbSetCompatMap()
3112 CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixManageAccess); in ProcXkbSetCompatMap()
3116 /* check first using a dry-run */ in ProcXkbSetCompatMap()
3120 if (stuff->deviceSpec == XkbUseCoreKbd) { in ProcXkbSetCompatMap()
3123 for (other = inputInfo.devices; other; other = other->next) { in ProcXkbSetCompatMap()
3124 if ((other != dev) && other->key && !IsMaster(other) && in ProcXkbSetCompatMap()
3129 /* dry-run */ in ProcXkbSetCompatMap()
3138 /* Yay, the dry-runs succeed. Let's apply */ in ProcXkbSetCompatMap()
3142 if (stuff->deviceSpec == XkbUseCoreKbd) { in ProcXkbSetCompatMap()
3145 for (other = inputInfo.devices; other; other = other->next) { in ProcXkbSetCompatMap()
3146 if ((other != dev) && other->key && !IsMaster(other) && in ProcXkbSetCompatMap()
3174 if (!(client->xkbClientFlags & _XkbClientInitialized)) in ProcXkbGetIndicatorState()
3177 CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixReadAccess); in ProcXkbGetIndicatorState()
3186 .deviceID = dev->id, in ProcXkbGetIndicatorState()
3187 .sequenceNumber = client->sequence, in ProcXkbGetIndicatorState()
3189 .state = sli->effectiveState in ProcXkbGetIndicatorState()
3192 if (client->swapped) { in ProcXkbGetIndicatorState()
3209 rep->realIndicators = indicators->phys_indicators; in XkbComputeGetIndicatorMapReplySize()
3211 if (rep->which & bit) in XkbComputeGetIndicatorMapReplySize()
3214 rep->length = (nIndicators * SIZEOF(xkbIndicatorMapWireDesc)) / 4; in XkbComputeGetIndicatorMapReplySize()
3215 rep->nIndicators = nIndicators; in XkbComputeGetIndicatorMapReplySize()
3228 if (rep->length > 0) { in XkbSendIndicatorMap()
3231 to = map = xallocarray(rep->length, 4); in XkbSendIndicatorMap()
3233 xkbIndicatorMapWireDesc *wire = (xkbIndicatorMapWireDesc *) to; in XkbSendIndicatorMap() local
3235 length = rep->length * 4; in XkbSendIndicatorMap()
3238 if (rep->which & bit) { in XkbSendIndicatorMap()
3239 wire->flags = indicators->maps[i].flags; in XkbSendIndicatorMap()
3240 wire->whichGroups = indicators->maps[i].which_groups; in XkbSendIndicatorMap()
3241 wire->groups = indicators->maps[i].groups; in XkbSendIndicatorMap()
3242 wire->whichMods = indicators->maps[i].which_mods; in XkbSendIndicatorMap()
3243 wire->mods = indicators->maps[i].mods.mask; in XkbSendIndicatorMap()
3244 wire->realMods = indicators->maps[i].mods.real_mods; in XkbSendIndicatorMap()
3245 wire->virtualMods = indicators->maps[i].mods.vmods; in XkbSendIndicatorMap()
3246 wire->ctrls = indicators->maps[i].ctrls; in XkbSendIndicatorMap()
3247 if (client->swapped) { in XkbSendIndicatorMap()
3248 swaps(&wire->virtualMods); in XkbSendIndicatorMap()
3249 swapl(&wire->ctrls); in XkbSendIndicatorMap()
3251 wire++; in XkbSendIndicatorMap()
3254 to = (CARD8 *) wire; in XkbSendIndicatorMap()
3255 if ((to - map) != length) { in XkbSendIndicatorMap()
3256 client->errorValue = _XkbErrCode2(0xff, length); in XkbSendIndicatorMap()
3266 if (client->swapped) { in XkbSendIndicatorMap()
3267 swaps(&rep->sequenceNumber); in XkbSendIndicatorMap()
3268 swapl(&rep->length); in XkbSendIndicatorMap()
3269 swapl(&rep->which); in XkbSendIndicatorMap()
3270 swapl(&rep->realIndicators); in XkbSendIndicatorMap()
3291 if (!(client->xkbClientFlags & _XkbClientInitialized)) in ProcXkbGetIndicatorMap()
3294 CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess); in ProcXkbGetIndicatorMap()
3296 xkb = dev->key->xkbInfo->desc; in ProcXkbGetIndicatorMap()
3297 leds = xkb->indicators; in ProcXkbGetIndicatorMap()
3301 .deviceID = dev->id, in ProcXkbGetIndicatorMap()
3302 .sequenceNumber = client->sequence, in ProcXkbGetIndicatorMap()
3304 .which = stuff->which in ProcXkbGetIndicatorMap()
3323 xkbi = dev->key->xkbInfo; in _XkbSetIndicatorMap()
3332 sli->maps[i].flags = desc->flags; in _XkbSetIndicatorMap()
3333 sli->maps[i].which_groups = desc->whichGroups; in _XkbSetIndicatorMap()
3334 sli->maps[i].groups = desc->groups; in _XkbSetIndicatorMap()
3335 sli->maps[i].which_mods = desc->whichMods; in _XkbSetIndicatorMap()
3336 sli->maps[i].mods.mask = desc->mods; in _XkbSetIndicatorMap()
3337 sli->maps[i].mods.real_mods = desc->mods; in _XkbSetIndicatorMap()
3338 sli->maps[i].mods.vmods = desc->virtualMods; in _XkbSetIndicatorMap()
3339 sli->maps[i].ctrls = desc->ctrls; in _XkbSetIndicatorMap()
3340 if (desc->virtualMods != 0) { in _XkbSetIndicatorMap()
3343 tmp = XkbMaskForVMask(xkbi->desc, desc->virtualMods); in _XkbSetIndicatorMap()
3344 sli->maps[i].mods.mask = desc->mods | tmp; in _XkbSetIndicatorMap()
3368 if (!(client->xkbClientFlags & _XkbClientInitialized)) in ProcXkbSetIndicatorMap()
3371 CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixSetAttrAccess); in ProcXkbSetIndicatorMap()
3373 if (stuff->which == 0) in ProcXkbSetIndicatorMap()
3377 if (stuff->which & bit) in ProcXkbSetIndicatorMap()
3380 if (stuff->length != ((SIZEOF(xkbSetIndicatorMapReq) + in ProcXkbSetIndicatorMap()
3388 if (stuff->which & bit) { in ProcXkbSetIndicatorMap()
3389 if (client->swapped) { in ProcXkbSetIndicatorMap()
3390 swaps(&from->virtualMods); in ProcXkbSetIndicatorMap()
3391 swapl(&from->ctrls); in ProcXkbSetIndicatorMap()
3393 CHK_MASK_LEGAL(i, from->whichGroups, XkbIM_UseAnyGroup); in ProcXkbSetIndicatorMap()
3394 CHK_MASK_LEGAL(i, from->whichMods, XkbIM_UseAnyMods); in ProcXkbSetIndicatorMap()
3400 rc = _XkbSetIndicatorMap(client, dev, stuff->which, from); in ProcXkbSetIndicatorMap()
3404 if (stuff->deviceSpec == XkbUseCoreKbd) { in ProcXkbSetIndicatorMap()
3407 for (other = inputInfo.devices; other; other = other->next) { in ProcXkbSetIndicatorMap()
3408 if ((other != dev) && other->key && !IsMaster(other) && in ProcXkbSetIndicatorMap()
3413 _XkbSetIndicatorMap(client, other, stuff->which, from); in ProcXkbSetIndicatorMap()
3435 if (!(client->xkbClientFlags & _XkbClientInitialized)) in ProcXkbGetNamedIndicator()
3438 CHK_LED_DEVICE(dev, stuff->deviceSpec, client, DixReadAccess); in ProcXkbGetNamedIndicator()
3439 CHK_ATOM_ONLY(stuff->indicator); in ProcXkbGetNamedIndicator()
3441 sli = XkbFindSrvLedInfo(dev, stuff->ledClass, stuff->ledID, 0); in ProcXkbGetNamedIndicator()
3447 if ((sli->names) && (sli->maps)) { in ProcXkbGetNamedIndicator()
3449 if (stuff->indicator == sli->names[i]) { in ProcXkbGetNamedIndicator()
3450 map = &sli->maps[i]; in ProcXkbGetNamedIndicator()
3458 .sequenceNumber = client->sequence, in ProcXkbGetNamedIndicator()
3460 .deviceID = dev->id, in ProcXkbGetNamedIndicator()
3461 .indicator = stuff->indicator in ProcXkbGetNamedIndicator()
3465 rep.on = ((sli->effectiveState & (1 << i)) != 0); in ProcXkbGetNamedIndicator()
3466 rep.realIndicator = ((sli->physIndicators & (1 << i)) != 0); in ProcXkbGetNamedIndicator()
3468 rep.flags = map->flags; in ProcXkbGetNamedIndicator()
3469 rep.whichGroups = map->which_groups; in ProcXkbGetNamedIndicator()
3470 rep.groups = map->groups; in ProcXkbGetNamedIndicator()
3471 rep.whichMods = map->which_mods; in ProcXkbGetNamedIndicator()
3472 rep.mods = map->mods.mask; in ProcXkbGetNamedIndicator()
3473 rep.realMods = map->mods.real_mods; in ProcXkbGetNamedIndicator()
3474 rep.virtualMods = map->mods.vmods; in ProcXkbGetNamedIndicator()
3475 rep.ctrls = map->ctrls; in ProcXkbGetNamedIndicator()
3493 if (client->swapped) { in ProcXkbGetNamedIndicator()
3518 if (sli->names && sli->maps) { in _XkbFindNamedIndicatorMap()
3522 if (sli->names[led] == indicator) { in _XkbFindNamedIndicatorMap()
3523 map = &sli->maps[led]; in _XkbFindNamedIndicatorMap()
3557 if ((sli->names) && (sli->maps) && (sli->names[led] == None) && in _XkbCreateIndicatorMap()
3558 (!XkbIM_InUse(&sli->maps[led]))) { in _XkbCreateIndicatorMap()
3559 map = &sli->maps[led]; in _XkbCreateIndicatorMap()
3561 sli->names[led] = indicator; in _XkbCreateIndicatorMap()
3590 rc = _XkbCreateIndicatorMap(dev, stuff->indicator, stuff->ledClass, in _XkbSetNamedIndicator()
3591 stuff->ledID, &map, &led, FALSE); in _XkbSetNamedIndicator()
3592 if (rc != Success || !map) /* oh-oh */ in _XkbSetNamedIndicator()
3595 sli = XkbFindSrvLedInfo(dev, stuff->ledClass, stuff->ledID, in _XkbSetNamedIndicator()
3604 sli->namesPresent |= ((stuff->indicator != None) ? (1 << led) : 0); in _XkbSetNamedIndicator()
3607 if (stuff->setMap) { in _XkbSetNamedIndicator()
3608 map->flags = stuff->flags; in _XkbSetNamedIndicator()
3609 map->which_groups = stuff->whichGroups; in _XkbSetNamedIndicator()
3610 map->groups = stuff->groups; in _XkbSetNamedIndicator()
3611 map->which_mods = stuff->whichMods; in _XkbSetNamedIndicator()
3612 map->mods.mask = stuff->realMods; in _XkbSetNamedIndicator()
3613 map->mods.real_mods = stuff->realMods; in _XkbSetNamedIndicator()
3614 map->mods.vmods = stuff->virtualMods; in _XkbSetNamedIndicator()
3615 map->ctrls = stuff->ctrls; in _XkbSetNamedIndicator()
3619 if ((stuff->setState) && ((map->flags & XkbIM_NoExplicit) == 0)) { in _XkbSetNamedIndicator()
3620 if (stuff->on) in _XkbSetNamedIndicator()
3621 sli->explicitState |= (1 << led); in _XkbSetNamedIndicator()
3623 sli->explicitState &= ~(1 << led); in _XkbSetNamedIndicator()
3624 statec |= ((sli->effectiveState ^ sli->explicitState) & (1 << led)); in _XkbSetNamedIndicator()
3638 if ((sli->flags & XkbSLI_HasOwnState) == 0) in _XkbSetNamedIndicator()
3656 if (!(client->xkbClientFlags & _XkbClientInitialized)) in ProcXkbSetNamedIndicator()
3659 CHK_LED_DEVICE(dev, stuff->deviceSpec, client, DixSetAttrAccess); in ProcXkbSetNamedIndicator()
3660 CHK_ATOM_ONLY(stuff->indicator); in ProcXkbSetNamedIndicator()
3661 CHK_MASK_LEGAL(0x10, stuff->whichGroups, XkbIM_UseAnyGroup); in ProcXkbSetNamedIndicator()
3662 CHK_MASK_LEGAL(0x11, stuff->whichMods, XkbIM_UseAnyMods); in ProcXkbSetNamedIndicator()
3664 /* Dry-run for checks */ in ProcXkbSetNamedIndicator()
3665 rc = _XkbCreateIndicatorMap(dev, stuff->indicator, in ProcXkbSetNamedIndicator()
3666 stuff->ledClass, stuff->ledID, in ProcXkbSetNamedIndicator()
3671 if (stuff->deviceSpec == XkbUseCoreKbd || in ProcXkbSetNamedIndicator()
3672 stuff->deviceSpec == XkbUseCorePtr) { in ProcXkbSetNamedIndicator()
3675 for (other = inputInfo.devices; other; other = other->next) { in ProcXkbSetNamedIndicator()
3677 GetMaster(other, MASTER_KEYBOARD) == dev && (other->kbdfeed || in ProcXkbSetNamedIndicator()
3678 other->leds) && in ProcXkbSetNamedIndicator()
3681 rc = _XkbCreateIndicatorMap(other, stuff->indicator, in ProcXkbSetNamedIndicator()
3682 stuff->ledClass, stuff->ledID, &map, in ProcXkbSetNamedIndicator()
3695 if (stuff->deviceSpec == XkbUseCoreKbd || in ProcXkbSetNamedIndicator()
3696 stuff->deviceSpec == XkbUseCorePtr) { in ProcXkbSetNamedIndicator()
3699 for (other = inputInfo.devices; other; other = other->next) { in ProcXkbSetNamedIndicator()
3701 GetMaster(other, MASTER_KEYBOARD) == dev && (other->kbdfeed || in ProcXkbSetNamedIndicator()
3702 other->leds) && in ProcXkbSetNamedIndicator()
3733 _XkbWriteAtoms(char *wire, Atom *atoms, int maxAtoms, int swap) in _XkbWriteAtoms() argument
3738 atm = (Atom *) wire; in _XkbWriteAtoms()
3757 rep->minKeyCode = xkb->min_key_code; in XkbComputeGetNamesReplySize()
3758 rep->maxKeyCode = xkb->max_key_code; in XkbComputeGetNamesReplySize()
3759 which = rep->which; in XkbComputeGetNamesReplySize()
3761 if (xkb->names != NULL) { in XkbComputeGetNamesReplySize()
3778 if (xkb->map != NULL) { in XkbComputeGetNamesReplySize()
3780 length += xkb->map->num_types; in XkbComputeGetNamesReplySize()
3781 rep->nTypes = xkb->map->num_types; in XkbComputeGetNamesReplySize()
3783 XkbKeyTypePtr pType = xkb->map->types; in XkbComputeGetNamesReplySize()
3786 length += XkbPaddedSize(xkb->map->num_types) / 4; in XkbComputeGetNamesReplySize()
3787 for (i = 0; i < xkb->map->num_types; i++, pType++) { in XkbComputeGetNamesReplySize()
3788 if (pType->level_names != NULL) in XkbComputeGetNamesReplySize()
3789 nKTLevels += pType->num_levels; in XkbComputeGetNamesReplySize()
3791 rep->nKTLevels = nKTLevels; in XkbComputeGetNamesReplySize()
3796 rep->nTypes = 0; in XkbComputeGetNamesReplySize()
3797 rep->nKTLevels = 0; in XkbComputeGetNamesReplySize()
3801 rep->minKeyCode = xkb->min_key_code; in XkbComputeGetNamesReplySize()
3802 rep->maxKeyCode = xkb->max_key_code; in XkbComputeGetNamesReplySize()
3803 rep->indicators = 0; in XkbComputeGetNamesReplySize()
3804 rep->virtualMods = 0; in XkbComputeGetNamesReplySize()
3805 rep->groupNames = 0; in XkbComputeGetNamesReplySize()
3806 if (xkb->names != NULL) { in XkbComputeGetNamesReplySize()
3810 rep->indicators = in XkbComputeGetNamesReplySize()
3811 _XkbCountAtoms(xkb->names->indicators, XkbNumIndicators, in XkbComputeGetNamesReplySize()
3821 rep->virtualMods = in XkbComputeGetNamesReplySize()
3822 _XkbCountAtoms(xkb->names->vmods, XkbNumVirtualMods, &nVMods); in XkbComputeGetNamesReplySize()
3831 rep->groupNames = in XkbComputeGetNamesReplySize()
3832 _XkbCountAtoms(xkb->names->groups, XkbNumKbdGroups, &nGroups); in XkbComputeGetNamesReplySize()
3838 if ((which & XkbKeyNamesMask) && (xkb->names->keys)) in XkbComputeGetNamesReplySize()
3839 length += rep->nKeys; in XkbComputeGetNamesReplySize()
3844 (xkb->names->key_aliases) && (xkb->names->num_key_aliases > 0)) { in XkbComputeGetNamesReplySize()
3845 rep->nKeyAliases = xkb->names->num_key_aliases; in XkbComputeGetNamesReplySize()
3846 length += rep->nKeyAliases * 2; in XkbComputeGetNamesReplySize()
3850 rep->nKeyAliases = 0; in XkbComputeGetNamesReplySize()
3853 if ((which & XkbRGNamesMask) && (xkb->names->num_rg > 0)) in XkbComputeGetNamesReplySize()
3854 length += xkb->names->num_rg; in XkbComputeGetNamesReplySize()
3864 rep->length = length; in XkbComputeGetNamesReplySize()
3865 rep->which = which; in XkbComputeGetNamesReplySize()
3876 length = rep->length * 4; in XkbSendNames()
3877 which = rep->which; in XkbSendNames()
3878 if (client->swapped) { in XkbSendNames()
3879 swaps(&rep->sequenceNumber); in XkbSendNames()
3880 swapl(&rep->length); in XkbSendNames()
3881 swapl(&rep->which); in XkbSendNames()
3882 swaps(&rep->virtualMods); in XkbSendNames()
3883 swapl(&rep->indicators); in XkbSendNames()
3889 if (xkb->names) { in XkbSendNames()
3891 *((CARD32 *) desc) = xkb->names->keycodes; in XkbSendNames()
3892 if (client->swapped) { in XkbSendNames()
3898 *((CARD32 *) desc) = xkb->names->geometry; in XkbSendNames()
3899 if (client->swapped) { in XkbSendNames()
3905 *((CARD32 *) desc) = xkb->names->symbols; in XkbSendNames()
3906 if (client->swapped) { in XkbSendNames()
3914 atm[0] = (CARD32) xkb->names->phys_symbols; in XkbSendNames()
3915 if (client->swapped) { in XkbSendNames()
3921 *((CARD32 *) desc) = (CARD32) xkb->names->types; in XkbSendNames()
3922 if (client->swapped) { in XkbSendNames()
3928 *((CARD32 *) desc) = (CARD32) xkb->names->compat; in XkbSendNames()
3929 if (client->swapped) { in XkbSendNames()
3936 register XkbKeyTypePtr type = xkb->map->types; in XkbSendNames()
3938 for (i = 0; i < xkb->map->num_types; i++, atm++, type++) { in XkbSendNames()
3939 *atm = (CARD32) type->name; in XkbSendNames()
3940 if (client->swapped) { in XkbSendNames()
3946 if (which & XkbKTLevelNamesMask && xkb->map) { in XkbSendNames()
3947 XkbKeyTypePtr type = xkb->map->types; in XkbSendNames()
3950 for (i = 0; i < rep->nTypes; i++, type++) { in XkbSendNames()
3951 *desc++ = type->num_levels; in XkbSendNames()
3953 desc += XkbPaddedSize(rep->nTypes) - rep->nTypes; in XkbSendNames()
3956 type = xkb->map->types; in XkbSendNames()
3957 for (i = 0; i < xkb->map->num_types; i++, type++) { in XkbSendNames()
3960 if (type->level_names) { in XkbSendNames()
3961 for (l = 0; l < type->num_levels; l++, atm++) { in XkbSendNames()
3962 *atm = type->level_names[l]; in XkbSendNames()
3963 if (client->swapped) { in XkbSendNames()
3967 desc += type->num_levels * 4; in XkbSendNames()
3973 _XkbWriteAtoms(desc, xkb->names->indicators, XkbNumIndicators, in XkbSendNames()
3974 client->swapped); in XkbSendNames()
3977 desc = _XkbWriteAtoms(desc, xkb->names->vmods, XkbNumVirtualMods, in XkbSendNames()
3978 client->swapped); in XkbSendNames()
3981 desc = _XkbWriteAtoms(desc, xkb->names->groups, XkbNumKbdGroups, in XkbSendNames()
3982 client->swapped); in XkbSendNames()
3985 for (i = 0; i < rep->nKeys; i++, desc += sizeof(XkbKeyNameRec)) { in XkbSendNames()
3986 *((XkbKeyNamePtr) desc) = xkb->names->keys[i + rep->firstKey]; in XkbSendNames()
3992 pAl = xkb->names->key_aliases; in XkbSendNames()
3993 for (i = 0; i < rep->nKeyAliases; in XkbSendNames()
3998 if ((which & XkbRGNamesMask) && (rep->nRadioGroups > 0)) { in XkbSendNames()
4001 for (i = 0; i < rep->nRadioGroups; i++, atm++) { in XkbSendNames()
4002 *atm = (CARD32) xkb->names->radio_groups[i]; in XkbSendNames()
4003 if (client->swapped) { in XkbSendNames()
4007 desc += rep->nRadioGroups * 4; in XkbSendNames()
4011 if ((desc - start) != (length)) { in XkbSendNames()
4013 length, (unsigned long) (desc - start)); in XkbSendNames()
4031 if (!(client->xkbClientFlags & _XkbClientInitialized)) in ProcXkbGetNames()
4034 CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess); in ProcXkbGetNames()
4035 CHK_MASK_LEGAL(0x01, stuff->which, XkbAllNamesMask); in ProcXkbGetNames()
4037 xkb = dev->key->xkbInfo->desc; in ProcXkbGetNames()
4040 .deviceID = dev->id, in ProcXkbGetNames()
4041 .sequenceNumber = client->sequence, in ProcXkbGetNames()
4043 .which = stuff->which, in ProcXkbGetNames()
4044 .nTypes = xkb->map->num_types, in ProcXkbGetNames()
4045 .firstKey = xkb->min_key_code, in ProcXkbGetNames()
4047 .nKeyAliases = xkb->names ? xkb->names->num_key_aliases : 0, in ProcXkbGetNames()
4048 .nRadioGroups = xkb->names ? xkb->names->num_rg : 0 in ProcXkbGetNames()
4057 _XkbCheckAtoms(CARD32 *wire, int nAtoms, int swapped, Atom *pError) in _XkbCheckAtoms() argument
4061 for (i = 0; i < nAtoms; i++, wire++) { in _XkbCheckAtoms()
4063 swapl(wire); in _XkbCheckAtoms()
4065 if ((((Atom) *wire) != None) && (!ValidAtom((Atom) *wire))) { in _XkbCheckAtoms()
4066 *pError = ((Atom) *wire); in _XkbCheckAtoms()
4070 return wire; in _XkbCheckAtoms()
4074 _XkbCheckMaskedAtoms(CARD32 *wire, int nAtoms, CARD32 present, int swapped, in _XkbCheckMaskedAtoms() argument
4083 swapl(wire); in _XkbCheckMaskedAtoms()
4085 if ((((Atom) *wire) != None) && (!ValidAtom(((Atom) *wire)))) { in _XkbCheckMaskedAtoms()
4086 *pError = (Atom) *wire; in _XkbCheckMaskedAtoms()
4089 wire++; in _XkbCheckMaskedAtoms()
4091 return wire; in _XkbCheckMaskedAtoms()
4095 _XkbCopyMaskedAtoms(Atom *wire, Atom *dest, int nAtoms, CARD32 present) in _XkbCopyMaskedAtoms() argument
4102 dest[i] = *wire++; in _XkbCopyMaskedAtoms()
4104 return wire; in _XkbCopyMaskedAtoms()
4120 * Check the device-dependent data in the request against the device. Returns
4132 xkb = dev->key->xkbInfo->desc; in _XkbSetNamesCheck()
4134 if (stuff->which & XkbKeyTypeNamesMask) { in _XkbSetNamesCheck()
4138 if (stuff->nTypes < 1) { in _XkbSetNamesCheck()
4139 client->errorValue = _XkbErrCode2(0x02, stuff->nTypes); in _XkbSetNamesCheck()
4142 if ((unsigned) (stuff->firstType + stuff->nTypes - 1) >= in _XkbSetNamesCheck()
4143 xkb->map->num_types) { in _XkbSetNamesCheck()
4144 client->errorValue = in _XkbSetNamesCheck()
4145 _XkbErrCode4(0x03, stuff->firstType, stuff->nTypes, in _XkbSetNamesCheck()
4146 xkb->map->num_types); in _XkbSetNamesCheck()
4149 if (((unsigned) stuff->firstType) <= XkbLastRequiredType) { in _XkbSetNamesCheck()
4150 client->errorValue = _XkbErrCode2(0x04, stuff->firstType); in _XkbSetNamesCheck()
4153 if (!_XkbCheckRequestBounds(client, stuff, tmp, tmp + stuff->nTypes)) in _XkbSetNamesCheck()
4156 tmp = _XkbCheckAtoms(tmp, stuff->nTypes, client->swapped, &bad); in _XkbSetNamesCheck()
4158 client->errorValue = bad; in _XkbSetNamesCheck()
4161 for (i = 0; i < stuff->nTypes; i++, old++) { in _XkbSetNamesCheck()
4162 if (!_XkbCheckTypeName((Atom) *old, stuff->firstType + i)) in _XkbSetNamesCheck()
4163 client->errorValue = _XkbErrCode2(0x05, i); in _XkbSetNamesCheck()
4166 if (stuff->which & XkbKTLevelNamesMask) { in _XkbSetNamesCheck()
4171 if (stuff->nKTLevels < 1) { in _XkbSetNamesCheck()
4172 client->errorValue = _XkbErrCode2(0x05, stuff->nKTLevels); in _XkbSetNamesCheck()
4175 if ((unsigned) (stuff->firstKTLevel + stuff->nKTLevels - 1) >= in _XkbSetNamesCheck()
4176 xkb->map->num_types) { in _XkbSetNamesCheck()
4177 client->errorValue = _XkbErrCode4(0x06, stuff->firstKTLevel, in _XkbSetNamesCheck()
4178 stuff->nKTLevels, in _XkbSetNamesCheck()
4179 xkb->map->num_types); in _XkbSetNamesCheck()
4183 tmp = (CARD32 *) (((char *) tmp) + XkbPaddedSize(stuff->nKTLevels)); in _XkbSetNamesCheck()
4186 type = &xkb->map->types[stuff->firstKTLevel]; in _XkbSetNamesCheck()
4187 for (i = 0; i < stuff->nKTLevels; i++, type++) { in _XkbSetNamesCheck()
4190 else if (width[i] != type->num_levels) { in _XkbSetNamesCheck()
4191 client->errorValue = _XkbErrCode4(0x07, i + stuff->firstKTLevel, in _XkbSetNamesCheck()
4192 type->num_levels, width[i]); in _XkbSetNamesCheck()
4197 tmp = _XkbCheckAtoms(tmp, width[i], client->swapped, &bad); in _XkbSetNamesCheck()
4199 client->errorValue = bad; in _XkbSetNamesCheck()
4204 if (stuff->which & XkbIndicatorNamesMask) { in _XkbSetNamesCheck()
4205 if (stuff->indicators == 0) { in _XkbSetNamesCheck()
4206 client->errorValue = 0x08; in _XkbSetNamesCheck()
4210 tmp + Ones(stuff->indicators))) in _XkbSetNamesCheck()
4212 tmp = _XkbCheckMaskedAtoms(tmp, XkbNumIndicators, stuff->indicators, in _XkbSetNamesCheck()
4213 client->swapped, &bad); in _XkbSetNamesCheck()
4215 client->errorValue = bad; in _XkbSetNamesCheck()
4219 if (stuff->which & XkbVirtualModNamesMask) { in _XkbSetNamesCheck()
4220 if (stuff->virtualMods == 0) { in _XkbSetNamesCheck()
4221 client->errorValue = 0x09; in _XkbSetNamesCheck()
4225 tmp + Ones(stuff->virtualMods))) in _XkbSetNamesCheck()
4228 (CARD32) stuff->virtualMods, in _XkbSetNamesCheck()
4229 client->swapped, &bad); in _XkbSetNamesCheck()
4231 client->errorValue = bad; in _XkbSetNamesCheck()
4235 if (stuff->which & XkbGroupNamesMask) { in _XkbSetNamesCheck()
4236 if (stuff->groupNames == 0) { in _XkbSetNamesCheck()
4237 client->errorValue = 0x0a; in _XkbSetNamesCheck()
4241 tmp + Ones(stuff->groupNames))) in _XkbSetNamesCheck()
4244 (CARD32) stuff->groupNames, in _XkbSetNamesCheck()
4245 client->swapped, &bad); in _XkbSetNamesCheck()
4247 client->errorValue = bad; in _XkbSetNamesCheck()
4251 if (stuff->which & XkbKeyNamesMask) { in _XkbSetNamesCheck()
4252 if (stuff->firstKey < (unsigned) xkb->min_key_code) { in _XkbSetNamesCheck()
4253 client->errorValue = _XkbErrCode3(0x0b, xkb->min_key_code, in _XkbSetNamesCheck()
4254 stuff->firstKey); in _XkbSetNamesCheck()
4257 if (((unsigned) (stuff->firstKey + stuff->nKeys - 1) > in _XkbSetNamesCheck()
4258 xkb->max_key_code) || (stuff->nKeys < 1)) { in _XkbSetNamesCheck()
4259 client->errorValue = in _XkbSetNamesCheck()
4260 _XkbErrCode4(0x0c, xkb->max_key_code, stuff->firstKey, in _XkbSetNamesCheck()
4261 stuff->nKeys); in _XkbSetNamesCheck()
4264 if (!_XkbCheckRequestBounds(client, stuff, tmp, tmp + stuff->nKeys)) in _XkbSetNamesCheck()
4266 tmp += stuff->nKeys; in _XkbSetNamesCheck()
4268 if ((stuff->which & XkbKeyAliasesMask) && (stuff->nKeyAliases > 0)) { in _XkbSetNamesCheck()
4270 tmp + (stuff->nKeyAliases * 2))) in _XkbSetNamesCheck()
4272 tmp += stuff->nKeyAliases * 2; in _XkbSetNamesCheck()
4274 if (stuff->which & XkbRGNamesMask) { in _XkbSetNamesCheck()
4275 if (stuff->nRadioGroups < 1) { in _XkbSetNamesCheck()
4276 client->errorValue = _XkbErrCode2(0x0d, stuff->nRadioGroups); in _XkbSetNamesCheck()
4280 tmp + stuff->nRadioGroups)) in _XkbSetNamesCheck()
4282 tmp = _XkbCheckAtoms(tmp, stuff->nRadioGroups, client->swapped, &bad); in _XkbSetNamesCheck()
4284 client->errorValue = bad; in _XkbSetNamesCheck()
4288 if ((tmp - ((CARD32 *) stuff)) != stuff->length) { in _XkbSetNamesCheck()
4289 client->errorValue = stuff->length; in _XkbSetNamesCheck()
4305 xkb = dev->key->xkbInfo->desc; in _XkbSetNames()
4306 names = xkb->names; in _XkbSetNames()
4308 if (XkbAllocNames(xkb, stuff->which, stuff->nRadioGroups, in _XkbSetNames()
4309 stuff->nKeyAliases) != Success) { in _XkbSetNames()
4314 nn.changed = stuff->which; in _XkbSetNames()
4316 if (stuff->which & XkbKeycodesNameMask) in _XkbSetNames()
4317 names->keycodes = *tmp++; in _XkbSetNames()
4318 if (stuff->which & XkbGeometryNameMask) in _XkbSetNames()
4319 names->geometry = *tmp++; in _XkbSetNames()
4320 if (stuff->which & XkbSymbolsNameMask) in _XkbSetNames()
4321 names->symbols = *tmp++; in _XkbSetNames()
4322 if (stuff->which & XkbPhysSymbolsNameMask) in _XkbSetNames()
4323 names->phys_symbols = *tmp++; in _XkbSetNames()
4324 if (stuff->which & XkbTypesNameMask) in _XkbSetNames()
4325 names->types = *tmp++; in _XkbSetNames()
4326 if (stuff->which & XkbCompatNameMask) in _XkbSetNames()
4327 names->compat = *tmp++; in _XkbSetNames()
4328 if ((stuff->which & XkbKeyTypeNamesMask) && (stuff->nTypes > 0)) { in _XkbSetNames()
4332 type = &xkb->map->types[stuff->firstType]; in _XkbSetNames()
4333 for (i = 0; i < stuff->nTypes; i++, type++) { in _XkbSetNames()
4334 type->name = *tmp++; in _XkbSetNames()
4336 nn.firstType = stuff->firstType; in _XkbSetNames()
4337 nn.nTypes = stuff->nTypes; in _XkbSetNames()
4339 if (stuff->which & XkbKTLevelNamesMask) { in _XkbSetNames()
4345 tmp = (CARD32 *) (((char *) tmp) + XkbPaddedSize(stuff->nKTLevels)); in _XkbSetNames()
4346 type = &xkb->map->types[stuff->firstKTLevel]; in _XkbSetNames()
4347 for (i = 0; i < stuff->nKTLevels; i++, type++) { in _XkbSetNames()
4349 if (type->level_names) { in _XkbSetNames()
4353 type->level_names[n] = tmp[n]; in _XkbSetNames()
4360 nn.nLevelNames = stuff->nTypes; in _XkbSetNames()
4362 if (stuff->which & XkbIndicatorNamesMask) { in _XkbSetNames()
4363 tmp = _XkbCopyMaskedAtoms(tmp, names->indicators, XkbNumIndicators, in _XkbSetNames()
4364 stuff->indicators); in _XkbSetNames()
4365 nn.changedIndicators = stuff->indicators; in _XkbSetNames()
4367 if (stuff->which & XkbVirtualModNamesMask) { in _XkbSetNames()
4368 tmp = _XkbCopyMaskedAtoms(tmp, names->vmods, XkbNumVirtualMods, in _XkbSetNames()
4369 stuff->virtualMods); in _XkbSetNames()
4370 nn.changedVirtualMods = stuff->virtualMods; in _XkbSetNames()
4372 if (stuff->which & XkbGroupNamesMask) { in _XkbSetNames()
4373 tmp = _XkbCopyMaskedAtoms(tmp, names->groups, XkbNumKbdGroups, in _XkbSetNames()
4374 stuff->groupNames); in _XkbSetNames()
4375 nn.changedVirtualMods = stuff->groupNames; in _XkbSetNames()
4377 if (stuff->which & XkbKeyNamesMask) { in _XkbSetNames()
4378 memcpy((char *) &names->keys[stuff->firstKey], (char *) tmp, in _XkbSetNames()
4379 stuff->nKeys * XkbKeyNameLength); in _XkbSetNames()
4380 tmp += stuff->nKeys; in _XkbSetNames()
4381 nn.firstKey = stuff->firstKey; in _XkbSetNames()
4382 nn.nKeys = stuff->nKeys; in _XkbSetNames()
4384 if (stuff->which & XkbKeyAliasesMask) { in _XkbSetNames()
4385 if (stuff->nKeyAliases > 0) { in _XkbSetNames()
4386 register int na = stuff->nKeyAliases; in _XkbSetNames()
4390 memcpy((char *) names->key_aliases, (char *) tmp, in _XkbSetNames()
4391 stuff->nKeyAliases * sizeof(XkbKeyAliasRec)); in _XkbSetNames()
4392 tmp += stuff->nKeyAliases * 2; in _XkbSetNames()
4394 else if (names->key_aliases != NULL) { in _XkbSetNames()
4395 free(names->key_aliases); in _XkbSetNames()
4396 names->key_aliases = NULL; in _XkbSetNames()
4397 names->num_key_aliases = 0; in _XkbSetNames()
4399 nn.nAliases = names->num_key_aliases; in _XkbSetNames()
4401 if (stuff->which & XkbRGNamesMask) { in _XkbSetNames()
4402 if (stuff->nRadioGroups > 0) { in _XkbSetNames()
4405 nrg = stuff->nRadioGroups; in _XkbSetNames()
4409 for (i = 0; i < stuff->nRadioGroups; i++) { in _XkbSetNames()
4410 names->radio_groups[i] = tmp[i]; in _XkbSetNames()
4412 tmp += stuff->nRadioGroups; in _XkbSetNames()
4414 else if (names->radio_groups) { in _XkbSetNames()
4415 free(names->radio_groups); in _XkbSetNames()
4416 names->radio_groups = NULL; in _XkbSetNames()
4417 names->num_rg = 0; in _XkbSetNames()
4419 nn.nRadioGroups = names->num_rg; in _XkbSetNames()
4434 sli->namesPresent = 0; in _XkbSetNames()
4436 if (names->indicators[i] != None) in _XkbSetNames()
4437 sli->namesPresent |= bit; in _XkbSetNames()
4442 edev.ledID = dev->kbdfeed->ctrl.id; in _XkbSetNames()
4443 edev.ledsDefined = sli->namesPresent | sli->mapsPresent; in _XkbSetNames()
4444 edev.ledState = sli->effectiveState; in _XkbSetNames()
4466 if (!(client->xkbClientFlags & _XkbClientInitialized)) in ProcXkbSetNames()
4469 CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixManageAccess); in ProcXkbSetNames()
4470 CHK_MASK_LEGAL(0x01, stuff->which, XkbAllNamesMask); in ProcXkbSetNames()
4472 /* check device-independent stuff */ in ProcXkbSetNames()
4477 if (stuff->which & XkbKeycodesNameMask) { in ProcXkbSetNames()
4478 tmp = _XkbCheckAtoms(tmp, 1, client->swapped, &bad); in ProcXkbSetNames()
4480 client->errorValue = bad; in ProcXkbSetNames()
4486 if (stuff->which & XkbGeometryNameMask) { in ProcXkbSetNames()
4487 tmp = _XkbCheckAtoms(tmp, 1, client->swapped, &bad); in ProcXkbSetNames()
4489 client->errorValue = bad; in ProcXkbSetNames()
4495 if (stuff->which & XkbSymbolsNameMask) { in ProcXkbSetNames()
4496 tmp = _XkbCheckAtoms(tmp, 1, client->swapped, &bad); in ProcXkbSetNames()
4498 client->errorValue = bad; in ProcXkbSetNames()
4504 if (stuff->which & XkbPhysSymbolsNameMask) { in ProcXkbSetNames()
4505 tmp = _XkbCheckAtoms(tmp, 1, client->swapped, &bad); in ProcXkbSetNames()
4507 client->errorValue = bad; in ProcXkbSetNames()
4513 if (stuff->which & XkbTypesNameMask) { in ProcXkbSetNames()
4514 tmp = _XkbCheckAtoms(tmp, 1, client->swapped, &bad); in ProcXkbSetNames()
4516 client->errorValue = bad; in ProcXkbSetNames()
4522 if (stuff->which & XkbCompatNameMask) { in ProcXkbSetNames()
4523 tmp = _XkbCheckAtoms(tmp, 1, client->swapped, &bad); in ProcXkbSetNames()
4525 client->errorValue = bad; in ProcXkbSetNames()
4530 /* start of device-dependent tests */ in ProcXkbSetNames()
4535 if (stuff->deviceSpec == XkbUseCoreKbd) { in ProcXkbSetNames()
4538 for (other = inputInfo.devices; other; other = other->next) { in ProcXkbSetNames()
4539 if ((other != dev) && other->key && !IsMaster(other) && in ProcXkbSetNames()
4553 /* everything is okay -- update names */ in ProcXkbSetNames()
4559 if (stuff->deviceSpec == XkbUseCoreKbd) { in ProcXkbSetNames()
4562 for (other = inputInfo.devices; other; other = other->next) { in ProcXkbSetNames()
4563 if ((other != dev) && other->key && !IsMaster(other) && in ProcXkbSetNames()
4574 /* everything is okay -- update names */ in ProcXkbSetNames()
4583 #define XkbSizeCountedString(s) ((s)?((((2+strlen(s))+3)/4)*4):4)
4586 * Write the zero-terminated string str into wire as a pascal string with a
4587 * 16-bit length field prefixed before the actual string.
4589 * @param wire The destination array, usually the wire struct
4590 * @param str The source string as zero-terminated C string
4594 * (swapped) 16 bit string length, non-zero terminated.
4597 XkbWriteCountedString(char *wire, const char *str, Bool swap) in XkbWriteCountedString() argument
4602 return wire; in XkbWriteCountedString()
4605 pLen = (CARD16 *) wire; in XkbWriteCountedString()
4610 paddedLen = pad_to_int32(sizeof(len) + len) - sizeof(len); in XkbWriteCountedString()
4611 strncpy(&wire[sizeof(len)], str, paddedLen); in XkbWriteCountedString()
4612 wire += sizeof(len) + paddedLen; in XkbWriteCountedString()
4613 return wire; in XkbWriteCountedString()
4622 for (size = i = 0, prop = geom->properties; i < geom->num_properties; in XkbSizeGeomProperties()
4624 size += XkbSizeCountedString(prop->name); in XkbSizeGeomProperties()
4625 size += XkbSizeCountedString(prop->value); in XkbSizeGeomProperties()
4631 XkbWriteGeomProperties(char *wire, XkbGeometryPtr geom, Bool swap) in XkbWriteGeomProperties() argument
4636 for (i = 0, prop = geom->properties; i < geom->num_properties; i++, prop++) { in XkbWriteGeomProperties()
4637 wire = XkbWriteCountedString(wire, prop->name, swap); in XkbWriteGeomProperties()
4638 wire = XkbWriteCountedString(wire, prop->value, swap); in XkbWriteGeomProperties()
4640 return wire; in XkbWriteGeomProperties()
4646 return geom->num_key_aliases * (2 * XkbKeyNameLength); in XkbSizeGeomKeyAliases()
4650 XkbWriteGeomKeyAliases(char *wire, XkbGeometryPtr geom, Bool swap) in XkbWriteGeomKeyAliases() argument
4654 sz = geom->num_key_aliases * (XkbKeyNameLength * 2); in XkbWriteGeomKeyAliases()
4656 memcpy(wire, (char *) geom->key_aliases, sz); in XkbWriteGeomKeyAliases()
4657 wire += sz; in XkbWriteGeomKeyAliases()
4659 return wire; in XkbWriteGeomKeyAliases()
4668 for (i = size = 0, color = geom->colors; i < geom->num_colors; i++, color++) { in XkbSizeGeomColors()
4669 size += XkbSizeCountedString(color->spec); in XkbSizeGeomColors()
4675 XkbWriteGeomColors(char *wire, XkbGeometryPtr geom, Bool swap) in XkbWriteGeomColors() argument
4680 for (i = 0, color = geom->colors; i < geom->num_colors; i++, color++) { in XkbWriteGeomColors()
4681 wire = XkbWriteCountedString(wire, color->spec, swap); in XkbWriteGeomColors()
4683 return wire; in XkbWriteGeomColors()
4692 for (i = size = 0, shape = geom->shapes; i < geom->num_shapes; i++, shape++) { in XkbSizeGeomShapes()
4697 for (n = 0, ol = shape->outlines; n < shape->num_outlines; n++, ol++) { in XkbSizeGeomShapes()
4699 size += ol->num_points * SIZEOF(xkbPointWireDesc); in XkbSizeGeomShapes()
4706 XkbWriteGeomShapes(char *wire, XkbGeometryPtr geom, Bool swap) in XkbWriteGeomShapes() argument
4712 for (i = 0, shape = geom->shapes; i < geom->num_shapes; i++, shape++) { in XkbWriteGeomShapes()
4717 shapeWire = (xkbShapeWireDesc *) wire; in XkbWriteGeomShapes()
4718 shapeWire->name = shape->name; in XkbWriteGeomShapes()
4719 shapeWire->nOutlines = shape->num_outlines; in XkbWriteGeomShapes()
4720 if (shape->primary != NULL) in XkbWriteGeomShapes()
4721 shapeWire->primaryNdx = XkbOutlineIndex(shape, shape->primary); in XkbWriteGeomShapes()
4723 shapeWire->primaryNdx = XkbNoShape; in XkbWriteGeomShapes()
4724 if (shape->approx != NULL) in XkbWriteGeomShapes()
4725 shapeWire->approxNdx = XkbOutlineIndex(shape, shape->approx); in XkbWriteGeomShapes()
4727 shapeWire->approxNdx = XkbNoShape; in XkbWriteGeomShapes()
4728 shapeWire->pad = 0; in XkbWriteGeomShapes()
4730 swapl(&shapeWire->name); in XkbWriteGeomShapes()
4732 wire = (char *) &shapeWire[1]; in XkbWriteGeomShapes()
4733 for (o = 0, ol = shape->outlines; o < shape->num_outlines; o++, ol++) { in XkbWriteGeomShapes()
4738 olWire = (xkbOutlineWireDesc *) wire; in XkbWriteGeomShapes()
4739 olWire->nPoints = ol->num_points; in XkbWriteGeomShapes()
4740 olWire->cornerRadius = ol->corner_radius; in XkbWriteGeomShapes()
4741 olWire->pad = 0; in XkbWriteGeomShapes()
4742 wire = (char *) &olWire[1]; in XkbWriteGeomShapes()
4743 ptWire = (xkbPointWireDesc *) wire; in XkbWriteGeomShapes()
4744 for (p = 0, pt = ol->points; p < ol->num_points; p++, pt++) { in XkbWriteGeomShapes()
4745 ptWire[p].x = pt->x; in XkbWriteGeomShapes()
4746 ptWire[p].y = pt->y; in XkbWriteGeomShapes()
4752 wire = (char *) &ptWire[ol->num_points]; in XkbWriteGeomShapes()
4755 return wire; in XkbWriteGeomShapes()
4765 if (doodad->any.type == XkbTextDoodad) { in XkbSizeGeomDoodads()
4766 size += XkbSizeCountedString(doodad->text.text); in XkbSizeGeomDoodads()
4767 size += XkbSizeCountedString(doodad->text.font); in XkbSizeGeomDoodads()
4769 else if (doodad->any.type == XkbLogoDoodad) { in XkbSizeGeomDoodads()
4770 size += XkbSizeCountedString(doodad->logo.logo_name); in XkbSizeGeomDoodads()
4777 XkbWriteGeomDoodads(char *wire, int num_doodads, XkbDoodadPtr doodad, Bool swap) in XkbWriteGeomDoodads() argument
4783 doodadWire = (xkbDoodadWireDesc *) wire; in XkbWriteGeomDoodads()
4784 wire = (char *) &doodadWire[1]; in XkbWriteGeomDoodads()
4786 doodadWire->any.name = doodad->any.name; in XkbWriteGeomDoodads()
4787 doodadWire->any.type = doodad->any.type; in XkbWriteGeomDoodads()
4788 doodadWire->any.priority = doodad->any.priority; in XkbWriteGeomDoodads()
4789 doodadWire->any.top = doodad->any.top; in XkbWriteGeomDoodads()
4790 doodadWire->any.left = doodad->any.left; in XkbWriteGeomDoodads()
4792 swapl(&doodadWire->any.name); in XkbWriteGeomDoodads()
4793 swaps(&doodadWire->any.top); in XkbWriteGeomDoodads()
4794 swaps(&doodadWire->any.left); in XkbWriteGeomDoodads()
4796 switch (doodad->any.type) { in XkbWriteGeomDoodads()
4799 doodadWire->shape.angle = doodad->shape.angle; in XkbWriteGeomDoodads()
4800 doodadWire->shape.colorNdx = doodad->shape.color_ndx; in XkbWriteGeomDoodads()
4801 doodadWire->shape.shapeNdx = doodad->shape.shape_ndx; in XkbWriteGeomDoodads()
4803 swaps(&doodadWire->shape.angle); in XkbWriteGeomDoodads()
4807 doodadWire->text.angle = doodad->text.angle; in XkbWriteGeomDoodads()
4808 doodadWire->text.width = doodad->text.width; in XkbWriteGeomDoodads()
4809 doodadWire->text.height = doodad->text.height; in XkbWriteGeomDoodads()
4810 doodadWire->text.colorNdx = doodad->text.color_ndx; in XkbWriteGeomDoodads()
4812 swaps(&doodadWire->text.angle); in XkbWriteGeomDoodads()
4813 swaps(&doodadWire->text.width); in XkbWriteGeomDoodads()
4814 swaps(&doodadWire->text.height); in XkbWriteGeomDoodads()
4816 wire = XkbWriteCountedString(wire, doodad->text.text, swap); in XkbWriteGeomDoodads()
4817 wire = XkbWriteCountedString(wire, doodad->text.font, swap); in XkbWriteGeomDoodads()
4820 doodadWire->indicator.shapeNdx = doodad->indicator.shape_ndx; in XkbWriteGeomDoodads()
4821 doodadWire->indicator.onColorNdx = doodad->indicator.on_color_ndx; in XkbWriteGeomDoodads()
4822 doodadWire->indicator.offColorNdx = doodad->indicator.off_color_ndx; in XkbWriteGeomDoodads()
4825 doodadWire->logo.angle = doodad->logo.angle; in XkbWriteGeomDoodads()
4826 doodadWire->logo.colorNdx = doodad->logo.color_ndx; in XkbWriteGeomDoodads()
4827 doodadWire->logo.shapeNdx = doodad->logo.shape_ndx; in XkbWriteGeomDoodads()
4828 wire = XkbWriteCountedString(wire, doodad->logo.logo_name, swap); in XkbWriteGeomDoodads()
4832 doodad->any.type); in XkbWriteGeomDoodads()
4837 return wire; in XkbWriteGeomDoodads()
4841 XkbWriteGeomOverlay(char *wire, XkbOverlayPtr ol, Bool swap) in XkbWriteGeomOverlay() argument
4847 olWire = (xkbOverlayWireDesc *) wire; in XkbWriteGeomOverlay()
4848 olWire->name = ol->name; in XkbWriteGeomOverlay()
4849 olWire->nRows = ol->num_rows; in XkbWriteGeomOverlay()
4850 olWire->pad1 = 0; in XkbWriteGeomOverlay()
4851 olWire->pad2 = 0; in XkbWriteGeomOverlay()
4853 swapl(&olWire->name); in XkbWriteGeomOverlay()
4855 wire = (char *) &olWire[1]; in XkbWriteGeomOverlay()
4856 for (r = 0, row = ol->rows; r < ol->num_rows; r++, row++) { in XkbWriteGeomOverlay()
4861 rowWire = (xkbOverlayRowWireDesc *) wire; in XkbWriteGeomOverlay()
4862 rowWire->rowUnder = row->row_under; in XkbWriteGeomOverlay()
4863 rowWire->nKeys = row->num_keys; in XkbWriteGeomOverlay()
4864 rowWire->pad1 = 0; in XkbWriteGeomOverlay()
4865 wire = (char *) &rowWire[1]; in XkbWriteGeomOverlay()
4866 for (k = 0, key = row->keys; k < row->num_keys; k++, key++) { in XkbWriteGeomOverlay()
4869 keyWire = (xkbOverlayKeyWireDesc *) wire; in XkbWriteGeomOverlay()
4870 memcpy(keyWire->over, key->over.name, XkbKeyNameLength); in XkbWriteGeomOverlay()
4871 memcpy(keyWire->under, key->under.name, XkbKeyNameLength); in XkbWriteGeomOverlay()
4872 wire = (char *) &keyWire[1]; in XkbWriteGeomOverlay()
4875 return wire; in XkbWriteGeomOverlay()
4884 for (i = size = 0, section = geom->sections; i < geom->num_sections; in XkbSizeGeomSections()
4887 if (section->rows) { in XkbSizeGeomSections()
4891 for (r = 0, row = section->rows; r < section->num_rows; row++, r++) { in XkbSizeGeomSections()
4893 size += row->num_keys * SIZEOF(xkbKeyWireDesc); in XkbSizeGeomSections()
4896 if (section->doodads) in XkbSizeGeomSections()
4897 size += XkbSizeGeomDoodads(section->num_doodads, section->doodads); in XkbSizeGeomSections()
4898 if (section->overlays) { in XkbSizeGeomSections()
4902 for (o = 0, ol = section->overlays; o < section->num_overlays; in XkbSizeGeomSections()
4908 for (r = 0, row = ol->rows; r < ol->num_rows; r++, row++) { in XkbSizeGeomSections()
4910 size += row->num_keys * SIZEOF(xkbOverlayKeyWireDesc); in XkbSizeGeomSections()
4919 XkbWriteGeomSections(char *wire, XkbGeometryPtr geom, Bool swap) in XkbWriteGeomSections() argument
4925 for (i = 0, section = geom->sections; i < geom->num_sections; in XkbWriteGeomSections()
4927 sectionWire = (xkbSectionWireDesc *) wire; in XkbWriteGeomSections()
4928 sectionWire->name = section->name; in XkbWriteGeomSections()
4929 sectionWire->top = section->top; in XkbWriteGeomSections()
4930 sectionWire->left = section->left; in XkbWriteGeomSections()
4931 sectionWire->width = section->width; in XkbWriteGeomSections()
4932 sectionWire->height = section->height; in XkbWriteGeomSections()
4933 sectionWire->angle = section->angle; in XkbWriteGeomSections()
4934 sectionWire->priority = section->priority; in XkbWriteGeomSections()
4935 sectionWire->nRows = section->num_rows; in XkbWriteGeomSections()
4936 sectionWire->nDoodads = section->num_doodads; in XkbWriteGeomSections()
4937 sectionWire->nOverlays = section->num_overlays; in XkbWriteGeomSections()
4938 sectionWire->pad = 0; in XkbWriteGeomSections()
4940 swapl(§ionWire->name); in XkbWriteGeomSections()
4941 swaps(§ionWire->top); in XkbWriteGeomSections()
4942 swaps(§ionWire->left); in XkbWriteGeomSections()
4943 swaps(§ionWire->width); in XkbWriteGeomSections()
4944 swaps(§ionWire->height); in XkbWriteGeomSections()
4945 swaps(§ionWire->angle); in XkbWriteGeomSections()
4947 wire = (char *) §ionWire[1]; in XkbWriteGeomSections()
4948 if (section->rows) { in XkbWriteGeomSections()
4953 for (r = 0, row = section->rows; r < section->num_rows; r++, row++) { in XkbWriteGeomSections()
4954 rowWire = (xkbRowWireDesc *) wire; in XkbWriteGeomSections()
4955 rowWire->top = row->top; in XkbWriteGeomSections()
4956 rowWire->left = row->left; in XkbWriteGeomSections()
4957 rowWire->nKeys = row->num_keys; in XkbWriteGeomSections()
4958 rowWire->vertical = row->vertical; in XkbWriteGeomSections()
4959 rowWire->pad = 0; in XkbWriteGeomSections()
4961 swaps(&rowWire->top); in XkbWriteGeomSections()
4962 swaps(&rowWire->left); in XkbWriteGeomSections()
4964 wire = (char *) &rowWire[1]; in XkbWriteGeomSections()
4965 if (row->keys) { in XkbWriteGeomSections()
4970 keyWire = (xkbKeyWireDesc *) wire; in XkbWriteGeomSections()
4971 for (k = 0, key = row->keys; k < row->num_keys; k++, key++) { in XkbWriteGeomSections()
4972 memcpy(keyWire[k].name, key->name.name, in XkbWriteGeomSections()
4974 keyWire[k].gap = key->gap; in XkbWriteGeomSections()
4975 keyWire[k].shapeNdx = key->shape_ndx; in XkbWriteGeomSections()
4976 keyWire[k].colorNdx = key->color_ndx; in XkbWriteGeomSections()
4981 wire = (char *) &keyWire[row->num_keys]; in XkbWriteGeomSections()
4985 if (section->doodads) { in XkbWriteGeomSections()
4986 wire = XkbWriteGeomDoodads(wire, in XkbWriteGeomSections()
4987 section->num_doodads, section->doodads, in XkbWriteGeomSections()
4990 if (section->overlays) { in XkbWriteGeomSections()
4993 for (o = 0; o < section->num_overlays; o++) { in XkbWriteGeomSections()
4994 wire = XkbWriteGeomOverlay(wire, §ion->overlays[o], swap); in XkbWriteGeomSections()
4998 return wire; in XkbWriteGeomSections()
5008 len = XkbSizeCountedString(geom->label_font); in XkbComputeGetGeometryReplySize()
5013 len += XkbSizeGeomDoodads(geom->num_doodads, geom->doodads); in XkbComputeGetGeometryReplySize()
5015 rep->length = len / 4; in XkbComputeGetGeometryReplySize()
5016 rep->found = TRUE; in XkbComputeGetGeometryReplySize()
5017 rep->name = geom->name; in XkbComputeGetGeometryReplySize()
5018 rep->widthMM = geom->width_mm; in XkbComputeGetGeometryReplySize()
5019 rep->heightMM = geom->height_mm; in XkbComputeGetGeometryReplySize()
5020 rep->nProperties = geom->num_properties; in XkbComputeGetGeometryReplySize()
5021 rep->nColors = geom->num_colors; in XkbComputeGetGeometryReplySize()
5022 rep->nShapes = geom->num_shapes; in XkbComputeGetGeometryReplySize()
5023 rep->nSections = geom->num_sections; in XkbComputeGetGeometryReplySize()
5024 rep->nDoodads = geom->num_doodads; in XkbComputeGetGeometryReplySize()
5025 rep->nKeyAliases = geom->num_key_aliases; in XkbComputeGetGeometryReplySize()
5026 rep->baseColorNdx = XkbGeomColorIndex(geom, geom->base_color); in XkbComputeGetGeometryReplySize()
5027 rep->labelColorNdx = XkbGeomColorIndex(geom, geom->label_color); in XkbComputeGetGeometryReplySize()
5030 rep->length = 0; in XkbComputeGetGeometryReplySize()
5031 rep->found = FALSE; in XkbComputeGetGeometryReplySize()
5032 rep->name = name; in XkbComputeGetGeometryReplySize()
5033 rep->widthMM = rep->heightMM = 0; in XkbComputeGetGeometryReplySize()
5034 rep->nProperties = rep->nColors = rep->nShapes = 0; in XkbComputeGetGeometryReplySize()
5035 rep->nSections = rep->nDoodads = 0; in XkbComputeGetGeometryReplySize()
5036 rep->nKeyAliases = 0; in XkbComputeGetGeometryReplySize()
5037 rep->labelColorNdx = rep->baseColorNdx = 0; in XkbComputeGetGeometryReplySize()
5049 start = desc = xallocarray(rep->length, 4); in XkbSendGeometry()
5052 len = rep->length * 4; in XkbSendGeometry()
5053 desc = XkbWriteCountedString(desc, geom->label_font, client->swapped); in XkbSendGeometry()
5054 if (rep->nProperties > 0) in XkbSendGeometry()
5055 desc = XkbWriteGeomProperties(desc, geom, client->swapped); in XkbSendGeometry()
5056 if (rep->nColors > 0) in XkbSendGeometry()
5057 desc = XkbWriteGeomColors(desc, geom, client->swapped); in XkbSendGeometry()
5058 if (rep->nShapes > 0) in XkbSendGeometry()
5059 desc = XkbWriteGeomShapes(desc, geom, client->swapped); in XkbSendGeometry()
5060 if (rep->nSections > 0) in XkbSendGeometry()
5061 desc = XkbWriteGeomSections(desc, geom, client->swapped); in XkbSendGeometry()
5062 if (rep->nDoodads > 0) in XkbSendGeometry()
5063 desc = XkbWriteGeomDoodads(desc, geom->num_doodads, geom->doodads, in XkbSendGeometry()
5064 client->swapped); in XkbSendGeometry()
5065 if (rep->nKeyAliases > 0) in XkbSendGeometry()
5066 desc = XkbWriteGeomKeyAliases(desc, geom, client->swapped); in XkbSendGeometry()
5067 if ((desc - start) != (len)) { in XkbSendGeometry()
5070 len, (unsigned long) (desc - start)); in XkbSendGeometry()
5077 if (client->swapped) { in XkbSendGeometry()
5078 swaps(&rep->sequenceNumber); in XkbSendGeometry()
5079 swapl(&rep->length); in XkbSendGeometry()
5080 swapl(&rep->name); in XkbSendGeometry()
5081 swaps(&rep->widthMM); in XkbSendGeometry()
5082 swaps(&rep->heightMM); in XkbSendGeometry()
5083 swaps(&rep->nProperties); in XkbSendGeometry()
5084 swaps(&rep->nColors); in XkbSendGeometry()
5085 swaps(&rep->nShapes); in XkbSendGeometry()
5086 swaps(&rep->nSections); in XkbSendGeometry()
5087 swaps(&rep->nDoodads); in XkbSendGeometry()
5088 swaps(&rep->nKeyAliases); in XkbSendGeometry()
5112 if (!(client->xkbClientFlags & _XkbClientInitialized)) in ProcXkbGetGeometry()
5115 CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess); in ProcXkbGetGeometry()
5116 CHK_ATOM_OR_NONE(stuff->name); in ProcXkbGetGeometry()
5118 geom = XkbLookupNamedGeometry(dev, stuff->name, &shouldFree); in ProcXkbGetGeometry()
5121 .deviceID = dev->id, in ProcXkbGetGeometry()
5122 .sequenceNumber = client->sequence, in ProcXkbGetGeometry()
5125 status = XkbComputeGetGeometryReplySize(geom, &rep, stuff->name); in ProcXkbGetGeometry()
5137 char *wire, *next; in _GetCountedString() local
5140 wire = *wire_inout; in _GetCountedString()
5141 len = *(CARD16 *) wire; in _GetCountedString()
5142 if (client->swapped) { in _GetCountedString()
5145 next = wire + XkbPaddedSize(len + 2); in _GetCountedString()
5147 if (client->req_len < in _GetCountedString()
5148 bytes_to_int32(next - (char *) client->requestBuffer)) in _GetCountedString()
5153 memcpy(*str, &wire[2], len); in _GetCountedString()
5163 char *wire; in _CheckSetDoodad() local
5171 any = dWire->any; in _CheckSetDoodad()
5172 wire = (char *) &dWire[1]; in _CheckSetDoodad()
5173 if (client->swapped) { in _CheckSetDoodad()
5179 CHK_ATOM_ONLY(dWire->any.name); in _CheckSetDoodad()
5183 doodad->any.type = dWire->any.type; in _CheckSetDoodad()
5184 doodad->any.priority = dWire->any.priority; in _CheckSetDoodad()
5185 doodad->any.top = any.top; in _CheckSetDoodad()
5186 doodad->any.left = any.left; in _CheckSetDoodad()
5187 doodad->any.angle = any.angle; in _CheckSetDoodad()
5188 switch (doodad->any.type) { in _CheckSetDoodad()
5191 if (dWire->shape.colorNdx >= geom->num_colors) { in _CheckSetDoodad()
5192 client->errorValue = _XkbErrCode3(0x40, geom->num_colors, in _CheckSetDoodad()
5193 dWire->shape.colorNdx); in _CheckSetDoodad()
5196 if (dWire->shape.shapeNdx >= geom->num_shapes) { in _CheckSetDoodad()
5197 client->errorValue = _XkbErrCode3(0x41, geom->num_shapes, in _CheckSetDoodad()
5198 dWire->shape.shapeNdx); in _CheckSetDoodad()
5201 doodad->shape.color_ndx = dWire->shape.colorNdx; in _CheckSetDoodad()
5202 doodad->shape.shape_ndx = dWire->shape.shapeNdx; in _CheckSetDoodad()
5205 if (dWire->text.colorNdx >= geom->num_colors) { in _CheckSetDoodad()
5206 client->errorValue = _XkbErrCode3(0x42, geom->num_colors, in _CheckSetDoodad()
5207 dWire->text.colorNdx); in _CheckSetDoodad()
5210 text = dWire->text; in _CheckSetDoodad()
5211 if (client->swapped) { in _CheckSetDoodad()
5215 doodad->text.width = text.width; in _CheckSetDoodad()
5216 doodad->text.height = text.height; in _CheckSetDoodad()
5217 doodad->text.color_ndx = dWire->text.colorNdx; in _CheckSetDoodad()
5218 status = _GetCountedString(&wire, client, &doodad->text.text); in _CheckSetDoodad()
5221 status = _GetCountedString(&wire, client, &doodad->text.font); in _CheckSetDoodad()
5223 free (doodad->text.text); in _CheckSetDoodad()
5228 if (dWire->indicator.onColorNdx >= geom->num_colors) { in _CheckSetDoodad()
5229 client->errorValue = _XkbErrCode3(0x43, geom->num_colors, in _CheckSetDoodad()
5230 dWire->indicator.onColorNdx); in _CheckSetDoodad()
5233 if (dWire->indicator.offColorNdx >= geom->num_colors) { in _CheckSetDoodad()
5234 client->errorValue = _XkbErrCode3(0x44, geom->num_colors, in _CheckSetDoodad()
5235 dWire->indicator.offColorNdx); in _CheckSetDoodad()
5238 if (dWire->indicator.shapeNdx >= geom->num_shapes) { in _CheckSetDoodad()
5239 client->errorValue = _XkbErrCode3(0x45, geom->num_shapes, in _CheckSetDoodad()
5240 dWire->indicator.shapeNdx); in _CheckSetDoodad()
5243 doodad->indicator.shape_ndx = dWire->indicator.shapeNdx; in _CheckSetDoodad()
5244 doodad->indicator.on_color_ndx = dWire->indicator.onColorNdx; in _CheckSetDoodad()
5245 doodad->indicator.off_color_ndx = dWire->indicator.offColorNdx; in _CheckSetDoodad()
5248 if (dWire->logo.colorNdx >= geom->num_colors) { in _CheckSetDoodad()
5249 client->errorValue = _XkbErrCode3(0x46, geom->num_colors, in _CheckSetDoodad()
5250 dWire->logo.colorNdx); in _CheckSetDoodad()
5253 if (dWire->logo.shapeNdx >= geom->num_shapes) { in _CheckSetDoodad()
5254 client->errorValue = _XkbErrCode3(0x47, geom->num_shapes, in _CheckSetDoodad()
5255 dWire->logo.shapeNdx); in _CheckSetDoodad()
5258 doodad->logo.color_ndx = dWire->logo.colorNdx; in _CheckSetDoodad()
5259 doodad->logo.shape_ndx = dWire->logo.shapeNdx; in _CheckSetDoodad()
5260 status = _GetCountedString(&wire, client, &doodad->logo.logo_name); in _CheckSetDoodad()
5265 client->errorValue = _XkbErrCode2(0x4F, dWire->any.type); in _CheckSetDoodad()
5268 *wire_inout = wire; in _CheckSetDoodad()
5277 char *wire; in _CheckSetOverlay() local
5282 wire = *wire_inout; in _CheckSetOverlay()
5283 olWire = (xkbOverlayWireDesc *) wire; in _CheckSetOverlay()
5284 if (client->swapped) { in _CheckSetOverlay()
5285 swapl(&olWire->name); in _CheckSetOverlay()
5287 CHK_ATOM_ONLY(olWire->name); in _CheckSetOverlay()
5288 ol = XkbAddGeomOverlay(section, olWire->name, olWire->nRows); in _CheckSetOverlay()
5290 for (r = 0; r < olWire->nRows; r++) { in _CheckSetOverlay()
5295 if (rWire->rowUnder > section->num_rows) { in _CheckSetOverlay()
5296 client->errorValue = _XkbErrCode4(0x20, r, section->num_rows, in _CheckSetOverlay()
5297 rWire->rowUnder); in _CheckSetOverlay()
5300 row = XkbAddGeomOverlayRow(ol, rWire->rowUnder, rWire->nKeys); in _CheckSetOverlay()
5302 for (k = 0; k < rWire->nKeys; k++, kWire++) { in _CheckSetOverlay()
5304 (char *) kWire->over, in _CheckSetOverlay()
5305 (char *) kWire->under) == NULL) { in _CheckSetOverlay()
5306 client->errorValue = _XkbErrCode3(0x21, r, k); in _CheckSetOverlay()
5313 wire = (char *) olWire; in _CheckSetOverlay()
5314 *wire_inout = wire; in _CheckSetOverlay()
5324 char *wire; in _CheckSetSections() local
5328 wire = *wire_inout; in _CheckSetSections()
5329 if (req->nSections < 1) in _CheckSetSections()
5331 sWire = (xkbSectionWireDesc *) wire; in _CheckSetSections()
5332 for (s = 0; s < req->nSections; s++) { in _CheckSetSections()
5336 if (client->swapped) { in _CheckSetSections()
5337 swapl(&sWire->name); in _CheckSetSections()
5338 swaps(&sWire->top); in _CheckSetSections()
5339 swaps(&sWire->left); in _CheckSetSections()
5340 swaps(&sWire->width); in _CheckSetSections()
5341 swaps(&sWire->height); in _CheckSetSections()
5342 swaps(&sWire->angle); in _CheckSetSections()
5344 CHK_ATOM_ONLY(sWire->name); in _CheckSetSections()
5345 section = XkbAddGeomSection(geom, sWire->name, sWire->nRows, in _CheckSetSections()
5346 sWire->nDoodads, sWire->nOverlays); in _CheckSetSections()
5349 section->priority = sWire->priority; in _CheckSetSections()
5350 section->top = sWire->top; in _CheckSetSections()
5351 section->left = sWire->left; in _CheckSetSections()
5352 section->width = sWire->width; in _CheckSetSections()
5353 section->height = sWire->height; in _CheckSetSections()
5354 section->angle = sWire->angle; in _CheckSetSections()
5356 for (r = 0; r < sWire->nRows; r++) { in _CheckSetSections()
5361 if (client->swapped) { in _CheckSetSections()
5362 swaps(&rWire->top); in _CheckSetSections()
5363 swaps(&rWire->left); in _CheckSetSections()
5365 row = XkbAddGeomRow(section, rWire->nKeys); in _CheckSetSections()
5368 row->top = rWire->top; in _CheckSetSections()
5369 row->left = rWire->left; in _CheckSetSections()
5370 row->vertical = rWire->vertical; in _CheckSetSections()
5372 for (k = 0; k < rWire->nKeys; k++) { in _CheckSetSections()
5378 memcpy(key->name.name, kWire[k].name, XkbKeyNameLength); in _CheckSetSections()
5379 key->gap = kWire[k].gap; in _CheckSetSections()
5380 key->shape_ndx = kWire[k].shapeNdx; in _CheckSetSections()
5381 key->color_ndx = kWire[k].colorNdx; in _CheckSetSections()
5382 if (key->shape_ndx >= geom->num_shapes) { in _CheckSetSections()
5383 client->errorValue = _XkbErrCode3(0x10, key->shape_ndx, in _CheckSetSections()
5384 geom->num_shapes); in _CheckSetSections()
5387 if (key->color_ndx >= geom->num_colors) { in _CheckSetSections()
5388 client->errorValue = _XkbErrCode3(0x11, key->color_ndx, in _CheckSetSections()
5389 geom->num_colors); in _CheckSetSections()
5393 rWire = (xkbRowWireDesc *) &kWire[rWire->nKeys]; in _CheckSetSections()
5395 wire = (char *) rWire; in _CheckSetSections()
5396 if (sWire->nDoodads > 0) { in _CheckSetSections()
5399 for (d = 0; d < sWire->nDoodads; d++) { in _CheckSetSections()
5400 status = _CheckSetDoodad(&wire, geom, section, client); in _CheckSetSections()
5405 if (sWire->nOverlays > 0) { in _CheckSetSections()
5408 for (o = 0; o < sWire->nOverlays; o++) { in _CheckSetSections()
5409 status = _CheckSetOverlay(&wire, geom, section, client); in _CheckSetSections()
5414 sWire = (xkbSectionWireDesc *) wire; in _CheckSetSections()
5416 wire = (char *) sWire; in _CheckSetSections()
5417 *wire_inout = wire; in _CheckSetSections()
5426 char *wire; in _CheckSetShapes() local
5428 wire = *wire_inout; in _CheckSetShapes()
5429 if (req->nShapes < 1) { in _CheckSetShapes()
5430 client->errorValue = _XkbErrCode2(0x06, req->nShapes); in _CheckSetShapes()
5438 shapeWire = (xkbShapeWireDesc *) wire; in _CheckSetShapes()
5439 for (i = 0; i < req->nShapes; i++) { in _CheckSetShapes()
5444 XkbAddGeomShape(geom, shapeWire->name, shapeWire->nOutlines); in _CheckSetShapes()
5448 for (o = 0; o < shapeWire->nOutlines; o++) { in _CheckSetShapes()
5453 ol = XkbAddGeomOutline(shape, olWire->nPoints); in _CheckSetShapes()
5456 ol->corner_radius = olWire->cornerRadius; in _CheckSetShapes()
5458 for (p = 0, pt = ol->points; p < olWire->nPoints; p++, pt++) { in _CheckSetShapes()
5459 pt->x = ptWire[p].x; in _CheckSetShapes()
5460 pt->y = ptWire[p].y; in _CheckSetShapes()
5461 if (client->swapped) { in _CheckSetShapes()
5462 swaps(&pt->x); in _CheckSetShapes()
5463 swaps(&pt->y); in _CheckSetShapes()
5466 ol->num_points = olWire->nPoints; in _CheckSetShapes()
5467 olWire = (xkbOutlineWireDesc *) (&ptWire[olWire->nPoints]); in _CheckSetShapes()
5469 if (shapeWire->primaryNdx != XkbNoShape) in _CheckSetShapes()
5470 shape->primary = &shape->outlines[shapeWire->primaryNdx]; in _CheckSetShapes()
5471 if (shapeWire->approxNdx != XkbNoShape) in _CheckSetShapes()
5472 shape->approx = &shape->outlines[shapeWire->approxNdx]; in _CheckSetShapes()
5475 wire = (char *) shapeWire; in _CheckSetShapes()
5477 if (geom->num_shapes != req->nShapes) { in _CheckSetShapes()
5478 client->errorValue = _XkbErrCode3(0x07, geom->num_shapes, req->nShapes); in _CheckSetShapes()
5482 *wire_inout = wire; in _CheckSetShapes()
5491 char *wire; in _CheckSetGeom() local
5493 wire = (char *) &req[1]; in _CheckSetGeom()
5494 status = _GetCountedString(&wire, client, &geom->label_font); in _CheckSetGeom()
5498 for (i = 0; i < req->nProperties; i++) { in _CheckSetGeom()
5501 status = _GetCountedString(&wire, client, &name); in _CheckSetGeom()
5504 status = _GetCountedString(&wire, client, &val); in _CheckSetGeom()
5518 if (req->nColors < 2) { in _CheckSetGeom()
5519 client->errorValue = _XkbErrCode3(0x01, 2, req->nColors); in _CheckSetGeom()
5522 if (req->baseColorNdx > req->nColors) { in _CheckSetGeom()
5523 client->errorValue = in _CheckSetGeom()
5524 _XkbErrCode3(0x03, req->nColors, req->baseColorNdx); in _CheckSetGeom()
5527 if (req->labelColorNdx > req->nColors) { in _CheckSetGeom()
5528 client->errorValue = in _CheckSetGeom()
5529 _XkbErrCode3(0x03, req->nColors, req->labelColorNdx); in _CheckSetGeom()
5532 if (req->labelColorNdx == req->baseColorNdx) { in _CheckSetGeom()
5533 client->errorValue = _XkbErrCode3(0x04, req->baseColorNdx, in _CheckSetGeom()
5534 req->labelColorNdx); in _CheckSetGeom()
5538 for (i = 0; i < req->nColors; i++) { in _CheckSetGeom()
5541 status = _GetCountedString(&wire, client, &name); in _CheckSetGeom()
5544 if (!XkbAddGeomColor(geom, name, geom->num_colors)) { in _CheckSetGeom()
5550 if (req->nColors != geom->num_colors) { in _CheckSetGeom()
5551 client->errorValue = _XkbErrCode3(0x05, req->nColors, geom->num_colors); in _CheckSetGeom()
5554 geom->label_color = &geom->colors[req->labelColorNdx]; in _CheckSetGeom()
5555 geom->base_color = &geom->colors[req->baseColorNdx]; in _CheckSetGeom()
5557 if ((status = _CheckSetShapes(geom, req, &wire, client)) != Success) in _CheckSetGeom()
5560 if ((status = _CheckSetSections(geom, req, &wire, client)) != Success) in _CheckSetGeom()
5563 for (i = 0; i < req->nDoodads; i++) { in _CheckSetGeom()
5564 status = _CheckSetDoodad(&wire, geom, NULL, client); in _CheckSetGeom()
5569 for (i = 0; i < req->nKeyAliases; i++) { in _CheckSetGeom()
5570 if (XkbAddGeomKeyAlias(geom, &wire[XkbKeyNameLength], wire) == NULL) in _CheckSetGeom()
5572 wire += 2 * XkbKeyNameLength; in _CheckSetGeom()
5587 xkb = dev->key->xkbInfo->desc; in _XkbSetGeometry()
5588 old = xkb->geom; in _XkbSetGeometry()
5589 xkb->geom = NULL; in _XkbSetGeometry()
5592 sizes.num_properties = stuff->nProperties; in _XkbSetGeometry()
5593 sizes.num_colors = stuff->nColors; in _XkbSetGeometry()
5594 sizes.num_shapes = stuff->nShapes; in _XkbSetGeometry()
5595 sizes.num_sections = stuff->nSections; in _XkbSetGeometry()
5596 sizes.num_doodads = stuff->nDoodads; in _XkbSetGeometry()
5597 sizes.num_key_aliases = stuff->nKeyAliases; in _XkbSetGeometry()
5599 xkb->geom = old; in _XkbSetGeometry()
5602 geom = xkb->geom; in _XkbSetGeometry()
5603 geom->name = stuff->name; in _XkbSetGeometry()
5604 geom->width_mm = stuff->widthMM; in _XkbSetGeometry()
5605 geom->height_mm = stuff->heightMM; in _XkbSetGeometry()
5608 xkb->geom = old; in _XkbSetGeometry()
5611 new_name = (xkb->names->geometry != geom->name); in _XkbSetGeometry()
5612 xkb->names->geometry = geom->name; in _XkbSetGeometry()
5622 nkn.deviceID = nkn.oldDeviceID = dev->id; in _XkbSetGeometry()
5623 nkn.minKeyCode = nkn.oldMinKeyCode = xkb->min_key_code; in _XkbSetGeometry()
5624 nkn.maxKeyCode = nkn.oldMaxKeyCode = xkb->max_key_code; in _XkbSetGeometry()
5641 if (!(client->xkbClientFlags & _XkbClientInitialized)) in ProcXkbSetGeometry()
5644 CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixManageAccess); in ProcXkbSetGeometry()
5645 CHK_ATOM_OR_NONE(stuff->name); in ProcXkbSetGeometry()
5651 if (stuff->deviceSpec == XkbUseCoreKbd) { in ProcXkbSetGeometry()
5654 for (other = inputInfo.devices; other; other = other->next) { in ProcXkbSetGeometry()
5655 if ((other != dev) && other->key && !IsMaster(other) && in ProcXkbSetGeometry()
5681 if (!(client->xkbClientFlags & _XkbClientInitialized)) in ProcXkbPerClientFlags()
5684 CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, access_mode); in ProcXkbPerClientFlags()
5685 CHK_MASK_LEGAL(0x01, stuff->change, XkbPCF_AllFlagsMask); in ProcXkbPerClientFlags()
5686 CHK_MASK_MATCH(0x02, stuff->change, stuff->value); in ProcXkbPerClientFlags()
5689 if (stuff->change) { in ProcXkbPerClientFlags()
5690 client->xkbClientFlags &= ~stuff->change; in ProcXkbPerClientFlags()
5691 client->xkbClientFlags |= stuff->value; in ProcXkbPerClientFlags()
5693 if (stuff->change & XkbPCF_AutoResetControlsMask) { in ProcXkbPerClientFlags()
5696 want = stuff->value & XkbPCF_AutoResetControlsMask; in ProcXkbPerClientFlags()
5698 interest->autoCtrls = interest->autoCtrlValues = 0; in ProcXkbPerClientFlags()
5701 XID id = FakeClientID(client->index); in ProcXkbPerClientFlags()
5712 affect = stuff->ctrlsToChange; in ProcXkbPerClientFlags()
5715 CHK_MASK_MATCH(0x04, affect, stuff->autoCtrls); in ProcXkbPerClientFlags()
5716 CHK_MASK_MATCH(0x05, stuff->autoCtrls, stuff->autoCtrlValues); in ProcXkbPerClientFlags()
5718 interest->autoCtrls &= ~affect; in ProcXkbPerClientFlags()
5719 interest->autoCtrlValues &= ~affect; in ProcXkbPerClientFlags()
5720 interest->autoCtrls |= stuff->autoCtrls & affect; in ProcXkbPerClientFlags()
5721 interest->autoCtrlValues |= stuff->autoCtrlValues & affect; in ProcXkbPerClientFlags()
5727 .sequenceNumber = client->sequence, in ProcXkbPerClientFlags()
5730 .value = client->xkbClientFlags & XkbPCF_AllFlagsMask, in ProcXkbPerClientFlags()
5731 .autoCtrls = interest ? interest->autoCtrls : 0, in ProcXkbPerClientFlags()
5732 .autoCtrlValues = interest ? interest->autoCtrlValues : 0, in ProcXkbPerClientFlags()
5734 if (client->swapped) { in ProcXkbPerClientFlags()
5747 /* all latin-1 alphanumerics, plus parens, minus, underscore, slash */
5769 unsigned char *wire, *str, *tmp, *legal; in GetComponentSpec() local
5776 wire = *pWire; in GetComponentSpec()
5777 len = (*(unsigned char *) wire++); in GetComponentSpec()
5783 if (legal[(*wire) / 8] & (1 << ((*wire) % 8))) in GetComponentSpec()
5784 *tmp++ = *wire++; in GetComponentSpec()
5786 wire++; in GetComponentSpec()
5802 *pWire = wire; in GetComponentSpec()
5821 if (!(client->xkbClientFlags & _XkbClientInitialized)) in ProcXkbListComponents()
5824 CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess); in ProcXkbListComponents()
5833 len = (str + size + 1) - ((unsigned char *) stuff); in ProcXkbListComponents()
5834 if ((XkbPaddedSize(len) / 4) > stuff->length) in ProcXkbListComponents()
5838 if ((XkbPaddedSize(len) / 4) != stuff->length) in ProcXkbListComponents()
5842 .deviceID = dev->id, in ProcXkbListComponents()
5843 .sequenceNumber = client->sequence, in ProcXkbListComponents()
5853 if (client->swapped) { in ProcXkbListComponents()
5897 if (!(client->xkbClientFlags & _XkbClientInitialized)) in ProcXkbGetKbdByName()
5900 CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, access_mode); in ProcXkbGetKbdByName()
5903 xkb = dev->key->xkbInfo->desc; in ProcXkbGetKbdByName()
5915 len = str - ((unsigned char *) stuff); in ProcXkbGetKbdByName()
5916 if ((XkbPaddedSize(len) / 4) != stuff->length) in ProcXkbGetKbdByName()
5919 CHK_MASK_LEGAL(0x01, stuff->want, XkbGBN_AllComponentsMask); in ProcXkbGetKbdByName()
5920 CHK_MASK_LEGAL(0x02, stuff->need, XkbGBN_AllComponentsMask); in ProcXkbGetKbdByName()
5922 if (stuff->load) in ProcXkbGetKbdByName()
5925 fwant = stuff->want | stuff->need; in ProcXkbGetKbdByName()
5945 rep.deviceID = dev->id; in ProcXkbGetKbdByName()
5946 rep.sequenceNumber = client->sequence; in ProcXkbGetKbdByName()
5948 rep.minKeyCode = xkb->min_key_code; in ProcXkbGetKbdByName()
5949 rep.maxKeyCode = xkb->max_key_code; in ProcXkbGetKbdByName()
5952 XkbConvertGetByNameComponents(TRUE, stuff->want) | XkmVirtualModsMask; in ProcXkbGetKbdByName()
5953 fneed = XkbConvertGetByNameComponents(TRUE, stuff->need); in ProcXkbGetKbdByName()
5955 if (stuff->load) { in ProcXkbGetKbdByName()
5970 stuff->want |= stuff->need; in ProcXkbGetKbdByName()
5974 if (stuff->load) in ProcXkbGetKbdByName()
5976 if (stuff->load || in ProcXkbGetKbdByName()
5977 ((rep.reported & XkbGBN_SymbolsMask) && (new->compat))) { in ProcXkbGetKbdByName()
5982 new->min_key_code, XkbNumKeys(new), &changes); in ProcXkbGetKbdByName()
5985 if (new->map == NULL) in ProcXkbGetKbdByName()
5989 mrep.deviceID = dev->id; in ProcXkbGetKbdByName()
5990 mrep.sequenceNumber = client->sequence; in ProcXkbGetKbdByName()
5992 ((SIZEOF(xkbGetMapReply) - SIZEOF(xGenericReply)) >> 2); in ProcXkbGetKbdByName()
5993 mrep.minKeyCode = new->min_key_code; in ProcXkbGetKbdByName()
5994 mrep.maxKeyCode = new->max_key_code; in ProcXkbGetKbdByName()
6002 mrep.nTypes = mrep.totalTypes = new->map->num_types; in ProcXkbGetKbdByName()
6010 mrep.firstKeySym = mrep.firstModMapKey = new->min_key_code; in ProcXkbGetKbdByName()
6021 mrep.firstKeyExplicit = new->min_key_code; in ProcXkbGetKbdByName()
6024 mrep.firstVModMapKey = new->min_key_code; in ProcXkbGetKbdByName()
6036 if (new->compat == NULL) in ProcXkbGetKbdByName()
6040 crep.deviceID = dev->id; in ProcXkbGetKbdByName()
6041 crep.sequenceNumber = client->sequence; in ProcXkbGetKbdByName()
6045 crep.nSI = crep.nTotalSI = new->compat->num_si; in ProcXkbGetKbdByName()
6046 XkbComputeGetCompatMapReplySize(new->compat, &crep); in ProcXkbGetKbdByName()
6049 if (new->indicators == NULL) in ProcXkbGetKbdByName()
6053 irep.deviceID = dev->id; in ProcXkbGetKbdByName()
6054 irep.sequenceNumber = client->sequence; in ProcXkbGetKbdByName()
6057 XkbComputeGetIndicatorMapReplySize(new->indicators, &irep); in ProcXkbGetKbdByName()
6060 if (new->names == NULL) in ProcXkbGetKbdByName()
6064 nrep.deviceID = dev->id; in ProcXkbGetKbdByName()
6065 nrep.sequenceNumber = client->sequence; in ProcXkbGetKbdByName()
6067 nrep.minKeyCode = new->min_key_code; in ProcXkbGetKbdByName()
6068 nrep.maxKeyCode = new->max_key_code; in ProcXkbGetKbdByName()
6071 if (new->map != NULL) in ProcXkbGetKbdByName()
6072 nrep.nTypes = new->map->num_types; in ProcXkbGetKbdByName()
6079 nrep.nRadioGroups = new->names->num_rg; in ProcXkbGetKbdByName()
6092 nrep.firstKey = new->min_key_code; in ProcXkbGetKbdByName()
6094 nrep.nKeyAliases = new->names->num_key_aliases; in ProcXkbGetKbdByName()
6106 if (new->geom == NULL) in ProcXkbGetKbdByName()
6110 grep.deviceID = dev->id; in ProcXkbGetKbdByName()
6111 grep.sequenceNumber = client->sequence; in ProcXkbGetKbdByName()
6119 XkbComputeGetGeometryReplySize(new->geom, &grep, None); in ProcXkbGetKbdByName()
6125 if (client->swapped) { in ProcXkbGetKbdByName()
6135 XkbSendCompatMap(client, new->compat, &crep); in ProcXkbGetKbdByName()
6137 XkbSendIndicatorMap(client, new->indicators, &irep); in ProcXkbGetKbdByName()
6141 XkbSendGeometry(client, new->geom, &grep, FALSE); in ProcXkbGetKbdByName()
6148 dev->key->xkbInfo->desc = xkb; in ProcXkbGetKbdByName()
6153 nkn.deviceID = nkn.oldDeviceID = dev->id; in ProcXkbGetKbdByName()
6154 nkn.minKeyCode = new->min_key_code; in ProcXkbGetKbdByName()
6155 nkn.maxKeyCode = new->max_key_code; in ProcXkbGetKbdByName()
6156 nkn.oldMinKeyCode = xkb->min_key_code; in ProcXkbGetKbdByName()
6157 nkn.oldMaxKeyCode = xkb->max_key_code; in ProcXkbGetKbdByName()
6168 for (tmpd = inputInfo.devices; tmpd; tmpd = tmpd->next) { in ProcXkbGetKbdByName()
6170 (tmpd != master || dev != master->lastSlave)) in ProcXkbGetKbdByName()
6176 if (tmpd->kbdfeed && tmpd->kbdfeed->xkb_sli) { in ProcXkbGetKbdByName()
6177 old_sli = tmpd->kbdfeed->xkb_sli; in ProcXkbGetKbdByName()
6178 tmpd->kbdfeed->xkb_sli = NULL; in ProcXkbGetKbdByName()
6179 sli = XkbAllocSrvLedInfo(tmpd, tmpd->kbdfeed, NULL, 0); in ProcXkbGetKbdByName()
6181 sli->explicitState = old_sli->explicitState; in ProcXkbGetKbdByName()
6182 sli->effectiveState = old_sli->effectiveState; in ProcXkbGetKbdByName()
6184 tmpd->kbdfeed->xkb_sli = sli; in ProcXkbGetKbdByName()
6213 sli->namesPresent = 0; in ComputeDeviceLedInfoSize()
6215 sli->mapsPresent = 0; in ComputeDeviceLedInfoSize()
6218 if (sli->names && sli->names[n] != None) { in ComputeDeviceLedInfoSize()
6219 sli->namesPresent |= bit; in ComputeDeviceLedInfoSize()
6222 if (sli->maps && XkbIM_InUse(&sli->maps[n])) { in ComputeDeviceLedInfoSize()
6223 sli->mapsPresent |= bit; in ComputeDeviceLedInfoSize()
6240 if (dev->kbdfeed) in CheckDeviceLedFBs()
6242 else if (dev->leds) in CheckDeviceLedFBs()
6245 client->errorValue = _XkbErrCode2(XkbErr_BadClass, class); in CheckDeviceLedFBs()
6250 if ((dev->kbdfeed) && in CheckDeviceLedFBs()
6255 for (kf = dev->kbdfeed; (kf); kf = kf->next) { in CheckDeviceLedFBs()
6257 (id != kf->ctrl.id)) in CheckDeviceLedFBs()
6261 if (!kf->xkb_sli) in CheckDeviceLedFBs()
6262 kf->xkb_sli = XkbAllocSrvLedInfo(dev, kf, NULL, 0); in CheckDeviceLedFBs()
6263 length += ComputeDeviceLedInfoSize(dev, rep->present, kf->xkb_sli); in CheckDeviceLedFBs()
6268 if ((dev->leds) && in CheckDeviceLedFBs()
6273 for (lf = dev->leds; (lf); lf = lf->next) { in CheckDeviceLedFBs()
6275 (id != lf->ctrl.id)) in CheckDeviceLedFBs()
6279 if (!lf->xkb_sli) in CheckDeviceLedFBs()
6280 lf->xkb_sli = XkbAllocSrvLedInfo(dev, NULL, lf, 0); in CheckDeviceLedFBs()
6281 length += ComputeDeviceLedInfoSize(dev, rep->present, lf->xkb_sli); in CheckDeviceLedFBs()
6287 rep->nDeviceLedFBs = nFBs; in CheckDeviceLedFBs()
6288 rep->length += (length / 4); in CheckDeviceLedFBs()
6292 client->errorValue = _XkbErrCode2(XkbErr_BadId, id); in CheckDeviceLedFBs()
6294 client->errorValue = _XkbErrCode2(XkbErr_BadClass, class); in CheckDeviceLedFBs()
6301 xkbDeviceLedsWireDesc wire; in SendDeviceLedInfo() local
6305 wire.ledClass = sli->class; in SendDeviceLedInfo()
6306 wire.ledID = sli->id; in SendDeviceLedInfo()
6307 wire.namesPresent = sli->namesPresent; in SendDeviceLedInfo()
6308 wire.mapsPresent = sli->mapsPresent; in SendDeviceLedInfo()
6309 wire.physIndicators = sli->physIndicators; in SendDeviceLedInfo()
6310 wire.state = sli->effectiveState; in SendDeviceLedInfo()
6311 if (client->swapped) { in SendDeviceLedInfo()
6312 swaps(&wire.ledClass); in SendDeviceLedInfo()
6313 swaps(&wire.ledID); in SendDeviceLedInfo()
6314 swapl(&wire.namesPresent); in SendDeviceLedInfo()
6315 swapl(&wire.mapsPresent); in SendDeviceLedInfo()
6316 swapl(&wire.physIndicators); in SendDeviceLedInfo()
6317 swapl(&wire.state); in SendDeviceLedInfo()
6319 WriteToClient(client, SIZEOF(xkbDeviceLedsWireDesc), &wire); in SendDeviceLedInfo()
6321 if (sli->namesPresent | sli->mapsPresent) { in SendDeviceLedInfo()
6324 if (sli->namesPresent) { in SendDeviceLedInfo()
6328 if (sli->namesPresent & bit) { in SendDeviceLedInfo()
6329 awire = (CARD32) sli->names[i]; in SendDeviceLedInfo()
6330 if (client->swapped) { in SendDeviceLedInfo()
6338 if (sli->mapsPresent) { in SendDeviceLedInfo()
6342 if (sli->mapsPresent & bit) { in SendDeviceLedInfo()
6343 iwire.flags = sli->maps[i].flags; in SendDeviceLedInfo()
6344 iwire.whichGroups = sli->maps[i].which_groups; in SendDeviceLedInfo()
6345 iwire.groups = sli->maps[i].groups; in SendDeviceLedInfo()
6346 iwire.whichMods = sli->maps[i].which_mods; in SendDeviceLedInfo()
6347 iwire.mods = sli->maps[i].mods.mask; in SendDeviceLedInfo()
6348 iwire.realMods = sli->maps[i].mods.real_mods; in SendDeviceLedInfo()
6349 iwire.virtualMods = sli->maps[i].mods.vmods; in SendDeviceLedInfo()
6350 iwire.ctrls = sli->maps[i].ctrls; in SendDeviceLedInfo()
6351 if (client->swapped) { in SendDeviceLedInfo()
6372 if (dev->kbdfeed) in SendDeviceLedFBs()
6374 else if (dev->leds) in SendDeviceLedFBs()
6377 if ((dev->kbdfeed) && in SendDeviceLedFBs()
6381 for (kf = dev->kbdfeed; (kf); kf = kf->next) { in SendDeviceLedFBs()
6383 (id == kf->ctrl.id)) { in SendDeviceLedFBs()
6384 length += SendDeviceLedInfo(kf->xkb_sli, client); in SendDeviceLedFBs()
6390 if ((dev->leds) && in SendDeviceLedFBs()
6394 for (lf = dev->leds; (lf); lf = lf->next) { in SendDeviceLedFBs()
6396 (id == lf->ctrl.id)) { in SendDeviceLedFBs()
6397 length += SendDeviceLedInfo(lf->xkb_sli, client); in SendDeviceLedFBs()
6423 if (!(client->xkbClientFlags & _XkbClientInitialized)) in ProcXkbGetDeviceInfo()
6426 wanted = stuff->wanted; in ProcXkbGetDeviceInfo()
6428 CHK_ANY_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess); in ProcXkbGetDeviceInfo()
6431 if ((!dev->button) || ((stuff->nBtns < 1) && (!stuff->allBtns))) in ProcXkbGetDeviceInfo()
6433 if ((!dev->kbdfeed) && (!dev->leds)) in ProcXkbGetDeviceInfo()
6436 nameLen = XkbSizeCountedString(dev->name); in ProcXkbGetDeviceInfo()
6439 .deviceID = dev->id, in ProcXkbGetDeviceInfo()
6440 .sequenceNumber = client->sequence, in ProcXkbGetDeviceInfo()
6450 .totalBtns = dev->button ? dev->button->numButtons : 0, in ProcXkbGetDeviceInfo()
6451 .hasOwnState = (dev->key && dev->key->xkbInfo), in ProcXkbGetDeviceInfo()
6452 .dfltKbdFB = dev->kbdfeed ? dev->kbdfeed->ctrl.id : XkbXINone, in ProcXkbGetDeviceInfo()
6453 .dfltLedFB = dev->leds ? dev->leds->ctrl.id : XkbXINone, in ProcXkbGetDeviceInfo()
6454 .devType = dev->xinput_type in ProcXkbGetDeviceInfo()
6457 ledClass = stuff->ledClass; in ProcXkbGetDeviceInfo()
6458 ledID = stuff->ledID; in ProcXkbGetDeviceInfo()
6461 if (stuff->allBtns) { in ProcXkbGetDeviceInfo()
6462 stuff->firstBtn = 0; in ProcXkbGetDeviceInfo()
6463 stuff->nBtns = dev->button->numButtons; in ProcXkbGetDeviceInfo()
6466 if ((stuff->firstBtn + stuff->nBtns) > dev->button->numButtons) { in ProcXkbGetDeviceInfo()
6467 client->errorValue = _XkbErrCode4(0x02, dev->button->numButtons, in ProcXkbGetDeviceInfo()
6468 stuff->firstBtn, stuff->nBtns); in ProcXkbGetDeviceInfo()
6472 rep.firstBtnWanted = stuff->firstBtn; in ProcXkbGetDeviceInfo()
6473 rep.nBtnsWanted = stuff->nBtns; in ProcXkbGetDeviceInfo()
6474 if (dev->button->xkb_acts != NULL) { in ProcXkbGetDeviceInfo()
6478 rep.firstBtnRtrn = stuff->firstBtn; in ProcXkbGetDeviceInfo()
6479 rep.nBtnsRtrn = stuff->nBtns; in ProcXkbGetDeviceInfo()
6480 act = &dev->button->xkb_acts[rep.firstBtnWanted]; in ProcXkbGetDeviceInfo()
6482 if (act->type != XkbSA_NoAction) in ProcXkbGetDeviceInfo()
6486 rep.nBtnsRtrn -= i; in ProcXkbGetDeviceInfo()
6488 &dev->button->xkb_acts[rep.firstBtnRtrn + rep.nBtnsRtrn - in ProcXkbGetDeviceInfo()
6490 for (i = 0; i < rep.nBtnsRtrn; i++, act--) { in ProcXkbGetDeviceInfo()
6491 if (act->type != XkbSA_NoAction) in ProcXkbGetDeviceInfo()
6494 rep.nBtnsRtrn -= i; in ProcXkbGetDeviceInfo()
6507 if (client->swapped) { in ProcXkbGetDeviceInfo()
6523 XkbWriteCountedString(str, dev->name, client->swapped); in ProcXkbGetDeviceInfo()
6526 length -= nameLen; in ProcXkbGetDeviceInfo()
6533 awire = (xkbActionWireDesc *) &dev->button->xkb_acts[rep.firstBtnRtrn]; in ProcXkbGetDeviceInfo()
6535 length -= sz; in ProcXkbGetDeviceInfo()
6552 CheckSetDeviceIndicators(char *wire, in CheckSetDeviceIndicators() argument
6560 ledWire = (xkbDeviceLedsWireDesc *) wire; in CheckSetDeviceIndicators()
6562 if (client->swapped) { in CheckSetDeviceIndicators()
6563 swaps(&ledWire->ledClass); in CheckSetDeviceIndicators()
6564 swaps(&ledWire->ledID); in CheckSetDeviceIndicators()
6565 swapl(&ledWire->namesPresent); in CheckSetDeviceIndicators()
6566 swapl(&ledWire->mapsPresent); in CheckSetDeviceIndicators()
6567 swapl(&ledWire->physIndicators); in CheckSetDeviceIndicators()
6570 sli = XkbFindSrvLedInfo(dev, ledWire->ledClass, ledWire->ledID, in CheckSetDeviceIndicators()
6581 if (ledWire->namesPresent & bit) in CheckSetDeviceIndicators()
6583 if (ledWire->mapsPresent & bit) in CheckSetDeviceIndicators()
6589 if (client->swapped) { in CheckSetDeviceIndicators()
6592 CHK_ATOM_OR_NONE3(((Atom) (*atomWire)), client->errorValue, in CheckSetDeviceIndicators()
6600 if (client->swapped) { in CheckSetDeviceIndicators()
6601 swaps(&mapWire->virtualMods); in CheckSetDeviceIndicators()
6602 swapl(&mapWire->ctrls); in CheckSetDeviceIndicators()
6604 CHK_MASK_LEGAL3(0x21, mapWire->whichGroups, in CheckSetDeviceIndicators()
6606 client->errorValue, *status_rtrn, NULL); in CheckSetDeviceIndicators()
6607 CHK_MASK_LEGAL3(0x22, mapWire->whichMods, XkbIM_UseAnyMods, in CheckSetDeviceIndicators()
6608 client->errorValue, *status_rtrn, NULL); in CheckSetDeviceIndicators()
6623 SetDeviceIndicators(char *wire, in SetDeviceIndicators() argument
6643 ledWire = (xkbDeviceLedsWireDesc *) wire; in SetDeviceIndicators()
6657 sli = XkbFindSrvLedInfo(dev, ledWire->ledClass, ledWire->ledID, in SetDeviceIndicators()
6666 namec = sli->namesPresent | ledWire->namesPresent; in SetDeviceIndicators()
6667 memset((char *) sli->names, 0, XkbNumIndicators * sizeof(Atom)); in SetDeviceIndicators()
6669 if (ledWire->namesPresent) { in SetDeviceIndicators()
6670 sli->namesPresent = ledWire->namesPresent; in SetDeviceIndicators()
6671 memset((char *) sli->names, 0, XkbNumIndicators * sizeof(Atom)); in SetDeviceIndicators()
6673 if (ledWire->namesPresent & bit) { in SetDeviceIndicators()
6678 sli->names[n] = (Atom) *atomWire; in SetDeviceIndicators()
6679 if (sli->names[n] == None) in SetDeviceIndicators()
6680 ledWire->namesPresent &= ~bit; in SetDeviceIndicators()
6687 mapc = sli->mapsPresent | ledWire->mapsPresent; in SetDeviceIndicators()
6688 sli->mapsPresent = ledWire->mapsPresent; in SetDeviceIndicators()
6689 memset((char *) sli->maps, 0, in SetDeviceIndicators()
6692 if (ledWire->mapsPresent) { in SetDeviceIndicators()
6694 if (ledWire->mapsPresent & bit) { in SetDeviceIndicators()
6699 sli->maps[n].flags = mapWire->flags; in SetDeviceIndicators()
6700 sli->maps[n].which_groups = mapWire->whichGroups; in SetDeviceIndicators()
6701 sli->maps[n].groups = mapWire->groups; in SetDeviceIndicators()
6702 sli->maps[n].which_mods = mapWire->whichMods; in SetDeviceIndicators()
6703 sli->maps[n].mods.mask = mapWire->mods; in SetDeviceIndicators()
6704 sli->maps[n].mods.real_mods = mapWire->realMods; in SetDeviceIndicators()
6705 sli->maps[n].mods.vmods = mapWire->virtualMods; in SetDeviceIndicators()
6706 sli->maps[n].ctrls = mapWire->ctrls; in SetDeviceIndicators()
6712 statec = sli->effectiveState ^ ledWire->state; in SetDeviceIndicators()
6713 sli->explicitState &= ~statec; in SetDeviceIndicators()
6714 sli->explicitState |= (ledWire->state & statec); in SetDeviceIndicators()
6724 if ((sli->flags & XkbSLI_HasOwnState) == 0) in SetDeviceIndicators()
6737 char *wire; in _XkbSetDeviceInfo() local
6739 wire = (char *) &stuff[1]; in _XkbSetDeviceInfo()
6740 if (stuff->change & XkbXI_ButtonActionsMask) { in _XkbSetDeviceInfo()
6741 if (!dev->button) { in _XkbSetDeviceInfo()
6742 client->errorValue = _XkbErrCode2(XkbErr_BadClass, ButtonClass); in _XkbSetDeviceInfo()
6745 if ((stuff->firstBtn + stuff->nBtns) > dev->button->numButtons) { in _XkbSetDeviceInfo()
6746 client->errorValue = in _XkbSetDeviceInfo()
6747 _XkbErrCode4(0x02, stuff->firstBtn, stuff->nBtns, in _XkbSetDeviceInfo()
6748 dev->button->numButtons); in _XkbSetDeviceInfo()
6751 wire += (stuff->nBtns * SIZEOF(xkbActionWireDesc)); in _XkbSetDeviceInfo()
6753 if (stuff->change & XkbXI_IndicatorsMask) { in _XkbSetDeviceInfo()
6756 wire = CheckSetDeviceIndicators(wire, dev, stuff->nDeviceLedFBs, in _XkbSetDeviceInfo()
6761 if (((wire - ((char *) stuff)) / 4) != stuff->length) in _XkbSetDeviceInfo()
6771 char *wire; in _XkbSetDeviceInfoCheck() local
6775 ed.deviceID = dev->id; in _XkbSetDeviceInfoCheck()
6776 wire = (char *) &stuff[1]; in _XkbSetDeviceInfoCheck()
6777 if (stuff->change & XkbXI_ButtonActionsMask) { in _XkbSetDeviceInfoCheck()
6782 nBtns = dev->button->numButtons; in _XkbSetDeviceInfoCheck()
6783 acts = dev->button->xkb_acts; in _XkbSetDeviceInfoCheck()
6788 dev->button->xkb_acts = acts; in _XkbSetDeviceInfoCheck()
6790 if (stuff->firstBtn + stuff->nBtns > nBtns) in _XkbSetDeviceInfoCheck()
6792 sz = stuff->nBtns * SIZEOF(xkbActionWireDesc); in _XkbSetDeviceInfoCheck()
6793 if (!_XkbCheckRequestBounds(client, stuff, wire, (char *) wire + sz)) in _XkbSetDeviceInfoCheck()
6795 memcpy((char *) &acts[stuff->firstBtn], (char *) wire, sz); in _XkbSetDeviceInfoCheck()
6796 wire += sz; in _XkbSetDeviceInfoCheck()
6798 ed.firstBtn = stuff->firstBtn; in _XkbSetDeviceInfoCheck()
6799 ed.nBtns = stuff->nBtns; in _XkbSetDeviceInfoCheck()
6801 if (dev->key) in _XkbSetDeviceInfoCheck()
6805 acts = &dev->button->xkb_acts[stuff->firstBtn]; in _XkbSetDeviceInfoCheck()
6806 for (i = 0; i < stuff->nBtns; i++, acts++) { in _XkbSetDeviceInfoCheck()
6807 if (acts->type != XkbSA_NoAction) in _XkbSetDeviceInfoCheck()
6808 XkbSetActionKeyMods(kbd->key->xkbInfo->desc, acts, 0); in _XkbSetDeviceInfoCheck()
6811 if (stuff->change & XkbXI_IndicatorsMask) { in _XkbSetDeviceInfoCheck()
6814 wire = SetDeviceIndicators(wire, dev, stuff->change, in _XkbSetDeviceInfoCheck()
6815 stuff->nDeviceLedFBs, &status, client, &ed, in _XkbSetDeviceInfoCheck()
6820 if ((stuff->change) && (ed.reason)) in _XkbSetDeviceInfoCheck()
6834 if (!(client->xkbClientFlags & _XkbClientInitialized)) in ProcXkbSetDeviceInfo()
6837 CHK_ANY_DEVICE(dev, stuff->deviceSpec, client, DixManageAccess); in ProcXkbSetDeviceInfo()
6838 CHK_MASK_LEGAL(0x01, stuff->change, XkbXI_AllFeaturesMask); in ProcXkbSetDeviceInfo()
6845 if (stuff->deviceSpec == XkbUseCoreKbd || in ProcXkbSetDeviceInfo()
6846 stuff->deviceSpec == XkbUseCorePtr) { in ProcXkbSetDeviceInfo()
6849 for (other = inputInfo.devices; other; other = other->next) { in ProcXkbSetDeviceInfo()
6852 ((stuff->deviceSpec == XkbUseCoreKbd && other->key) || in ProcXkbSetDeviceInfo()
6853 (stuff->deviceSpec == XkbUseCorePtr && other->button))) { in ProcXkbSetDeviceInfo()
6870 if (stuff->deviceSpec == XkbUseCoreKbd || in ProcXkbSetDeviceInfo()
6871 stuff->deviceSpec == XkbUseCorePtr) { in ProcXkbSetDeviceInfo()
6874 for (other = inputInfo.devices; other; other = other->next) { in ProcXkbSetDeviceInfo()
6877 ((stuff->deviceSpec == XkbUseCoreKbd && other->key) || in ProcXkbSetDeviceInfo()
6878 (stuff->deviceSpec == XkbUseCorePtr && other->button))) { in ProcXkbSetDeviceInfo()
6909 newFlags = xkbDebugFlags & (~stuff->affectFlags); in ProcXkbSetDebuggingFlags()
6910 newFlags |= (stuff->flags & stuff->affectFlags); in ProcXkbSetDebuggingFlags()
6911 newCtrls = xkbDebugCtrls & (~stuff->affectCtrls); in ProcXkbSetDebuggingFlags()
6912 newCtrls |= (stuff->ctrls & stuff->affectCtrls); in ProcXkbSetDebuggingFlags()
6913 if (xkbDebugFlags || newFlags || stuff->msgLength) { in ProcXkbSetDebuggingFlags()
6920 extraLength = (stuff->length << 2) - sz_xkbSetDebuggingFlagsReq; in ProcXkbSetDebuggingFlags()
6921 if (stuff->msgLength > 0) { in ProcXkbSetDebuggingFlags()
6924 if (extraLength < XkbPaddedSize(stuff->msgLength)) { in ProcXkbSetDebuggingFlags()
6927 stuff->msgLength, (long) extraLength, in ProcXkbSetDebuggingFlags()
6928 XkbPaddedSize(stuff->msgLength)); in ProcXkbSetDebuggingFlags()
6932 if (msg[stuff->msgLength - 1] != '\0') { in ProcXkbSetDebuggingFlags()
6933 ErrorF("[xkb] XkbDebug: message not null-terminated\n"); in ProcXkbSetDebuggingFlags()
6943 .sequenceNumber = client->sequence, in ProcXkbSetDebuggingFlags()
6950 if (client->swapped) { in ProcXkbSetDebuggingFlags()
6967 switch (stuff->data) { in ProcXkbDispatch()
7052 XkbReqCode = (unsigned char) extEntry->base; in XkbExtensionInit()
7053 XkbEventBase = (unsigned char) extEntry->eventBase; in XkbExtensionInit()
7054 XkbErrorBase = (unsigned char) extEntry->errorBase; in XkbExtensionInit()