Commit Graph

168 Commits

Author SHA1 Message Date
Jeremy Huddleston b8e0f74082 mieq: Protect from pDev=NULL in mieqEnqueue and mieqProcessInputEvents
(cherry picked from commit bf60ffb497)
2009-07-25 20:17:25 -07:00
Pierre Willenbrock 9965174f4f Check dev->u.master if there is a custom event handler, too
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-17 14:40:54 +10:00
Pierre Willenbrock c806162c13 Always update u.lastSlave
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-17 14:40:54 +10:00
Peter Hutterer d3f6b43a24 Update to xextproto 7.0.99.1.
xextproto had Xlib client headers moved into libXext.
Protocol header files are named fooproto.h, header files with constants
foo.h or fooconst.h where foo.h was already in use for client-side headers.
2009-07-15 17:00:05 +10:00
Peter Hutterer d040af7fa3 Update to type-specific raw events - require inputproto 1.9.99.14.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-15 10:36:30 +10:00
David Miller afa680e495 mi: ignore DGA events in ChangeDeviceID
DGA events don't have a deviceid, so they don't need changing.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-18 08:23:30 +10:00
Peter Hutterer af4e658401 mi: only process master if the SD is still attached.
SDs may be detached during event processing (e.g. if a passive grab
activates). In this case, the event must not be processed through the master
device.

Reported-by: Thomas Jaeger
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-03 14:38:55 +10:00
Peter Hutterer ebe45e1a72 input: introduce partial class copying depending on the event.
Copying all classes into the master device has drawbacks for hybrid devices
(devices that are both mice and keyboards). If such a device posts an event,
it's key classes are moved into the VCP. The key event itself is unaffected
by keyboard grabs and the like.

Partial class copying copies depending on the event and copies the classes
into the right master device (i.e. the VCK for key events, the VCP for
pointer events).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-22 15:44:57 +10:00
Peter Hutterer 438a4eafa5 input: remove nested union from InternalEvent.
There's no need for internal events to be a struct with a single nested
union, we might as well make the union itself the InternalEvent.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-22 15:44:56 +10:00
Peter Hutterer b12d302df8 Input: rename DeviceIntRec->isMaster to ->type.
isMaster is not enough as long as we differ between master pointers and
keyboard. With flexible device classes, the usual checks for whether a
master device is a pointer (currently check for ->button, ->valuators or
->key) do not work as an SD may post an event through a master and mess this
check up.

Example, a device with valuators but no buttons would remove the button
class from the VCP and thus result in the
IsPointerDevice(inputInfo.pointer) == FALSE.

This will become worse in the future when new device classes are introduced
that aren't provided in the current system (e.g. a switch class).

This patch replaces isMaster with "type", one of SLAVE, MASTER_POINTER and
MASTER_KEYBOARD. All checks for dev->isMaster are replaced with an
IsMaster(dev).
2009-05-22 15:44:50 +10:00
Peter Hutterer add2defac7 Split the signal-handler's lastSlave out into a separate variable.
dev->u.lastSlave was not signal safe since it was accessed by the DIX and
during signal handling.
Replaced with:
'dev->last.slave' for the signal handler's lastSlave (used to generate
                  DeviceChangedEvents), .
'dev->u.lastSlave' for the DIX lastSlave (currently only used in
                   change_modmap)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-22 15:44:03 +10:00
Peter Hutterer 057fc9a4f8 Merge branch 'master' into xi2
Conflicts:
	Xi/chdevhier.c
	include/input.h
2009-04-24 16:15:47 +10:00
Peter Hutterer 932d6bcbb6 mi: remove superfluous check.
mieqProcessInputEvents doesn't process events from MDs anymore, so we don't
need to check for pDev->isMaster.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-04-24 15:29:24 +10:00
Peter Hutterer 4cc6a96d71 input: add support for RawDeviceEvents. 2009-03-20 15:17:56 +10:00
Peter Hutterer 6fe4c28bf4 Add agressive event type checking.
Best to FatalError if a wrong event comes in. At least that forces me to fix
it really quickly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-20 15:17:53 +10:00
Peter Hutterer b874a5c0aa mi: only print the "EQ overflowing" error once.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-03 07:07:30 +10:00
Peter Hutterer 36583a4996 mi: split EQ popping and event processing into two functions.
mieqProcessInputEvents() - pop an event off the EQ and pass it to
mieqProcessDeviceEvent() - process the event according to the MD/SD hierarchy.

