Lines Matching full:map
46 XkbClientMapPtr map; in XkbAllocClientMap() local
60 if (xkb->map == NULL) { in XkbAllocClientMap()
61 map = calloc(1, sizeof(XkbClientMapRec)); in XkbAllocClientMap()
62 if (map == NULL) in XkbAllocClientMap()
64 xkb->map = map; in XkbAllocClientMap()
67 map = xkb->map; in XkbAllocClientMap()
70 if (map->types == NULL) { in XkbAllocClientMap()
71 map->types = calloc(nTotalTypes, sizeof(XkbKeyTypeRec)); in XkbAllocClientMap()
72 if (map->types == NULL) in XkbAllocClientMap()
74 map->num_types = 0; in XkbAllocClientMap()
75 map->size_types = nTotalTypes; in XkbAllocClientMap()
77 else if (map->size_types < nTotalTypes) { in XkbAllocClientMap()
78 XkbKeyTypeRec *prev_types = map->types; in XkbAllocClientMap()
80 map->types = in XkbAllocClientMap()
81 reallocarray(map->types, nTotalTypes, sizeof(XkbKeyTypeRec)); in XkbAllocClientMap()
82 if (map->types == NULL) { in XkbAllocClientMap()
84 map->num_types = map->size_types = 0; in XkbAllocClientMap()
87 map->size_types = nTotalTypes; in XkbAllocClientMap()
88 memset(&map->types[map->num_types], 0, in XkbAllocClientMap()
89 ((map->size_types - in XkbAllocClientMap()
90 map->num_types) * sizeof(XkbKeyTypeRec))); in XkbAllocClientMap()
96 if (map->syms == NULL) { in XkbAllocClientMap()
97 map->size_syms = (nKeys * 15) / 10; in XkbAllocClientMap()
98 map->syms = calloc(map->size_syms, sizeof(KeySym)); in XkbAllocClientMap()
99 if (!map->syms) { in XkbAllocClientMap()
100 map->size_syms = 0; in XkbAllocClientMap()
103 map->num_syms = 1; in XkbAllocClientMap()
104 map->syms[0] = NoSymbol; in XkbAllocClientMap()
106 if (map->key_sym_map == NULL) { in XkbAllocClientMap()
108 map->key_sym_map = calloc(i, sizeof(XkbSymMapRec)); in XkbAllocClientMap()
109 if (map->key_sym_map == NULL) in XkbAllocClientMap()
118 if (map->modmap == NULL) { in XkbAllocClientMap()
120 map->modmap = calloc(i, sizeof(unsigned char)); in XkbAllocClientMap()
121 if (map->modmap == NULL) in XkbAllocClientMap()
132 XkbServerMapPtr map; in XkbAllocServerMap() local
137 map = calloc(1, sizeof(XkbServerMapRec)); in XkbAllocServerMap()
138 if (map == NULL) in XkbAllocServerMap()
141 map->vmods[i] = XkbNoModifierMask; in XkbAllocServerMap()
143 xkb->server = map; in XkbAllocServerMap()
146 map = xkb->server; in XkbAllocServerMap()
152 if (map->explicit == NULL) { in XkbAllocServerMap()
154 map->explicit = calloc(i, sizeof(unsigned char)); in XkbAllocServerMap()
155 if (map->explicit == NULL) in XkbAllocServerMap()
166 if (map->acts == NULL) { in XkbAllocServerMap()
167 map->acts = calloc((nNewActions + 1), sizeof(XkbAction)); in XkbAllocServerMap()
168 if (map->acts == NULL) in XkbAllocServerMap()
170 map->num_acts = 1; in XkbAllocServerMap()
171 map->size_acts = nNewActions + 1; in XkbAllocServerMap()
173 else if ((map->size_acts - map->num_acts) < nNewActions) { in XkbAllocServerMap()
175 XkbAction *prev_acts = map->acts; in XkbAllocServerMap()
177 need = map->num_acts + nNewActions; in XkbAllocServerMap()
178 map->acts = reallocarray(map->acts, need, sizeof(XkbAction)); in XkbAllocServerMap()
179 if (map->acts == NULL) { in XkbAllocServerMap()
181 map->num_acts = map->size_acts = 0; in XkbAllocServerMap()
184 map->size_acts = need; in XkbAllocServerMap()
185 memset(&map->acts[map->num_acts], 0, in XkbAllocServerMap()
186 ((map->size_acts - map->num_acts) * sizeof(XkbAction))); in XkbAllocServerMap()
188 if (map->key_acts == NULL) { in XkbAllocServerMap()
190 map->key_acts = calloc(i, sizeof(unsigned short)); in XkbAllocServerMap()
191 if (map->key_acts == NULL) in XkbAllocServerMap()
200 if (map->behaviors == NULL) { in XkbAllocServerMap()
202 map->behaviors = calloc(i, sizeof(XkbBehavior)); in XkbAllocServerMap()
203 if (map->behaviors == NULL) in XkbAllocServerMap()
212 if (map->vmodmap == NULL) { in XkbAllocServerMap()
214 map->vmodmap = calloc(i, sizeof(unsigned short)); in XkbAllocServerMap()
215 if (map->vmodmap == NULL) in XkbAllocServerMap()
229 free(into->map); in XkbCopyKeyType()
230 into->map = NULL; in XkbCopyKeyType()
236 if ((from->map) && (into->map_count > 0)) { in XkbCopyKeyType()
237 into->map = calloc(into->map_count, sizeof(XkbKTMapEntryRec)); in XkbCopyKeyType()
238 if (!into->map) in XkbCopyKeyType()
240 memcpy(into->map, from->map, in XkbCopyKeyType()
282 if ((type_ndx < 0) || (type_ndx >= xkb->map->num_types) || (map_count < 0) in XkbResizeKeyType()
297 type = &xkb->map->types[type_ndx]; in XkbResizeKeyType()
299 free(type->map); in XkbResizeKeyType()
300 type->map = NULL; in XkbResizeKeyType()
306 XkbKTMapEntryRec *prev_map = type->map; in XkbResizeKeyType()
308 if ((map_count > type->map_count) || (type->map == NULL)) in XkbResizeKeyType()
309 type->map = in XkbResizeKeyType()
310 reallocarray(type->map, map_count, sizeof(XkbKTMapEntryRec)); in XkbResizeKeyType()
311 if (!type->map) { in XkbResizeKeyType()
397 xkb->map->size_syms = (nTotal * 15) / 10; in XkbResizeKeyType()
398 newSyms = calloc(xkb->map->size_syms, sizeof(KeySym)); in XkbResizeKeyType()
414 xkb->map->key_sym_map[i].offset = nSyms; in XkbResizeKeyType()
420 xkb->map->key_sym_map[i].offset = nSyms; in XkbResizeKeyType()
425 free(xkb->map->syms); in XkbResizeKeyType()
426 xkb->map->syms = newSyms; in XkbResizeKeyType()
427 xkb->map->num_syms = nSyms; in XkbResizeKeyType()
485 xkb->map->key_sym_map[key].offset = 0; in XkbResizeKeySyms()
486 return xkb->map->syms; in XkbResizeKeySyms()
492 if (xkb->map->size_syms - xkb->map->num_syms >= (unsigned) needed) { in XkbResizeKeySyms()
494 memcpy(&xkb->map->syms[xkb->map->num_syms], XkbKeySymsPtr(xkb, key), in XkbResizeKeySyms()
498 memset(&xkb->map-> in XkbResizeKeySyms()
499 syms[xkb->map->num_syms + XkbKeyNumSyms(xkb, key)], 0, in XkbResizeKeySyms()
502 xkb->map->key_sym_map[key].offset = xkb->map->num_syms; in XkbResizeKeySyms()
503 xkb->map->num_syms += needed; in XkbResizeKeySyms()
504 return &xkb->map->syms[xkb->map->key_sym_map[key].offset]; in XkbResizeKeySyms()
506 xkb->map->size_syms += (needed > 32 ? needed : 32); in XkbResizeKeySyms()
507 newSyms = calloc(xkb->map->size_syms, sizeof(KeySym)); in XkbResizeKeySyms()
526 xkb->map->key_sym_map[i].offset = nSyms; in XkbResizeKeySyms()
529 free(xkb->map->syms); in XkbResizeKeySyms()
530 xkb->map->syms = newSyms; in XkbResizeKeySyms()
531 xkb->map->num_syms = nSyms; in XkbResizeKeySyms()
532 return &xkb->map->syms[xkb->map->key_sym_map[key].offset]; in XkbResizeKeySyms()
571 changes->map.min_key_code = minKC; in XkbChangeKeycodeRange()
573 if (xkb->map) { in XkbChangeKeycodeRange()
574 if (xkb->map->key_sym_map) { in XkbChangeKeycodeRange()
575 memset((char *) &xkb->map->key_sym_map[minKC], 0, in XkbChangeKeycodeRange()
578 changes->map.changed = _ExtendRange(changes->map.changed, in XkbChangeKeycodeRange()
580 &changes->map. in XkbChangeKeycodeRange()
582 &changes->map. in XkbChangeKeycodeRange()
586 if (xkb->map->modmap) { in XkbChangeKeycodeRange()
587 memset((char *) &xkb->map->modmap[minKC], 0, tmp); in XkbChangeKeycodeRange()
589 changes->map.changed = _ExtendRange(changes->map.changed, in XkbChangeKeycodeRange()
592 &changes->map. in XkbChangeKeycodeRange()
594 &changes->map. in XkbChangeKeycodeRange()
604 changes->map.changed = _ExtendRange(changes->map.changed, in XkbChangeKeycodeRange()
607 &changes->map. in XkbChangeKeycodeRange()
609 &changes->map. in XkbChangeKeycodeRange()
617 changes->map.changed = _ExtendRange(changes->map.changed, in XkbChangeKeycodeRange()
620 &changes->map. in XkbChangeKeycodeRange()
622 &changes->map. in XkbChangeKeycodeRange()
630 changes->map.changed = _ExtendRange(changes->map.changed, in XkbChangeKeycodeRange()
633 &changes->map. in XkbChangeKeycodeRange()
635 &changes->map. in XkbChangeKeycodeRange()
654 changes->map.max_key_code = maxKC; in XkbChangeKeycodeRange()
656 if (xkb->map) { in XkbChangeKeycodeRange()
657 if (xkb->map->key_sym_map) { in XkbChangeKeycodeRange()
658 XkbSymMapRec *prev_key_sym_map = xkb->map->key_sym_map; in XkbChangeKeycodeRange()
660 xkb->map->key_sym_map = reallocarray(xkb->map->key_sym_map, in XkbChangeKeycodeRange()
663 if (!xkb->map->key_sym_map) { in XkbChangeKeycodeRange()
667 memset((char *) &xkb->map->key_sym_map[xkb->max_key_code], 0, in XkbChangeKeycodeRange()
670 changes->map.changed = _ExtendRange(changes->map.changed, in XkbChangeKeycodeRange()
672 &changes->map. in XkbChangeKeycodeRange()
674 &changes->map. in XkbChangeKeycodeRange()
678 if (xkb->map->modmap) { in XkbChangeKeycodeRange()
679 unsigned char *prev_modmap = xkb->map->modmap; in XkbChangeKeycodeRange()
681 xkb->map->modmap = reallocarray(xkb->map->modmap, in XkbChangeKeycodeRange()
684 if (!xkb->map->modmap) { in XkbChangeKeycodeRange()
688 memset((char *) &xkb->map->modmap[xkb->max_key_code], 0, tmp); in XkbChangeKeycodeRange()
690 changes->map.changed = _ExtendRange(changes->map.changed, in XkbChangeKeycodeRange()
693 &changes->map. in XkbChangeKeycodeRange()
695 &changes->map. in XkbChangeKeycodeRange()
714 changes->map.changed = _ExtendRange(changes->map.changed, in XkbChangeKeycodeRange()
717 &changes->map. in XkbChangeKeycodeRange()
719 &changes->map. in XkbChangeKeycodeRange()
736 changes->map.changed = _ExtendRange(changes->map.changed, in XkbChangeKeycodeRange()
739 &changes->map. in XkbChangeKeycodeRange()
741 &changes->map. in XkbChangeKeycodeRange()
758 changes->map.changed = _ExtendRange(changes->map.changed, in XkbChangeKeycodeRange()
761 &changes->map. in XkbChangeKeycodeRange()
763 &changes->map. in XkbChangeKeycodeRange()
846 XkbClientMapPtr map; in XkbFreeClientMap() local
848 if ((xkb == NULL) || (xkb->map == NULL)) in XkbFreeClientMap()
852 map = xkb->map; in XkbFreeClientMap()
854 if (map->types != NULL) { in XkbFreeClientMap()
855 if (map->num_types > 0) { in XkbFreeClientMap()
859 for (i = 0, type = map->types; i < map->num_types; i++, type++) { in XkbFreeClientMap()
860 free(type->map); in XkbFreeClientMap()
861 type->map = NULL; in XkbFreeClientMap()
869 free(map->types); in XkbFreeClientMap()
870 map->num_types = map->size_types = 0; in XkbFreeClientMap()
871 map->types = NULL; in XkbFreeClientMap()
875 free(map->key_sym_map); in XkbFreeClientMap()
876 map->key_sym_map = NULL; in XkbFreeClientMap()
877 if (map->syms != NULL) { in XkbFreeClientMap()
878 free(map->syms); in XkbFreeClientMap()
879 map->size_syms = map->num_syms = 0; in XkbFreeClientMap()
880 map->syms = NULL; in XkbFreeClientMap()
883 if ((what & XkbModifierMapMask) && (map->modmap != NULL)) { in XkbFreeClientMap()
884 free(map->modmap); in XkbFreeClientMap()
885 map->modmap = NULL; in XkbFreeClientMap()
888 free(xkb->map); in XkbFreeClientMap()
889 xkb->map = NULL; in XkbFreeClientMap()
897 XkbServerMapPtr map; in XkbFreeServerMap() local
903 map = xkb->server; in XkbFreeServerMap()
904 if ((what & XkbExplicitComponentsMask) && (map->explicit != NULL)) { in XkbFreeServerMap()
905 free(map->explicit); in XkbFreeServerMap()
906 map->explicit = NULL; in XkbFreeServerMap()
909 free(map->key_acts); in XkbFreeServerMap()
910 map->key_acts = NULL; in XkbFreeServerMap()
911 if (map->acts != NULL) { in XkbFreeServerMap()
912 free(map->acts); in XkbFreeServerMap()
913 map->num_acts = map->size_acts = 0; in XkbFreeServerMap()
914 map->acts = NULL; in XkbFreeServerMap()
917 if ((what & XkbKeyBehaviorsMask) && (map->behaviors != NULL)) { in XkbFreeServerMap()
918 free(map->behaviors); in XkbFreeServerMap()
919 map->behaviors = NULL; in XkbFreeServerMap()
921 if ((what & XkbVirtualModMapMask) && (map->vmodmap != NULL)) { in XkbFreeServerMap()
922 free(map->vmodmap); in XkbFreeServerMap()
923 map->vmodmap = NULL; in XkbFreeServerMap()