Commit 021fc5cb authored by Adam Jackson's avatar Adam Jackson

Static markup and dead code cull over xkb/.

The former <X11/extensions/XKBsrv.h> has been pulled into the server now as
include/xkbsrv.h, and the world updated to look for it in the new place,
since it made no sense to define server API in an extension header.  Any
further work along this line will need to do similar things with XKBgeom.h
and friends.
parent 9398d62f
......@@ -52,7 +52,7 @@ of the copyright holder.
#include "inputstr.h"
#include "windowstr.h"
#include "cursorstr.h"
#include <X11/extensions/XKBsrv.h>
#include <xkbsrv.h>
#include "../os/osdep.h"
......
......@@ -67,7 +67,7 @@ SOFTWARE.
#define XKB_IN_SERVER
#endif
#ifdef XKB
#include <X11/extensions/XKBsrv.h>
#include <xkbsrv.h>
#endif
#include "xace.h"
......
......@@ -143,7 +143,7 @@ int ProcInitialConnection();
#define XKB_IN_SERVER
#endif
#include "inputstr.h"
#include <X11/extensions/XKBsrv.h>
#include <xkbsrv.h>
#endif
#ifdef XSERVER_DTRACE
......
......@@ -133,7 +133,7 @@ of the copyright holder.
#ifdef XKB
#include <X11/extensions/XKBproto.h>
#include <X11/extensions/XKBsrv.h>
#include <xkbsrv.h>
extern Bool XkbFilterEvents(ClientPtr, int, xEvent *);
#endif
......
......@@ -44,7 +44,7 @@
#ifdef XKB
#include <X11/extensions/XKBproto.h>
#include <X11/extensions/XKBsrv.h>
#include <xkbsrv.h>
extern Bool XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies);
#endif
......
......@@ -126,7 +126,7 @@ typedef XID KeySym64;
#undef KeySym
#endif
/* These are in exglobals.h, but that conflicts with X11/extensions/XKBsrv.h */
/* These are in exglobals.h, but that conflicts with xkbsrv.h */
extern int ProximityIn;
extern int ProximityOut;
extern int DeviceValuator;
......@@ -144,7 +144,7 @@ extern int ChangeDeviceNotify;
#ifndef XKB_IN_SERVER
#define XKB_IN_SERVER
#endif
#include <X11/extensions/XKBsrv.h>
#include <xkbsrv.h>
#undef XPointer
#endif
#include <X11/extensions/XIproto.h>
......
......@@ -42,7 +42,7 @@
#endif
#ifdef XKB
#include <X11/extensions/XKBsrv.h>
#include <xkbsrv.h>
#endif
#include <X11/extensions/XI.h>
......
......@@ -75,7 +75,7 @@ extern DeviceAssocRec mouse_assoc;
#ifdef XKB
#undef XKB_IN_SERVER
#define XKB_IN_SERVER
#include <X11/extensions/XKBsrv.h>
#include <xkbsrv.h>
#endif
#ifdef RENDER
......
......@@ -43,7 +43,7 @@
#include "servermd.h"
#include "micmap.h"
#ifdef XKB
#include <X11/extensions/XKBsrv.h>
#include <xkbsrv.h>
#endif
#include "xf86Xinput.h"
......
......@@ -73,7 +73,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define XF86_OS_PRIVS
#include "xf86_OSlib.h"
#include <X11/extensions/XKBsrv.h>
#include <xkbsrv.h>
void
xf86InitXkb(void)
......
......@@ -40,7 +40,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "inputstr.h"
#include "scrnintstr.h"
#include "windowstr.h"
#include <X11/extensions/XKBsrv.h>
#include <xkbsrv.h>
#include <X11/extensions/XI.h>
#include "xf86.h"
......
......@@ -12,7 +12,7 @@
#include <X11/X.h>
#include "windowstr.h"
#define XKBSRV_NEED_FILE_FUNCS
#include <X11/extensions/XKBsrv.h>
#include <xkbsrv.h>
#include "xf86.h"
......
......@@ -40,7 +40,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "inputstr.h"
#include "scrnintstr.h"
#include "windowstr.h"
#include <X11/extensions/XKBsrv.h>
#include <xkbsrv.h>
#include <X11/extensions/XI.h>
#include "xf86.h"
......
......@@ -86,7 +86,7 @@
#endif
#include "selection.h"
#ifdef XKB
#include <X11/extensions/XKBsrv.h>
#include <xkbsrv.h>
extern int XkbDfltRepeatDelay, XkbDfltRepeatInterval;
#endif
......
......@@ -41,7 +41,7 @@
#ifdef XKB
#define XKB_IN_SERVER
#include <X11/extensions/XKBsrv.h>
#include <xkbsrv.h>
#endif
static DeviceIntPtr pKdKeyboard, pKdPointer;
......
......@@ -50,7 +50,7 @@
#ifdef XKB
#include <X11/extensions/XKB.h>
#include <X11/extensions/XKBsrv.h>
#include <xkbsrv.h>
#include <X11/extensions/XKBconfig.h>
extern Bool
......
......@@ -36,7 +36,7 @@ is" without express or implied warranty.
#ifdef XKB
#include <X11/extensions/XKB.h>
#include <X11/extensions/XKBsrv.h>
#include <xkbsrv.h>
#include <X11/extensions/XKBconfig.h>
extern Bool
......
......@@ -44,7 +44,7 @@ from The Open Group.
#include <mntent.h>
#endif
#if defined(XKB) && defined(WIN32)
#include <X11/extensions/XKBsrv.h>
#include <xkbsrv.h>
#endif
#ifdef RELOCATE_PROJECTROOT
#include <shlobj.h>
......
......@@ -40,7 +40,7 @@
#ifndef XKB_IN_SERVER
#define XKB_IN_SERVER
#endif
#include <X11/extensions/XKBsrv.h>
#include <xkbsrv.h>
#endif
#ifdef XWIN_XF86CONFIG
......
......@@ -44,7 +44,7 @@
#ifndef XKB_IN_SERVER
#define XKB_IN_SERVER
#endif
#include <X11/extensions/XKBsrv.h>
#include <xkbsrv.h>
#endif
static Bool g_winKeyState[NUM_KEYCODES];
......
This diff is collapsed.
......@@ -117,7 +117,7 @@ OR PERFORMANCE OF THIS SOFTWARE.
#endif
#ifdef XKB
#include <X11/extensions/XKBsrv.h>
#include <xkbsrv.h>
#endif
#ifdef XCSECURITY
#include "securitysrv.h"
......
......@@ -41,7 +41,8 @@ X11_SRCS = \
XKBGAlloc.c \
XKBMAlloc.c
XI_SRCS = xkbPrOtherEv.c
# ends up unused...
# XI_SRCS = xkbPrOtherEv.c
libxkb_la_SOURCES = $(DDX_SRCS) $(DIX_SRCS) $(XI_SRCS) $(XKBFILE_SRCS) \
$(X11_SRCS)
......
......@@ -35,7 +35,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/Xproto.h>
#include "misc.h"
#include "inputstr.h"
#include <X11/extensions/XKBsrv.h>
#include <xkbsrv.h>
#include <X11/extensions/XKBgeom.h>
/***===================================================================***/
......@@ -259,7 +259,7 @@ XkbAllocControls(XkbDescPtr xkb,unsigned which)
}
/*ARGSUSED*/
void
static void
XkbFreeControls(XkbDescPtr xkb,unsigned which,Bool freeMap)
{
if (freeMap && (xkb!=NULL) && (xkb->ctrls!=NULL)) {
......@@ -284,7 +284,7 @@ XkbAllocIndicatorMaps(XkbDescPtr xkb)
return Success;
}
void
static void
XkbFreeIndicatorMaps(XkbDescPtr xkb)
{
if ((xkb!=NULL)&&(xkb->indicators!=NULL)) {
......@@ -335,154 +335,3 @@ XkbFreeKeyboard(XkbDescPtr xkb,unsigned which,Bool freeAll)
_XkbFree(xkb);
return;
}
/***====================================================================***/
XkbDeviceLedInfoPtr
XkbAddDeviceLedInfo(XkbDeviceInfoPtr devi,unsigned ledClass,unsigned ledId)
{
XkbDeviceLedInfoPtr devli;
register int i;
if ((!devi)||(!XkbSingleXIClass(ledClass))||(!XkbSingleXIId(ledId)))
return NULL;
for (i=0,devli=devi->leds;i<devi->num_leds;i++,devli++) {
if ((devli->led_class==ledClass)&&(devli->led_id==ledId))
return devli;
}
if (devi->num_leds>=devi->sz_leds) {
XkbDeviceLedInfoRec *prev_leds = devi->leds;
if (devi->sz_leds>0) devi->sz_leds*= 2;
else devi->sz_leds= 1;
devi->leds= _XkbTypedRealloc(devi->leds,devi->sz_leds,
XkbDeviceLedInfoRec);
if (!devi->leds) {
_XkbFree(prev_leds);
devi->sz_leds= devi->num_leds= 0;
return NULL;
}
i= devi->num_leds;
for (devli=&devi->leds[i];i<devi->sz_leds;i++,devli++) {
bzero(devli,sizeof(XkbDeviceLedInfoRec));
devli->led_class= XkbXINone;
devli->led_id= XkbXINone;
}
}
devli= &devi->leds[devi->num_leds++];
bzero(devli,sizeof(XkbDeviceLedInfoRec));
devli->led_class= ledClass;
devli->led_id= ledId;
return devli;
}
Status
XkbResizeDeviceButtonActions(XkbDeviceInfoPtr devi,unsigned newTotal)
{
XkbAction *prev_btn_acts;
if ((!devi)||(newTotal>255))
return BadValue;
if ((devi->btn_acts!=NULL)&&(newTotal==devi->num_btns))
return Success;
if (newTotal==0) {
if (devi->btn_acts!=NULL) {
_XkbFree(devi->btn_acts);
devi->btn_acts= NULL;
}
devi->num_btns= 0;
return Success;
}
prev_btn_acts = devi->btn_acts;
devi->btn_acts= _XkbTypedRealloc(devi->btn_acts,newTotal,XkbAction);
if (devi->btn_acts==NULL) {
_XkbFree(prev_btn_acts);
devi->num_btns= 0;
return BadAlloc;
}
if (newTotal>devi->num_btns) {
XkbAction *act;
act= &devi->btn_acts[devi->num_btns];
bzero((char *)act,(newTotal-devi->num_btns)*sizeof(XkbAction));
}
devi->num_btns= newTotal;
return Success;
}
/*ARGSUSED*/
XkbDeviceInfoPtr
XkbAllocDeviceInfo(unsigned deviceSpec,unsigned nButtons,unsigned szLeds)
{
XkbDeviceInfoPtr devi;
devi= _XkbTypedCalloc(1,XkbDeviceInfoRec);
if (devi!=NULL) {
devi->device_spec= deviceSpec;
devi->has_own_state= False;
devi->num_btns= 0;
devi->btn_acts= NULL;
if (nButtons>0) {
devi->num_btns= nButtons;
devi->btn_acts= _XkbTypedCalloc(nButtons,XkbAction);
if (!devi->btn_acts) {
_XkbFree(devi);
return NULL;
}
}
devi->dflt_kbd_fb= XkbXINone;
devi->dflt_led_fb= XkbXINone;
devi->num_leds= 0;
devi->sz_leds= 0;
devi->leds= NULL;
if (szLeds>0) {
devi->sz_leds= szLeds;
devi->leds= _XkbTypedCalloc(szLeds,XkbDeviceLedInfoRec);
if (!devi->leds) {
if (devi->btn_acts)
_XkbFree(devi->btn_acts);
_XkbFree(devi);
return NULL;
}
}
}
return devi;
}
void
XkbFreeDeviceInfo(XkbDeviceInfoPtr devi,unsigned which,Bool freeDevI)
{
if (devi) {
if (freeDevI) {
which= XkbXI_AllDeviceFeaturesMask;
if (devi->name) {
_XkbFree(devi->name);
devi->name= NULL;
}
}
if ((which&XkbXI_ButtonActionsMask)&&(devi->btn_acts)) {
_XkbFree(devi->btn_acts);
devi->num_btns= 0;
devi->btn_acts= NULL;
}
if ((which&XkbXI_IndicatorsMask)&&(devi->leds)) {
register int i;
if ((which&XkbXI_IndicatorsMask)==XkbXI_IndicatorsMask) {
_XkbFree(devi->leds);
devi->sz_leds= devi->num_leds= 0;
devi->leds= NULL;
}
else {
XkbDeviceLedInfoPtr devli;
for (i=0,devli=devi->leds;i<devi->num_leds;i++,devli++) {
if (which&XkbXI_IndicatorMapsMask)
bzero((char *)&devli->maps[0],sizeof(devli->maps));
else bzero((char *)&devli->names[0],sizeof(devli->names));
}
}
}
if (freeDevI)
_XkbFree(devi);
}
return;
}
......@@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/Xproto.h>
#include "misc.h"
#include "inputstr.h"
#include <X11/extensions/XKBsrv.h>
#include <xkbsrv.h>
#include <X11/extensions/XKBgeom.h>
#ifdef X_NOT_POSIX
......
......@@ -39,7 +39,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "inputstr.h"
#include <X11/keysym.h>
#define XKBSRV_NEED_FILE_FUNCS
#include <X11/extensions/XKBsrv.h>
#include <xkbsrv.h>
/***====================================================================***/
......@@ -220,7 +220,7 @@ XkbServerMapPtr map;
/***====================================================================***/
Status
static Status
XkbCopyKeyType(XkbKeyTypePtr from,XkbKeyTypePtr into)
{
if ((!from)||(!into))
......@@ -275,82 +275,6 @@ register int i,rtrn;
return Success;
}
XkbKeyTypePtr
XkbAddKeyType( XkbDescPtr xkb,
Atom name,
int map_count,
Bool want_preserve,
int num_lvls)
{
register int i;
unsigned tmp;
XkbKeyTypePtr type;
XkbClientMapPtr map;
if ((!xkb)||(num_lvls<1))
return NULL;
map= xkb->map;
if ((map)&&(map->types)) {
for (i=0;i<map->num_types;i++) {
if (map->types[i].name==name) {
Status status;
status=XkbResizeKeyType(xkb,i,map_count,want_preserve,num_lvls);
return (status==Success?&map->types[i]:NULL);
}
}
}
if ((!map)||(!map->types)||(!map->num_types<XkbNumRequiredTypes)) {
tmp= XkbNumRequiredTypes+1;
if (XkbAllocClientMap(xkb,XkbKeyTypesMask,tmp)!=Success)
return NULL;
map = xkb->map;
tmp= 0;
if (map->num_types<=XkbKeypadIndex)
tmp|= XkbKeypadMask;
if (map->num_types<=XkbAlphabeticIndex)
tmp|= XkbAlphabeticMask;
if (map->num_types<=XkbTwoLevelIndex)
tmp|= XkbTwoLevelMask;
if (map->num_types<=XkbOneLevelIndex)
tmp|= XkbOneLevelMask;
if (XkbInitCanonicalKeyTypes(xkb,tmp,XkbNoModifier)==Success) {
for (i=0;i<map->num_types;i++) {
Status status;
if (map->types[i].name!=name)
continue;
status=XkbResizeKeyType(xkb,i,map_count,want_preserve,num_lvls);
return (status==Success?&map->types[i]:NULL);
}
}
}
if ((map->num_types<=map->size_types)&&
(XkbAllocClientMap(xkb,XkbKeyTypesMask,map->num_types+1)!=Success)) {
return NULL;
}
type= &map->types[map->num_types];
map->num_types++;
bzero((char *)type,sizeof(XkbKeyTypeRec));
type->num_levels= num_lvls;
type->map_count= map_count;
type->name= name;
if (map_count>0) {
type->map= _XkbTypedCalloc(map_count,XkbKTMapEntryRec);
if (!type->map) {
map->num_types--;
return NULL;
}
if (want_preserve) {
type->preserve= _XkbTypedCalloc(map_count,XkbModsRec);
if (!type->preserve) {
_XkbFree(type->map);
map->num_types--;
return NULL;
}
}
}
return type;
}
Status
XkbResizeKeyType( XkbDescPtr xkb,
int type_ndx,
......
......@@ -39,102 +39,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "inputstr.h"
#include <X11/keysym.h>
#define XKBSRV_NEED_FILE_FUNCS
#include <X11/extensions/XKBsrv.h>
/***====================================================================***/
#define mapSize(m) (sizeof(m)/sizeof(XkbKTMapEntryRec))
static XkbKTMapEntryRec map2Level[]= {
{ True, ShiftMask, {1, ShiftMask, 0} }
};
static XkbKTMapEntryRec mapAlpha[]= {
{ True, ShiftMask, { 1, ShiftMask, 0 } },
{ True, LockMask, { 0, LockMask, 0 } }
};
static XkbModsRec preAlpha[]= {
{ 0, 0, 0 },
{ LockMask, LockMask, 0 }
};
#define NL_VMOD_MASK 0
static XkbKTMapEntryRec mapKeypad[]= {
{ True, ShiftMask, { 1, ShiftMask, 0 } },
{ False, 0, { 1, 0, NL_VMOD_MASK } }
};
static XkbKeyTypeRec canonicalTypes[XkbNumRequiredTypes] = {
{ { 0, 0, 0 },
1, /* num_levels */
0, /* map_count */
NULL, NULL,
None, NULL
},
{ { ShiftMask, ShiftMask, 0 },
2, /* num_levels */
mapSize(map2Level), /* map_count */
map2Level, NULL,
None, NULL
},
{ { ShiftMask|LockMask, ShiftMask|LockMask, 0 },
2, /* num_levels */
mapSize(mapAlpha), /* map_count */
mapAlpha, preAlpha,
None, NULL
},
{ { ShiftMask, ShiftMask, NL_VMOD_MASK },
2, /* num_levels */
mapSize(mapKeypad), /* map_count */
mapKeypad, NULL,
None, NULL
}
};
Status
XkbInitCanonicalKeyTypes(XkbDescPtr xkb,unsigned which,int keypadVMod)
{
XkbClientMapPtr map;
XkbKeyTypePtr from,to;
Status rtrn;
if (!xkb)
return BadMatch;
rtrn= XkbAllocClientMap(xkb,XkbKeyTypesMask,XkbNumRequiredTypes);
if (rtrn!=Success)
return rtrn;
map= xkb->map;
if ((which&XkbAllRequiredTypes)==0)
return Success;
rtrn= Success;
from= canonicalTypes;
to= map->types;
if (which&XkbOneLevelMask)
rtrn= XkbCopyKeyType(&from[XkbOneLevelIndex],&to[XkbOneLevelIndex]);
if ((which&XkbTwoLevelMask)&&(rtrn==Success))
rtrn= XkbCopyKeyType(&from[XkbTwoLevelIndex],&to[XkbTwoLevelIndex]);
if ((which&XkbAlphabeticMask)&&(rtrn==Success))
rtrn= XkbCopyKeyType(&from[XkbAlphabeticIndex],&to[XkbAlphabeticIndex]);
if ((which&XkbKeypadMask)&&(rtrn==Success)) {
XkbKeyTypePtr type;
rtrn= XkbCopyKeyType(&from[XkbKeypadIndex],&to[XkbKeypadIndex]);
type= &to[XkbKeypadIndex];
if ((keypadVMod>=0)&&(keypadVMod<XkbNumVirtualMods)&&(rtrn==Success)) {
type->mods.vmods= (1<<keypadVMod);
type->map[0].active= True;
type->map[0].mods.mask= ShiftMask;
type->map[0].mods.real_mods= ShiftMask;
type->map[0].mods.vmods= 0;
type->map[0].level= 1;
type->map[1].active= False;
type->map[1].mods.mask= 0;
type->map[1].mods.real_mods= 0;
type->map[1].mods.vmods= (1<<keypadVMod);
type->map[1].level= 1;
}
}
return Success;
}
#include <xkbsrv.h>
/***====================================================================***/
......@@ -558,88 +463,6 @@ unsigned changed,tmp;
return True;
}
Bool
XkbUpdateMapFromCore( XkbDescPtr xkb,
KeyCode first_key,
int num_keys,
int map_width,
KeySym * core_keysyms,
XkbChangesPtr changes)
{
register int key,last_key;
KeySym * syms;
syms= &core_keysyms[(first_key-xkb->min_key_code)*map_width];
if (changes) {
if (changes->map.changed&XkbKeySymsMask) {
_XkbAddKeyChange(&changes->map.first_key_sym,
&changes->map.num_key_syms,first_key);
if (num_keys>1) {
_XkbAddKeyChange(&changes->map.first_key_sym,
&changes->map.num_key_syms,
first_key+num_keys-1);
}
}
else {
changes->map.changed|= XkbKeySymsMask;
changes->map.first_key_sym= first_key;
changes->map.num_key_syms= num_keys;
}
}
last_key= first_key+num_keys-1;
for (key=first_key;key<=last_key;key++,syms+= map_width) {
XkbMapChangesPtr mc;
unsigned explicit;
KeySym tsyms[XkbMaxSymsPerKey];
int types[XkbNumKbdGroups];
int nG;
explicit= xkb->server->explicit[key]&XkbExplicitKeyTypesMask;
types[XkbGroup1Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup1Index);
types[XkbGroup2Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup2Index);
types[XkbGroup3Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup3Index);
types[XkbGroup4Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup4Index);
nG= XkbKeyTypesForCoreSymbols(xkb,map_width,syms,explicit,types,tsyms);
if (changes)
mc= &changes->map;
else mc= NULL;
XkbChangeTypesOfKey(xkb,key,nG,XkbAllGroupsMask,types,mc);
memcpy((char *)XkbKeySymsPtr(xkb,key),(char *)tsyms,
XkbKeyNumSyms(xkb,key)*sizeof(KeySym));
XkbApplyCompatMapToKey(xkb,key,changes);
}
if ((xkb->server->vmods!=NULL)&&(xkb->map->modmap!=NULL)&&(changes)&&
(changes->map.changed&(XkbVirtualModMapMask|XkbModifierMapMask))) {
unsigned char newVMods[XkbNumVirtualMods];
register unsigned bit,i;
unsigned present;
bzero(newVMods,XkbNumVirtualMods);
present= 0;
for (key=xkb->min_key_code;key<=xkb->max_key_code;key++) {
if (xkb->server->vmodmap[key]==0)
continue;
for (i=0,bit=1;i<XkbNumVirtualMods;i++,bit<<=1) {
if (bit&xkb->server->vmodmap[key]) {
present|= bit;
newVMods[i]|= xkb->map->modmap[key];
}
}
}
for (i=0,bit=1;i<XkbNumVirtualMods;i++,bit<<=1) {
if ((bit&present)&&(newVMods[i]!=xkb->server->vmods[i])) {
changes->map.changed|= XkbVirtualModsMask;
changes->map.vmods|= bit;
xkb->server->vmods[i]= newVMods[i];
}
}
}
if (changes && (changes->map.changed&XkbVirtualModsMask))
XkbApplyVirtualModChanges(xkb,changes->map.vmods,changes);
return True;
}
Status
XkbChangeTypesOfKey( XkbDescPtr xkb,
int key,
......@@ -788,7 +611,7 @@ register unsigned mask;
/***====================================================================***/
Bool
static Bool
XkbUpdateActionVirtualMods(XkbDescPtr xkb,XkbAction *act,unsigned changed)
{
unsigned int tmp;
......@@ -814,7 +637,7 @@ unsigned int tmp;
return False;
}
void
static void
XkbUpdateKeyTypeVirtualMods( XkbDescPtr xkb,
XkbKeyTypePtr type,
unsigned int changed,
......
......@@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.