This way, we can use mieqPDE() from Xtest, xkb, and others to post an event.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-23 17:52:40 +10:00
Peter Hutterer 47f136ed6f mi: change custom handlers to internal events
This should re-enable DGA, but XQuartz needs to be changed to internal events
too now.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-23 17:52:40 +10:00
Peter Hutterer 763848d3ab Input: change processing API to InternalEvents.
Don't pass xEvent* and count through to processing, pass a single
InternalEvent.

Custom handlers are disabled for the time being. And for extra fun,
XKB's pointer motion emulation is disabled. But stick an error in there so
that we get reminded should we forget about it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-23 17:52:40 +10:00
Peter Hutterer 007e93c869 xkb: Switch the xkb event processing path over to InternalEvents.
Before dropping down into the DIX, convert back into XI events. This is a
temporary solution only, until the DIX is capable of handling InternalEvents
anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-23 17:52:39 +10:00
Peter Hutterer 4026c63e4e mi: switch the EQ to contain InternalEvents only.
This gets rid of the nevents parameter, InternalEvents are always a single
item per event. Also remove the special DeviceValuator handling in both
enqueueing and dequeueing.

Custom callback handlers are now broken until fixed.

For bisectability, we copy the InternalEvent back into the XI required during
POE and friends. Consider this a temporary solution.

