Commit Graph

194 Commits

Author SHA1 Message Date
Peter Hutterer
a88386ee27 Xi: only DeliverFocusedEvents if the event is not a pointer event.
A pointer device may have a focus class, but even if so, pointer events must
be delivered to the sprite window, not the focus window.
2008-04-10 14:42:26 +09:30
Peter Hutterer
4824942527 Xi: dont copy FocusClassRec if the master already has one.
Blindly copying will override the focus setting of the master. If there's XI
applications running, they may set the SD focus, while leaving the
MD's focus as it was. In this case, after a class swap we still want to get
the MD's events to the same window as before.
2008-04-10 14:36:10 +09:30
Peter Hutterer
5a4c6621aa Xi: some extra checks for validity of kbd and mouse.
Floating SDs are paired with themselves, so the paired device may not be a
proper keyboard or mouse. Put some extra checks in to avoid dereferencing a
nullpointer later.
2008-04-10 08:29:05 +09:30
Peter Hutterer
e7211eb0b3 Xi: When attaching, check for ptr -> ptr and keybd -> keybd.
Some pointer devices have key classes (e.g. MS Optical Desktop 2000). The
previous test was performed as Error if ptr -> keybd or keybd -> ptr. This
doesnt work with such devices. New test is Succeed if ptr->ptr or
keybd->keybd.
2008-04-10 08:08:54 +09:30
Peter Hutterer
389dae73cc Xi: If device "to" has a class but "from" doesn't, free the class in "to". 2008-04-09 08:26:00 +09:30
Peter Hutterer
60c38d248c Xi: plug memory leak, free previous motion history before allocating new. 2008-04-09 07:47:34 +09:30
Peter Hutterer
ea05cf0813 Xi: check if source has a key class before copying. 2008-04-08 22:09:11 +09:30
Peter Hutterer
fd06e8f8c1 Merge branch 'master' into dcdc_rework
Conflicts:

	Xext/xevie.c
	dix/dispatch.c
2008-04-07 07:56:41 +09:30
Peter Hutterer
8f38feb3e4 Xi: add comments for DeepCopyDeviceClasses, ChangeMasterDeviceClasses. 2008-04-05 20:37:21 +10:30
Peter Hutterer
d0395a7530 Xi: realloc to->valuator instead of allocing it blindly. 2008-04-04 15:05:26 +10:30
Peter Hutterer
502689847b Xi: ALLOC_COPY_CLASS_IF should only alloc if to->field doesn't exist. 2008-04-04 15:01:53 +10:30
Peter Hutterer
035b1b6995 Xi: remove duplicate copying of kbdfeed and ptrfeed. 2008-04-04 15:00:06 +10:30
Peter Hutterer
52fc7aed18 Xi: only alloc memory for feedback classes if it doesn't already exist. 2008-04-04 14:47:23 +10:30
Peter Hutterer
4eb87c8693 Xi: don't free device classes before copying them.
First commit in a series to come.
2008-04-04 14:20:37 +10:30
Peter Hutterer
8e562fe26f Xi: remove false memset from DeepCopyDeviceClasses.
It's wrong, needs to be different, but I haven't had enough coffee to figure
out what it needs to do yet.
2008-03-05 15:11:41 +10:30
Peter Hutterer
7b4f3616f7 Xi: add deviceid to QueryDevicePointer request.
Why not, we had the padding anyway.
Suggested by Jim Gettys on the X.Org mailing list.
2008-03-04 18:29:15 +10:30
Peter Hutterer
4f2cd0ed96 Merge branch 'master' into mpx
This merge reverts Magnus' device coorindate scaling changes. MPX core event
generation is very different, so we can't scale in GetPointerEvents.

Conflicts:

	Xi/opendev.c
	dix/devices.c
	dix/dixfonts.c
	dix/getevents.c
	dix/resource.c
	dix/window.c
	hw/xfree86/common/xf86Xinput.c
	mi/mipointer.c
	xkb/ddxBeep.c
	xkb/ddxCtrls.c
	xkb/ddxKeyClick.c
	xkb/ddxList.c
	xkb/ddxLoad.c
	xkb/xkb.c
	xkb/xkbAccessX.c
	xkb/xkbEvents.c
	xkb/xkbInit.c
	xkb/xkbPrKeyEv.c
	xkb/xkbUtils.c
2008-03-04 18:11:10 +10:30
Eamon Walsh
27bcf40cda XACE: Fix instances of DixUnknownAccess at hook callsites. 2008-02-28 16:43:43 -05:00
Peter Hutterer
453661a9e1 Xi: swap the control attached to a ChangeDeviceControl request. Bug #14170
Just swapping the request's data isn't enough, we need to swap the actual
control as well.

