summaryrefslogtreecommitdiff
path: root/Xi/chgkbd.c
diff options
context:
space:
mode:
Diffstat (limited to 'Xi/chgkbd.c')
-rw-r--r--Xi/chgkbd.c114
1 files changed, 54 insertions, 60 deletions
diff --git a/Xi/chgkbd.c b/Xi/chgkbd.c
index 6f3c63521..289bd85af 100644
--- a/Xi/chgkbd.c
+++ b/Xi/chgkbd.c
@@ -1,5 +1,3 @@
-/* $Xorg: chgkbd.c,v 1.4 2001/02/09 02:04:33 xorgcvs Exp $ */
-
/************************************************************
Copyright 1989, 1998 The Open Group
@@ -45,7 +43,6 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
-/* $XFree86: xc/programs/Xserver/Xi/chgkbd.c,v 3.5 2001/08/23 14:56:19 alanh Exp $ */
/***********************************************************************
*
@@ -59,15 +56,15 @@ SOFTWARE.
#include <dix-config.h>
#endif
-#include <X11/X.h> /* for inputstr.h */
-#include <X11/Xproto.h> /* Request macro */
-#include "inputstr.h" /* DeviceIntPtr */
+#include <X11/X.h> /* for inputstr.h */
+#include <X11/Xproto.h> /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "XIstubs.h"
#include "globals.h"
#include "extnsionst.h"
-#include "extinit.h" /* LookupDeviceIntRec */
+#include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h"
#include "exglobals.h"
@@ -89,8 +86,8 @@ SProcXChangeKeyboardDevice(register ClientPtr client)
REQUEST(xChangeKeyboardDeviceReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xChangeKeyboardDeviceReq);
- return(ProcXChangeKeyboardDevice(client));
- }
+ return (ProcXChangeKeyboardDevice(client));
+}
/***********************************************************************
*
@@ -100,16 +97,16 @@ SProcXChangeKeyboardDevice(register ClientPtr client)
*/
int
-ProcXChangeKeyboardDevice (register ClientPtr client)
+ProcXChangeKeyboardDevice(register ClientPtr client)
{
- int i;
- DeviceIntPtr xkbd = inputInfo.keyboard;
- DeviceIntPtr dev;
- FocusClassPtr xf = xkbd->focus;
- FocusClassPtr df;
- KeyClassPtr k;
- xChangeKeyboardDeviceReply rep;
- changeDeviceNotify ev;
+ int i;
+ DeviceIntPtr xkbd = inputInfo.keyboard;
+ DeviceIntPtr dev;
+ FocusClassPtr xf = xkbd->focus;
+ FocusClassPtr df;
+ KeyClassPtr k;
+ xChangeKeyboardDeviceReply rep;
+ changeDeviceNotify ev;
REQUEST(xChangeKeyboardDeviceReq);
REQUEST_SIZE_MATCH(xChangeKeyboardDeviceReq);
@@ -119,79 +116,75 @@ ProcXChangeKeyboardDevice (register ClientPtr client)
rep.length = 0;
rep.sequenceNumber = client->sequence;
- dev = LookupDeviceIntRec (stuff->deviceid);
- if (dev == NULL)
- {
+ dev = LookupDeviceIntRec(stuff->deviceid);
+ if (dev == NULL) {
rep.status = -1;
- SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0,
- BadDevice);
+ SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0,
+ BadDevice);
return Success;
- }
+ }
k = dev->key;
- if (k == NULL)
- {
+ if (k == NULL) {
rep.status = -1;
- SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0,
- BadMatch);
+ SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0,
+ BadMatch);
return Success;
- }
+ }
if (((dev->grab) && !SameClient(dev->grab, client)) ||
- ((xkbd->grab) && !SameClient(xkbd->grab, client)))
+ ((xkbd->grab) && !SameClient(xkbd->grab, client)))
rep.status = AlreadyGrabbed;
else if ((dev->sync.frozen &&
- dev->sync.other && !SameClient(dev->sync.other, client)) ||
+ dev->sync.other && !SameClient(dev->sync.other, client)) ||
(xkbd->sync.frozen &&
xkbd->sync.other && !SameClient(xkbd->sync.other, client)))
rep.status = GrabFrozen;
- else
- {
- if (ChangeKeyboardDevice (xkbd, dev) != Success)
- {
- SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0,
- BadDevice);
+ else {
+ if (ChangeKeyboardDevice(xkbd, dev) != Success) {
+ SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0,
+ BadDevice);
return Success;
- }
+ }
if (!dev->focus)
- InitFocusClassDeviceStruct (dev);
+ InitFocusClassDeviceStruct(dev);
if (!dev->kbdfeed)
- InitKbdFeedbackClassDeviceStruct(dev, (BellProcPtr)NoopDDA,
- (KbdCtrlProcPtr)NoopDDA);
+ InitKbdFeedbackClassDeviceStruct(dev, (BellProcPtr) NoopDDA,
+ (KbdCtrlProcPtr) NoopDDA);
df = dev->focus;
df->win = xf->win;
df->revert = xf->revert;
df->time = xf->time;
df->traceGood = xf->traceGood;
- if (df->traceSize != xf->traceSize)
- {
- Must_have_memory = TRUE; /* XXX */
- df->trace = (WindowPtr *) xrealloc(df->trace,
- xf->traceSize * sizeof(WindowPtr));
- Must_have_memory = FALSE; /* XXX */
- }
+ if (df->traceSize != xf->traceSize) {
+ Must_have_memory = TRUE; /* XXX */
+ df->trace = (WindowPtr *) xrealloc(df->trace,
+ xf->traceSize *
+ sizeof(WindowPtr));
+ Must_have_memory = FALSE; /* XXX */
+ }
df->traceSize = xf->traceSize;
- for (i=0; i<df->traceSize; i++)
+ for (i = 0; i < df->traceSize; i++)
df->trace[i] = xf->trace[i];
- RegisterOtherDevice (xkbd);
- RegisterKeyboardDevice (dev);
+ RegisterOtherDevice(xkbd);
+ RegisterKeyboardDevice(dev);
ev.type = ChangeDeviceNotify;
ev.deviceid = stuff->deviceid;
ev.time = currentTime.milliseconds;
ev.request = NewKeyboard;
- SendEventToAllWindows (dev, ChangeDeviceNotifyMask, (xEvent *)&ev, 1);
- SendMappingNotify (MappingKeyboard, k->curKeySyms.minKeyCode,
- k->curKeySyms.maxKeyCode - k->curKeySyms.minKeyCode + 1,client);
+ SendEventToAllWindows(dev, ChangeDeviceNotifyMask, (xEvent *) & ev, 1);
+ SendMappingNotify(MappingKeyboard, k->curKeySyms.minKeyCode,
+ k->curKeySyms.maxKeyCode - k->curKeySyms.minKeyCode +
+ 1, client);
rep.status = 0;
- }
+ }
- WriteReplyToClient (client, sizeof (xChangeKeyboardDeviceReply),
- &rep);
+ WriteReplyToClient(client, sizeof(xChangeKeyboardDeviceReply), &rep);
return Success;
- }
+}
/***********************************************************************
*
@@ -201,11 +194,12 @@ ProcXChangeKeyboardDevice (register ClientPtr client)
*/
void
-SRepXChangeKeyboardDevice (ClientPtr client, int size, xChangeKeyboardDeviceReply *rep)
+SRepXChangeKeyboardDevice(ClientPtr client, int size,
+ xChangeKeyboardDeviceReply * rep)
{
register char n;
swaps(&rep->sequenceNumber, n);
swapl(&rep->length, n);
WriteToClient(client, size, (char *)rep);
- }
+}