aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/Xi/chgkbd.c
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/programs/Xserver/Xi/chgkbd.c')
-rw-r--r--nx-X11/programs/Xserver/Xi/chgkbd.c124
1 files changed, 58 insertions, 66 deletions
diff --git a/nx-X11/programs/Xserver/Xi/chgkbd.c b/nx-X11/programs/Xserver/Xi/chgkbd.c
index 1d45023cf..4e8b5ee70 100644
--- a/nx-X11/programs/Xserver/Xi/chgkbd.c
+++ b/nx-X11/programs/Xserver/Xi/chgkbd.c
@@ -55,15 +55,15 @@ SOFTWARE.
#include <dix-config.h>
#endif
-#include <nx-X11/X.h> /* for inputstr.h */
-#include <nx-X11/Xproto.h> /* Request macro */
-#include "inputstr.h" /* DeviceIntPtr */
+#include <nx-X11/X.h> /* for inputstr.h */
+#include <nx-X11/Xproto.h> /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
#include <nx-X11/extensions/XI.h>
#include <nx-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"
@@ -78,14 +78,13 @@ SOFTWARE.
*/
int
-SProcXChangeKeyboardDevice(client)
- register ClientPtr client;
- {
+SProcXChangeKeyboardDevice(register ClientPtr client)
+{
REQUEST(xChangeKeyboardDeviceReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xChangeKeyboardDeviceReq);
- return(ProcXChangeKeyboardDevice(client));
- }
+ return (ProcXChangeKeyboardDevice(client));
+}
/***********************************************************************
*
@@ -95,17 +94,16 @@ SProcXChangeKeyboardDevice(client)
*/
int
-ProcXChangeKeyboardDevice (client)
- register ClientPtr client;
- {
- int i;
- DeviceIntPtr xkbd = inputInfo.keyboard;
- DeviceIntPtr dev;
- FocusClassPtr xf = xkbd->focus;
- FocusClassPtr df;
- KeyClassPtr k;
- xChangeKeyboardDeviceReply rep;
- changeDeviceNotify ev;
+ProcXChangeKeyboardDevice(register ClientPtr client)
+{
+ 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);
@@ -115,79 +113,75 @@ ProcXChangeKeyboardDevice (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 *) realloc(df->trace,
- xf->traceSize * sizeof(WindowPtr));
- Must_have_memory = FALSE; /* XXX */
- }
+ if (df->traceSize != xf->traceSize) {
+ Must_have_memory = TRUE; /* XXX */
+ df->trace = (WindowPtr *) realloc(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;
- }
+}
/***********************************************************************
*
@@ -197,12 +191,10 @@ ProcXChangeKeyboardDevice (client)
*/
void
-SRepXChangeKeyboardDevice (client, size, rep)
- ClientPtr client;
- int size;
- xChangeKeyboardDeviceReply *rep;
- {
+SRepXChangeKeyboardDevice(ClientPtr client, int size,
+ xChangeKeyboardDeviceReply * rep)
+{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
- }
+}