diff options
author | marha <marha@users.sourceforge.net> | 2012-05-21 09:28:15 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-05-21 09:28:15 +0200 |
commit | d4b066581bc9a4bf7b0a5ffa11ff0adb47d2075c (patch) | |
tree | db56fe01d61a824e4bd975cbf8603b11e9c5ecdf /xorg-server/Xi | |
parent | d2dacc6bc44f7dc245dee6e66723013afb49cfb5 (diff) | |
parent | f543ceaca6820260f15a4eff86938214cf43c7d2 (diff) | |
download | vcxsrv-d4b066581bc9a4bf7b0a5ffa11ff0adb47d2075c.tar.gz vcxsrv-d4b066581bc9a4bf7b0a5ffa11ff0adb47d2075c.tar.bz2 vcxsrv-d4b066581bc9a4bf7b0a5ffa11ff0adb47d2075c.zip |
Merge remote-tracking branch 'origin/released'
Diffstat (limited to 'xorg-server/Xi')
-rw-r--r-- | xorg-server/Xi/exevents.c | 270 | ||||
-rw-r--r-- | xorg-server/Xi/extinit.c | 7 | ||||
-rw-r--r-- | xorg-server/Xi/xiproperty.c | 2 | ||||
-rw-r--r-- | xorg-server/Xi/xiselectev.c | 8 |
4 files changed, 17 insertions, 270 deletions
diff --git a/xorg-server/Xi/exevents.c b/xorg-server/Xi/exevents.c index f11e09f38..99224088e 100644 --- a/xorg-server/Xi/exevents.c +++ b/xorg-server/Xi/exevents.c @@ -271,8 +271,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; @@ -303,8 +301,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; @@ -336,8 +332,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; @@ -371,8 +365,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; @@ -419,8 +411,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; @@ -439,8 +429,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; @@ -496,8 +484,6 @@ DeepCopyKeyboardClasses(DeviceIntPtr from, DeviceIntPtr to) } } else if (to->focus) { - ClassesPtr classes; - classes = to->unused_classes; classes->focus = to->focus; to->focus = NULL; @@ -538,8 +524,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; @@ -566,8 +550,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; @@ -603,8 +585,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; @@ -626,8 +606,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; @@ -1463,9 +1441,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) @@ -1496,7 +1474,7 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, * the event. */ if (!devgrab && dev->deviceGrab.grab && dev->deviceGrab.implicitGrab) { - TouchListener *listener; + TouchListener *l; devgrab = dev->deviceGrab.grab; @@ -1506,13 +1484,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; } } @@ -2118,240 +2096,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; } } |