aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/dix/inpututils.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-12-16 20:49:54 +0100
committerMarc Haesen <marc@hc-consult.be>2011-12-16 20:46:08 +0100
commit1ae4005bfe3690b34ec40e33918b3e24468d47e1 (patch)
tree451bee4796d3058f90af4e66f2cfbdfbe6c77bfe /xorg-server/dix/inpututils.c
parent64718ba8bdcecd8d736a48239847b1f9aadd40ea (diff)
parent47913e82955ec8e2b1ba4d4b145497dede9163b5 (diff)
downloadvcxsrv-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/dix/inpututils.c')
-rw-r--r--xorg-server/dix/inpututils.c60
1 files changed, 59 insertions, 1 deletions
diff --git a/xorg-server/dix/inpututils.c b/xorg-server/dix/inpututils.c
index 60f9fa0a8..8cd4d5921 100644
--- a/xorg-server/dix/inpututils.c
+++ b/xorg-server/dix/inpututils.c
@@ -626,7 +626,7 @@ void verify_internal_event(const InternalEvent *ev)
if (ev && ev->any.header != ET_Internal)
{
int i;
- unsigned char *data = (unsigned char*)ev;
+ const unsigned char *data = (const unsigned char*)ev;
ErrorF("dix: invalid event type %d\n", ev->any.header);
@@ -657,6 +657,64 @@ void init_device_event(DeviceEvent *event, DeviceIntPtr dev, Time ms)
event->sourceid = dev->id;
}
+int event_get_corestate(DeviceIntPtr mouse, DeviceIntPtr kbd)
+{
+ int corestate;
+ /* 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;
+ return corestate;
+}
+
+void event_set_state(DeviceIntPtr mouse, DeviceIntPtr kbd, DeviceEvent *event)
+{
+ int i;
+
+ 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;
+ }
+}
+
+/**
+ * Return the event filter mask for the given device and the given core or
+ * XI1 protocol type.
+ */
+Mask
+event_get_filter_from_type(DeviceIntPtr dev, int evtype)
+{
+ return event_filters[dev ? dev->id : 0][evtype];
+}
+
+/**
+ * Return the event filter mask for the given device and the given core or
+ * XI2 protocol type.
+ */
+Mask
+event_get_filter_from_xi2type(int evtype)
+{
+ return (1 << (evtype % 8));
+}
+
Bool
point_on_screen(ScreenPtr pScreen, int x, int y)
{