diff options
author | marha <marha@users.sourceforge.net> | 2011-12-16 20:49:54 +0100 |
---|---|---|
committer | Marc Haesen <marc@hc-consult.be> | 2011-12-16 20:46:08 +0100 |
commit | 1ae4005bfe3690b34ec40e33918b3e24468d47e1 (patch) | |
tree | 451bee4796d3058f90af4e66f2cfbdfbe6c77bfe /xorg-server/Xi | |
parent | 64718ba8bdcecd8d736a48239847b1f9aadd40ea (diff) | |
parent | 47913e82955ec8e2b1ba4d4b145497dede9163b5 (diff) | |
download | vcxsrv-1ae4005bfe3690b34ec40e33918b3e24468d47e1.tar.gz vcxsrv-1ae4005bfe3690b34ec40e33918b3e24468d47e1.tar.bz2 vcxsrv-1ae4005bfe3690b34ec40e33918b3e24468d47e1.zip |
Merge remote-tracking branch 'origin/released'
Conflicts:
xorg-server/dix/dispatch.c
xorg-server/dix/registry.c
xorg-server/include/resource.h
xorg-server/os/access.c
xorg-server/os/auth.c
Diffstat (limited to 'xorg-server/Xi')
-rw-r--r-- | xorg-server/Xi/exevents.c | 147 | ||||
-rw-r--r-- | xorg-server/Xi/grabdev.c | 2 | ||||
-rw-r--r-- | xorg-server/Xi/grabdevb.c | 4 | ||||
-rw-r--r-- | xorg-server/Xi/grabdevk.c | 4 | ||||
-rw-r--r-- | xorg-server/Xi/ungrdev.c | 2 | ||||
-rw-r--r-- | xorg-server/Xi/ungrdevb.c | 2 | ||||
-rw-r--r-- | xorg-server/Xi/ungrdevk.c | 2 | ||||
-rw-r--r-- | xorg-server/Xi/xigrabdev.c | 4 | ||||
-rw-r--r-- | xorg-server/Xi/xipassivegrab.c | 8 |
9 files changed, 88 insertions, 87 deletions
diff --git a/xorg-server/Xi/exevents.c b/xorg-server/Xi/exevents.c index 1fa030a92..1c8633a8f 100644 --- a/xorg-server/Xi/exevents.c +++ b/xorg-server/Xi/exevents.c @@ -706,6 +706,55 @@ ChangeMasterDeviceClasses(DeviceIntPtr device, DeviceChangedEvent *dce) } /** + * Add state and motionMask to the filter for this event. The protocol + * supports some extra masks for motion when a button is down: + * ButtonXMotionMask and the DeviceButtonMotionMask to trigger only when at + * least one button (or that specific button is down). These masks need to + * be added to the filters for core/XI motion events. + * + * @param device The device to update the mask for + * @param state The current button state mask + * @param motion_mask The motion mask (DeviceButtonMotionMask or 0) + */ +static void +UpdateDeviceMotionMask(DeviceIntPtr device, unsigned short state, + Mask motion_mask) +{ + Mask mask; + + mask = DevicePointerMotionMask | state | motion_mask; + SetMaskForEvent(device->id, mask, DeviceMotionNotify); + mask = PointerMotionMask | state | motion_mask; + SetMaskForEvent(device->id, mask, MotionNotify); +} + +static void +IncreaseButtonCount(DeviceIntPtr dev, int key, CARD8 *buttons_down, + Mask *motion_mask, unsigned short *state) +{ + if (dev->valuator) + dev->valuator->motionHintWindow = NullWindow; + + (*buttons_down)++; + *motion_mask = DeviceButtonMotionMask; + if (dev->button->map[key] <= 5) + *state |= (Button1Mask >> 1) << dev->button->map[key]; +} + +static void +DecreaseButtonCount(DeviceIntPtr dev, int key, CARD8 *buttons_down, + Mask *motion_mask, unsigned short *state) +{ + if (dev->valuator) + dev->valuator->motionHintWindow = NullWindow; + + if (*buttons_down >= 1 && !--(*buttons_down)) + *motion_mask = 0; + if (dev->button->map[key] <= 5) + *state &= ~((Button1Mask >> 1) << dev->button->map[key]); +} + +/** * Update the device state according to the data in the event. * * return values are @@ -803,7 +852,6 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event) device->valuator->motionHintWindow = NullWindow; set_key_up(device, key, KEY_PROCESSED); } else if (event->type == ET_ButtonPress) { - Mask mask; if (!b) return DONT_PROCESS; @@ -811,22 +859,13 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event) return DONT_PROCESS; set_button_down(device, key, BUTTON_PROCESSED); - if (device->valuator) - device->valuator->motionHintWindow = NullWindow; + if (!b->map[key]) return DONT_PROCESS; - b->buttonsDown++; - b->motionMask = DeviceButtonMotionMask; - if (b->map[key] <= 5) - b->state |= (Button1Mask >> 1) << b->map[key]; - - /* Add state and motionMask to the filter for this event */ - mask = DevicePointerMotionMask | b->state | b->motionMask; - SetMaskForEvent(device->id, mask, DeviceMotionNotify); - mask = PointerMotionMask | b->state | b->motionMask; - SetMaskForEvent(device->id, mask, MotionNotify); + + IncreaseButtonCount(device, key, &b->buttonsDown, &b->motionMask, &b->state); + UpdateDeviceMotionMask(device, b->state, b->motionMask); } else if (event->type == ET_ButtonRelease) { - Mask mask; if (!b) return DONT_PROCESS; @@ -852,20 +891,11 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event) } } set_button_up(device, key, BUTTON_PROCESSED); - if (device->valuator) - device->valuator->motionHintWindow = NullWindow; if (!b->map[key]) return DONT_PROCESS; - if (b->buttonsDown >= 1 && !--b->buttonsDown) - b->motionMask = 0; - if (b->map[key] <= 5) - b->state &= ~((Button1Mask >> 1) << b->map[key]); - - /* Add state and motionMask to the filter for this event */ - mask = DevicePointerMotionMask | b->state | b->motionMask; - SetMaskForEvent(device->id, mask, DeviceMotionNotify); - mask = PointerMotionMask | b->state | b->motionMask; - SetMaskForEvent(device->id, mask, MotionNotify); + + DecreaseButtonCount(device, key, &b->buttonsDown, &b->motionMask, &b->state); + UpdateDeviceMotionMask(device, b->state, b->motionMask); } else if (event->type == ET_ProximityIn) device->proximity->in_proximity = TRUE; else if (event->type == ET_ProximityOut) @@ -887,7 +917,7 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device) int key = 0, rootX, rootY; ButtonClassPtr b; int ret = 0; - int corestate, i; + int corestate; DeviceIntPtr mouse = NULL, kbd = NULL; DeviceEvent *event = &ev->device_event; @@ -917,33 +947,8 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device) mouse = NULL; } - /* core state needs to be assembled BEFORE the device is updated. */ - corestate = (kbd && kbd->key) ? XkbStateFieldFromRec(&kbd->key->xkbInfo->state) : 0; - corestate |= (mouse && mouse->button) ? (mouse->button->state) : 0; - - for (i = 0; mouse && mouse->button && i < mouse->button->numButtons; i++) - if (BitIsOn(mouse->button->down, i)) - SetBit(event->buttons, i); - - if (kbd && kbd->key) - { - XkbStatePtr state; - /* we need the state before the event happens */ - if (event->type == ET_KeyPress || event->type == ET_KeyRelease) - state = &kbd->key->xkbInfo->prev_state; - else - state = &kbd->key->xkbInfo->state; - - event->mods.base = state->base_mods; - event->mods.latched = state->latched_mods; - event->mods.locked = state->locked_mods; - event->mods.effective = state->mods; - - event->group.base = state->base_group; - event->group.latched = state->latched_group; - event->group.locked = state->locked_group; - event->group.effective = state->group; - } + corestate = event_get_corestate(mouse, kbd); + event_set_state(mouse, kbd, event); ret = UpdateDeviceState(device, event); if (ret == DONT_PROCESS) @@ -1000,9 +1005,7 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device) case ET_KeyRelease: if (grab && device->deviceGrab.fromPassiveGrab && (key == device->deviceGrab.activatingKey) && - (device->deviceGrab.grab->type == KeyPress || - device->deviceGrab.grab->type == DeviceKeyPress || - device->deviceGrab.grab->type == XI_KeyPress)) + GrabIsKeyboardGrab(device->deviceGrab.grab)) deactivateDeviceGrab = TRUE; break; case ET_ButtonPress: @@ -1022,9 +1025,7 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device) event->detail.button = b->map[key]; if (grab && !b->buttonsDown && device->deviceGrab.fromPassiveGrab && - (device->deviceGrab.grab->type == ButtonPress || - device->deviceGrab.grab->type == DeviceButtonPress || - device->deviceGrab.grab->type == XI_ButtonPress)) + GrabIsPointerGrab(device->deviceGrab.grab)) deactivateDeviceGrab = TRUE; default: break; @@ -1392,9 +1393,9 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail, int CheckGrabValues(ClientPtr client, GrabParameters* param) { - if (param->grabtype != GRABTYPE_CORE && - param->grabtype != GRABTYPE_XI && - param->grabtype != GRABTYPE_XI2) + if (param->grabtype != CORE && + param->grabtype != XI && + param->grabtype != XI2) { ErrorF("[Xi] grabtype is invalid. This is a bug.\n"); return BadImplementation; @@ -1411,7 +1412,7 @@ CheckGrabValues(ClientPtr client, GrabParameters* param) return BadValue; } - if (param->grabtype != GRABTYPE_XI2 && (param->modifiers != AnyModifier) && + if (param->grabtype != XI2 && (param->modifiers != AnyModifier) && (param->modifiers & ~AllModifiersMask)) { client->errorValue = param->modifiers; return BadValue; @@ -1426,7 +1427,7 @@ CheckGrabValues(ClientPtr client, GrabParameters* param) int GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device, - int button, GrabParameters *param, GrabType grabtype, + int button, GrabParameters *param, enum InputLevel grabtype, GrabMask *mask) { WindowPtr pWin, confineTo; @@ -1466,9 +1467,9 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device, if (rc != Success) return rc; - if (grabtype == GRABTYPE_XI) + if (grabtype == XI) type = DeviceButtonPress; - else if (grabtype == GRABTYPE_XI2) + else if (grabtype == XI2) type = XI_ButtonPress; grab = CreateGrab(client->index, dev, modifier_device, pWin, grabtype, @@ -1479,12 +1480,12 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device, } /** - * Grab the given key. If grabtype is GRABTYPE_XI, the key is a keycode. If - * grabtype is GRABTYPE_XI2, the key is a keysym. + * Grab the given key. If grabtype is XI, the key is a keycode. If + * grabtype is XI2, the key is a keysym. */ int GrabKey(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device, - int key, GrabParameters *param, GrabType grabtype, GrabMask *mask) + int key, GrabParameters *param, enum InputLevel grabtype, GrabMask *mask) { WindowPtr pWin; GrabPtr grab; @@ -1497,7 +1498,7 @@ GrabKey(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device, return rc; if ((dev->id != XIAllDevices && dev->id != XIAllMasterDevices) && k == NULL) return BadMatch; - if (grabtype == GRABTYPE_XI) + if (grabtype == XI) { if ((key > k->xkbInfo->desc->max_key_code || key < k->xkbInfo->desc->min_key_code) @@ -1506,7 +1507,7 @@ GrabKey(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device, return BadValue; } type = DeviceKeyPress; - } else if (grabtype == GRABTYPE_XI2) + } else if (grabtype == XI2) type = XI_KeyPress; rc = dixLookupWindow(&pWin, param->grabWindow, client, DixSetAttrAccess); @@ -1561,7 +1562,7 @@ GrabWindow(ClientPtr client, DeviceIntPtr dev, int type, if (rc != Success) return rc; - grab = CreateGrab(client->index, dev, dev, pWin, GRABTYPE_XI2, + grab = CreateGrab(client->index, dev, dev, pWin, XI2, mask, param, (type == XIGrabtypeEnter) ? XI_Enter : XI_FocusIn, 0, NULL, cursor); diff --git a/xorg-server/Xi/grabdev.c b/xorg-server/Xi/grabdev.c index 4572c33fc..8fd114e60 100644 --- a/xorg-server/Xi/grabdev.c +++ b/xorg-server/Xi/grabdev.c @@ -130,7 +130,7 @@ ProcXGrabDevice(ClientPtr client) rc = GrabDevice(client, dev, stuff->other_devices_mode, stuff->this_device_mode, stuff->grabWindow, stuff->ownerEvents, stuff->time, - &mask, GRABTYPE_XI, None, None, + &mask, XI, None, None, &rep.status); if (rc != Success) diff --git a/xorg-server/Xi/grabdevb.c b/xorg-server/Xi/grabdevb.c index 2897d410b..dda0da8bb 100644 --- a/xorg-server/Xi/grabdevb.c +++ b/xorg-server/Xi/grabdevb.c @@ -137,7 +137,7 @@ ProcXGrabDeviceButton(ClientPtr client) return ret; memset(¶m, 0, sizeof(param)); - param.grabtype = GRABTYPE_XI; + param.grabtype = XI; param.ownerEvents = stuff->ownerEvents; param.this_device_mode = stuff->this_device_mode; param.other_devices_mode = stuff->other_devices_mode; @@ -146,7 +146,7 @@ ProcXGrabDeviceButton(ClientPtr client) mask.xi = tmp[stuff->grabbed_device].mask; ret = GrabButton(client, dev, mdev, stuff->button, ¶m, - GRABTYPE_XI, &mask); + XI, &mask); return ret; } diff --git a/xorg-server/Xi/grabdevk.c b/xorg-server/Xi/grabdevk.c index cedd90d9c..61ab43a20 100644 --- a/xorg-server/Xi/grabdevk.c +++ b/xorg-server/Xi/grabdevk.c @@ -135,7 +135,7 @@ ProcXGrabDeviceKey(ClientPtr client) memset(¶m, 0, sizeof(param)); - param.grabtype = GRABTYPE_XI; + param.grabtype = XI; param.ownerEvents = stuff->ownerEvents; param.this_device_mode = stuff->this_device_mode; param.other_devices_mode = stuff->other_devices_mode; @@ -143,7 +143,7 @@ ProcXGrabDeviceKey(ClientPtr client) param.modifiers = stuff->modifiers; mask.xi = tmp[stuff->grabbed_device].mask; - ret = GrabKey(client, dev, mdev, stuff->key, ¶m, GRABTYPE_XI, &mask); + ret = GrabKey(client, dev, mdev, stuff->key, ¶m, XI, &mask); return ret; } diff --git a/xorg-server/Xi/ungrdev.c b/xorg-server/Xi/ungrdev.c index bc66cfc4b..58c1f57ef 100644 --- a/xorg-server/Xi/ungrdev.c +++ b/xorg-server/Xi/ungrdev.c @@ -102,7 +102,7 @@ ProcXUngrabDevice(ClientPtr client) time = ClientTimeToServerTime(stuff->time); if ((CompareTimeStamps(time, currentTime) != LATER) && (CompareTimeStamps(time, dev->deviceGrab.grabTime) != EARLIER) && - (grab) && SameClient(grab, client) && grab->grabtype == GRABTYPE_XI) + (grab) && SameClient(grab, client) && grab->grabtype == XI) (*dev->deviceGrab.DeactivateGrab) (dev); return Success; } diff --git a/xorg-server/Xi/ungrdevb.c b/xorg-server/Xi/ungrdevb.c index 628024870..0ba395cf3 100644 --- a/xorg-server/Xi/ungrdevb.c +++ b/xorg-server/Xi/ungrdevb.c @@ -134,7 +134,7 @@ ProcXUngrabDeviceButton(ClientPtr client) temporaryGrab->device = dev; temporaryGrab->window = pWin; temporaryGrab->type = DeviceButtonPress; - temporaryGrab->grabtype = GRABTYPE_XI; + temporaryGrab->grabtype = XI; temporaryGrab->modifierDevice = mdev; temporaryGrab->modifiersDetail.exact = stuff->modifiers; temporaryGrab->modifiersDetail.pMask = NULL; diff --git a/xorg-server/Xi/ungrdevk.c b/xorg-server/Xi/ungrdevk.c index b0d83cbbc..8785989b0 100644 --- a/xorg-server/Xi/ungrdevk.c +++ b/xorg-server/Xi/ungrdevk.c @@ -141,7 +141,7 @@ ProcXUngrabDeviceKey(ClientPtr client) temporaryGrab->device = dev; temporaryGrab->window = pWin; temporaryGrab->type = DeviceKeyPress; - temporaryGrab->grabtype = GRABTYPE_XI; + temporaryGrab->grabtype = XI; temporaryGrab->modifierDevice = mdev; temporaryGrab->modifiersDetail.exact = stuff->modifiers; temporaryGrab->modifiersDetail.pMask = NULL; diff --git a/xorg-server/Xi/xigrabdev.c b/xorg-server/Xi/xigrabdev.c index 1cfbf243b..2b3055004 100644 --- a/xorg-server/Xi/xigrabdev.c +++ b/xorg-server/Xi/xigrabdev.c @@ -96,7 +96,7 @@ ProcXIGrabDevice(ClientPtr client) stuff->owner_events, stuff->time, &mask, - GRABTYPE_XI2, + XI2, stuff->cursor, None /* confineTo */, &status); @@ -148,7 +148,7 @@ ProcXIUngrabDevice(ClientPtr client) time = ClientTimeToServerTime(stuff->time); if ((CompareTimeStamps(time, currentTime) != LATER) && (CompareTimeStamps(time, dev->deviceGrab.grabTime) != EARLIER) && - (grab) && SameClient(grab, client) && grab->grabtype == GRABTYPE_XI2) + (grab) && SameClient(grab, client) && grab->grabtype == XI2) (*dev->deviceGrab.DeactivateGrab) (dev); return Success; diff --git a/xorg-server/Xi/xipassivegrab.c b/xorg-server/Xi/xipassivegrab.c index 4860757fc..713a1654e 100644 --- a/xorg-server/Xi/xipassivegrab.c +++ b/xorg-server/Xi/xipassivegrab.c @@ -139,7 +139,7 @@ ProcXIPassiveGrabDevice(ClientPtr client) rep.num_modifiers = 0; memset(¶m, 0, sizeof(param)); - param.grabtype = GRABTYPE_XI2; + param.grabtype = XI2; param.ownerEvents = stuff->owner_events; param.this_device_mode = stuff->grab_mode; param.other_devices_mode = stuff->paired_device_mode; @@ -183,11 +183,11 @@ ProcXIPassiveGrabDevice(ClientPtr client) { case XIGrabtypeButton: status = GrabButton(client, dev, mod_dev, stuff->detail, - ¶m, GRABTYPE_XI2, &mask); + ¶m, XI2, &mask); break; case XIGrabtypeKeycode: status = GrabKey(client, dev, mod_dev, stuff->detail, - ¶m, GRABTYPE_XI2, &mask); + ¶m, XI2, &mask); break; case XIGrabtypeEnter: case XIGrabtypeFocusIn: @@ -313,7 +313,7 @@ ProcXIPassiveUngrabDevice(ClientPtr client) case XIGrabtypeEnter: tempGrab->type = XI_Enter; break; case XIGrabtypeFocusIn: tempGrab->type = XI_FocusIn; break; } - tempGrab->grabtype = GRABTYPE_XI2; + tempGrab->grabtype = XI2; tempGrab->modifierDevice = mod_dev; tempGrab->modifiersDetail.pMask = NULL; tempGrab->detail.exact = stuff->detail; |