aboutsummaryrefslogtreecommitdiff
path: root/libX11/src/xkb/XKB.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-08-26 09:04:58 +0200
committermarha <marha@users.sourceforge.net>2013-08-26 09:04:58 +0200
commit5ee5b91b019005aa27273dff01388a68c12be293 (patch)
treed2db8b0d1533d2eea8bfe77f8a6b3d52fa3f633e /libX11/src/xkb/XKB.c
parent854ec4da20ddff9b830be0a7d5b81d8cb4774132 (diff)
downloadvcxsrv-5ee5b91b019005aa27273dff01388a68c12be293.tar.gz
vcxsrv-5ee5b91b019005aa27273dff01388a68c12be293.tar.bz2
vcxsrv-5ee5b91b019005aa27273dff01388a68c12be293.zip
xserver mesa fontconfig libX11 libxcb libxcb/xcb-proto xkeyboard-config git update 26 Aug 2013
xserver commit e01a3f65d3e6d92f92ef2992b338cc9625bde082 libxcb commit c52f2891b43ae77008f63700982f800371458f4d libxcb/xcb-proto commit bd7708ac1037e647b094fa7440ebb6171b9bc75f xkeyboard-config commit 77026e8c59cc64856180452c5f89be86928fea7c libX11 commit e9b14d10d0258bfcc273ff8bc84cd349dccda62c libXdmcp commit 66514a4af7eaa47e8718434356d7efce95e570cf libXext commit 7378d4bdbd33ed49ed6cfa5c4f73d7527982aab4 libfontenc commit 3acba630d8b57084f7e92c15732408711ed5137a libXinerama commit 6e1d1dc328ba8162bba2f4694e7f3c706a1491ff libXau commit 899790011304c4029e15abf410e49ce7cec17e0a xkbcomp commit 0ebdf47fd4bc434ac3d2339544c022a869510738 pixman commit 3518a0dafa63098d41e466f73d105b7e3e4b12de xextproto commit f27fcc99d1cf935cc289933326f7d3baacd5107a randrproto commit ca7cc541c2e43e6c784df19b4583ac35829d2f72 glproto commit 8e3407e02980d088e20041e79bdcdd3737e7827e mkfontscale commit f48de13423c7300f4da9f61993b624426b38ddc0 xwininfo commit ba0d1b0da21d2dbdd81098ed5778f3792b472e13 libXft commit c5e760a239afc62a1c75e0509868e35957c8df52 libXmu commit d5dac08d65c4865f311cb62c161dbb1300eecd11 libxtrans commit f6a161f2a003f4da0a2e414b4faa0ee0de0c01f0 fontconfig commit fba9efecd2ef3aca84e0a4806899c09ba95f4c19 mesa commit 7fa18774bd9d0e97a82ee9b7dfce8fc5a1041c3a
Diffstat (limited to 'libX11/src/xkb/XKB.c')
-rw-r--r--libX11/src/xkb/XKB.c766
1 files changed, 390 insertions, 376 deletions
diff --git a/libX11/src/xkb/XKB.c b/libX11/src/xkb/XKB.c
index f926cb997..8a9795982 100644
--- a/libX11/src/xkb/XKB.c
+++ b/libX11/src/xkb/XKB.c
@@ -32,45 +32,47 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/extensions/XKBproto.h>
#include "XKBlibint.h"
-XkbInternAtomFunc _XkbInternAtomFunc= XInternAtom;
-XkbGetAtomNameFunc _XkbGetAtomNameFunc= XGetAtomName;
+XkbInternAtomFunc _XkbInternAtomFunc = XInternAtom;
+XkbGetAtomNameFunc _XkbGetAtomNameFunc = XGetAtomName;
Bool
-XkbQueryExtension( Display *dpy,
- int * opcodeReturn,
- int * eventBaseReturn,
- int * errorBaseReturn,
- int * majorReturn,
- int * minorReturn)
+XkbQueryExtension(Display *dpy,
+ int *opcodeReturn,
+ int *eventBaseReturn,
+ int *errorBaseReturn,
+ int *majorReturn,
+ int *minorReturn)
{
- if (!XkbUseExtension(dpy,majorReturn,minorReturn))
- return False;
+ if (!XkbUseExtension(dpy, majorReturn, minorReturn))
+ return False;
if (opcodeReturn)
- *opcodeReturn = dpy->xkb_info->codes->major_opcode;
+ *opcodeReturn = dpy->xkb_info->codes->major_opcode;
if (eventBaseReturn)
- *eventBaseReturn = dpy->xkb_info->codes->first_event;
+ *eventBaseReturn = dpy->xkb_info->codes->first_event;
if (errorBaseReturn)
- *errorBaseReturn = dpy->xkb_info->codes->first_error;
+ *errorBaseReturn = dpy->xkb_info->codes->first_error;
if (majorReturn)
- *majorReturn = dpy->xkb_info->srv_major;
+ *majorReturn = dpy->xkb_info->srv_major;
if (minorReturn)
- *minorReturn = dpy->xkb_info->srv_minor;
+ *minorReturn = dpy->xkb_info->srv_minor;
return True;
}
Bool
-XkbLibraryVersion(int *libMajorRtrn,int *libMinorRtrn)
+XkbLibraryVersion(int *libMajorRtrn, int *libMinorRtrn)
{
-int supported;
+ int supported;
if (*libMajorRtrn != XkbMajorVersion) {
- /* version 0.65 is (almost) compatible with 1.00 */
- if ((XkbMajorVersion==1)&&(((*libMajorRtrn)==0)&&((*libMinorRtrn)==65)))
- supported= True;
- else supported= False;
+ /* version 0.65 is (almost) compatible with 1.00 */
+ if ((XkbMajorVersion == 1) &&
+ (((*libMajorRtrn) == 0) && ((*libMinorRtrn) == 65)))
+ supported = True;
+ else
+ supported = False;
}
else {
- supported = True;
+ supported = True;
}
*libMajorRtrn = XkbMajorVersion;
@@ -79,49 +81,52 @@ int supported;
}
Bool
-XkbSelectEvents( Display * dpy,
- unsigned int deviceSpec,
- unsigned int affect,
- unsigned int selectAll)
+XkbSelectEvents(Display *dpy,
+ unsigned int deviceSpec,
+ unsigned int affect,
+ unsigned int selectAll)
{
register xkbSelectEventsReq *req;
XkbInfoPtr xkbi;
if ((dpy->flags & XlibDisplayNoXkb) ||
- (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL)))
- return False;
+ (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL)))
+ return False;
LockDisplay(dpy);
xkbi = dpy->xkb_info;
- xkbi->selected_events&= ~affect;
- xkbi->selected_events|= (affect&selectAll);
+ xkbi->selected_events &= ~affect;
+ xkbi->selected_events |= (affect & selectAll);
GetReq(kbSelectEvents, req);
req->reqType = xkbi->codes->major_opcode;
req->xkbReqType = X_kbSelectEvents;
req->deviceSpec = deviceSpec;
- req->affectWhich = (CARD16)affect;
- req->clear = affect&(~selectAll);
- req->selectAll = affect&selectAll;
- if (affect&XkbMapNotifyMask) {
- req->affectMap= XkbAllMapComponentsMask;
- /* the implicit support needs the client info */
- /* even if the client itself doesn't want it */
- if (selectAll&XkbMapNotifyMask)
- req->map= XkbAllMapEventsMask;
- else req->map= XkbAllClientInfoMask;
- if (selectAll&XkbMapNotifyMask)
- xkbi->selected_map_details= XkbAllMapEventsMask;
- else xkbi->selected_map_details= 0;
+ req->affectWhich = (CARD16) affect;
+ req->clear = affect & (~selectAll);
+ req->selectAll = affect & selectAll;
+ if (affect & XkbMapNotifyMask) {
+ req->affectMap = XkbAllMapComponentsMask;
+ /* the implicit support needs the client info */
+ /* even if the client itself doesn't want it */
+ if (selectAll & XkbMapNotifyMask)
+ req->map = XkbAllMapEventsMask;
+ else
+ req->map = XkbAllClientInfoMask;
+ if (selectAll & XkbMapNotifyMask)
+ xkbi->selected_map_details = XkbAllMapEventsMask;
+ else
+ xkbi->selected_map_details = 0;
}
- if (affect&XkbNewKeyboardNotifyMask) {
- if (selectAll&XkbNewKeyboardNotifyMask)
- xkbi->selected_nkn_details= XkbAllNewKeyboardEventsMask;
- else xkbi->selected_nkn_details= 0;
- if (!(xkbi->xlib_ctrls&XkbLC_IgnoreNewKeyboards)) {
- /* we want it, even if the client doesn't. Don't mess */
- /* around with details -- ask for all of them and throw */
- /* away the ones we don't need */
- req->selectAll|= XkbNewKeyboardNotifyMask;
- }
+ if (affect & XkbNewKeyboardNotifyMask) {
+ if (selectAll & XkbNewKeyboardNotifyMask)
+ xkbi->selected_nkn_details = XkbAllNewKeyboardEventsMask;
+ else
+ xkbi->selected_nkn_details = 0;
+ if (!(xkbi->xlib_ctrls & XkbLC_IgnoreNewKeyboards)) {
+ /* we want it, even if the client doesn't. Don't mess */
+ /* around with details -- ask for all of them and throw */
+ /* away the ones we don't need */
+ req->selectAll |= XkbNewKeyboardNotifyMask;
+ }
}
UnlockDisplay(dpy);
SyncHandle();
@@ -129,91 +134,94 @@ XkbSelectEvents( Display * dpy,
}
Bool
-XkbSelectEventDetails( Display * dpy,
- unsigned deviceSpec,
- unsigned eventType,
- unsigned long int affect,
- unsigned long int details)
+XkbSelectEventDetails(Display *dpy,
+ unsigned deviceSpec,
+ unsigned eventType,
+ unsigned long int affect,
+ unsigned long int details)
{
register xkbSelectEventsReq *req;
- XkbInfoPtr xkbi;
- int size = 0;
- char *out;
+ XkbInfoPtr xkbi;
+ int size = 0;
+ char *out;
union {
- CARD8 *c8;
- CARD16 *c16;
- CARD32 *c32;
+ CARD8 *c8;
+ CARD16 *c16;
+ CARD32 *c32;
} u;
if ((dpy->flags & XlibDisplayNoXkb) ||
- (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL)))
- return False;
+ (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL)))
+ return False;
LockDisplay(dpy);
xkbi = dpy->xkb_info;
- if (affect&details) xkbi->selected_events|= (1<<eventType);
- else xkbi->selected_events&= ~(1<<eventType);
+ if (affect & details)
+ xkbi->selected_events |= (1 << eventType);
+ else
+ xkbi->selected_events &= ~(1 << eventType);
GetReq(kbSelectEvents, req);
req->reqType = xkbi->codes->major_opcode;
req->xkbReqType = X_kbSelectEvents;
req->deviceSpec = deviceSpec;
- req->clear= req->selectAll= 0;
- if (eventType==XkbMapNotify) {
- /* we need all of the client info, even if the application */
- /* doesn't. Make sure that we always request the stuff */
- /* that the implicit support needs, and just filter out anything */
- /* the client doesn't want later */
- req->affectWhich = 0;
- req->selectAll = 0;
- req->clear = 0;
- req->affectMap = (CARD16)affect;
- req->map = (CARD16)details|(XkbAllClientInfoMask&affect);
- req->affectWhich = XkbMapNotifyMask;
- xkbi->selected_map_details&= ~affect;
- xkbi->selected_map_details|= (details&affect);
+ req->clear = req->selectAll = 0;
+ if (eventType == XkbMapNotify) {
+ /* we need all of the client info, even if the application */
+ /* doesn't. Make sure that we always request the stuff */
+ /* that the implicit support needs, and just filter out anything */
+ /* the client doesn't want later */
+ req->affectWhich = 0;
+ req->selectAll = 0;
+ req->clear = 0;
+ req->affectMap = (CARD16) affect;
+ req->map = (CARD16) details | (XkbAllClientInfoMask & affect);
+ req->affectWhich = XkbMapNotifyMask;
+ xkbi->selected_map_details &= ~affect;
+ xkbi->selected_map_details |= (details & affect);
}
else {
- req->affectMap = req->map = 0;
- req->affectWhich= (1<<eventType);
- switch (eventType) {
- case XkbNewKeyboardNotify:
- xkbi->selected_nkn_details&= ~affect;
- xkbi->selected_nkn_details|= (details&affect);
- if (!(xkbi->xlib_ctrls&XkbLC_IgnoreNewKeyboards))
- details= (affect&XkbAllNewKeyboardEventsMask);
- case XkbStateNotify:
- case XkbNamesNotify:
- case XkbAccessXNotify:
- case XkbExtensionDeviceNotify:
- size= 2;
- req->length+= 1;
- break;
- case XkbControlsNotify:
- case XkbIndicatorStateNotify:
- case XkbIndicatorMapNotify:
- size= 4;
- req->length+= 2;
- break;
- case XkbBellNotify:
- case XkbActionMessage:
- case XkbCompatMapNotify:
- size= 1;
- req->length+= 1;
- break;
- }
- BufAlloc(char *,out,(((size*2)+(unsigned)3)/4)*4);
- u.c8= (CARD8 *)out;
- if (size==2) {
- u.c16[0]= (CARD16)affect;
- u.c16[1]= (CARD16)details;
- }
- else if (size==4) {
- u.c32[0]= (CARD32)affect;
- u.c32[1]= (CARD32)details;
- }
- else {
- u.c8[0]= (CARD8)affect;
- u.c8[1]= (CARD8)details;
- }
+ req->affectMap = req->map = 0;
+ req->affectWhich = (1 << eventType);
+ switch (eventType) {
+ case XkbNewKeyboardNotify:
+ xkbi->selected_nkn_details &= ~affect;
+ xkbi->selected_nkn_details |= (details & affect);
+ if (!(xkbi->xlib_ctrls & XkbLC_IgnoreNewKeyboards))
+ details = (affect & XkbAllNewKeyboardEventsMask);
+ case XkbStateNotify:
+ case XkbNamesNotify:
+ case XkbAccessXNotify:
+ case XkbExtensionDeviceNotify:
+ size = 2;
+ req->length += 1;
+ break;
+ case XkbControlsNotify:
+ case XkbIndicatorStateNotify:
+ case XkbIndicatorMapNotify:
+ size = 4;
+ req->length += 2;
+ break;
+ case XkbBellNotify:
+ case XkbActionMessage:
+ case XkbCompatMapNotify:
+ size = 1;
+ req->length += 1;
+ break;
+ }
+ BufAlloc(char *, out, (((size * 2) + (unsigned) 3) / 4) * 4);
+
+ u.c8 = (CARD8 *) out;
+ if (size == 2) {
+ u.c16[0] = (CARD16) affect;
+ u.c16[1] = (CARD16) details;
+ }
+ else if (size == 4) {
+ u.c32[0] = (CARD32) affect;
+ u.c32[1] = (CARD32) details;
+ }
+ else {
+ u.c8[0] = (CARD8) affect;
+ u.c8[1] = (CARD8) details;
+ }
}
UnlockDisplay(dpy);
SyncHandle();
@@ -221,24 +229,24 @@ XkbSelectEventDetails( Display * dpy,
}
Bool
-XkbLockModifiers( Display * dpy,
- unsigned int deviceSpec,
- unsigned int affect,
- unsigned int values)
+XkbLockModifiers(Display *dpy,
+ unsigned int deviceSpec,
+ unsigned int affect,
+ unsigned int values)
{
register xkbLatchLockStateReq *req;
XkbInfoPtr xkbi;
if ((dpy->flags & XlibDisplayNoXkb) ||
- (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL)))
- return False;
+ (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL)))
+ return False;
LockDisplay(dpy);
xkbi = dpy->xkb_info;
GetReq(kbLatchLockState, req);
req->reqType = xkbi->codes->major_opcode;
req->xkbReqType = X_kbLatchLockState;
req->deviceSpec = deviceSpec;
- req->affectModLocks= affect;
+ req->affectModLocks = affect;
req->modLocks = values;
req->lockGroup = False;
req->groupLock = 0;
@@ -252,17 +260,17 @@ XkbLockModifiers( Display * dpy,
}
Bool
-XkbLatchModifiers( Display * dpy,
- unsigned int deviceSpec,
- unsigned int affect,
- unsigned int values)
+XkbLatchModifiers(Display *dpy,
+ unsigned int deviceSpec,
+ unsigned int affect,
+ unsigned int values)
{
register xkbLatchLockStateReq *req;
XkbInfoPtr xkbi;
if ((dpy->flags & XlibDisplayNoXkb) ||
- (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL)))
- return False;
+ (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL)))
+ return False;
LockDisplay(dpy);
xkbi = dpy->xkb_info;
GetReq(kbLatchLockState, req);
@@ -270,7 +278,7 @@ XkbLatchModifiers( Display * dpy,
req->xkbReqType = X_kbLatchLockState;
req->deviceSpec = deviceSpec;
- req->affectModLatches= affect;
+ req->affectModLatches = affect;
req->modLatches = values;
req->latchGroup = False;
req->groupLatch = 0;
@@ -285,21 +293,21 @@ XkbLatchModifiers( Display * dpy,
}
Bool
-XkbLockGroup(Display *dpy,unsigned int deviceSpec,unsigned int group)
+XkbLockGroup(Display *dpy, unsigned int deviceSpec, unsigned int group)
{
register xkbLatchLockStateReq *req;
XkbInfoPtr xkbi;
if ((dpy->flags & XlibDisplayNoXkb) ||
- (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL)))
- return False;
+ (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL)))
+ return False;
LockDisplay(dpy);
xkbi = dpy->xkb_info;
GetReq(kbLatchLockState, req);
req->reqType = xkbi->codes->major_opcode;
req->xkbReqType = X_kbLatchLockState;
req->deviceSpec = deviceSpec;
- req->affectModLocks= 0;
+ req->affectModLocks = 0;
req->modLocks = 0;
req->lockGroup = True;
req->groupLock = group;
@@ -313,14 +321,14 @@ XkbLockGroup(Display *dpy,unsigned int deviceSpec,unsigned int group)
}
Bool
-XkbLatchGroup(Display *dpy,unsigned int deviceSpec,unsigned int group)
+XkbLatchGroup(Display *dpy, unsigned int deviceSpec, unsigned int group)
{
register xkbLatchLockStateReq *req;
XkbInfoPtr xkbi;
if ((dpy->flags & XlibDisplayNoXkb) ||
- (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL)))
- return False;
+ (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL)))
+ return False;
LockDisplay(dpy);
xkbi = dpy->xkb_info;
GetReq(kbLatchLockState, req);
@@ -328,7 +336,7 @@ XkbLatchGroup(Display *dpy,unsigned int deviceSpec,unsigned int group)
req->xkbReqType = X_kbLatchLockState;
req->deviceSpec = deviceSpec;
- req->affectModLatches= 0;
+ req->affectModLatches = 0;
req->modLatches = 0;
req->latchGroup = True;
req->groupLatch = group;
@@ -343,15 +351,15 @@ XkbLatchGroup(Display *dpy,unsigned int deviceSpec,unsigned int group)
}
unsigned
-XkbSetXlibControls(Display *dpy,unsigned affect,unsigned values)
+XkbSetXlibControls(Display *dpy, unsigned affect, unsigned values)
{
if (!dpy->xkb_info)
- XkbUseExtension(dpy,NULL,NULL);
+ XkbUseExtension(dpy, NULL, NULL);
if (!dpy->xkb_info)
- return 0;
- affect&= XkbLC_AllControls;
- dpy->xkb_info->xlib_ctrls&= ~affect;
- dpy->xkb_info->xlib_ctrls|= (affect&values);
+ return 0;
+ affect &= XkbLC_AllControls;
+ dpy->xkb_info->xlib_ctrls &= ~affect;
+ dpy->xkb_info->xlib_ctrls |= (affect & values);
return dpy->xkb_info->xlib_ctrls;
}
@@ -359,9 +367,9 @@ unsigned
XkbGetXlibControls(Display *dpy)
{
if (!dpy->xkb_info)
- XkbUseExtension(dpy,NULL,NULL);
+ XkbUseExtension(dpy, NULL, NULL);
if (!dpy->xkb_info)
- return 0;
+ return 0;
return dpy->xkb_info->xlib_ctrls;
}
@@ -371,155 +379,157 @@ XkbXlibControlsImplemented(void)
#ifdef __sgi
return XkbLC_AllControls;
#else
- return XkbLC_AllControls&~XkbLC_AllComposeControls;
+ return XkbLC_AllControls & ~XkbLC_AllComposeControls;
#endif
}
Bool
-XkbSetDebuggingFlags( Display * dpy,
- unsigned int mask,
- unsigned int flags,
- char * msg,
- unsigned int ctrls_mask,
- unsigned int ctrls,
- unsigned int * rtrn_flags,
- unsigned int * rtrn_ctrls)
+XkbSetDebuggingFlags(Display *dpy,
+ unsigned int mask,
+ unsigned int flags,
+ char *msg,
+ unsigned int ctrls_mask,
+ unsigned int ctrls,
+ unsigned int *rtrn_flags,
+ unsigned int *rtrn_ctrls)
{
register xkbSetDebuggingFlagsReq *req;
xkbSetDebuggingFlagsReply rep;
XkbInfoPtr xkbi;
if ((dpy->flags & XlibDisplayNoXkb) ||
- (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL)))
- return False;
+ (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL)))
+ return False;
LockDisplay(dpy);
xkbi = dpy->xkb_info;
GetReq(kbSetDebuggingFlags, req);
- req->reqType= xkbi->codes->major_opcode;
- req->xkbReqType= X_kbSetDebuggingFlags;
- req->affectFlags= mask;
- req->flags= flags;
- req->affectCtrls= ctrls_mask;
- req->ctrls= ctrls;
+ req->reqType = xkbi->codes->major_opcode;
+ req->xkbReqType = X_kbSetDebuggingFlags;
+ req->affectFlags = mask;
+ req->flags = flags;
+ req->affectCtrls = ctrls_mask;
+ req->ctrls = ctrls;
if (msg) {
- char *out;
- req->msgLength= (unsigned short)strlen(msg)+1;
- req->length+= (req->msgLength+(unsigned)3)>>2;
- BufAlloc(char *,out,((req->msgLength+(unsigned)3)/4)*4);
- memcpy(out,msg,req->msgLength);
+ char *out;
+
+ req->msgLength = (unsigned short) strlen(msg) + 1;
+ req->length += (req->msgLength + (unsigned) 3) >> 2;
+ BufAlloc(char *, out, ((req->msgLength + (unsigned) 3) / 4) * 4);
+ memcpy(out, msg, req->msgLength);
}
- else req->msgLength= 0;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
+ else
+ req->msgLength = 0;
+ if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
}
if (rtrn_flags)
- *rtrn_flags= rep.currentFlags;
+ *rtrn_flags = rep.currentFlags;
if (rtrn_ctrls)
- *rtrn_ctrls= rep.currentCtrls;
+ *rtrn_ctrls = rep.currentCtrls;
UnlockDisplay(dpy);
SyncHandle();
return True;
}
Bool
-XkbComputeEffectiveMap( XkbDescPtr xkb,
- XkbKeyTypePtr type,
- unsigned char * map_rtrn)
+XkbComputeEffectiveMap(XkbDescPtr xkb,
+ XkbKeyTypePtr type,
+ unsigned char *map_rtrn)
{
-register int i;
-unsigned tmp;
-XkbKTMapEntryPtr entry = NULL;
-
- if ((!xkb)||(!type)||(!xkb->server))
- return False;
-
- if (type->mods.vmods!=0) {
- if (!XkbVirtualModsToReal(xkb,type->mods.vmods,&tmp))
- return False;
-
- type->mods.mask= tmp|type->mods.real_mods;
- entry= type->map;
- for (i=0;i<type->map_count;i++,entry++) {
- tmp= 0;
- if (entry->mods.vmods!=0) {
- if (!XkbVirtualModsToReal(xkb,entry->mods.vmods,&tmp))
- return False;
- if (tmp==0) {
- entry->active= False;
- continue;
- }
- }
- entry->active= True;
- entry->mods.mask= (entry->mods.real_mods|tmp)&type->mods.mask;
- }
+ register int i;
+ unsigned tmp;
+ XkbKTMapEntryPtr entry = NULL;
+
+ if ((!xkb) || (!type) || (!xkb->server))
+ return False;
+
+ if (type->mods.vmods != 0) {
+ if (!XkbVirtualModsToReal(xkb, type->mods.vmods, &tmp))
+ return False;
+
+ type->mods.mask = tmp | type->mods.real_mods;
+ entry = type->map;
+ for (i = 0; i < type->map_count; i++, entry++) {
+ tmp = 0;
+ if (entry->mods.vmods != 0) {
+ if (!XkbVirtualModsToReal(xkb, entry->mods.vmods, &tmp))
+ return False;
+ if (tmp == 0) {
+ entry->active = False;
+ continue;
+ }
+ }
+ entry->active = True;
+ entry->mods.mask = (entry->mods.real_mods | tmp) & type->mods.mask;
+ }
}
else {
- type->mods.mask= type->mods.real_mods;
+ type->mods.mask = type->mods.real_mods;
}
- if (map_rtrn!=NULL) {
- bzero(map_rtrn,type->mods.mask+1);
- for (i=0;i<type->map_count;i++) {
- if (entry && entry->active) {
- map_rtrn[type->map[i].mods.mask]= type->map[i].level;
- }
- }
+ if (map_rtrn != NULL) {
+ bzero(map_rtrn, type->mods.mask + 1);
+ for (i = 0; i < type->map_count; i++) {
+ if (entry && entry->active) {
+ map_rtrn[type->map[i].mods.mask] = type->map[i].level;
+ }
+ }
}
return True;
}
Status
-XkbGetState(Display *dpy,unsigned deviceSpec,XkbStatePtr rtrn)
+XkbGetState(Display *dpy, unsigned deviceSpec, XkbStatePtr rtrn)
{
- register xkbGetStateReq *req;
+ register xkbGetStateReq *req;
xkbGetStateReply rep;
XkbInfoPtr xkbi;
if ((dpy->flags & XlibDisplayNoXkb) ||
- (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL)))
- return BadAccess;
+ (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL)))
+ return BadAccess;
LockDisplay(dpy);
xkbi = dpy->xkb_info;
GetReq(kbGetState, req);
req->reqType = xkbi->codes->major_opcode;
req->xkbReqType = X_kbGetState;
req->deviceSpec = deviceSpec;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return BadImplementation;
+ if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return BadImplementation;
}
- rtrn->mods= rep.mods;
- rtrn->base_mods= rep.baseMods;
- rtrn->latched_mods= rep.latchedMods;
- rtrn->locked_mods= rep.lockedMods;
- rtrn->group= rep.group;
- rtrn->base_group= rep.baseGroup;
- rtrn->latched_group= rep.latchedGroup;
- rtrn->locked_group= rep.lockedGroup;
- rtrn->compat_state= rep.compatState;
- rtrn->grab_mods= rep.grabMods;
- rtrn->compat_grab_mods= rep.compatGrabMods;
- rtrn->lookup_mods= rep.lookupMods;
- rtrn->compat_lookup_mods= rep.compatLookupMods;
- rtrn->ptr_buttons= rep.ptrBtnState;
+ rtrn->mods = rep.mods;
+ rtrn->base_mods = rep.baseMods;
+ rtrn->latched_mods = rep.latchedMods;
+ rtrn->locked_mods = rep.lockedMods;
+ rtrn->group = rep.group;
+ rtrn->base_group = rep.baseGroup;
+ rtrn->latched_group = rep.latchedGroup;
+ rtrn->locked_group = rep.lockedGroup;
+ rtrn->compat_state = rep.compatState;
+ rtrn->grab_mods = rep.grabMods;
+ rtrn->compat_grab_mods = rep.compatGrabMods;
+ rtrn->lookup_mods = rep.lookupMods;
+ rtrn->compat_lookup_mods = rep.compatLookupMods;
+ rtrn->ptr_buttons = rep.ptrBtnState;
UnlockDisplay(dpy);
SyncHandle();
return Success;
}
Bool
-XkbSetDetectableAutoRepeat(Display *dpy,Bool detectable,Bool *supported)
+XkbSetDetectableAutoRepeat(Display *dpy, Bool detectable, Bool *supported)
{
-register xkbPerClientFlagsReq * req;
-xkbPerClientFlagsReply rep;
-XkbInfoPtr xkbi;
+ register xkbPerClientFlagsReq *req;
+ xkbPerClientFlagsReply rep;
+ XkbInfoPtr xkbi;
if ((dpy->flags & XlibDisplayNoXkb) ||
- (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL)))
- return False;
+ (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL)))
+ return False;
LockDisplay(dpy);
xkbi = dpy->xkb_info;
GetReq(kbPerClientFlags, req);
@@ -528,31 +538,32 @@ XkbInfoPtr xkbi;
req->deviceSpec = XkbUseCoreKbd;
req->change = XkbPCF_DetectableAutoRepeatMask;
if (detectable)
- req->value = XkbPCF_DetectableAutoRepeatMask;
- else req->value = 0;
- req->ctrlsToChange = req->autoCtrls= req->autoCtrlValues= 0;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
+ req->value = XkbPCF_DetectableAutoRepeatMask;
+ else
+ req->value = 0;
+ req->ctrlsToChange = req->autoCtrls = req->autoCtrlValues = 0;
+ if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
}
UnlockDisplay(dpy);
SyncHandle();
- if (supported!=NULL)
- *supported= ((rep.supported&XkbPCF_DetectableAutoRepeatMask)!=0);
- return ((rep.value&XkbPCF_DetectableAutoRepeatMask)!=0);
+ if (supported != NULL)
+ *supported = ((rep.supported & XkbPCF_DetectableAutoRepeatMask) != 0);
+ return ((rep.value & XkbPCF_DetectableAutoRepeatMask) != 0);
}
Bool
-XkbGetDetectableAutoRepeat(Display *dpy,Bool *supported)
+XkbGetDetectableAutoRepeat(Display *dpy, Bool *supported)
{
-register xkbPerClientFlagsReq * req;
-xkbPerClientFlagsReply rep;
-XkbInfoPtr xkbi;
+ register xkbPerClientFlagsReq *req;
+ xkbPerClientFlagsReply rep;
+ XkbInfoPtr xkbi;
if ((dpy->flags & XlibDisplayNoXkb) ||
- (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL)))
- return False;
+ (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL)))
+ return False;
LockDisplay(dpy);
xkbi = dpy->xkb_info;
GetReq(kbPerClientFlags, req);
@@ -561,32 +572,32 @@ XkbInfoPtr xkbi;
req->deviceSpec = XkbUseCoreKbd;
req->change = 0;
req->value = 0;
- req->ctrlsToChange = req->autoCtrls= req->autoCtrlValues= 0;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
+ req->ctrlsToChange = req->autoCtrls = req->autoCtrlValues = 0;
+ if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
}
UnlockDisplay(dpy);
SyncHandle();
- if (supported!=NULL)
- *supported= ((rep.supported&XkbPCF_DetectableAutoRepeatMask)!=0);
- return ((rep.value&XkbPCF_DetectableAutoRepeatMask)!=0);
+ if (supported != NULL)
+ *supported = ((rep.supported & XkbPCF_DetectableAutoRepeatMask) != 0);
+ return ((rep.value & XkbPCF_DetectableAutoRepeatMask) != 0);
}
Bool
-XkbSetAutoResetControls( Display * dpy,
- unsigned changes,
- unsigned * auto_ctrls,
- unsigned * auto_values)
+XkbSetAutoResetControls(Display *dpy,
+ unsigned changes,
+ unsigned *auto_ctrls,
+ unsigned *auto_values)
{
-register xkbPerClientFlagsReq * req;
-xkbPerClientFlagsReply rep;
-XkbInfoPtr xkbi;
+ register xkbPerClientFlagsReq *req;
+ xkbPerClientFlagsReply rep;
+ XkbInfoPtr xkbi;
if ((dpy->flags & XlibDisplayNoXkb) ||
- (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL)))
- return False;
+ (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL)))
+ return False;
LockDisplay(dpy);
xkbi = dpy->xkb_info;
GetReq(kbPerClientFlags, req);
@@ -595,33 +606,33 @@ XkbInfoPtr xkbi;
req->change = XkbPCF_AutoResetControlsMask;
req->deviceSpec = XkbUseCoreKbd;
req->value = XkbPCF_AutoResetControlsMask;
- req->ctrlsToChange= changes;
- req->autoCtrls= *auto_ctrls;
- req->autoCtrlValues= *auto_values;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
+ req->ctrlsToChange = changes;
+ req->autoCtrls = *auto_ctrls;
+ req->autoCtrlValues = *auto_values;
+ if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
}
UnlockDisplay(dpy);
SyncHandle();
- *auto_ctrls= rep.autoCtrls;
- *auto_values= rep.autoCtrlValues;
- return ((rep.value&XkbPCF_AutoResetControlsMask)!=0);
+ *auto_ctrls = rep.autoCtrls;
+ *auto_values = rep.autoCtrlValues;
+ return ((rep.value & XkbPCF_AutoResetControlsMask) != 0);
}
Bool
-XkbGetAutoResetControls( Display * dpy,
- unsigned * auto_ctrls,
- unsigned * auto_ctrl_values)
+XkbGetAutoResetControls(Display *dpy,
+ unsigned *auto_ctrls,
+ unsigned *auto_ctrl_values)
{
-register xkbPerClientFlagsReq * req;
-xkbPerClientFlagsReply rep;
-XkbInfoPtr xkbi;
+ register xkbPerClientFlagsReq *req;
+ xkbPerClientFlagsReply rep;
+ XkbInfoPtr xkbi;
if ((dpy->flags & XlibDisplayNoXkb) ||
- (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL)))
- return False;
+ (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL)))
+ return False;
LockDisplay(dpy);
xkbi = dpy->xkb_info;
GetReq(kbPerClientFlags, req);
@@ -630,35 +641,35 @@ XkbInfoPtr xkbi;
req->deviceSpec = XkbUseCoreKbd;
req->change = 0;
req->value = 0;
- req->ctrlsToChange = req->autoCtrls= req->autoCtrlValues= 0;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
+ req->ctrlsToChange = req->autoCtrls = req->autoCtrlValues = 0;
+ if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
}
UnlockDisplay(dpy);
SyncHandle();
if (auto_ctrls)
- *auto_ctrls= rep.autoCtrls;
+ *auto_ctrls = rep.autoCtrls;
if (auto_ctrl_values)
- *auto_ctrl_values= rep.autoCtrlValues;
- return ((rep.value&XkbPCF_AutoResetControlsMask)!=0);
+ *auto_ctrl_values = rep.autoCtrlValues;
+ return ((rep.value & XkbPCF_AutoResetControlsMask) != 0);
}
Bool
-XkbSetPerClientControls( Display * dpy,
- unsigned change,
- unsigned * values)
+XkbSetPerClientControls(Display *dpy, unsigned change, unsigned *values)
{
-register xkbPerClientFlagsReq * req;
-xkbPerClientFlagsReply rep;
-XkbInfoPtr xkbi;
-unsigned value_hold = *values;
+ register xkbPerClientFlagsReq *req;
+ xkbPerClientFlagsReply rep;
+ XkbInfoPtr xkbi;
+ unsigned value_hold = *values;
if ((dpy->flags & XlibDisplayNoXkb) ||
- (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL)) ||
- (change & ~(XkbPCF_GrabsUseXKBStateMask|XkbPCF_LookupStateWhenGrabbed|XkbPCF_SendEventUsesXKBState)))
- return False;
+ (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL)) ||
+ (change & ~(XkbPCF_GrabsUseXKBStateMask |
+ XkbPCF_LookupStateWhenGrabbed |
+ XkbPCF_SendEventUsesXKBState)))
+ return False;
LockDisplay(dpy);
xkbi = dpy->xkb_info;
GetReq(kbPerClientFlags, req);
@@ -667,30 +678,31 @@ unsigned value_hold = *values;
req->change = change;
req->deviceSpec = XkbUseCoreKbd;
req->value = *values;
- req->ctrlsToChange = req->autoCtrls = req->autoCtrlValues= 0;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
+ req->ctrlsToChange = req->autoCtrls = req->autoCtrlValues = 0;
+ if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
}
UnlockDisplay(dpy);
SyncHandle();
*values = rep.value;
- return ((rep.value&value_hold)!=0);
+ return ((rep.value & value_hold) != 0);
}
Bool
-XkbGetPerClientControls( Display * dpy,
- unsigned * ctrls)
+XkbGetPerClientControls(Display *dpy, unsigned *ctrls)
{
-register xkbPerClientFlagsReq * req;
-xkbPerClientFlagsReply rep;
-XkbInfoPtr xkbi;
+ register xkbPerClientFlagsReq *req;
+ xkbPerClientFlagsReply rep;
+ XkbInfoPtr xkbi;
if ((dpy->flags & XlibDisplayNoXkb) ||
- (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL)) ||
- (*ctrls & ~(XkbPCF_GrabsUseXKBStateMask|XkbPCF_LookupStateWhenGrabbed|XkbPCF_SendEventUsesXKBState)))
- return False;
+ (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL)) ||
+ (*ctrls & ~(XkbPCF_GrabsUseXKBStateMask |
+ XkbPCF_LookupStateWhenGrabbed |
+ XkbPCF_SendEventUsesXKBState)))
+ return False;
LockDisplay(dpy);
xkbi = dpy->xkb_info;
GetReq(kbPerClientFlags, req);
@@ -699,69 +711,71 @@ XkbInfoPtr xkbi;
req->deviceSpec = XkbUseCoreKbd;
req->change = 0;
req->value = 0;
- req->ctrlsToChange = req->autoCtrls= req->autoCtrlValues= 0;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
+ req->ctrlsToChange = req->autoCtrls = req->autoCtrlValues = 0;
+ if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
}
UnlockDisplay(dpy);
SyncHandle();
if (ctrls)
- *ctrls= (rep.value & (XkbPCF_GrabsUseXKBStateMask |
- XkbPCF_LookupStateWhenGrabbed |
- XkbPCF_SendEventUsesXKBState));
+ *ctrls = (rep.value & (XkbPCF_GrabsUseXKBStateMask |
+ XkbPCF_LookupStateWhenGrabbed |
+ XkbPCF_SendEventUsesXKBState));
return (True);
}
Display *
-XkbOpenDisplay( char * name,
- int * ev_rtrn,
- int * err_rtrn,
- int * major_rtrn,
- int * minor_rtrn,
- int * reason)
+XkbOpenDisplay(char *name,
+ int *ev_rtrn,
+ int *err_rtrn,
+ int *major_rtrn,
+ int *minor_rtrn,
+ int *reason)
{
- Display* dpy;
- int major_num,minor_num;
-
- if ((major_rtrn!=NULL) && (minor_rtrn!=NULL)) {
- if (!XkbLibraryVersion(major_rtrn,minor_rtrn)) {
- if (reason!=NULL)
- *reason= XkbOD_BadLibraryVersion;
- return NULL;
- }
+ Display *dpy;
+ int major_num, minor_num;
+
+ if ((major_rtrn != NULL) && (minor_rtrn != NULL)) {
+ if (!XkbLibraryVersion(major_rtrn, minor_rtrn)) {
+ if (reason != NULL)
+ *reason = XkbOD_BadLibraryVersion;
+ return NULL;
+ }
}
else {
- major_num= XkbMajorVersion;
- minor_num= XkbMinorVersion;
- major_rtrn= &major_num;
- minor_rtrn= &minor_num;
+ major_num = XkbMajorVersion;
+ minor_num = XkbMinorVersion;
+ major_rtrn = &major_num;
+ minor_rtrn = &minor_num;
}
- dpy= XOpenDisplay(name);
- if (dpy==NULL) {
- if (reason!=NULL)
- *reason= XkbOD_ConnectionRefused;
- return NULL;
+ dpy = XOpenDisplay(name);
+ if (dpy == NULL) {
+ if (reason != NULL)
+ *reason = XkbOD_ConnectionRefused;
+ return NULL;
}
- if (!XkbQueryExtension(dpy,NULL,ev_rtrn,err_rtrn,major_rtrn,minor_rtrn)) {
- if (reason!=NULL) {
- if ((*major_rtrn!=0)||(*minor_rtrn!=0))
- *reason= XkbOD_BadServerVersion;
- else *reason= XkbOD_NonXkbServer;
- }
- XCloseDisplay(dpy);
- return NULL;
+ if (!XkbQueryExtension(dpy, NULL, ev_rtrn, err_rtrn,
+ major_rtrn, minor_rtrn)) {
+ if (reason != NULL) {
+ if ((*major_rtrn != 0) || (*minor_rtrn != 0))
+ *reason = XkbOD_BadServerVersion;
+ else
+ *reason = XkbOD_NonXkbServer;
+ }
+ XCloseDisplay(dpy);
+ return NULL;
}
- if (reason!=NULL)
- *reason= XkbOD_Success;
+ if (reason != NULL)
+ *reason = XkbOD_Success;
return dpy;
}
void
-XkbSetAtomFuncs(XkbInternAtomFunc getAtom,XkbGetAtomNameFunc getName)
+XkbSetAtomFuncs(XkbInternAtomFunc getAtom, XkbGetAtomNameFunc getName)
{
- _XkbInternAtomFunc= (getAtom?getAtom:XInternAtom);
- _XkbGetAtomNameFunc= (getName?getName:XGetAtomName);
+ _XkbInternAtomFunc = (getAtom ? getAtom : XInternAtom);
+ _XkbGetAtomNameFunc = (getName ? getName : XGetAtomName);
return;
}