Note: Because of misc linker bonghits, Xvfb won't link in this revision.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-23 17:52:39 +10:00
Jeremy Huddleston ca46c01869 XQuartz: mieq: Wait for the server to finish initializing before letting other threads mieqEnqueue
Avoid possible race condition whereby one thread might call mieqEnqueue before InitAndStartDevices finishes
(cherry picked from commit 94e417ac87)
2009-01-16 13:58:20 -08:00
Peter Hutterer d645721170 mi: ensure chained button mappings from SD -> MD (#19282)
After copying the master event, flip the detail field to the mapped button of
the SD, not the physical button. This way if the SD has a mapping 1:3 and the
MD has a mapping of 3:4, a press on button 1 on the SD results in a core event
on button 4.

X.Org Bug 19282 <http://bugs.freedesktop.org/show_bug.cgi?id=19282>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-15 09:28:01 +10:00
Jeremy Huddleston dde5c591be mieq: Avoid possible race condition whereby one thread might call mieqEnqueue before InitAndStartDevices finishes
This is more of a hack around the problem.  This is something that will need to be addressed in a
more structured manner with the multi threaded input efforts.
(cherry picked from commit 3c596c061e)
2009-01-11 16:39:20 -08:00
Jeremy Huddleston 5339c22a8c XQuartz: Add locking to make mieq thread safe on OSX
(cherry picked from commit 7a8d226686)
2009-01-11 01:56:45 -08:00
Jeremy Huddleston a939368ab8 mi: Reuse memory in mieqProcessInputEvents rather than making excessive calls to calloc()
Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2008-12-15 03:20:17 -08:00
Peter Hutterer cb95642dc8 Remove #define NEED_EVENTS and NEED_REPLIES
A grep on xorg/* revealed there's no consumer of this define.

Quote Alan Coopersmith:
"The consumer was in past versions of the headers now located
in proto/x11proto - for instance, in X11R6.0's xc/include/Xproto.h,
all the event definitions were only available if NEED_EVENTS were
defined, and all the reply definitions required NEED_REPLIES.

Looks like Xproto.h dropped them by X11R6.3, which didn't have
the #ifdef's anymore, so these are truly ancient now."

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2008-12-12 11:43:32 +10:00
Peter Hutterer d281866b74 mi: Clean up CopyGetMasterEvent, re-use the memory.
Alloc an EventList once and then re-use instead of allocing a new event each
time we need a master event.
There's a trick included: because all the event processing handlers only take
an xEvent, init a size 1 EventList and squash the events into this one.

Events that have count > 1 must be squished into an xEvent array anyway before
passing into the event handlers, so we don't lose anything here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Daniel Stone <daniel@fooishbar.org>
2008-12-10 12:42:45 +10:00
Peter Hutterer 0b4fef6337 dix: move MAX_VALUATOR_EVENTS into include/input.h
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2008-12-10 12:42:45 +10:00
Peter Hutterer 090f631239 mi: always update the sprite for master devices.
Follow-up to 9ce995373e. This re-enables cursor rendering if the MD is
controlled through software (e.g. synergy).

Reported by John Tapsell: "I use Xorg with no mouse attached, but use synergy
to control the mouse.  The commit means that I no longer have a visible mouse
cursor.  The mouse cursor is still 'there' in terms that I can click buttons
etc with it, but it's just not visible."

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2008-12-10 11:06:59 +10:00
Paulo Cesar Pereira de Andrade 49f77fff14 Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.

  This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)

  LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.

  xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 05:43:34 -02:00
Peter Hutterer 9ce995373e mi: UpdateSprite only if the device is attached. 2008-12-02 15:50:38 +10:00
Paulo Cesar Pereira de Andrade d6cbd4511e Export symbols defined in the sdk.
This is the biggest "visibility" patch. Instead of doing a "export"
symbol on demand, export everything in the sdk, so that if some module
fails due to an unresolved symbol, it is because it is using a symbol
not in the sdk.

  Most exported symbols shouldn't really be made visible, neither
advertised in the sdk, as they are only used by a single shared object.

  Symbols in the sdk (or referenced in sdk macros), but not defined
anywhere include:
XkbBuildCoreState()
XkbInitialMap
XkbXIUnsupported
XkbCheckActionVMods()
XkbSendCompatNotify()
XkbDDXFakePointerButton()
XkbDDXApplyConfig()
_XkbStrCaseCmp()
_XkbErrMessages[]
_XkbErrCode
_XkbErrLocation
_XkbErrData
XkbAccessXDetailText()
XkbNKNDetailMaskText()
XkbLookupGroupAndLevel()
XkbInitAtoms()
XkbGetOrderedDrawables()
XkbFreeOrderedDrawables()
XkbConvertXkbComponents()
XkbWriteXKBSemantics()
XkbWriteXKBLayout()
XkbWriteXKBKeymap()
XkbWriteXKBFile()
XkbWriteCFile()
XkbWriteXKMFile()
XkbWriteToServer()
XkbMergeFile()
XkmFindTOCEntry()
XkmReadFileSection()
XkmReadFileSectionName()
InitExtInput()
xf86CheckButton()
xf86SwitchCoreDevice()
RamDacSetGamma()
RamDacRestoreDACValues()
xf86Bpp
xf86ConfigPix24
xf86MouseCflags[]
xf86SupportedMouseTypes[]
xf86NumMouseTypes
xf86ChangeBusIndex()
xf86EntityEnter()
xf86EntityLeave()
xf86WrapperInit()
xf86RingBell()
xf86findOptionBoolean()
xf86debugListOptions()
LoadSubModuleLocal()
LoaderSymbolLocal()
getInt10Rec()
xf86CurrentScreen
xf86ReallocatePciResources()
xf86NewSerialNumber()
xf86RandRSetInitialMode()
fbCompositeSolidMask_nx1xn
fbCompositeSolidMask_nx8888x0565C
fbCompositeSolidMask_nx8888x8888C
fbCompositeSolidMask_nx8x0565
fbCompositeSolidMask_nx8x0888
fbCompositeSolidMask_nx8x8888
fbCompositeSrc_0565x0565
fbCompositeSrc_8888x0565
fbCompositeSrc_8888x0888
fbCompositeSrc_8888x8888
fbCompositeSrcAdd_1000x1000
fbCompositeSrcAdd_8000x8000
fbCompositeSrcAdd_8888x8888
fbGeneration
fbIn
fbOver
fbOver24
fbOverlayGeneration
fbRasterizeEdges
fbRestoreAreas
fbSaveAreas
composeFunctions
VBEBuildVbeModeList()
VBECalcVbeModeIndex()
TIramdac3030CalculateMNPForClock()
shadowBufPtr
shadowFindBuf()
miRRGetScreenInfo()
RRSetScreenConfig()
RRModePruneUnused()
PixmanImageFromPicture()
extern int miPointerGetMotionEvents()
miClipPicture()
miRasterizeTriangle()
fbPush1toN()
fbInitializeBackingStore()
ddxBeforeReset()
SetupSprite()
InitSprite()
DGADeliverEvent()

  SPECIAL CASES
o defined as _X_INTERNAL
	xf86NewInputDevice()
o defined as static
	fbGCPrivateKey
	fbOverlayScreenPrivateKey
	fbScreenPrivateKey
	fbWinPrivateKey
o defined in libXfont.so, but declared in xorg/dixfont.h
	GetGlyphs()
	QueryGlyphExtents()
	QueryTextExtents()
	ParseGlyphCachingMode()
	InitGlyphCaching()
	SetGlyphCachingMode()
2008-11-29 23:56:06 -02:00
Jeremy Huddleston 19aac4274b mi: Push screen-saver/DPMS handling to after the EQ pop operation.
This way we on't need to hold the mutex during the dixSaveScreens() call.

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Signed-off-by: Tiago Vignatti <vignatti@c3sl.ufpr.br>
Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-11-19 10:55:29 -08:00
Jeremy Huddleston 56d1793c43 mi: Only increment tail (push) when the event data is actually in the queue
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Signed-off-by: Tiago Vignatti <vignatti@c3sl.ufpr.br>
Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-11-19 10:54:57 -08:00
Peter Hutterer fc3e8bfb82 mi: clean up mieqProcessInputEvents, copy all events before processing.
Copy the EventRec's information into local variables before processing them,
this should make it safer for upcoming threading and also makes it easier to
read.

Simplify the event allocation code from the abyss it was before.

This also fixes a potential bug where a custom handler could scramble the
event before the same -now scrambled- event was then passed through the
master's custom event handler.

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-11-11 14:52:54 +10:00
Peter Hutterer cbc6f98395 xkb: when faking mouse button events, fake them on the correct devices.
When MouseKeys are activated, keyboard devices may generate fake mouse button
events through XKB. Let's get then running through the appropriate paths, i.e.
as XI events on the correct device.

To make matters more fun, ProcessOtherEvents drops events if the DIX device
state cannot be updated accordingly, i.e. all button events from keyboard
devices.
Hence we need to get the paired MD for the device in XkbDDXFakeDeviceButton,
and post the event through the paired MD (usually the VCP).

Removes now-unused ddxFakeBtn.c.

Note: this patch only half-arsedly fixed button events, motion events are a
more complicated matter.
2008-11-04 16:04:15 +10:30
Adam Jackson b736f477f5 mieq: Backtrace when the queue overflows.
Since we're probably stuck down in a driver somewhere, let's at least
try to point out where.  This will need to be rethought when the input
thread work lands though.
2008-10-10 16:33:57 -04:00
Jeremy Huddleston dac9e91870 mieq: Made custom event handlers safer for nevents >1 2008-09-21 17:33:04 -07:00
Jeremy Huddleston 47bf269d59 mieq: Fix my broken cherry pick. 2008-09-03 12:54:56 -07:00
Jeremy Huddleston 9e70a3cf58 mieqProcessInputEvents: Check custom event handlers first. 2008-09-03 09:33:39 -07:00
Tiago Vignatti 881e551de9 CopyGetMasterEvent() can be static. 2008-06-11 18:03:33 -03:00
Paulo Cesar Pereira de Andrade 8644aa4717 mi: minor build fix when compiling with debug enabled.
Signed-off-by: Peter Hutterer <peter@cs.unisa.edu.au>
2008-06-05 08:55:09 +09:30
Peter Hutterer 341a61b608 mi: reduce noisyness. DebugF is enough if device ID can't be changed.
Also - printing out the event type is actually helpful.
2008-05-31 17:42:05 +09:30
Peter Hutterer f9edecd1b5 mi: sync declaration and definition of mieqResizeEvents. 2008-05-20 11:07:17 +09:30
Peter Hutterer a0e6a7d4f5 dix: resize EQ to minimum size to avoid reallocs during SIGIO.
When a new device is added, calculate the event size needed if a DCCE event is
sent and set the EQ's event size to this minimum. This avoids reallocs when a
event is sent (which may happen during a SIGIO).
2008-04-30 17:57:48 +09:30
Peter Hutterer ff36753755 mi: call the custom event handlers for both MD and SD. 2008-04-29 14:53:41 +09:30
Peter Hutterer f5ac98747d Standardise copyright headers for all new files created as part of MPX. 2008-04-25 14:50:24 +09:30
Peter Hutterer 179a082c26 Xext: route event through master if required (XTestFakeInput) 2008-04-22 17:45:55 +09:30
Peter Hutterer fb784d99c5 mi: fix typo in comment. 2008-04-22 17:45:48 +09:30
Magnus Vigerlöf 5ffbcfec3d dix: Ensure Proximity events don't kill the server.
Add Prox events to the if-clauses with the other events
that are usually sent from the input devices.
Ensure that the event deliverers won't try to deliver
events of type '0' (some extended events doesn't have
an equivalent core-type)

Small modification by Peter Hutterer.

Signed-off-by: Peter Hutterer <peter@cs.unisa.edu.au>
2008-04-08 14:43:22 +09:30
Peter Hutterer b81c330f70 mi: remove RawDeviceEvent's ID changing. 2008-02-14 09:32:54 +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
Bartosz Fabianowski 5b02a6ca5b Input: Fix proximity events with valuators
Initialise num_events to 1, so we always send a proximity event, and then
optionally valuator events.  Also make sure mieq can deal with valuator
events sent after proximity events.
2007-12-14 13:15:26 +02:00
Peter Hutterer c5acf401da mi: unify last two ErrorF's in mieq.c 2007-12-07 20:19:43 +10:30
Peter Hutterer 117458d2db mi: change infamous "Tossed event ..." error for something more explanatory.
Few whitespace errors fixed.
Two ErrorF's prefixed with [mi].
2007-12-07 20:18:49 +10:30
Eamon Walsh 60be452c2e xace: restore the old SaveScreens function and introduce new API, since the
old version is called from drivers...
2007-11-19 16:59:34 -05:00
Peter Hutterer a08665d4d3 mi: don't call SwitchCoreKeyboard, we switch during event processing now. 2007-11-15 10:42:29 +10:30
Peter Hutterer 51239f87ce dix: Send MappingNotify when keyboard maps change.
If a slave device is attached to a master device, then we need to send a
mapping notify to the client.
Mapping notify needs to be sent if
 - different slave device but on same master
 - different master

This gives you funny behaviour with the ClientPointer. When a
MappingNotify is sent to the client, the client usually responds with a
GetKeyboardMapping. This will retrieve the ClientPointer's keyboard mapping,
regardless of which keyboard sent the last mapping notify request. So
depending on the CP setting, your keyboard may change layout in each app...
2007-11-13 11:26:16 +10:30
Peter Hutterer 5a7a65a3c9 mi: avoid SIGABRT by setting master_event to NULL. 2007-11-12 12:37:39 +10:30
Peter Hutterer 7a81bafc9b Xi, dix: Add ability to change MD classes + send event when doing so.
Each time a different slave device sends through a master, an
DeviceClassesChangedEvent is enqueued. When this event is processed, all
classes of the matching master device are changed, and the event is sent to
the clients.

Next time the master is queried, it thus shows the evclasses of the last slave
device. The original classes are stored in the devPrivates.

TODO: if all slave devices are removed, the master's original classes need to
be restored.
2007-11-09 23:10:24 +10:30
Peter Hutterer 3063f0c667 mi: change the device id to the master devices' when duplicating the event.
Move the event duplication into a CopyGetMasterEvent(), makes the code a bit
better to read.
2007-11-08 11:51:03 +10:30
Peter Hutterer 15944b8f02 mi: duplicate event before processing it, so master has original values
Event values may get changed in the event processing stage, so we need to
duplicate it to pump different events through for slave and master device.
2007-11-07 11:33:24 +10:30
Peter Hutterer 8b7c4249d8 mi: call processInputProc for master devices after slave event processing.
More work is needed to sort out grabs though.
2007-10-17 10:41:58 +09:30
Peter Hutterer 2b075e97ec mi: switch core keyboard on XI events, not only on core events.
We only get core events through the EQ in exceptional cases, so make sure we
actually swap the core keymap for XI events as well. Gives us back the ability
to have multiple keyboard layouts simultaneously.
2007-10-02 13:28:40 +09:30
Peter Hutterer a511c445de Remove generation of core events, long live XI!
Let the drivers only generate XI events and put those into the event queue.
When processing events, generate core events as needed. This fixes a number of
problems with XKB and the DIX in general.

The previous approach was to put core events and XI events as separate events
into the event queue. When being processed, the server had no knowledge of
them coming from the same device state change. Anything that would then change
the state of the device accordingly was in danger of changing it twice,
leading to some funny (i.e. not funny at all) results.

Emulating core events while processing XI events fixes this, there is only one
path that actually changes the device state now. Although we have to be
careful when replaying events from synced devices, otherwise we may lose
events.

Note: XI has precedence over core for passive grabs, but core events are
delivered to the client first.

This removes the wrapping added in 340911d724
2007-09-28 18:46:41 +09:30
Peter Hutterer 340911d724 Wrap core event handling through ProcessOtherEvents.
When processing events from the EQ, _always_ call the processInputProc of the
matching device. For XI devices, this proc is wrapped in three layers.
Core event handling is wrapped by XI event handling, which is wrapped by XKB.
A core event now passes through XKB -> XI -> DIX.

This gets rid of a sync'd grab problem: with the previous code, core events
did disappear during a sync'd device grab on account of mieqProcessInputEvents
calling the processInputProc of the VCP/VCK instead of the actual device. This
lead to the event being processed as normal instead of being enqueued for
later replaying.
2007-09-26 15:12:49 +09:30
Eamon Walsh b82557c9fb xace: add hooks + new access codes: core protocol screensaver requests 2007-08-16 10:36:05 -04:00
Peter Hutterer 9eddede039 mieqEnqueue: Don't try to update the time for GenericEvents.
Doing so may overwrite the event's length field and cause havoc. Also check if
realloc'd memory did actually return valid pointer.
2007-08-06 15:48:22 +09:30
Peter Hutterer 49136d3e9f mieqEnqueue: use modulo for queue tail wrapping.
This was previously committed by Michael Daenzer, but was lost during a pull.
2007-06-27 11:58:12 +09:30
Peter Hutterer 1f97a76476 Merge branch 'master' into mpx
Conflicts:

	dix/devices.c
	hw/xfree86/common/xf86Xinput.c
	hw/xfree86/loader/xf86sym.c
	mi/mieq.c
2007-06-19 17:20:52 +09:30
Michel Dänzer 40f27a2df4 mieqEnqueue: Make local queue tail variables unsigned.
So the modulo arithmetic actually works as intended... thanks to Peter Hutterer
for pointing out the problem.
2007-06-19 09:11:16 +02:00
Michel Dänzer 30a3297fed mieq queue handling cleanups.
In particular, fix handling of wraparounds in mieqEnqueue.
2007-06-11 09:23:18 +02:00
Peter Hutterer 58c0fd2927 Adjust EQ to support long events.
Add RawDeviceEvent (pointers only for now).

This commit changes the event queue to use EventLists instead of xEvent
arrays. Only EQ is affected, event delivery still uses xEvent* (look for
comment in mieqProcessInputEvent).

RawDeviceEvents deliver driver information to the client, without clipping or
acceleration.
2007-05-02 13:50:09 +09:30
Paulo Ricardo Zanoni 82f97e1c0c Enable event delivery for multiple heads.
Requires moving the spriteTrace into the DeviceIntRec and adjusting a few
functions to take in device argument, most notably XYToWindow().

Cursor rendering on the second screen is busted.
2007-04-26 15:58:50 +09:30
Peter Hutterer d4dad6f84f Merge branch 'master' into mpx
Conflicts:

	configure.ac
	dix/events.c
	hw/xfree86/common/xf86Xinput.c
2007-04-12 11:11:03 +09:30
Daniel Stone e49f836d6f mieq: Use larger default queue size
Use a default queue size of 512 rather than 256, else Xephyr is too slow
without a host cursor, so events get stuck in the queue.
2007-04-10 23:58:20 +03:00
Stefan Huehner 1f6741db19 Bug #10560: Code-Cleanup: function declarations () -> (void)
X.Org Bugzilla #10560: <https://bugs.freedesktop.org/show_bug.cgi?id=10560>
Patch #9511 <https://bugs.freedesktop.org/attachment.cgi?id=9511>
2007-04-09 14:33:15 -07:00
Peter Hutterer e8777a91f3 Merge branch 'master' into mpx
Conflicts:

	Xi/closedev.c
	Xi/exevents.c
	Xi/extinit.c
	Xi/listdev.c
	dix/window.c
	hw/xfree86/common/xf86Xinput.c
	include/extinit.h
	mi/mipointer.c
2007-04-02 15:36:26 +09:30
Peter Hutterer 5f9c10e8da Clean up DeviceIntPtr, prepare for Server 1.4 ABI. Move sprite-related
information into a new SpriteInfoRec, remove isMPDev flag.
2007-03-25 15:00:03 +09:30
Daniel Stone 80d29475b9 mieq: Allow event handlers for arbitrary events to be set
Allow arbitrary events to use mieq by letting custom handlers be set.
2007-03-21 00:10:38 +02:00
Peter Hutterer a309c936bb xkb: Daniel's patch to stop evdev keyboard segfaults.
mi:	Remove quickfix from ba547d4f6a
2007-02-05 11:38:44 +10:30
Peter Hutterer 15a81b6325 Merge branch 'master' 2007-01-28 17:18:57 +10:30
Peter Hutterer ba547d4f6a mi: Quick fix to stop segfault on non-core keyboards. 2007-01-12 14:42:02 +10:30
Peter Hutterer 5e2f8dee63 mi: remove core pointer special handling. No event has core pointer as
device now.

dix:    zero pSprite memory, stop segfaults on server restart.
2007-01-11 14:05:39 +10:30
Fredrik Höglund 3b5b7ef5c2 Move the code for resetting the DPMS mode in response to input events,
from WaitForSomething to mieqProcessInputEvents.

mieqProcessInputEvents already handles resetting the screen saver.
2007-01-03 21:05:35 +01:00
Peter Hutterer d8b5394eda Cleaning up ifdef MPX from remaining files, removing it from configure.ac.
Removing building mpx extension from Makefile.am
2006-12-18 17:35:34 +10:30
Peter Hutterer 03c554283e mi: removing MPX ifdefs
global sprite renaming in mipointer and misprite
	fixed: multiple remove cursor call in miSpriteInstallColormap
	fixed: wrong core pointer usage in miSpriteStoreColors

dix:    bugfix in CheckCursorConfinement
	removing MPX ifdefs
	removing MPX event generation (using Xi solely now)
	bugfix GrabDevice: uninitialized field in grab struct caused segfault

xfree86: removing MPX fdefs

Xi:     removing MPX protocol events
2006-12-18 15:33:54 +10:30
Peter Hutterer e88bc0e55a mi: Bugfix: FreeCursor ignores negative refcounts.
mieq:   Bugfix: Motion notifies did overwrite DeviceMotionNotifies
2006-11-28 14:34:36 +10:30
Peter Hutterer 1c7568b8a1 mi: closing memory leak, miPointer is freed in miPointerCloseScreen
bugfix: uninitialized pPointer in miPointerGetPosition ifndef MPX
	adding DeviceIntPtr parameter to ScreenRec's cursor functions.
	cleanup of miPointer code to use same scheme in each function

dix:	MPHasCursor() function determines checking whether to invoke
	cursor rendering.

animcur: adding DeviceIntPtr parameter to cursor functions but animcur relies
	 on the core pointer right now.

xfixes: adding DeviceIntPtr parameter to cursor functions but xfixes relies on
	the core pointer right now.

rac:	adding DeviceIntPtr parameter to cursor functions but RAC relies on
	the core pointer right now.

ramdac:	adding DeviceIntPtr parameter to cursor functions but ramdac relies on
	the core pointer right now.
2006-11-23 17:15:14 +10:30
Peter Hutterer 9db851c22d dix: moved sprite from static to be pointer of type SpritePtr
added SpriteRecs for MPX devices
	changed sprite dependency and added MPX functionality to parts
	of events.c (ConfineToShape, PostNewCursor, XineramaCheckMotion,
	CheckMotion, XineramaChangeToCursor, ChangeToCursor, CheckPhysLimits,
	PointerConfinedToScreen)
	added DeviceIntRec param to GetSpritePosition(). This required some
	minor changes in ddx, xtest, xkb and xfixes.

mi:	changed miPointer to pointer instead of static struct.
2006-11-21 18:15:04 +10:30
Peter Hutterer 90bea69dfd mi:
added miCursorInfoRec to contain info of the MPX cursors.
        calling miUpdatePointerSprite() from event queue for MPX devices.
        adding device-specific processing to miPointer*() functions.

dix:    Call to SetCursorPosition in CheckMotion() temporarily disabled.

xfree86/common: call to miPointerUpdateSprite() disabled, is done from the EQ

NOTE: This build will not display cursor images.
BUG: The second mouse does to take correct x coordinates.
2006-11-17 18:03:43 +10:30
Peter Hutterer 5388423eb0 mieq: EQ processing handles MP devices
global: MPX define added to xorg-server.h.in

xfree86/common: small fix to avoid byte overflow
2006-11-16 20:43:27 +10:30
Peter Hutterer c957a16180 dix: added isMPdev field to _DeviceIntRec, is used in GetPointerEvents()
mieq:   avoid merging events from different devices in mieqEnqueue()

xfree86/common
        isMPdev field used from xf86ActivateDevice(), xf86PostMotionEvent()
        and xf86PostButtonEvent()
2006-11-16 15:11:14 +10:30
Daniel Stone c51fadc07d mieq: annotate with some more comments 2006-11-08 15:29:15 +02:00
Daniel Stone a5be654017 mieqEnqueue: only compare DEVICE_BITS of deviceid
Only compare DEVICE_BITS of the two deviceids, so we don't decide that
a valuator event isn't for us, because (id | MORE_EVENTS) != id.
2006-10-27 01:25:21 +03:00
Daniel Stone 77e724585f minor formatting fixes 2006-10-22 11:45:12 +03:00
Daniel Stone aeba855b07 move keymap copy to event processing, from enqueuing
Move the keymap copying to event processing time (in
ProcessInputEvents), instead of being at event enqueuing time.
Break SetCore{Pointer,Keyboard} out into separate functions.
Change mieqEnqueue to take a device pointer, that asks for the
_original_ device associated with this event.
2006-10-20 00:43:11 +03:00
Daniel Stone 41bb9fce47 mipointer: take device arguments, split miPointerAbsoluteCursor
Update mipointer API to take a device argument to (almost) all functions,
and split miPointerAbsoluteCursor into a couple of separate functions.
Remove miPointerAbsoluteCursor call from mieq, as we now deal with it in
GetPointerEvents.
Make miPointerSetPosition (successor of miPointerAbsoluteCursor) take
pointers to x and y, so it can return the clipped values.
Modify callers of miPointer*() functions to generally use the new
functions.
This should fix things with multi-head setups.
2006-10-08 20:34:32 +03:00
Daniel Stone ef68273f5b mi/mipointer: deprecate functions which don't take a device
Deprecate all mi pointer functions which don't take a device argument, and
replace them with versions which do, in preparation for MPX.
2006-10-08 17:44:37 +03:00