X.Org Bug 14170 <http://bugs.freedesktop.org/show_bug.cgi?id=14170>
2008-02-28 15:47:26 +10:30
Peter Hutterer
ce9fb2f8c4 Xi: MDs return the paired device's ID in attached field of ListInputDevices. 2008-02-26 13:51:19 +10:30
Peter Hutterer
d61f481a44 Xi: remove GetPairedPointer handling.
obsolete, ListInputDevices provides this information now.
2008-02-25 17:52:45 +10:30
Peter Hutterer
27b2127893 Xi: remove ungrab handling of ExtendedUngrabDevice request.
This can be done by UngrabDevice, no need for separate codepaths.
2008-02-25 17:00:42 +10:30
Peter Hutterer
09a8fc5c7a Xi: make SizeDeviceInfo public and re-use from CreateClassesChangedEvent. 2008-02-18 18:42:46 +10:30
Peter Hutterer
088067c891 Xi: even if ChangeDeviceHierarchy fails, we may need to send an event.
Changes are committed instantly, so if at least one change was successful, we
must send an event to the client, even if subsequent ones fail.
2008-02-18 16:46:07 +10:30
Eamon Walsh
ae43d835bd XACE: Change access modes for some device-related requests.
Opening a device is not really "reading" it.
Requests that globally configure a device should require "manage" access.
2008-02-13 20:20:49 -05:00
Peter Hutterer
921c298c4c Xi: QueryDevicePointer doesn't have a shared field anymore. 2008-02-14 09:48:19 +10:30
Peter Hutterer
b885588756 Xi: remove FakeDeviceData calls. And one leftover from GrabAccessControl.
FakeDeviceData needs more thoughtful integration.
2008-02-14 09:47:31 +10:30
Peter Hutterer
c99a9a9729 Xi: remove raw device events.
Need to be better refined.
2008-02-14 09:43:49 +10:30
Peter Hutterer
b35a9efa16 Xi: Remove files for GrabAccessControl. 2008-02-14 09:42:37 +10:30
Peter Hutterer
9d5edebe96 Xi: finish XKB initialisation before copying the keymap. 2008-02-07 21:24:45 +10:30
Peter Hutterer
0ac1755977 Merge branch 'master' into mpx
Conflicts:

	Xext/sampleEVI.c
2008-01-26 13:55:07 +10:30
Peter Hutterer
466f655219 Xi: if deviceid is > 127 assume GE mask is for all devices (XiSelectEvent). 2008-01-25 10:27:30 +10:30
Peter Hutterer
91dc8c43d2 Xi: Change window access right check to RecieveAccess in XiSelectEvent. 2008-01-25 10:27:21 +10:30
Peter Hutterer
94a6a65ae7 Xext: allow per-device GE masks.
Instead of a single mask per client we allow the storage of a mask per client
per device.
2008-01-25 10:26:41 +10:30
Peter Hutterer
ba315ae5dd Xi: add XACE hooks for device creation (ChangeDeviceHierarchy)
AddInputDevice checks for permissions already, so all we do is modify a few
callers to let AID sort it out.
2008-01-21 23:44:07 +10:30
Peter Hutterer
6e17184486 Xi: Check for DestroyAccess when trying to delete a master device. 2008-01-18 17:52:38 +10:30
Matthieu Herrb
dd5e0f5cd5 Fix for CVE-2007-6427 - Xinput extension memory corruption. 2008-01-17 15:27:34 +01:00
Peter Hutterer
4fd0885978 Xi: remove some leftovers from ProcessOtherEvents.
Core handling not needed anymore here.
2008-01-15 18:58:42 +10:30
Peter Hutterer
32aa252e98 dix: Process an input event as a single event, instead of two separate ones.
This is a significant shift in how input events are perceived. The common
approach was to treat a core event as a different entity than the XI event.
This could result in the XI event being delivered to a different client than
the core event. This doesn't work nicely if they come from the same device.

Instead, we treat an input event as a single event, that is delivered through
two separate APIs. So when delivering an event, we first try the XI event,
then the core event. If the window want's neither, we go to the parent and
repeat. Once either core or XI has been delivered, the processing stops.

Important: Different to the previous method, if a client registers for core
button events, the parent window will not get XI events. This should only
cause problems when you're mixing core and XI events, so don't do that!

Generic events don't fit into this yet, they cause me headaches.
2008-01-15 18:41:51 +10:30
Peter Hutterer
0969a9f749 dix: Emulate core events within CheckDeviceGrabs and ComputeFreezes.
This should restore the correct passive grab processing. When checking for
passive grabs, the core event is emulated and we check first for XI grabs on
the window, then for core grabs. Regardless of which event activates the grab,
the XI event is stored in the device's EQ.

When replaying the event, we take the XI event and replay it on the next
window, again including the emulation of the core event.
2008-01-15 11:31:12 +10:30
Peter Hutterer
4e85c7c322 Xi: keep a counter of buttons down to avoid duplicate press/release events.
If two devices are attached to the same master device, pressing button 1 on
each of them leads to two button presses from the same device. Some apps
really don't like that.

