aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/dix/devices.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-07-10 14:56:29 +0200
committermarha <marha@users.sourceforge.net>2012-07-10 14:56:29 +0200
commitd137057fd13e83ec15ab416c7fe774741da06047 (patch)
treef4b38caa4f3ecb983f00e84f4f4d8d66699ecbc5 /xorg-server/dix/devices.c
parentc29d91cfd8df084f16d0d2dfa82c3a86f7719a73 (diff)
downloadvcxsrv-d137057fd13e83ec15ab416c7fe774741da06047.tar.gz
vcxsrv-d137057fd13e83ec15ab416c7fe774741da06047.tar.bz2
vcxsrv-d137057fd13e83ec15ab416c7fe774741da06047.zip
fontconfig mesa xserver git update 10 Jul 2012
Diffstat (limited to 'xorg-server/dix/devices.c')
-rw-r--r--xorg-server/dix/devices.c154
1 files changed, 85 insertions, 69 deletions
diff --git a/xorg-server/dix/devices.c b/xorg-server/dix/devices.c
index 70fb273c9..839de35aa 100644
--- a/xorg-server/dix/devices.c
+++ b/xorg-server/dix/devices.c
@@ -321,15 +321,14 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
void
SendDevicePresenceEvent(int deviceid, int type)
{
- DeviceIntRec dummyDev;
- devicePresenceNotify ev;
-
- memset(&dummyDev, 0, sizeof(DeviceIntRec));
- ev.type = DevicePresenceNotify;
- ev.time = currentTime.milliseconds;
- ev.devchange = type;
- ev.deviceid = deviceid;
- dummyDev.id = XIAllDevices;
+ DeviceIntRec dummyDev = { .id = XIAllDevices };
+ devicePresenceNotify ev = {
+ .type = DevicePresenceNotify,
+ .time = currentTime.milliseconds,
+ .devchange = type,
+ .deviceid = deviceid
+ };
+
SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask,
(xEvent *) &ev, 1);
}
@@ -1666,9 +1665,11 @@ ProcSetModifierMapping(ClientPtr client)
bytes_to_int32(sizeof(xSetModifierMappingReq))))
return BadLength;
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
+ rep = (xSetModifierMappingReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0
+ };
rc = change_modmap(client, PickKeyboard(client), (KeyCode *) &stuff[1],
stuff->numKeyPerModifier);
@@ -1696,15 +1697,16 @@ ProcGetModifierMapping(ClientPtr client)
generate_modkeymap(client, PickKeyboard(client), &modkeymap,
&max_keys_per_mod);
- memset(&rep, 0, sizeof(xGetModifierMappingReply));
- rep.type = X_Reply;
- rep.numKeyPerModifier = max_keys_per_mod;
- rep.sequenceNumber = client->sequence;
+ rep = (xGetModifierMappingReply) {
+ .type = X_Reply,
+ .numKeyPerModifier = max_keys_per_mod,
+ .sequenceNumber = client->sequence,
/* length counts 4 byte quantities - there are 8 modifiers 1 byte big */
- rep.length = max_keys_per_mod << 1;
+ .length = max_keys_per_mod << 1
+ };
WriteReplyToClient(client, sizeof(xGetModifierMappingReply), &rep);
- (void) WriteToClient(client, max_keys_per_mod * 8, (char *) modkeymap);
+ WriteToClient(client, max_keys_per_mod * 8, modkeymap);
free(modkeymap);
@@ -1785,10 +1787,13 @@ ProcSetPointerMapping(ClientPtr client)
if (client->req_len !=
bytes_to_int32(sizeof(xSetPointerMappingReq) + stuff->nElts))
return BadLength;
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.success = MappingSuccess;
+
+ rep = (xSetPointerMappingReply) {
+ .type = X_Reply,
+ .success = MappingSuccess,
+ .sequenceNumber = client->sequence,
+ .length = 0
+ };
map = (BYTE *) &stuff[1];
/* So we're bounded here by the number of core buttons. This check
@@ -1857,12 +1862,13 @@ ProcGetKeyboardMapping(ClientPtr client)
if (!syms)
return BadAlloc;
- memset(&rep, 0, sizeof(xGetKeyboardMappingReply));
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.keySymsPerKeyCode = syms->mapWidth;
- /* length is a count of 4 byte quantities and KeySyms are 4 bytes */
- rep.length = syms->mapWidth * stuff->count;
+ rep = (xGetKeyboardMappingReply) {
+ .type = X_Reply,
+ .keySymsPerKeyCode = syms->mapWidth,
+ .sequenceNumber = client->sequence,
+ /* length is a count of 4 byte quantities and KeySyms are 4 bytes */
+ .length = syms->mapWidth * stuff->count
+ };
WriteReplyToClient(client, sizeof(xGetKeyboardMappingReply), &rep);
client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
WriteSwappedDataToClient(client,
@@ -1892,13 +1898,15 @@ ProcGetPointerMapping(ClientPtr client)
if (rc != Success)
return rc;
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.nElts = (butc) ? butc->numButtons : 0;
- rep.length = ((unsigned) rep.nElts + (4 - 1)) / 4;
+ rep = (xGetPointerMappingReply) {
+ .type = X_Reply,
+ .nElts = (butc) ? butc->numButtons : 0,
+ .sequenceNumber = client->sequence,
+ .length = ((unsigned) rep.nElts + (4 - 1)) / 4
+ };
WriteReplyToClient(client, sizeof(xGetPointerMappingReply), &rep);
if (butc)
- WriteToClient(client, (int) rep.nElts, (char *) &butc->map[1]);
+ WriteToClient(client, (int) rep.nElts, &butc->map[1]);
return Success;
}
@@ -2144,15 +2152,17 @@ ProcGetKeyboardControl(ClientPtr client)
if (rc != Success)
return rc;
- rep.type = X_Reply;
- rep.length = 5;
- rep.sequenceNumber = client->sequence;
- rep.globalAutoRepeat = ctrl->autoRepeat;
- rep.keyClickPercent = ctrl->click;
- rep.bellPercent = ctrl->bell;
- rep.bellPitch = ctrl->bell_pitch;
- rep.bellDuration = ctrl->bell_duration;
- rep.ledMask = ctrl->leds;
+ rep = (xGetKeyboardControlReply) {
+ .type = X_Reply,
+ .globalAutoRepeat = ctrl->autoRepeat,
+ .sequenceNumber = client->sequence,
+ .length = 5,
+ .ledMask = ctrl->leds,
+ .keyClickPercent = ctrl->click,
+ .bellPercent = ctrl->bell,
+ .bellPitch = ctrl->bell_pitch,
+ .bellDuration = ctrl->bell_duration
+ };
for (i = 0; i < 32; i++)
rep.map[i] = ctrl->autoRepeats[i];
WriteReplyToClient(client, sizeof(xGetKeyboardControlReply), &rep);
@@ -2287,12 +2297,14 @@ ProcGetPointerControl(ClientPtr client)
if (rc != Success)
return rc;
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.threshold = ctrl->threshold;
- rep.accelNumerator = ctrl->num;
- rep.accelDenominator = ctrl->den;
+ rep = (xGetPointerControlReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .accelNumerator = ctrl->num,
+ .accelDenominator = ctrl->den,
+ .threshold = ctrl->threshold
+ };
WriteReplyToClient(client, sizeof(xGenericReply), &rep);
return Success;
}
@@ -2336,8 +2348,10 @@ ProcGetMotionEvents(ClientPtr client)
if (mouse->valuator->motionHintWindow)
MaybeStopHint(mouse, client);
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
+ rep = (xGetMotionEventsReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence
+ };
nEvents = 0;
start = ClientTimeToServerTime(stuff->start);
stop = ClientTimeToServerTime(stuff->stop);
@@ -2385,20 +2399,23 @@ ProcQueryKeymap(ClientPtr client)
CARD8 *down = keybd->key->down;
REQUEST_SIZE_MATCH(xReq);
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 2;
+ rep = (xQueryKeymapReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 2
+ };
rc = XaceHook(XACE_DEVICE_ACCESS, client, keybd, DixReadAccess);
- if (rc != Success && rc != BadAccess)
+ /* If rc is Success, we're allowed to copy out the keymap.
+ * If it's BadAccess, we leave it empty & lie to the client.
+ */
+ if (rc == Success) {
+ for (i = 0; i < 32; i++)
+ rep.map[i] = down[i];
+ }
+ else if (rc != BadAccess)
return rc;
- for (i = 0; i < 32; i++)
- rep.map[i] = down[i];
-
- if (rc == BadAccess)
- memset(rep.map, 0, 32);
-
WriteReplyToClient(client, sizeof(xQueryKeymapReply), &rep);
return Success;
@@ -2432,18 +2449,17 @@ RecalculateMasterButtons(DeviceIntPtr slave)
if (master->button && master->button->numButtons != maxbuttons) {
int i;
- DeviceChangedEvent event;
-
- memset(&event, 0, sizeof(event));
+ DeviceChangedEvent event = {
+ .header = ET_Internal,
+ .type = ET_DeviceChanged,
+ .time = GetTimeInMillis(),
+ .deviceid = master->id,
+ .flags = DEVCHANGE_POINTER_EVENT | DEVCHANGE_DEVICE_CHANGE,
+ .buttons.num_buttons = maxbuttons
+ };
master->button->numButtons = maxbuttons;
- event.header = ET_Internal;
- event.type = ET_DeviceChanged;
- event.time = GetTimeInMillis();
- event.deviceid = master->id;
- event.flags = DEVCHANGE_POINTER_EVENT | DEVCHANGE_DEVICE_CHANGE;
- event.buttons.num_buttons = maxbuttons;
memcpy(&event.buttons.names, master->button->labels, maxbuttons *
sizeof(Atom));