aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/Xi/chgfctl.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-03-23 10:05:55 +0100
committermarha <marha@users.sourceforge.net>2012-03-23 10:05:55 +0100
commit0f834b91a4768673833ab4917e87d86c237bb1a6 (patch)
tree363489504ed4b2d360259b8de4c9e392918e5d02 /xorg-server/Xi/chgfctl.c
parentfc72edebf875378459368c5383d9023730cbca54 (diff)
downloadvcxsrv-0f834b91a4768673833ab4917e87d86c237bb1a6.tar.gz
vcxsrv-0f834b91a4768673833ab4917e87d86c237bb1a6.tar.bz2
vcxsrv-0f834b91a4768673833ab4917e87d86c237bb1a6.zip
libX11 xserver fontconfig mesa pixman xkbcomp xkeyboard-config git update
23 Mar 2012
Diffstat (limited to 'xorg-server/Xi/chgfctl.c')
-rw-r--r--xorg-server/Xi/chgfctl.c455
1 files changed, 231 insertions, 224 deletions
diff --git a/xorg-server/Xi/chgfctl.c b/xorg-server/Xi/chgfctl.c
index f818cd0ce..6dcf60c66 100644
--- a/xorg-server/Xi/chgfctl.c
+++ b/xorg-server/Xi/chgfctl.c
@@ -54,9 +54,9 @@ SOFTWARE.
#include <dix-config.h>
#endif
-#include "inputstr.h" /* DeviceIntPtr */
+#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
-#include <X11/extensions/XIproto.h> /* control constants */
+#include <X11/extensions/XIproto.h> /* control constants */
#include "exglobals.h"
@@ -89,107 +89,110 @@ SProcXChangeFeedbackControl(ClientPtr client)
static int
ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
- KbdFeedbackPtr k, xKbdFeedbackCtl * f)
+ KbdFeedbackPtr k, xKbdFeedbackCtl * f)
{
KeybdCtrl kctrl;
int t;
int key = DO_ALL;
if (client->swapped) {
- swaps(&f->length);
- swaps(&f->pitch);
- swaps(&f->duration);
- swapl(&f->led_mask);
- swapl(&f->led_values);
+ swaps(&f->length);
+ swaps(&f->pitch);
+ swaps(&f->duration);
+ swapl(&f->led_mask);
+ swapl(&f->led_values);
}
kctrl = k->ctrl;
if (mask & DvKeyClickPercent) {
- t = f->click;
- if (t == -1)
- t = defaultKeyboardControl.click;
- else if (t < 0 || t > 100) {
- client->errorValue = t;
- return BadValue;
- }
- kctrl.click = t;
+ t = f->click;
+ if (t == -1)
+ t = defaultKeyboardControl.click;
+ else if (t < 0 || t > 100) {
+ client->errorValue = t;
+ return BadValue;
+ }
+ kctrl.click = t;
}
if (mask & DvPercent) {
- t = f->percent;
- if (t == -1)
- t = defaultKeyboardControl.bell;
- else if (t < 0 || t > 100) {
- client->errorValue = t;
- return BadValue;
- }
- kctrl.bell = t;
+ t = f->percent;
+ if (t == -1)
+ t = defaultKeyboardControl.bell;
+ else if (t < 0 || t > 100) {
+ client->errorValue = t;
+ return BadValue;
+ }
+ kctrl.bell = t;
}
if (mask & DvPitch) {
- t = f->pitch;
- if (t == -1)
- t = defaultKeyboardControl.bell_pitch;
- else if (t < 0) {
- client->errorValue = t;
- return BadValue;
- }
- kctrl.bell_pitch = t;
+ t = f->pitch;
+ if (t == -1)
+ t = defaultKeyboardControl.bell_pitch;
+ else if (t < 0) {
+ client->errorValue = t;
+ return BadValue;
+ }
+ kctrl.bell_pitch = t;
}
if (mask & DvDuration) {
- t = f->duration;
- if (t == -1)
- t = defaultKeyboardControl.bell_duration;
- else if (t < 0) {
- client->errorValue = t;
- return BadValue;
- }
- kctrl.bell_duration = t;
+ t = f->duration;
+ if (t == -1)
+ t = defaultKeyboardControl.bell_duration;
+ else if (t < 0) {
+ client->errorValue = t;
+ return BadValue;
+ }
+ kctrl.bell_duration = t;
}
if (mask & DvLed) {
- kctrl.leds &= ~(f->led_mask);
- kctrl.leds |= (f->led_mask & f->led_values);
+ kctrl.leds &= ~(f->led_mask);
+ kctrl.leds |= (f->led_mask & f->led_values);
}
if (mask & DvKey) {
- key = (KeyCode) f->key;
- if (key < 8 || key > 255) {
- client->errorValue = key;
- return BadValue;
- }
- if (!(mask & DvAutoRepeatMode))
- return BadMatch;
+ key = (KeyCode) f->key;
+ if (key < 8 || key > 255) {
+ client->errorValue = key;
+ return BadValue;
+ }
+ if (!(mask & DvAutoRepeatMode))
+ return BadMatch;
}
if (mask & DvAutoRepeatMode) {
- int inx = (key >> 3);
- int kmask = (1 << (key & 7));
-
- t = (CARD8) f->auto_repeat_mode;
- if (t == AutoRepeatModeOff) {
- if (key == DO_ALL)
- kctrl.autoRepeat = FALSE;
- else
- kctrl.autoRepeats[inx] &= ~kmask;
- } else if (t == AutoRepeatModeOn) {
- if (key == DO_ALL)
- kctrl.autoRepeat = TRUE;
- else
- kctrl.autoRepeats[inx] |= kmask;
- } else if (t == AutoRepeatModeDefault) {
- if (key == DO_ALL)
- kctrl.autoRepeat = defaultKeyboardControl.autoRepeat;
- else
- kctrl.autoRepeats[inx] &= ~kmask;
- kctrl.autoRepeats[inx] =
- (kctrl.autoRepeats[inx] & ~kmask) |
- (defaultKeyboardControl.autoRepeats[inx] & kmask);
- } else {
- client->errorValue = t;
- return BadValue;
- }
+ int inx = (key >> 3);
+ int kmask = (1 << (key & 7));
+
+ t = (CARD8) f->auto_repeat_mode;
+ if (t == AutoRepeatModeOff) {
+ if (key == DO_ALL)
+ kctrl.autoRepeat = FALSE;
+ else
+ kctrl.autoRepeats[inx] &= ~kmask;
+ }
+ else if (t == AutoRepeatModeOn) {
+ if (key == DO_ALL)
+ kctrl.autoRepeat = TRUE;
+ else
+ kctrl.autoRepeats[inx] |= kmask;
+ }
+ else if (t == AutoRepeatModeDefault) {
+ if (key == DO_ALL)
+ kctrl.autoRepeat = defaultKeyboardControl.autoRepeat;
+ else
+ kctrl.autoRepeats[inx] &= ~kmask;
+ kctrl.autoRepeats[inx] =
+ (kctrl.autoRepeats[inx] & ~kmask) |
+ (defaultKeyboardControl.autoRepeats[inx] & kmask);
+ }
+ else {
+ client->errorValue = t;
+ return BadValue;
+ }
}
k->ctrl = kctrl;
@@ -205,55 +208,58 @@ ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
static int
ChangePtrFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
- PtrFeedbackPtr p, xPtrFeedbackCtl * f)
+ PtrFeedbackPtr p, xPtrFeedbackCtl * f)
{
- PtrCtrl pctrl; /* might get BadValue part way through */
+ PtrCtrl pctrl; /* might get BadValue part way through */
if (client->swapped) {
- swaps(&f->length);
- swaps(&f->num);
- swaps(&f->denom);
- swaps(&f->thresh);
+ swaps(&f->length);
+ swaps(&f->num);
+ swaps(&f->denom);
+ swaps(&f->thresh);
}
pctrl = p->ctrl;
if (mask & DvAccelNum) {
- int accelNum;
-
- accelNum = f->num;
- if (accelNum == -1)
- pctrl.num = defaultPointerControl.num;
- else if (accelNum < 0) {
- client->errorValue = accelNum;
- return BadValue;
- } else
- pctrl.num = accelNum;
+ int accelNum;
+
+ accelNum = f->num;
+ if (accelNum == -1)
+ pctrl.num = defaultPointerControl.num;
+ else if (accelNum < 0) {
+ client->errorValue = accelNum;
+ return BadValue;
+ }
+ else
+ pctrl.num = accelNum;
}
if (mask & DvAccelDenom) {
- int accelDenom;
-
- accelDenom = f->denom;
- if (accelDenom == -1)
- pctrl.den = defaultPointerControl.den;
- else if (accelDenom <= 0) {
- client->errorValue = accelDenom;
- return BadValue;
- } else
- pctrl.den = accelDenom;
+ int accelDenom;
+
+ accelDenom = f->denom;
+ if (accelDenom == -1)
+ pctrl.den = defaultPointerControl.den;
+ else if (accelDenom <= 0) {
+ client->errorValue = accelDenom;
+ return BadValue;
+ }
+ else
+ pctrl.den = accelDenom;
}
if (mask & DvThreshold) {
- int threshold;
-
- threshold = f->thresh;
- if (threshold == -1)
- pctrl.threshold = defaultPointerControl.threshold;
- else if (threshold < 0) {
- client->errorValue = threshold;
- return BadValue;
- } else
- pctrl.threshold = threshold;
+ int threshold;
+
+ threshold = f->thresh;
+ if (threshold == -1)
+ pctrl.threshold = defaultPointerControl.threshold;
+ else if (threshold < 0) {
+ client->errorValue = threshold;
+ return BadValue;
+ }
+ else
+ pctrl.threshold = threshold;
}
p->ctrl = pctrl;
@@ -269,12 +275,12 @@ ChangePtrFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
static int
ChangeIntegerFeedback(ClientPtr client, DeviceIntPtr dev,
- long unsigned int mask, IntegerFeedbackPtr i,
- xIntegerFeedbackCtl * f)
+ long unsigned int mask, IntegerFeedbackPtr i,
+ xIntegerFeedbackCtl * f)
{
if (client->swapped) {
- swaps(&f->length);
- swapl(&f->int_to_display);
+ swaps(&f->length);
+ swapl(&f->int_to_display);
}
i->ctrl.integer_displayed = f->int_to_display;
@@ -290,33 +296,33 @@ ChangeIntegerFeedback(ClientPtr client, DeviceIntPtr dev,
static int
ChangeStringFeedback(ClientPtr client, DeviceIntPtr dev,
- long unsigned int mask, StringFeedbackPtr s,
- xStringFeedbackCtl * f)
+ long unsigned int mask, StringFeedbackPtr s,
+ xStringFeedbackCtl * f)
{
int i, j;
KeySym *syms, *sup_syms;
syms = (KeySym *) (f + 1);
if (client->swapped) {
- swaps(&f->length); /* swapped num_keysyms in calling proc */
- SwapLongs((CARD32 *) syms, f->num_keysyms);
+ swaps(&f->length); /* swapped num_keysyms in calling proc */
+ SwapLongs((CARD32 *) syms, f->num_keysyms);
}
if (f->num_keysyms > s->ctrl.max_symbols)
- return BadValue;
+ return BadValue;
sup_syms = s->ctrl.symbols_supported;
for (i = 0; i < f->num_keysyms; i++) {
- for (j = 0; j < s->ctrl.num_symbols_supported; j++)
- if (*(syms + i) == *(sup_syms + j))
- break;
- if (j == s->ctrl.num_symbols_supported)
- return BadMatch;
+ for (j = 0; j < s->ctrl.num_symbols_supported; j++)
+ if (*(syms + i) == *(sup_syms + j))
+ break;
+ if (j == s->ctrl.num_symbols_supported)
+ return BadMatch;
}
s->ctrl.num_symbols_displayed = f->num_keysyms;
for (i = 0; i < f->num_keysyms; i++)
- *(s->ctrl.symbols_displayed + i) = *(syms + i);
+ *(s->ctrl.symbols_displayed + i) = *(syms + i);
(*s->CtrlProc) (dev, &s->ctrl);
return Success;
}
@@ -329,50 +335,50 @@ ChangeStringFeedback(ClientPtr client, DeviceIntPtr dev,
static int
ChangeBellFeedback(ClientPtr client, DeviceIntPtr dev,
- long unsigned int mask, BellFeedbackPtr b,
- xBellFeedbackCtl * f)
+ long unsigned int mask, BellFeedbackPtr b,
+ xBellFeedbackCtl * f)
{
int t;
- BellCtrl bctrl; /* might get BadValue part way through */
+ BellCtrl bctrl; /* might get BadValue part way through */
if (client->swapped) {
- swaps(&f->length);
- swaps(&f->pitch);
- swaps(&f->duration);
+ swaps(&f->length);
+ swaps(&f->pitch);
+ swaps(&f->duration);
}
bctrl = b->ctrl;
if (mask & DvPercent) {
- t = f->percent;
- if (t == -1)
- t = defaultKeyboardControl.bell;
- else if (t < 0 || t > 100) {
- client->errorValue = t;
- return BadValue;
- }
- bctrl.percent = t;
+ t = f->percent;
+ if (t == -1)
+ t = defaultKeyboardControl.bell;
+ else if (t < 0 || t > 100) {
+ client->errorValue = t;
+ return BadValue;
+ }
+ bctrl.percent = t;
}
if (mask & DvPitch) {
- t = f->pitch;
- if (t == -1)
- t = defaultKeyboardControl.bell_pitch;
- else if (t < 0) {
- client->errorValue = t;
- return BadValue;
- }
- bctrl.pitch = t;
+ t = f->pitch;
+ if (t == -1)
+ t = defaultKeyboardControl.bell_pitch;
+ else if (t < 0) {
+ client->errorValue = t;
+ return BadValue;
+ }
+ bctrl.pitch = t;
}
if (mask & DvDuration) {
- t = f->duration;
- if (t == -1)
- t = defaultKeyboardControl.bell_duration;
- else if (t < 0) {
- client->errorValue = t;
- return BadValue;
- }
- bctrl.duration = t;
+ t = f->duration;
+ if (t == -1)
+ t = defaultKeyboardControl.bell_duration;
+ else if (t < 0) {
+ client->errorValue = t;
+ return BadValue;
+ }
+ bctrl.duration = t;
}
b->ctrl = bctrl;
(*b->CtrlProc) (dev, &b->ctrl);
@@ -387,24 +393,24 @@ ChangeBellFeedback(ClientPtr client, DeviceIntPtr dev,
static int
ChangeLedFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
- LedFeedbackPtr l, xLedFeedbackCtl * f)
+ LedFeedbackPtr l, xLedFeedbackCtl * f)
{
- LedCtrl lctrl; /* might get BadValue part way through */
+ LedCtrl lctrl; /* might get BadValue part way through */
if (client->swapped) {
- swaps(&f->length);
- swapl(&f->led_values);
- swapl(&f->led_mask);
+ swaps(&f->length);
+ swapl(&f->led_values);
+ swapl(&f->led_mask);
}
- f->led_mask &= l->ctrl.led_mask; /* set only supported leds */
- f->led_values &= l->ctrl.led_mask; /* set only supported leds */
+ f->led_mask &= l->ctrl.led_mask; /* set only supported leds */
+ f->led_values &= l->ctrl.led_mask; /* set only supported leds */
if (mask & DvLed) {
- lctrl.led_mask = f->led_mask;
- lctrl.led_values = f->led_values;
- (*l->CtrlProc) (dev, &lctrl);
- l->ctrl.led_values &= ~(f->led_mask); /* zero changed leds */
- l->ctrl.led_values |= (f->led_mask & f->led_values); /* OR in set leds */
+ lctrl.led_mask = f->led_mask;
+ lctrl.led_values = f->led_values;
+ (*l->CtrlProc) (dev, &lctrl);
+ l->ctrl.led_values &= ~(f->led_mask); /* zero changed leds */
+ l->ctrl.led_values |= (f->led_mask & f->led_values); /* OR in set leds */
}
return Success;
@@ -435,74 +441,75 @@ ProcXChangeFeedbackControl(ClientPtr client)
len = stuff->length - bytes_to_int32(sizeof(xChangeFeedbackControlReq));
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixManageAccess);
if (rc != Success)
- return rc;
+ return rc;
switch (stuff->feedbackid) {
case KbdFeedbackClass:
- if (len != bytes_to_int32(sizeof(xKbdFeedbackCtl)))
- return BadLength;
-
- for (k = dev->kbdfeed; k; k = k->next)
- if (k->ctrl.id == ((xKbdFeedbackCtl *) & stuff[1])->id)
- return ChangeKbdFeedback(client, dev, stuff->mask, k,
- (xKbdFeedbackCtl *) & stuff[1]);
- break;
+ if (len != bytes_to_int32(sizeof(xKbdFeedbackCtl)))
+ return BadLength;
+
+ for (k = dev->kbdfeed; k; k = k->next)
+ if (k->ctrl.id == ((xKbdFeedbackCtl *) &stuff[1])->id)
+ return ChangeKbdFeedback(client, dev, stuff->mask, k,
+ (xKbdFeedbackCtl *) &stuff[1]);
+ break;
case PtrFeedbackClass:
- if (len != bytes_to_int32(sizeof(xPtrFeedbackCtl)))
- return BadLength;
-
- for (p = dev->ptrfeed; p; p = p->next)
- if (p->ctrl.id == ((xPtrFeedbackCtl *) & stuff[1])->id)
- return ChangePtrFeedback(client, dev, stuff->mask, p,
- (xPtrFeedbackCtl *) & stuff[1]);
- break;
+ if (len != bytes_to_int32(sizeof(xPtrFeedbackCtl)))
+ return BadLength;
+
+ for (p = dev->ptrfeed; p; p = p->next)
+ if (p->ctrl.id == ((xPtrFeedbackCtl *) &stuff[1])->id)
+ return ChangePtrFeedback(client, dev, stuff->mask, p,
+ (xPtrFeedbackCtl *) &stuff[1]);
+ break;
case StringFeedbackClass:
{
- xStringFeedbackCtl *f = ((xStringFeedbackCtl *) & stuff[1]);
-
- if (client->swapped) {
- swaps(&f->num_keysyms);
- }
- if (len != (bytes_to_int32(sizeof(xStringFeedbackCtl)) + f->num_keysyms))
- return BadLength;
-
- for (s = dev->stringfeed; s; s = s->next)
- if (s->ctrl.id == ((xStringFeedbackCtl *) & stuff[1])->id)
- return ChangeStringFeedback(client, dev, stuff->mask, s,
- (xStringFeedbackCtl *) & stuff[1]);
- break;
+ xStringFeedbackCtl *f = ((xStringFeedbackCtl *) &stuff[1]);
+
+ if (client->swapped) {
+ swaps(&f->num_keysyms);
+ }
+ if (len !=
+ (bytes_to_int32(sizeof(xStringFeedbackCtl)) + f->num_keysyms))
+ return BadLength;
+
+ for (s = dev->stringfeed; s; s = s->next)
+ if (s->ctrl.id == ((xStringFeedbackCtl *) &stuff[1])->id)
+ return ChangeStringFeedback(client, dev, stuff->mask, s,
+ (xStringFeedbackCtl *) &stuff[1]);
+ break;
}
case IntegerFeedbackClass:
- if (len != bytes_to_int32(sizeof(xIntegerFeedbackCtl)))
- return BadLength;
-
- for (i = dev->intfeed; i; i = i->next)
- if (i->ctrl.id == ((xIntegerFeedbackCtl *) & stuff[1])->id)
- return ChangeIntegerFeedback(client, dev, stuff->mask, i,
- (xIntegerFeedbackCtl *)&stuff[1]);
- break;
+ if (len != bytes_to_int32(sizeof(xIntegerFeedbackCtl)))
+ return BadLength;
+
+ for (i = dev->intfeed; i; i = i->next)
+ if (i->ctrl.id == ((xIntegerFeedbackCtl *) &stuff[1])->id)
+ return ChangeIntegerFeedback(client, dev, stuff->mask, i,
+ (xIntegerFeedbackCtl *) &
+ stuff[1]);
+ break;
case LedFeedbackClass:
- if (len != bytes_to_int32(sizeof(xLedFeedbackCtl)))
- return BadLength;
-
- for (l = dev->leds; l; l = l->next)
- if (l->ctrl.id == ((xLedFeedbackCtl *) & stuff[1])->id)
- return ChangeLedFeedback(client, dev, stuff->mask, l,
- (xLedFeedbackCtl *) & stuff[1]);
- break;
+ if (len != bytes_to_int32(sizeof(xLedFeedbackCtl)))
+ return BadLength;
+
+ for (l = dev->leds; l; l = l->next)
+ if (l->ctrl.id == ((xLedFeedbackCtl *) &stuff[1])->id)
+ return ChangeLedFeedback(client, dev, stuff->mask, l,
+ (xLedFeedbackCtl *) &stuff[1]);
+ break;
case BellFeedbackClass:
- if (len != bytes_to_int32(sizeof(xBellFeedbackCtl)))
- return BadLength;
-
- for (b = dev->bell; b; b = b->next)
- if (b->ctrl.id == ((xBellFeedbackCtl *) & stuff[1])->id)
- return ChangeBellFeedback(client, dev, stuff->mask, b,
- (xBellFeedbackCtl *) & stuff[1]);
- break;
+ if (len != bytes_to_int32(sizeof(xBellFeedbackCtl)))
+ return BadLength;
+
+ for (b = dev->bell; b; b = b->next)
+ if (b->ctrl.id == ((xBellFeedbackCtl *) &stuff[1])->id)
+ return ChangeBellFeedback(client, dev, stuff->mask, b,
+ (xBellFeedbackCtl *) &stuff[1]);
+ break;
default:
- break;
+ break;
}
return BadMatch;
}
-