So we just put a counter in place and only send the first press and the last
release.
2008-01-09 17:36:39 +10:30
Peter Hutterer
249b9b30c1 Xi: remove file for the obsolete ChangePointerKeyboardPairing request handling. 2008-01-04 13:49:48 +10:30
Peter Hutterer
9cc41b88df Xi: ProcXSetClientPointer should directly check for the client from the id.
The window ID includes the client ID anyway, so we might as well just look up
the client directly instead of trying to get the window first and the client
from the window.

This also fixes a possible issue with XACE. If the client had permission to
write on the client but not on the window, the previous approach would have
failed.
2008-01-03 18:48:13 +10:30
Peter Hutterer
37194b1355 Xi: switch to using "rc" (instead of "err") as returncode.
All the rest of XI uses rc and returns rc in case of error, so make
mpx-related stuff comply. This stops the rest of XI sending the error
manually.
This is just a cosmetic change to be in line with the rest.
2008-01-03 18:36:33 +10:30
Peter Hutterer
8da83836b6 Merge branch 'master' into mpx
Conflicts:

	XTrap/xtrapddmi.c
	Xext/security.c
	Xext/xprint.c
	Xext/xtest.c
	Xext/xvdisp.c
	Xi/exevents.c
	Xi/grabdevb.c
	Xi/grabdevk.c
	Xi/opendev.c
	Xi/ungrdev.c
	Xi/ungrdevb.c
	Xi/ungrdevk.c
	dix/cursor.c
	dix/devices.c
	dix/dixutils.c
	dix/events.c
	dix/getevents.c
	dix/main.c
	dix/window.c
	hw/xfree86/ramdac/xf86Cursor.c
	include/dix.h
	include/input.h
	include/inputstr.h
	mi/midispcur.c
	mi/miinitext.c
	mi/misprite.c
	render/animcur.c
	xfixes/cursor.c
	xkb/xkbAccessX.c
2008-01-03 17:04:54 +10:30
Peter Hutterer
d0308b6465 Xi: specify correct struct when calculating size of GetDeviceControl reply.
This doesn't change much, as the struct previously given has the same size as
the ones now anyway. Still, we should be pendantic.

Thanks to Simon Thum for reporting.
2007-12-19 18:18:10 +10:30
Eamon Walsh
c8feb73f58 Merge branch 'master' into XACE-SELINUX
Conflicts:

	Xext/EVI.c
	Xext/bigreq.c
	Xext/cup.c
	Xext/dpms.c
	Xext/fontcache.c
	Xext/mitmisc.c
	Xext/xcmisc.c
	Xext/xf86bigfont.c
	Xext/xtest.c
	configure.ac
	dbe/dbe.c
	hw/darwin/darwin.h
	hw/darwin/darwinEvents.c
	hw/darwin/iokit/xfIOKit.h
	hw/darwin/iokit/xfIOKitCursor.c
	hw/darwin/quartz/fullscreen/fullscreen.c
	hw/darwin/quartz/fullscreen/quartzCursor.c
	hw/darwin/quartz/quartz.c
	hw/darwin/quartz/quartzCommon.h
	hw/darwin/quartz/quartzCursor.c
	hw/darwin/quartz/xpr/dri.c
	hw/darwin/quartz/xpr/dristruct.h
	hw/darwin/quartz/xpr/xprCursor.c
	hw/darwin/quartz/xpr/xprFrame.c
	hw/xfree86/modes/xf86RandR12.c
	include/cursor.h
	miext/rootless/rootlessCommon.h
	miext/rootless/rootlessScreen.c
	miext/rootless/rootlessWindow.c
	render/picturestr.h

Trying to pick up the pieces from the darwin churn here...
2007-12-13 18:38:25 -05:00
Daniel Stone
0fccb24aa9 ProcessOtherEvent: Don't do double translation of button events
We already deal with the button mapping in GetPointerEvents, so don't
do the remapping again in ProcessOtherEvent.
2007-12-05 18:29:54 +00:00
Peter Hutterer
f44d7dcb5f dix: change the filters to be per-device.
If we have one global filter, one pointer may change the filter value and
affect another pointer.

Reproduceable effect:
blackbox and xterm, start dragging xterm then click anywhere with the other
pointer (attached to different masterd device!).  The button release resets
the filter[Motion_Filter(button)] value, thus stopping dragging and no event
is sent to the client anymore.
Having the filters set per device gets around this.
2007-12-04 19:07:46 +10:30
Peter Hutterer
edebe76cfd Xi: set DeviceXXXState's length fields to the correct size of the struct.
Setting it to the size of a pointer is an interesting but equally wrong
approach. Luckily Xlib never used this field anyway so nobody got hurt so far.

Spotted by Simon Thum.
(cherry picked from commit 0f2398d06c)
2007-11-27 13:15:28 +10:30