diff options
Diffstat (limited to 'xorg-server')
25 files changed, 368 insertions, 339 deletions
diff --git a/xorg-server/Xi/exevents.c b/xorg-server/Xi/exevents.c index e9f02072a..4aad52734 100644 --- a/xorg-server/Xi/exevents.c +++ b/xorg-server/Xi/exevents.c @@ -269,8 +269,6 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to) } } else if (to->intfeed && !from->intfeed) { - ClassesPtr classes; - classes = to->unused_classes; classes->intfeed = to->intfeed; to->intfeed = NULL; @@ -301,8 +299,6 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to) } } else if (to->stringfeed && !from->stringfeed) { - ClassesPtr classes; - classes = to->unused_classes; classes->stringfeed = to->stringfeed; to->stringfeed = NULL; @@ -334,8 +330,6 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to) } } else if (to->bell && !from->bell) { - ClassesPtr classes; - classes = to->unused_classes; classes->bell = to->bell; to->bell = NULL; @@ -369,8 +363,6 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to) } } else if (to->leds && !from->leds) { - ClassesPtr classes; - classes = to->unused_classes; classes->leds = to->leds; to->leds = NULL; @@ -417,8 +409,6 @@ DeepCopyKeyboardClasses(DeviceIntPtr from, DeviceIntPtr to) } } else if (to->kbdfeed && !from->kbdfeed) { - ClassesPtr classes; - classes = to->unused_classes; classes->kbdfeed = to->kbdfeed; to->kbdfeed = NULL; @@ -437,8 +427,6 @@ DeepCopyKeyboardClasses(DeviceIntPtr from, DeviceIntPtr to) CopyKeyClass(from, to); } else if (to->key && !from->key) { - ClassesPtr classes; - classes = to->unused_classes; classes->key = to->key; to->key = NULL; @@ -494,8 +482,6 @@ DeepCopyKeyboardClasses(DeviceIntPtr from, DeviceIntPtr to) } } else if (to->focus) { - ClassesPtr classes; - classes = to->unused_classes; classes->focus = to->focus; to->focus = NULL; @@ -536,8 +522,6 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to) } } else if (to->ptrfeed && !from->ptrfeed) { - ClassesPtr classes; - classes = to->unused_classes; classes->ptrfeed = to->ptrfeed; to->ptrfeed = NULL; @@ -564,8 +548,6 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to) v->sourceid = from->id; } else if (to->valuator && !from->valuator) { - ClassesPtr classes; - classes = to->unused_classes; classes->valuator = to->valuator; to->valuator = NULL; @@ -601,8 +583,6 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to) to->button->sourceid = from->id; } else if (to->button && !from->button) { - ClassesPtr classes; - classes = to->unused_classes; classes->button = to->button; to->button = NULL; @@ -624,8 +604,6 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to) to->proximity->sourceid = from->id; } else if (to->proximity) { - ClassesPtr classes; - classes = to->unused_classes; classes->proximity = to->proximity; to->proximity = NULL; @@ -1461,9 +1439,9 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, if (grab->ownerEvents) { WindowPtr focus = NullWindow; - WindowPtr win = dev->spriteInfo->sprite->win; + WindowPtr sprite_win = dev->spriteInfo->sprite->win; - deliveries = DeliverDeviceEvents(win, ptrev, grab, focus, dev); + deliveries = DeliverDeviceEvents(sprite_win, ptrev, grab, focus, dev); } if (!deliveries) @@ -1494,7 +1472,7 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, * the event. */ if (!devgrab && dev->deviceGrab.grab && dev->deviceGrab.implicitGrab) { - TouchListener *listener; + TouchListener *l; devgrab = dev->deviceGrab.grab; @@ -1504,13 +1482,13 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, * selection. Implicit grab activation occurs through delivering an * event selection. Thus, we update the last listener in the array. */ - listener = &ti->listeners[ti->num_listeners - 1]; - listener->listener = devgrab->resource; + l = &ti->listeners[ti->num_listeners - 1]; + l->listener = devgrab->resource; if (devgrab->grabtype != XI2 || devgrab->type != XI_TouchBegin) - listener->type = LISTENER_POINTER_GRAB; + l->type = LISTENER_POINTER_GRAB; else - listener->type = LISTENER_GRAB; + l->type = LISTENER_GRAB; } } @@ -2114,240 +2092,6 @@ SetScrollValuator(DeviceIntPtr dev, int axnum, enum ScrollType type, return TRUE; } -static void -FixDeviceStateNotify(DeviceIntPtr dev, deviceStateNotify * ev, KeyClassPtr k, - ButtonClassPtr b, ValuatorClassPtr v, int first) -{ - ev->type = DeviceStateNotify; - ev->deviceid = dev->id; - ev->time = currentTime.milliseconds; - ev->classes_reported = 0; - ev->num_keys = 0; - ev->num_buttons = 0; - ev->num_valuators = 0; - - if (b) { - ev->classes_reported |= (1 << ButtonClass); - ev->num_buttons = b->numButtons; - memcpy((char *) ev->buttons, (char *) b->down, 4); - } - else if (k) { - ev->classes_reported |= (1 << KeyClass); - ev->num_keys = k->xkbInfo->desc->max_key_code - - k->xkbInfo->desc->min_key_code; - memmove((char *) &ev->keys[0], (char *) k->down, 4); - } - if (v) { - int nval = v->numAxes - first; - - ev->classes_reported |= (1 << ValuatorClass); - ev->classes_reported |= valuator_get_mode(dev, 0) << ModeBitsShift; - ev->num_valuators = nval < 3 ? nval : 3; - switch (ev->num_valuators) { - case 3: - ev->valuator2 = v->axisVal[first + 2]; - case 2: - ev->valuator1 = v->axisVal[first + 1]; - case 1: - ev->valuator0 = v->axisVal[first]; - break; - } - } -} - -static void -FixDeviceValuator(DeviceIntPtr dev, deviceValuator * ev, ValuatorClassPtr v, - int first) -{ - int nval = v->numAxes - first; - - ev->type = DeviceValuator; - ev->deviceid = dev->id; - ev->num_valuators = nval < 3 ? nval : 3; - ev->first_valuator = first; - switch (ev->num_valuators) { - case 3: - ev->valuator2 = v->axisVal[first + 2]; - case 2: - ev->valuator1 = v->axisVal[first + 1]; - case 1: - ev->valuator0 = v->axisVal[first]; - break; - } - first += ev->num_valuators; -} - -static void -DeliverStateNotifyEvent(DeviceIntPtr dev, WindowPtr win) -{ - int evcount = 1; - deviceStateNotify *ev, *sev; - deviceKeyStateNotify *kev; - deviceButtonStateNotify *bev; - - KeyClassPtr k; - ButtonClassPtr b; - ValuatorClassPtr v; - int nval = 0, nkeys = 0, nbuttons = 0, first = 0; - - if (!(wOtherInputMasks(win)) || - !(wOtherInputMasks(win)->inputEvents[dev->id] & DeviceStateNotifyMask)) - return; - - if ((b = dev->button) != NULL) { - nbuttons = b->numButtons; - if (nbuttons > 32) - evcount++; - } - if ((k = dev->key) != NULL) { - nkeys = k->xkbInfo->desc->max_key_code - k->xkbInfo->desc->min_key_code; - if (nkeys > 32) - evcount++; - if (nbuttons > 0) { - evcount++; - } - } - if ((v = dev->valuator) != NULL) { - nval = v->numAxes; - - if (nval > 3) - evcount++; - if (nval > 6) { - if (!(k && b)) - evcount++; - if (nval > 9) - evcount += ((nval - 7) / 3); - } - } - - sev = ev = (deviceStateNotify *) malloc(evcount * sizeof(xEvent)); - FixDeviceStateNotify(dev, ev, NULL, NULL, NULL, first); - - if (b != NULL) { - FixDeviceStateNotify(dev, ev++, NULL, b, v, first); - first += 3; - nval -= 3; - if (nbuttons > 32) { - (ev - 1)->deviceid |= MORE_EVENTS; - bev = (deviceButtonStateNotify *) ev++; - bev->type = DeviceButtonStateNotify; - bev->deviceid = dev->id; - memcpy((char *) &bev->buttons[4], (char *) &b->down[4], - DOWN_LENGTH - 4); - } - if (nval > 0) { - (ev - 1)->deviceid |= MORE_EVENTS; - FixDeviceValuator(dev, (deviceValuator *) ev++, v, first); - first += 3; - nval -= 3; - } - } - - if (k != NULL) { - FixDeviceStateNotify(dev, ev++, k, NULL, v, first); - first += 3; - nval -= 3; - if (nkeys > 32) { - (ev - 1)->deviceid |= MORE_EVENTS; - kev = (deviceKeyStateNotify *) ev++; - kev->type = DeviceKeyStateNotify; - kev->deviceid = dev->id; - memmove((char *) &kev->keys[0], (char *) &k->down[4], 28); - } - if (nval > 0) { - (ev - 1)->deviceid |= MORE_EVENTS; - FixDeviceValuator(dev, (deviceValuator *) ev++, v, first); - first += 3; - nval -= 3; - } - } - - while (nval > 0) { - FixDeviceStateNotify(dev, ev++, NULL, NULL, v, first); - first += 3; - nval -= 3; - if (nval > 0) { - (ev - 1)->deviceid |= MORE_EVENTS; - FixDeviceValuator(dev, (deviceValuator *) ev++, v, first); - first += 3; - nval -= 3; - } - } - - DeliverEventsToWindow(dev, win, (xEvent *) sev, evcount, - DeviceStateNotifyMask, NullGrab); - free(sev); -} - -void -DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail, - WindowPtr pWin) -{ - deviceFocus event; - xXIFocusInEvent *xi2event; - DeviceIntPtr mouse; - int btlen, len, i; - - mouse = IsFloating(dev) ? dev : GetMaster(dev, MASTER_POINTER); - - /* XI 2 event */ - btlen = (mouse->button) ? bits_to_bytes(mouse->button->numButtons) : 0; - btlen = bytes_to_int32(btlen); - len = sizeof(xXIFocusInEvent) + btlen * 4; - - xi2event = calloc(1, len); - xi2event->type = GenericEvent; - xi2event->extension = IReqCode; - xi2event->evtype = type; - xi2event->length = bytes_to_int32(len - sizeof(xEvent)); - xi2event->buttons_len = btlen; - xi2event->detail = detail; - xi2event->time = currentTime.milliseconds; - xi2event->deviceid = dev->id; - xi2event->sourceid = dev->id; /* a device doesn't change focus by itself */ - xi2event->mode = mode; - xi2event->root_x = FP1616(mouse->spriteInfo->sprite->hot.x, 0); - xi2event->root_y = FP1616(mouse->spriteInfo->sprite->hot.y, 0); - - for (i = 0; mouse && mouse->button && i < mouse->button->numButtons; i++) - if (BitIsOn(mouse->button->down, i)) - SetBit(&xi2event[1], mouse->button->map[i]); - - if (dev->key) { - xi2event->mods.base_mods = dev->key->xkbInfo->state.base_mods; - xi2event->mods.latched_mods = dev->key->xkbInfo->state.latched_mods; - xi2event->mods.locked_mods = dev->key->xkbInfo->state.locked_mods; - xi2event->mods.effective_mods = dev->key->xkbInfo->state.mods; - - xi2event->group.base_group = dev->key->xkbInfo->state.base_group; - xi2event->group.latched_group = dev->key->xkbInfo->state.latched_group; - xi2event->group.locked_group = dev->key->xkbInfo->state.locked_group; - xi2event->group.effective_group = dev->key->xkbInfo->state.group; - } - - FixUpEventFromWindow(dev->spriteInfo->sprite, (xEvent *) xi2event, pWin, - None, FALSE); - - DeliverEventsToWindow(dev, pWin, (xEvent *) xi2event, 1, - GetEventFilter(dev, (xEvent *) xi2event), NullGrab); - - free(xi2event); - - /* XI 1.x event */ - event.deviceid = dev->id; - event.mode = mode; - event.type = (type == XI_FocusIn) ? DeviceFocusIn : DeviceFocusOut; - event.detail = detail; - event.window = pWin->drawable.id; - event.time = currentTime.milliseconds; - - DeliverEventsToWindow(dev, pWin, (xEvent *) &event, 1, - DeviceFocusChangeMask, NullGrab); - - if (event.type == DeviceFocusIn) - DeliverStateNotifyEvent(dev, pWin); -} - int CheckGrabValues(ClientPtr client, GrabParameters *param) { diff --git a/xorg-server/Xi/extinit.c b/xorg-server/Xi/extinit.c index 4483076e9..494e887cd 100644 --- a/xorg-server/Xi/extinit.c +++ b/xorg-server/Xi/extinit.c @@ -1137,6 +1137,9 @@ IResetProc(ExtensionEntry * unused) EventSwapVector[DevicePresenceNotify] = NotImplemented; EventSwapVector[DevicePropertyNotify] = NotImplemented; RestoreExtensionEvents(); + + free(xi_all_devices.name); + free(xi_all_master_devices.name); } /*********************************************************************** @@ -1298,9 +1301,9 @@ XInputExtensionInit(void) memset(&xi_all_devices, 0, sizeof(xi_all_devices)); memset(&xi_all_master_devices, 0, sizeof(xi_all_master_devices)); xi_all_devices.id = XIAllDevices; - xi_all_devices.name = "XIAllDevices"; + xi_all_devices.name = strdup("XIAllDevices"); xi_all_master_devices.id = XIAllMasterDevices; - xi_all_master_devices.name = "XIAllMasterDevices"; + xi_all_master_devices.name = strdup("XIAllMasterDevices"); inputInfo.all_devices = &xi_all_devices; inputInfo.all_master_devices = &xi_all_master_devices; diff --git a/xorg-server/Xi/xiproperty.c b/xorg-server/Xi/xiproperty.c index e17efe407..5f46b5435 100644 --- a/xorg-server/Xi/xiproperty.c +++ b/xorg-server/Xi/xiproperty.c @@ -754,7 +754,7 @@ XIChangeDeviceProperty(DeviceIntPtr dev, Atom property, Atom type, break; } if (new_data) - memcpy((char *) new_data, (char *) value, len * size_in_bytes); + memcpy((char *) new_data, value, len * size_in_bytes); if (old_data) memcpy((char *) old_data, (char *) prop_value->data, prop_value->size * size_in_bytes); diff --git a/xorg-server/Xi/xiselectev.c b/xorg-server/Xi/xiselectev.c index 43a67c833..e7e719d16 100644 --- a/xorg-server/Xi/xiselectev.c +++ b/xorg-server/Xi/xiselectev.c @@ -175,17 +175,17 @@ ProcXISelectEvents(ClientPtr client) if (inputMasks) iclient = inputMasks->inputClients; for (; iclient; iclient = iclient->next) { - DeviceIntPtr dummy; + DeviceIntPtr tmp; if (CLIENT_ID(iclient->resource) == client->index) continue; - dixLookupDevice(&dummy, evmask->deviceid, serverClient, + dixLookupDevice(&tmp, evmask->deviceid, serverClient, DixReadAccess); - if (!dummy) + if (!tmp) return BadImplementation; /* this shouldn't happen */ - if (xi2mask_isset(iclient->xi2mask, dummy, XI_TouchBegin)) + if (xi2mask_isset(iclient->xi2mask, tmp, XI_TouchBegin)) return BadAccess; } } diff --git a/xorg-server/dix/devices.c b/xorg-server/dix/devices.c index 7f3886507..0c62a012d 100644 --- a/xorg-server/dix/devices.c +++ b/xorg-server/dix/devices.c @@ -1332,13 +1332,10 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes, Atom *labels, /* global list of acceleration schemes */ ValuatorAccelerationRec pointerAccelerationScheme[] = { - {PtrAccelNoOp, NULL, NULL, NULL, NULL} - , + {PtrAccelNoOp, NULL, NULL, NULL, NULL}, {PtrAccelPredictable, acceleratePointerPredictable, NULL, - InitPredictableAccelerationScheme, AccelerationDefaultCleanup} - , - {PtrAccelLightweight, acceleratePointerLightweight, NULL, NULL, NULL} - , + InitPredictableAccelerationScheme, AccelerationDefaultCleanup}, + {PtrAccelLightweight, acceleratePointerLightweight, NULL, NULL, NULL}, {-1, NULL, NULL, NULL, NULL} /* terminator */ }; @@ -1375,8 +1372,7 @@ InitPointerAccelerationScheme(DeviceIntPtr dev, int scheme) if (pointerAccelerationScheme[i].AccelInitProc) { if (!pointerAccelerationScheme[i].AccelInitProc(dev, - &pointerAccelerationScheme - [i])) { + &pointerAccelerationScheme[i])) { return FALSE; } } diff --git a/xorg-server/dix/enterleave.c b/xorg-server/dix/enterleave.c index 725080a4c..761ab3b9f 100644 --- a/xorg-server/dix/enterleave.c +++ b/xorg-server/dix/enterleave.c @@ -30,11 +30,15 @@ #include <X11/X.h> #include <X11/extensions/XI2.h> +#include <X11/extensions/XIproto.h> +#include <X11/extensions/XI2proto.h> #include "inputstr.h" #include "windowstr.h" #include "scrnintstr.h" #include "exglobals.h" #include "enterleave.h" +#include "eventconvert.h" +#include "xkbsrv.h" /** * @file @@ -602,6 +606,241 @@ DoEnterLeaveEvents(DeviceIntPtr pDev, DeviceEnterLeaveEvents(pDev, sourceid, fromWin, toWin, mode); } +static void +FixDeviceValuator(DeviceIntPtr dev, deviceValuator * ev, ValuatorClassPtr v, + int first) +{ + int nval = v->numAxes - first; + + ev->type = DeviceValuator; + ev->deviceid = dev->id; + ev->num_valuators = nval < 3 ? nval : 3; + ev->first_valuator = first; + switch (ev->num_valuators) { + case 3: + ev->valuator2 = v->axisVal[first + 2]; + case 2: + ev->valuator1 = v->axisVal[first + 1]; + case 1: + ev->valuator0 = v->axisVal[first]; + break; + } + first += ev->num_valuators; +} + +static void +FixDeviceStateNotify(DeviceIntPtr dev, deviceStateNotify * ev, KeyClassPtr k, + ButtonClassPtr b, ValuatorClassPtr v, int first) +{ + ev->type = DeviceStateNotify; + ev->deviceid = dev->id; + ev->time = currentTime.milliseconds; + ev->classes_reported = 0; + ev->num_keys = 0; + ev->num_buttons = 0; + ev->num_valuators = 0; + + if (b) { + ev->classes_reported |= (1 << ButtonClass); + ev->num_buttons = b->numButtons; + memcpy((char *) ev->buttons, (char *) b->down, 4); + } + else if (k) { + ev->classes_reported |= (1 << KeyClass); + ev->num_keys = k->xkbInfo->desc->max_key_code - + k->xkbInfo->desc->min_key_code; + memmove((char *) &ev->keys[0], (char *) k->down, 4); + } + if (v) { + int nval = v->numAxes - first; + + ev->classes_reported |= (1 << ValuatorClass); + ev->classes_reported |= valuator_get_mode(dev, 0) << ModeBitsShift; + ev->num_valuators = nval < 3 ? nval : 3; + switch (ev->num_valuators) { + case 3: + ev->valuator2 = v->axisVal[first + 2]; + case 2: + ev->valuator1 = v->axisVal[first + 1]; + case 1: + ev->valuator0 = v->axisVal[first]; + break; + } + } +} + + +static void +DeliverStateNotifyEvent(DeviceIntPtr dev, WindowPtr win) +{ + int evcount = 1; + deviceStateNotify *ev, *sev; + deviceKeyStateNotify *kev; + deviceButtonStateNotify *bev; + + KeyClassPtr k; + ButtonClassPtr b; + ValuatorClassPtr v; + int nval = 0, nkeys = 0, nbuttons = 0, first = 0; + + if (!(wOtherInputMasks(win)) || + !(wOtherInputMasks(win)->inputEvents[dev->id] & DeviceStateNotifyMask)) + return; + + if ((b = dev->button) != NULL) { + nbuttons = b->numButtons; + if (nbuttons > 32) + evcount++; + } + if ((k = dev->key) != NULL) { + nkeys = k->xkbInfo->desc->max_key_code - k->xkbInfo->desc->min_key_code; + if (nkeys > 32) + evcount++; + if (nbuttons > 0) { + evcount++; + } + } + if ((v = dev->valuator) != NULL) { + nval = v->numAxes; + + if (nval > 3) + evcount++; + if (nval > 6) { + if (!(k && b)) + evcount++; + if (nval > 9) + evcount += ((nval - 7) / 3); + } + } + + sev = ev = (deviceStateNotify *) malloc(evcount * sizeof(xEvent)); + FixDeviceStateNotify(dev, ev, NULL, NULL, NULL, first); + + if (b != NULL) { + FixDeviceStateNotify(dev, ev++, NULL, b, v, first); + first += 3; + nval -= 3; + if (nbuttons > 32) { + (ev - 1)->deviceid |= MORE_EVENTS; + bev = (deviceButtonStateNotify *) ev++; + bev->type = DeviceButtonStateNotify; + bev->deviceid = dev->id; + memcpy((char *) &bev->buttons[4], (char *) &b->down[4], + DOWN_LENGTH - 4); + } + if (nval > 0) { + (ev - 1)->deviceid |= MORE_EVENTS; + FixDeviceValuator(dev, (deviceValuator *) ev++, v, first); + first += 3; + nval -= 3; + } + } + + if (k != NULL) { + FixDeviceStateNotify(dev, ev++, k, NULL, v, first); + first += 3; + nval -= 3; + if (nkeys > 32) { + (ev - 1)->deviceid |= MORE_EVENTS; + kev = (deviceKeyStateNotify *) ev++; + kev->type = DeviceKeyStateNotify; + kev->deviceid = dev->id; + memmove((char *) &kev->keys[0], (char *) &k->down[4], 28); + } + if (nval > 0) { + (ev - 1)->deviceid |= MORE_EVENTS; + FixDeviceValuator(dev, (deviceValuator *) ev++, v, first); + first += 3; + nval -= 3; + } + } + + while (nval > 0) { + FixDeviceStateNotify(dev, ev++, NULL, NULL, v, first); + first += 3; + nval -= 3; + if (nval > 0) { + (ev - 1)->deviceid |= MORE_EVENTS; + FixDeviceValuator(dev, (deviceValuator *) ev++, v, first); + first += 3; + nval -= 3; + } + } + + DeliverEventsToWindow(dev, win, (xEvent *) sev, evcount, + DeviceStateNotifyMask, NullGrab); + free(sev); +} + +void +DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail, + WindowPtr pWin) +{ + deviceFocus event; + xXIFocusInEvent *xi2event; + DeviceIntPtr mouse; + int btlen, len, i; + + mouse = IsFloating(dev) ? dev : GetMaster(dev, MASTER_POINTER); + + /* XI 2 event */ + btlen = (mouse->button) ? bits_to_bytes(mouse->button->numButtons) : 0; + btlen = bytes_to_int32(btlen); + len = sizeof(xXIFocusInEvent) + btlen * 4; + + xi2event = calloc(1, len); + xi2event->type = GenericEvent; + xi2event->extension = IReqCode; + xi2event->evtype = type; + xi2event->length = bytes_to_int32(len - sizeof(xEvent)); + xi2event->buttons_len = btlen; + xi2event->detail = detail; + xi2event->time = currentTime.milliseconds; + xi2event->deviceid = dev->id; + xi2event->sourceid = dev->id; /* a device doesn't change focus by itself */ + xi2event->mode = mode; + xi2event->root_x = FP1616(mouse->spriteInfo->sprite->hot.x, 0); + xi2event->root_y = FP1616(mouse->spriteInfo->sprite->hot.y, 0); + + for (i = 0; mouse && mouse->button && i < mouse->button->numButtons; i++) + if (BitIsOn(mouse->button->down, i)) + SetBit(&xi2event[1], mouse->button->map[i]); + + if (dev->key) { + xi2event->mods.base_mods = dev->key->xkbInfo->state.base_mods; + xi2event->mods.latched_mods = dev->key->xkbInfo->state.latched_mods; + xi2event->mods.locked_mods = dev->key->xkbInfo->state.locked_mods; + xi2event->mods.effective_mods = dev->key->xkbInfo->state.mods; + + xi2event->group.base_group = dev->key->xkbInfo->state.base_group; + xi2event->group.latched_group = dev->key->xkbInfo->state.latched_group; + xi2event->group.locked_group = dev->key->xkbInfo->state.locked_group; + xi2event->group.effective_group = dev->key->xkbInfo->state.group; + } + + FixUpEventFromWindow(dev->spriteInfo->sprite, (xEvent *) xi2event, pWin, + None, FALSE); + + DeliverEventsToWindow(dev, pWin, (xEvent *) xi2event, 1, + GetEventFilter(dev, (xEvent *) xi2event), NullGrab); + + free(xi2event); + + /* XI 1.x event */ + event.deviceid = dev->id; + event.mode = mode; + event.type = (type == XI_FocusIn) ? DeviceFocusIn : DeviceFocusOut; + event.detail = detail; + event.window = pWin->drawable.id; + event.time = currentTime.milliseconds; + + DeliverEventsToWindow(dev, pWin, (xEvent *) &event, 1, + DeviceFocusChangeMask, NullGrab); + + if (event.type == DeviceFocusIn) + DeliverStateNotifyEvent(dev, pWin); +} + /** * Send focus out events to all windows between 'child' and 'ancestor'. * Events are sent running up the hierarchy. diff --git a/xorg-server/dix/enterleave.h b/xorg-server/dix/enterleave.h index c937c0e7f..a59d05799 100644 --- a/xorg-server/dix/enterleave.h +++ b/xorg-server/dix/enterleave.h @@ -52,6 +52,11 @@ extern void DeviceEnterLeaveEvent(DeviceIntPtr mouse, int type, int mode, int detail, WindowPtr pWin, Window child); +extern void DeviceFocusEvent(DeviceIntPtr dev, + int type, + int mode, + int detail , + WindowPtr pWin); extern void EnterWindow(DeviceIntPtr dev, WindowPtr win, int mode); diff --git a/xorg-server/dix/getevents.c b/xorg-server/dix/getevents.c index c960d4467..ae4112ffc 100644 --- a/xorg-server/dix/getevents.c +++ b/xorg-server/dix/getevents.c @@ -1166,16 +1166,33 @@ static void transformAbsolute(DeviceIntPtr dev, ValuatorMask *mask) { double x, y, ox, oy; + int has_x, has_y; + + has_x = valuator_mask_fetch_double(mask, 0, &ox); + has_y = valuator_mask_fetch_double(mask, 1, &oy); + + if (!has_x && !has_y) + return; + + if (!has_x || !has_y) { + struct pixman_f_transform invert; + + /* undo transformation from last event */ + ox = dev->last.valuators[0]; + oy = dev->last.valuators[1]; + + pixman_f_transform_invert(&invert, &dev->transform); + transform(&invert, &ox, &oy); + + x = ox; + y = oy; + } if (valuator_mask_isset(mask, 0)) ox = x = valuator_mask_get_double(mask, 0); - else - ox = x = dev->last.valuators[0]; if (valuator_mask_isset(mask, 1)) oy = y = valuator_mask_get_double(mask, 1); - else - oy = y = dev->last.valuators[1]; transform(&dev->transform, &x, &y); diff --git a/xorg-server/dix/ptrveloc.c b/xorg-server/dix/ptrveloc.c index a788575ca..338f415c5 100644 --- a/xorg-server/dix/ptrveloc.c +++ b/xorg-server/dix/ptrveloc.c @@ -788,7 +788,8 @@ ComputeAcceleration(DeviceIntPtr dev, result += 4.0f * BasicComputeAcceleration(dev, vel, (vel->last_velocity + - vel->velocity) / 2, threshold, + vel->velocity) / 2, + threshold, acc); result /= 6.0f; DebugAccelF("(dix ptracc) profile average [%.2f ... %.2f] is %.3f\n", diff --git a/xorg-server/hw/xquartz/X11Application.m b/xorg-server/hw/xquartz/X11Application.m index 0c3283ed0..1f9b05dd1 100644 --- a/xorg-server/hw/xquartz/X11Application.m +++ b/xorg-server/hw/xquartz/X11Application.m @@ -1329,6 +1329,11 @@ untrusted_str(NSEvent *e) } #endif +extern void +darwinEvents_lock(void); +extern void +darwinEvents_unlock(void); + - (void) sendX11NSEvent:(NSEvent *)e { NSPoint location = NSZeroPoint; @@ -1341,18 +1346,15 @@ untrusted_str(NSEvent *e) int modifierFlags; BOOL isMouseOrTabletEvent, isTabletEvent; -#ifdef HAVE_LIBDISPATCH - static dispatch_once_t once_pred; - dispatch_once(&once_pred, ^{ - tilt = NSZeroPoint; - darwinTabletCurrent = darwinTabletStylus; - }); -#else if (!darwinTabletCurrent) { + /* Ensure that the event system is initialized */ + darwinEvents_lock(); + darwinEvents_unlock(); + assert(darwinTabletStylus); + tilt = NSZeroPoint; darwinTabletCurrent = darwinTabletStylus; } -#endif isMouseOrTabletEvent = [e type] == NSLeftMouseDown || [e type] == NSOtherMouseDown || @@ -1641,6 +1643,11 @@ handle_mouse: case NSScrollWheel: { +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1050 + float deltaX = [e deltaX]; + float deltaY = [e deltaY]; + BOOL isContinuous = NO; +#else CGFloat deltaX = [e deltaX]; CGFloat deltaY = [e deltaY]; CGEventRef cge = [e CGEvent]; @@ -1662,6 +1669,7 @@ handle_mouse: deltaY *= lineHeight / 5.0; } #endif +#endif #if !defined(XPLUGIN_VERSION) || XPLUGIN_VERSION == 0 /* If we're in the background, we need to send a MotionNotify event diff --git a/xorg-server/hw/xquartz/console_redirect.c b/xorg-server/hw/xquartz/console_redirect.c index 1e0e56bad..91d693b67 100644 --- a/xorg-server/hw/xquartz/console_redirect.c +++ b/xorg-server/hw/xquartz/console_redirect.c @@ -310,6 +310,20 @@ xq_asl_init(void) atexit(redirect_atexit); } +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050 +#define fls(v) xq_fls(v) + +static inline int fls(int value) { + unsigned int b, v; + + v = *((unsigned int *)&value); + + for(b=0 ; v ; v >>= 1 , b++); + + return b; +} +#endif + int xq_asl_log_fd(aslclient asl, aslmsg msg, int level, int fd) { diff --git a/xorg-server/hw/xquartz/quartz.c b/xorg-server/hw/xquartz/quartz.c index ebaa56785..62a2852b7 100644 --- a/xorg-server/hw/xquartz/quartz.c +++ b/xorg-server/hw/xquartz/quartz.c @@ -69,6 +69,12 @@ #include <rootlessCommon.h> #include <Xplugin.h> +/* Work around a bug on Leopard's headers */ +#if defined (__LP64__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 && MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +extern OSErr UpdateSystemActivity(UInt8 activity); +#define OverallAct 0 +#endif + DevPrivateKeyRec quartzScreenKeyRec; int aquaMenuBarHeight = 0; QuartzModeProcsPtr quartzProcs = NULL; diff --git a/xorg-server/include/exevents.h b/xorg-server/include/exevents.h index feea170d2..321fc422d 100644 --- a/xorg-server/include/exevents.h +++ b/xorg-server/include/exevents.h @@ -162,13 +162,6 @@ extern void ProcessOtherEvent(InternalEvent * /* ev */ , DeviceIntPtr /* other */ ); -extern void - DeviceFocusEvent(DeviceIntPtr /* dev */ , - int /* type */ , - int /* mode */ , - int /* detail */ , - WindowPtr /* pWin */ ); - extern int CheckGrabValues(ClientPtr /* client */ , GrabParameters * /* param */ ); diff --git a/xorg-server/include/globals.h b/xorg-server/include/globals.h index d147df90f..8076955a9 100644 --- a/xorg-server/include/globals.h +++ b/xorg-server/include/globals.h @@ -104,6 +104,10 @@ extern _X_EXPORT Bool noXFixesExtension; extern _X_EXPORT Bool noPanoramiXExtension; #endif +#ifdef INXQUARTZ +extern _X_EXPORT Bool noPseudoramiXExtension; +#endif + #ifdef XSELINUX extern _X_EXPORT Bool noSELinuxExtension; diff --git a/xorg-server/include/ptrveloc.h b/xorg-server/include/ptrveloc.h index 8778646f5..3bd982a90 100644 --- a/xorg-server/include/ptrveloc.h +++ b/xorg-server/include/ptrveloc.h @@ -101,48 +101,43 @@ typedef struct _PredictableAccelSchemeRec { } PredictableAccelSchemeRec, *PredictableAccelSchemePtr; extern _X_EXPORT void - InitVelocityData(DeviceVelocityPtr vel); +InitVelocityData(DeviceVelocityPtr vel); extern _X_EXPORT void - InitTrackers(DeviceVelocityPtr vel, int ntracker); +InitTrackers(DeviceVelocityPtr vel, int ntracker); extern _X_EXPORT BOOL ProcessVelocityData2D(DeviceVelocityPtr vel, double dx, double dy, int time); extern _X_EXPORT double - BasicComputeAcceleration(DeviceIntPtr dev, DeviceVelocityPtr vel, double velocity, double threshold, double acc); extern _X_EXPORT void - FreeVelocityData(DeviceVelocityPtr vel); +FreeVelocityData(DeviceVelocityPtr vel); extern _X_EXPORT int - SetAccelerationProfile(DeviceVelocityPtr vel, int profile_num); +SetAccelerationProfile(DeviceVelocityPtr vel, int profile_num); extern _X_EXPORT DeviceVelocityPtr GetDevicePredictableAccelData(DeviceIntPtr dev); extern _X_EXPORT void - SetDeviceSpecificAccelerationProfile(DeviceVelocityPtr vel, PointerAccelerationProfileFunc profile); extern _X_INTERNAL void - AccelerationDefaultCleanup(DeviceIntPtr dev); +AccelerationDefaultCleanup(DeviceIntPtr dev); extern _X_INTERNAL Bool - InitPredictableAccelerationScheme(DeviceIntPtr dev, struct _ValuatorAccelerationRec *protoScheme); extern _X_INTERNAL void - acceleratePointerPredictable(DeviceIntPtr dev, ValuatorMask *val, CARD32 evtime); extern _X_INTERNAL void - acceleratePointerLightweight(DeviceIntPtr dev, ValuatorMask *val, CARD32 evtime); diff --git a/xorg-server/include/xkbsrv.h b/xorg-server/include/xkbsrv.h index 3b72885bd..a19c8fb29 100644 --- a/xorg-server/include/xkbsrv.h +++ b/xorg-server/include/xkbsrv.h @@ -305,9 +305,6 @@ extern _X_EXPORT CARD32 xkbDebugFlags; #define _XkbErrCode3(a,b,c) _XkbErrCode2(a,(((unsigned int)(b))<<16)|(c)) #define _XkbErrCode4(a,b,c,d) _XkbErrCode3(a,b,((((unsigned int)(c))<<8)|(d))) -extern _X_EXPORT int DeviceKeyPress, DeviceKeyRelease, DeviceMotionNotify; -extern _X_EXPORT int DeviceButtonPress, DeviceButtonRelease; - #define Status int extern _X_EXPORT void XkbUseMsg(void diff --git a/xorg-server/test/xi2/protocol-common.h b/xorg-server/test/xi2/protocol-common.h index 04a1e8990..f27f248c6 100644 --- a/xorg-server/test/xi2/protocol-common.h +++ b/xorg-server/test/xi2/protocol-common.h @@ -33,8 +33,6 @@ #ifndef PROTOCOL_COMMON_H #define PROTOCOL_COMMON_H -extern int BadDevice; - /* Check default values in a reply */ #define reply_check_defaults(rep, len, type) \ { \ @@ -83,7 +81,7 @@ struct devices { int num_devices; int num_master_devices; -} devices; +}; /** * The set of default devices available in all tests if necessary. diff --git a/xorg-server/test/xi2/protocol-xipassivegrabdevice.c b/xorg-server/test/xi2/protocol-xipassivegrabdevice.c index 53c65bda6..84b386bf3 100644 --- a/xorg-server/test/xi2/protocol-xipassivegrabdevice.c +++ b/xorg-server/test/xi2/protocol-xipassivegrabdevice.c @@ -37,6 +37,7 @@ #include "scrnintstr.h" #include "xipassivegrab.h" #include "exevents.h" +#include "exglobals.h" #include "protocol-common.h" @@ -54,7 +55,7 @@ int __wrap_GrabButton(ClientPtr client, DeviceIntPtr dev, GrabParameters *param, enum InputLevel grabtype, GrabMask *mask); static void reply_XIPassiveGrabDevice_data(ClientPtr client, int len, - char *data, void *userdata); + char *data, void *closure); int __wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access) @@ -85,7 +86,7 @@ __wrap_GrabButton(ClientPtr client, DeviceIntPtr dev, } static void -reply_XIPassiveGrabDevice(ClientPtr client, int len, char *data, void *userdata) +reply_XIPassiveGrabDevice(ClientPtr client, int len, char *data, void *closure) { xXIPassiveGrabDeviceReply *rep = (xXIPassiveGrabDeviceReply *) data; @@ -107,7 +108,7 @@ reply_XIPassiveGrabDevice(ClientPtr client, int len, char *data, void *userdata) static void reply_XIPassiveGrabDevice_data(ClientPtr client, int len, char *data, - void *userdata) + void *closure) { int i; diff --git a/xorg-server/test/xi2/protocol-xiquerydevice.c b/xorg-server/test/xi2/protocol-xiquerydevice.c index 5e59e8084..9d13bbb6f 100644 --- a/xorg-server/test/xi2/protocol-xiquerydevice.c +++ b/xorg-server/test/xi2/protocol-xiquerydevice.c @@ -32,6 +32,7 @@ #include <X11/Xatom.h> #include "inputstr.h" #include "extinit.h" +#include "exglobals.h" #include "scrnintstr.h" #include "xkbsrv.h" @@ -54,9 +55,9 @@ struct test_data { }; static void reply_XIQueryDevice_data(ClientPtr client, int len, char *data, - void *userdata); + void *closure); static void reply_XIQueryDevice(ClientPtr client, int len, char *data, - void *userdata); + void *closure); /* reply handling for the first bytes that constitute the reply */ static void @@ -86,10 +87,10 @@ reply_XIQueryDevice(ClientPtr client, int len, char *data, void *userdata) /* reply handling for the trailing bytes that constitute the device info */ static void -reply_XIQueryDevice_data(ClientPtr client, int len, char *data, void *userdata) +reply_XIQueryDevice_data(ClientPtr client, int len, char *data, void *closure) { int i, j; - struct test_data *querydata = (struct test_data *) userdata; + struct test_data *querydata = (struct test_data *) closure; DeviceIntPtr dev; xXIDeviceInfo *info = (xXIDeviceInfo *) data; @@ -222,7 +223,7 @@ reply_XIQueryDevice_data(ClientPtr client, int len, char *data, void *userdata) any->type == XIValuatorClass); if (any->type == XIButtonClass) { - int len; + int l; xXIButtonInfo *bi = (xXIButtonInfo *) any; if (client->swapped) @@ -230,10 +231,9 @@ reply_XIQueryDevice_data(ClientPtr client, int len, char *data, void *userdata) assert(bi->num_buttons == devices.vcp->button->numButtons); - len = - 2 + bi->num_buttons + + l = 2 + bi->num_buttons + bytes_to_int32(bits_to_bytes(bi->num_buttons)); - assert(bi->length == len); + assert(bi->length == l); } else if (any->type == XIValuatorClass) { xXIValuatorInfo *vi = (xXIValuatorInfo *) any; diff --git a/xorg-server/test/xi2/protocol-xiquerypointer.c b/xorg-server/test/xi2/protocol-xiquerypointer.c index 4756a6b2e..fc66b6429 100644 --- a/xorg-server/test/xi2/protocol-xiquerypointer.c +++ b/xorg-server/test/xi2/protocol-xiquerypointer.c @@ -37,12 +37,13 @@ #include "scrnintstr.h" #include "xiquerypointer.h" #include "exevents.h" +#include "exglobals.h" #include "protocol-common.h" static ClientRec client_request; static void reply_XIQueryPointer_data(ClientPtr client, int len, - char *data, void *userdata); + char *data, void *closure); static struct { DeviceIntPtr dev; @@ -70,7 +71,7 @@ __wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access) } static void -reply_XIQueryPointer(ClientPtr client, int len, char *data, void *userdata) +reply_XIQueryPointer(ClientPtr client, int len, char *data, void *closure) { xXIQueryPointerReply *rep = (xXIQueryPointerReply *) data; SpritePtr sprite; @@ -121,7 +122,7 @@ reply_XIQueryPointer(ClientPtr client, int len, char *data, void *userdata) } static void -reply_XIQueryPointer_data(ClientPtr client, int len, char *data, void *userdata) +reply_XIQueryPointer_data(ClientPtr client, int len, char *data, void *closure) { reply_handler = reply_XIQueryPointer; } diff --git a/xorg-server/test/xi2/protocol-xiqueryversion.c b/xorg-server/test/xi2/protocol-xiqueryversion.c index 1347e866c..aff023754 100644 --- a/xorg-server/test/xi2/protocol-xiqueryversion.c +++ b/xorg-server/test/xi2/protocol-xiqueryversion.c @@ -59,10 +59,10 @@ struct test_data { }; static void -reply_XIQueryVersion(ClientPtr client, int len, char *data, void *userdata) +reply_XIQueryVersion(ClientPtr client, int len, char *data, void *closure) { xXIQueryVersionReply *rep = (xXIQueryVersionReply *) data; - struct test_data *versions = (struct test_data *) userdata; + struct test_data *versions = (struct test_data *) closure; unsigned int sver, cver, ver; if (client->swapped) { @@ -85,10 +85,10 @@ reply_XIQueryVersion(ClientPtr client, int len, char *data, void *userdata) } static void -reply_XIQueryVersion_multiple(ClientPtr client, int len, char *data, void *userdata) +reply_XIQueryVersion_multiple(ClientPtr client, int len, char *data, void *closure) { xXIQueryVersionReply *rep = (xXIQueryVersionReply *) data; - struct test_data *versions = (struct test_data *) userdata; + struct test_data *versions = (struct test_data *) closure; reply_check_defaults(rep, len, XIQueryVersion); assert(rep->length == 0); diff --git a/xorg-server/test/xi2/protocol-xiselectevents.c b/xorg-server/test/xi2/protocol-xiselectevents.c index 4daba8775..8f6b947d4 100644 --- a/xorg-server/test/xi2/protocol-xiselectevents.c +++ b/xorg-server/test/xi2/protocol-xiselectevents.c @@ -55,6 +55,7 @@ #include "windowstr.h" #include "extinit.h" /* for XInputExtensionInit */ #include "scrnintstr.h" +#include "exglobals.h" #include "xiselectev.h" #include "protocol-common.h" diff --git a/xorg-server/test/xi2/protocol-xisetclientpointer.c b/xorg-server/test/xi2/protocol-xisetclientpointer.c index 51db4ac69..90f1b94c3 100644 --- a/xorg-server/test/xi2/protocol-xisetclientpointer.c +++ b/xorg-server/test/xi2/protocol-xisetclientpointer.c @@ -44,6 +44,7 @@ #include "scrnintstr.h" #include "xisetclientpointer.h" #include "exevents.h" +#include "exglobals.h" #include "protocol-common.h" diff --git a/xorg-server/test/xi2/protocol-xiwarppointer.c b/xorg-server/test/xi2/protocol-xiwarppointer.c index c279ac413..4bea333c3 100644 --- a/xorg-server/test/xi2/protocol-xiwarppointer.c +++ b/xorg-server/test/xi2/protocol-xiwarppointer.c @@ -37,6 +37,7 @@ #include "scrnintstr.h" #include "xiwarppointer.h" #include "exevents.h" +#include "exglobals.h" #include "protocol-common.h" diff --git a/xorg-server/xkeyboard-config/symbols/fr b/xorg-server/xkeyboard-config/symbols/fr index 85bcd5564..45ef6a475 100644 --- a/xorg-server/xkeyboard-config/symbols/fr +++ b/xorg-server/xkeyboard-config/symbols/fr @@ -48,13 +48,17 @@ xkb_symbols "olpc" { name[Group1]="French"; - key <AD02> { [ z, Z, VoidSymbol, guillemotleft ] }; - - key <AC02> { [ s, S, VoidSymbol, ssharp ] }; - - key <AB02> { [ x, X, VoidSymbol, guillemotright ] }; - - key <I219> { [ less, greater ] }; + key <I219> { [ less, greater ] }; + key <AD11> { [ dead_circumflex, dead_diaeresis, notsign, dead_abovering ] }; + key <AB08> { [ semicolon, period, underscore, multiply ] }; + key <TLDE> { [ twosuperior, asciitilde, VoidSymbol, VoidSymbol ] }; + + // Some keys only have the Shift+AltGr character printed on them (alongside + // the unmodified one). Make such keys shift-invariant so that the printed + // value is achieved by pressing AltGr or Shift+AltGr. + key <AB02> { [ x, X, guillemotright, guillemotright ] }; + key <AC02> { [ s, S, ssharp, ssharp ] }; + key <AD02> { [ z, Z, guillemotleft, guillemotleft ] }; }; partial alphanumeric_keys |