Commit Graph

176 Commits

Author SHA1 Message Date
Povilas Kanapickas 5163fc8bc2 Implement gesture processing logic 2021-05-30 13:26:42 +03:00
Povilas Kanapickas 22fa31ed56 dix: Add new internal event enums for gesture events 2021-05-30 13:26:30 +03:00
Povilas Kanapickas f5220117e9 dix: Extract FreezeThisEventIfNeededForSyncGrab() 2020-11-25 04:20:22 +00:00
Adam Jackson ec659f021e dix: Remove now-unused SetVendorString 2019-10-30 16:17:04 +00:00
Hans de Goede 834a467af9 dix: Add GetCurrentClient helper
Request-handlers as registered in the requestVector array, always get
passed the clientPtr for the client which sent the request.
But the implementation of many request-handlers typically consists of
a generic handler calling implementation specific callbacks and / or
various helpers often multiple levels deep and in many cases the clientPtr
does not get passed to the callbacks / helpers.

This means that in some places where we would like to have access to the
current-client, we cannot easily access it and fixing this would require
a lot of work and often would involve ABI breakage.

This commit adds a GetCurrentClient helper which can be used as a
shortcut to get access to the clienPtr for the currently being processed
request without needing a lot of refactoring and ABI breakage.

Note using this new GetCurrentClient helper is only safe for code
which only runs from the main thread, this new variable MUST NOT be used
by code which runs from signal handlers or from the input-thread.

The specific use-case which resulted in the creation of this patch is adding
support for emulation of randr / vidmode resolution changes to Xwayland.
This emulation will not actually change the monitor resolution instead it
will scale any window with a size which exactly matches the requested
resolution to fill the entire monitor. The main use-case for this is
games which are hard-coded to render at a specific resolution and have
sofar relied on randr / vidmode to change the monitor resolution when going
fullscreen.

To make this emulation as robust as possible (e.g. avoid accidentally scaling
windows from other apps) we want to make the emulated resolution a per client
state. But e.g. the RRSetCrtc function does not take a client pointer; and is
a (used) part of the Xorg server ABI (note the problem is not just limited
to RRSetCrtc).

Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-10-12 12:19:14 +02:00
Ray Strode 8738ce85df dix: ensure work queues are cleared on reset
If the server resets, most client workqueues are cleaned up as the
clients are killed.

The one exception is the server's client, which is exempt from
the killing spree.

If that client has a queued work procedure active, it won't get
cleared on reset.

This commit ensures it gets cleared too.
2018-11-19 19:37:10 +00:00
Adam Jackson 3297a1c871 include: Remove ___CLIENTSIGNALALL_DEFINED___ copypasta
___CLIENTSIGNAL_DEFINED___ is a hack to work around the declaration of
ClientSignal both in our own headers and in <X11/include/fontproto.h>,
the latter of which is properly part of libXfont (1, only) but packaged
in xorgproto because we have made some mistakes. ClientSignalAll needs
no such workaround.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2018-10-25 12:32:48 -04:00
Adam Jackson 2e7f790b57 dix: Remove ffs.c
Your libc has ffs, I promise.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2017-11-06 17:22:46 -05:00
Jeremy Huddleston Sequoia 2740dc1937 dix: Silence TSan warnings when checking for pending input
V2: Moves InputCheckPending() into dix.h

Bumps required version of xproto to 7.0.30

==================
WARNING: ThreadSanitizer: data race (pid=4943)
  Read of size 4 at 0x00010c4e3854 by thread T8:
    #0 WaitForSomething WaitFor.c:237 (X11.bin+0x00010049216c)
    #1 Dispatch dispatch.c:413 (X11.bin+0x000100352ed9)
    #2 dix_main main.c:287 (X11.bin+0x00010036e894)
    #3 server_thread quartzStartup.c:66 (X11.bin+0x000100039e63)

  Previous write of size 4 at 0x00010c4e3854 by thread T12 (mutexes: write M856, write M1976):
    #0 mieqEnqueue mieq.c:263 (X11.bin+0x000100448d14)
    #1 DarwinSendDDXEvent darwinEvents.c:641 (X11.bin+0x000100033613)
    #2 DarwinProcessFDAdditionQueue_thread darwinEvents.c:338 (X11.bin+0x000100032039)

  Location is global 'miEventQueue' at 0x00010c4e3850 (X11.bin+0x0001005ab854)

  Mutex M856 (0x00010c4c8c80) created at:
    #0 pthread_mutex_lock <null>:144 (libclang_rt.tsan_osx_dynamic.dylib+0x0000000321fe)
    #1 DarwinListenOnOpenFD darwinEvents.c:300 (X11.bin+0x000100031607)
    #2 socket_handoff bundle-main.c:288 (X11.bin+0x000100002b40)
    #3 __do_request_fd_handoff_socket_block_invoke bundle-main.c:379 (X11.bin+0x0001000029ba)
    #4 __tsan::invoke_and_release_block(void*) <null>:144 (libclang_rt.tsan_osx_dynamic.dylib+0x00000005d97b)
    #5 _dispatch_client_callout <null>:33 (libdispatch.dylib+0x0000000020ef)

  Mutex M1976 (0x00010c4e3d68) created at:
    #0 pthread_mutex_init <null>:144 (libclang_rt.tsan_osx_dynamic.dylib+0x0000000253c3)
    #1 input_lock inputthread.c:103 (X11.bin+0x00010049fd10)
    #2 TimerSet WaitFor.c:343 (X11.bin+0x0001004926c2)
    #3 RootlessQueueRedisplay rootlessScreen.c:594 (X11.bin+0x000100065d7f)
    #4 RootlessInstallColormap rootlessScreen.c:514 (X11.bin+0x000100069f1a)
    #5 miSpriteInstallColormap misprite.c:562 (X11.bin+0x000100467095)
    #6 miCreateDefColormap micmap.c:270 (X11.bin+0x000100440399)
    #7 DarwinScreenInit darwin.c:285 (X11.bin+0x0001000303bb)
    #8 AddScreen dispatch.c:3908 (X11.bin+0x00010036c417)
    #9 InitOutput darwin.c:671 (X11.bin+0x00010002fdeb)
    #10 dix_main main.c:197 (X11.bin+0x00010036e228)
    #11 server_thread quartzStartup.c:66 (X11.bin+0x000100039e63)

  Thread T8 (tid=4198779, running) created by main thread at:
    #0 pthread_create <null>:144 (libclang_rt.tsan_osx_dynamic.dylib+0x000000024490)
    #1 create_thread quartzStartup.c:78 (X11.bin+0x000100039dad)
    #2 QuartzInitServer quartzStartup.c:95 (X11.bin+0x000100039c16)
    #3 X11ApplicationMain X11Application.m:1238 (X11.bin+0x00010001cde4)
    #4 X11ControllerMain X11Controller.m:984 (X11.bin+0x00010002a642)
    #5 server_main quartzStartup.c:136 (X11.bin+0x00010003a03b)
    #6 do_start_x11_server bundle-main.c:436 (X11.bin+0x000100002eb5)
    #7 _Xstart_x11_server mach_startupServer.c:189 (X11.bin+0x000100004e99)
    #8 mach_startup_server mach_startupServer.c:399 (X11.bin+0x000100005734)
    #9 mach_msg_server mach_msg.c:563 (libsystem_kernel.dylib+0x000000012186)
    #10 start <null>:29 (libdyld.dylib+0x000000005254)

  Thread T12 (tid=4198797, running) created by thread T8 at:
    #0 pthread_create <null>:144 (libclang_rt.tsan_osx_dynamic.dylib+0x000000024490)
    #1 create_thread darwinEvents.c:121 (X11.bin+0x000100031ecf)
    #2 DarwinEQInit darwinEvents.c:365 (X11.bin+0x000100031860)
    #3 InitInput darwin.c:571 (X11.bin+0x00010002ea09)
    #4 dix_main main.c:261 (X11.bin+0x00010036e7ce)
    #5 server_thread quartzStartup.c:66 (X11.bin+0x000100039e63)

SUMMARY: ThreadSanitizer: data race WaitFor.c:237 in WaitForSomething
==================
==================
WARNING: ThreadSanitizer: data race (pid=22841)
  Write of size 4 at 0x000105bbd864 by main thread (mutexes: write M1945):
    #0 mieqEnqueue mieq.c:263 (X11.bin+0x000100448cf4)
    #1 DarwinSendDDXEvent darwinEvents.c:642 (X11.bin+0x000100033693)
    #2 -[X11Controller set_window_menu:] X11Controller.m:275 (X11.bin+0x0001000222fd)
    #3 -[X11Application set_window_menu:] X11Application.m:486 (X11.bin+0x000100018b44)
    #4 -[X11Application handleMachMessage:] X11Application.m:177 (X11.bin+0x000100016678)
    #5 __NSFireMachPort <null>:69 (Foundation+0x00000009b62b)
    #6 X11ControllerMain X11Controller.m:984 (X11.bin+0x00010002a5f2)
    #7 server_main quartzStartup.c:136 (X11.bin+0x000100039ffb)
    #8 do_start_x11_server bundle-main.c:436 (X11.bin+0x000100002e65)
    #9 _Xstart_x11_server mach_startupServer.c:189 (X11.bin+0x000100004e49)
    #10 mach_startup_server mach_startupServer.c:399 (X11.bin+0x0001000056e4)
    #11 mach_msg_server mach_msg.c:563 (libsystem_kernel.dylib+0x000000012186)
    #12 start <null>:29 (libdyld.dylib+0x000000005254)

  Previous read of size 4 at 0x000105bbd864 by thread T7:
    #0 Dispatch dispatch.c:434 (X11.bin+0x000100352fc8)
    #1 dix_main main.c:287 (X11.bin+0x00010036e874)
    #2 server_thread quartzStartup.c:66 (X11.bin+0x000100039e23)

  Location is global 'miEventQueue' at 0x000105bbd860 (X11.bin+0x0001005ab864)

  Mutex M1945 (0x000105bbdd78) created at:
    #0 pthread_mutex_init <null>:144 (libclang_rt.tsan_osx_dynamic.dylib+0x0000000253c3)
    #1 input_lock inputthread.c:103 (X11.bin+0x00010049fd10)
    #2 TimerSet WaitFor.c:348 (X11.bin+0x0001004926c2)
    #3 RootlessQueueRedisplay rootlessScreen.c:594 (X11.bin+0x000100065d3f)
    #4 RootlessInstallColormap rootlessScreen.c:514 (X11.bin+0x000100069eda)
    #5 miSpriteInstallColormap misprite.c:562 (X11.bin+0x000100467075)
    #6 miCreateDefColormap micmap.c:270 (X11.bin+0x000100440379)
    #7 DarwinScreenInit darwin.c:285 (X11.bin+0x00010003036b)
    #8 AddScreen dispatch.c:3914 (X11.bin+0x00010036c3f7)
    #9 InitOutput darwin.c:671 (X11.bin+0x00010002fd9b)
    #10 dix_main main.c:197 (X11.bin+0x00010036e208)
    #11 server_thread quartzStartup.c:66 (X11.bin+0x000100039e23)

  Thread T7 (tid=4257217, running) created by main thread at:
    #0 pthread_create <null>:144 (libclang_rt.tsan_osx_dynamic.dylib+0x000000024490)
    #1 create_thread quartzStartup.c:78 (X11.bin+0x000100039d6d)
    #2 QuartzInitServer quartzStartup.c:95 (X11.bin+0x000100039bd6)
    #3 X11ApplicationMain X11Application.m:1238 (X11.bin+0x00010001cd94)
    #4 X11ControllerMain X11Controller.m:984 (X11.bin+0x00010002a5f2)
    #5 server_main quartzStartup.c:136 (X11.bin+0x000100039ffb)
    #6 do_start_x11_server bundle-main.c:436 (X11.bin+0x000100002e65)
    #7 _Xstart_x11_server mach_startupServer.c:189 (X11.bin+0x000100004e49)
    #8 mach_startup_server mach_startupServer.c:399 (X11.bin+0x0001000056e4)
    #9 mach_msg_server mach_msg.c:563 (libsystem_kernel.dylib+0x000000012186)
    #10 start <null>:29 (libdyld.dylib+0x000000005254)

SUMMARY: ThreadSanitizer: data race mieq.c:263 in mieqEnqueue
==================

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2016-09-22 14:55:01 -07:00
Keith Packard 9d15912aa4 Remove fd_set from Block/Wakeup handler API
This removes the last uses of fd_set from the server interfaces
outside of the OS layer itself.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2016-07-18 15:27:51 -04:00
Adam Jackson 2c3a3afb51 dix: Add RootWindowFinalizeCallback
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2016-04-18 11:22:58 -04:00
Chris Wilson bc3634010c dix: Add ClientSignalAll()
This is a variant of ClientSignal() that signals all clients with an
optional matching sleeping client, function and closure.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-02-29 14:33:11 -05:00
Keith Packard 9802a0162f Missing parens in REQUEST_FIXED_SIZE macro [CVE-2014-8092 pt. 5]
The 'n' parameter must be surrounded by parens in both places to
prevent precedence from mis-computing things.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-12-09 11:28:07 -08:00
Alan Coopersmith 73c63afb93 Xi: unvalidated lengths in Xinput extension [CVE-2014-8095]
Multiple functions in the Xinput extension handling of requests from
clients failed to check that the length of the request sent by the
client was large enough to perform all the required operations and
thus could read or write to memory outside the bounds of the request
buffer.

This commit includes the creation of a new REQUEST_AT_LEAST_EXTRA_SIZE
macro in include/dix.h for the common case of needing to ensure a
request is large enough to include both the request itself and a
minimum amount of extra data following the request header.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-08 18:09:48 -08:00
Alan Coopersmith e0e1164462 dix: integer overflow in REQUEST_FIXED_SIZE() [CVE-2014-8092 4/4]
Force use of 64-bit integers when evaluating data provided by clients
in 32-bit fields which can overflow when added or multiplied during
checks.

Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-08 18:09:47 -08:00
Peter Hutterer 732fd7e571 Drop trailing whitespaces
sed -i "s/[ ]\+$//g" **/*.(c|h)

happy reviewing...
git diff -w is an empty diff.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-12 10:25:00 +10:00
Adam Jackson 1e56b2dfc6 mi: Move pScreen->SendGraphicsExpose up to dix
No DDX is overriding this and it's fairly absurd to expose it as a
screen operation anyway.

Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2014-10-09 11:14:53 +02:00
Peter Harris 5eb77697ea Avoid starting a comment with */*
Even though -Wcomment doesn't mind it (in gcc or clang), the appearance
of */* confuses the syntax highlighter of some editors (eg. vim), and
causes warnings in MSVC.

Signed-off-by: Peter Harris <pharris@opentext.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-07-17 10:19:52 -07:00
Eric Anholt abf1202706 glx: Move the GLX variable caching what GL context is current to dix.
GLX is trying to track whether the context it wants is current, to
avoid the glFlush() (and the rest of the overhead) that occurs on all
MakeCurrent calls.  However, its cache can be incorrect now that
glamor exists.  This is a step toward getting glamor to coordinate
with GLX.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2014-04-23 10:32:02 -07:00
Keith Packard 60014a4a98 Replace 'pointer' type with 'void *'
This lets us stop using the 'pointer' typedef in Xdefs.h as 'pointer'
is used throughout the X server for other things, and having duplicate
names generates compiler warnings.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-01-12 10:24:11 -08:00
Keith Packard d89b42bda4 Clean up warnings in DIX
As usual, mostly const char changes. However, filter_device_events had
a potentially uninitialized value, 'raw', which I added a bunch of
checks for. I suspect most of those are 'can't happen', but it's hard
to see that inside the function.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2014-01-12 10:14:49 -08:00
Peter Hutterer 06b87aa528 sync: if the idle time was reset, force alarms to trigger (#70476)
The time between the idle reset and the IdleTimeWakeupHandler to be called is
indeterminate. Clients with an PositiveTransition or NegativeTransition alarm
on a low threshold may miss an alarm.

Work around this by keeping a reset flag for each device. When the
WakeupHandler triggers and the reset flag is set, we force a re-calculation of
everything and pretend the current idle time is zero. Immediately after is the
next calculation with the real idle time.

Relatively reproducible test case: Set up a XSyncNegativeTransition alarm for
a threshold of 1 ms. May trigger, may not.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2013-10-18 16:44:32 +10:00
Peter Hutterer efc1035ca9 dix: provide accessor methods for the last device event time
And now that we have the accessors, localize it. No functional changes, just
preparing for a future change.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2013-10-18 16:44:32 +10:00
Yaakov Selkowitz e8d45f3018 dix: fix shadow warnings
dispatch.c: In function 'ProcCopyArea':
dispatch.c:1608:5: warning: declaration of 'rc' shadows a previous local
dispatch.c:1604:9: warning: shadowed declaration is here
dispatch.c: In function 'ProcCopyPlane':
dispatch.c:1647:5: warning: declaration of 'rc' shadows a previous local
dispatch.c:1643:9: warning: shadowed declaration is here
events.c: In function 'GetClientsForDelivery':
events.c:2030:68: warning: declaration of 'clients' shadows a global declaration
../include/dix.h:124:28: warning: shadowed declaration is here
events.c: In function 'DeliverEventToWindowMask':
events.c:2113:19: warning: declaration of 'clients' shadows a global declaration
../include/dix.h:124:28: warning: shadowed declaration is here
events.c: In function 'EventSuppressForWindow':
events.c:4420:12: warning: declaration of 'free' shadows a global declaration

Signed-off-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-11-05 13:25:00 -06:00
Daniel Stone 854c1fa4a1 Add a common ARRAY_SIZE macro to dix.h
Does what it says on the box, replacing those from Xi/ and glx/.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Cyril Brulebois <kibi@debian.org>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-07-09 23:06:41 -07:00
Alan Coopersmith 789d64e19a Remove unneccesary casts from WriteToClient calls
Casting return to (void) was used to tell lint that you intended
to ignore the return value, so it didn't warn you about it.

Casting the third argument to (char *) was used as the most generic
pointer type in the days before compilers supported C89 (void *)
(except for a couple places it's used for byte-sized pointer math).

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Tested-by: Daniel Stone <daniel@fooishbar.org>
2012-07-09 19:12:56 -07:00
Peter Hutterer e57d6a8902 dix: move freeing the sprite into a function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-06-07 14:13:44 +10:00
Peter Hutterer 6aef209ebc Change lastDeviceIdleTime to be per-device
Preparation work for per-device idle counters.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: James Jones <jajones@nvidia.com>
2012-03-22 13:12:56 +10:00
Keith Packard 9838b7032e Introduce a consistent coding style
This is strictly the application of the script 'x-indent-all.sh'
from util/modular. Compared to the patch that Daniel posted in
January, I've added a few indent flags:

	-bap
	-psl
	-T PrivatePtr
	-T pmWait
	-T _XFUNCPROTOBEGIN
	-T _XFUNCPROTOEND
	-T _X_EXPORT

The typedefs were needed to make the output of sdksyms.sh match the
previous output, otherwise, the code is formatted badly enough that
sdksyms.sh generates incorrect output.

The generated code was compared with the previous version and found to
be essentially identical -- "assert" line numbers and BUILD_TIME were
the only differences found.

The comparison was done with this script:

dir1=$1
dir2=$2

for dir in $dir1 $dir2; do
	(cd $dir && find . -name '*.o' | while read file; do
		dir=`dirname $file`
		base=`basename $file .o`
		dump=$dir/$base.dump
		objdump -d $file > $dump
	done)
done

find $dir1 -name '*.dump' | while read dump; do
	otherdump=`echo $dump | sed "s;$dir1;$dir2;"`
	diff -u $dump $otherdump
done

Signed-off-by: Keith Packard <keithp@keithp.com>
Acked-by: Daniel Stone <daniel@fooishbar.org>
Acked-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-03-21 13:54:42 -07:00
Peter Hutterer e395efc25f Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver into multitouch
Conflicts:
	configure.ac
	dix/inpututils.c

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-12-22 09:29:59 +10:00
Peter Hutterer e389a19a73 Process and deliver touch events
Does not include pointer emulation handling.
Does include partial ownership handling but not the actual processing of
ownership events.

Note: this commit is a retroactive commit extracted from a series of ~50
commits and may thus appear a bit more complicated than what you'd write out
from scratch.

Pointer processing tree is roughly:
- ProcessOtherEvents
  - ProcessTouchEvents
    - DeliverTouchEvents
      - DeliverTouchBeginEvent|DeliverTouchEndEvent|...
        - DeliverOneTouchEvent

Also hooks up the event history playing to the right function now.

Co-authored-by: Daniel Stone <daniel@fooishbar.org>
Co-authored-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-21 12:38:35 +10:00
Peter Hutterer 84db813b9d Hook up TouchBegin/Update/End events
The are the same as device events internally but require the touch ID
separately from the detail.button field (the protocol uses the detail field
for the touch id).
For simpler integration of pointer emulation we need to set the
detail.button field while keeping the touchid around.

Add the three new touch event types to the various places in the server
where they need to be handled. The actual handling of the events is somewhat
more complicated in most places.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-16 11:18:47 +10:00
Keith Packard 7da7aa96a0 Merge remote-tracking branch 'whot/for-keith' 2011-12-14 11:40:10 -08:00
Peter Hutterer 93945b0a74 dix: split grab event conversion and delivery into a helper function
Effective functional change: XI2 events are checked with XACE now.

DeliverOneGrabbedEvent is exported for future use by touch events.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-13 13:24:00 +10:00
Alan Coopersmith d5a5eece67 CompareISOLatin1Lowered: constify arguments
Allows callers to avoid deconstifying arguments when calling, fixing
gcc warning:

filter.c: In function 'PictureGetFilterId':
filter.c:59:2: warning: cast discards qualifiers from pointer target type

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-12-12 17:03:10 -08:00
Keith Packard 522f8bcc03 Merge remote-tracking branch 'whot/for-keith' 2011-12-08 20:57:26 -08:00
Peter Hutterer 7af23259d8 dix: switch the syncEvent queue to a struct list
No effective functionality change, just cleanup to make this code slightly
more sane.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-09 14:56:20 +10:00
Alan Coopersmith 8b6a750097 Fix gcc warnings about redundant declarations of fallback functions
Ensure ffs, strndup, strlcat, etc. aren't defined by our headers
if they're already defined in the system headers.

This does export the HAVE_FFS, HAVE_STRNDUP, etc. definitions to drivers,
but if you built the Xserver with a libc that had those, and then build
the drivers with a less capable libc, you're going to have problems anyway,
and this should solve some reported problems with conflicts between our
strndup definition and gcc magic for it.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2011-12-05 14:32:59 -08:00
Alexandr Shadchin 91131037a2 Fix position _X_EXPORT
Signed-off-by: Alexandr Shadchin <Alexandr.Shadchin@gmail.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2011-10-28 13:10:07 -07:00
Peter Hutterer 08a7246f43 dix: rename ProcessRawEvents to dix/events.c:DeliverRawEvent
No functional changes, prep work for future changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Cyril Brulebois <kibi@debian.org>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-06-08 13:57:05 +10:00
Peter Hutterer 5bcc22757e dix: return deliveries from DeliverGrabbedEvent
This isn't currently used by any of the callers but it will likely be in the
future.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
2011-05-13 09:41:37 +10:00
Daniel Stone 00ba884556 Input: Make CheckPassiveGrabsOnWindow take InternalEvent
Previously, it only took DeviceEvents, but it would be much more useful
if it took InternalEvents.  Any event that activates a grab must still
be a DeviceEvent, so put in a check to enforce this.

Change all callers to make the appropriate casts.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-05-06 13:15:16 +10:00
Adam Jackson 82a8677d91 dix: Remove deprecated.c
No more internal users, this can be dropped now.

Reviewed-by: Soren Sandmann <ssp@redhat.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2011-03-08 13:17:24 -05:00
Peter Hutterer 703baece7e dix: Add IsFloating(device) wrapper.
Simplifies check for floating devices.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <tissoire@cena.fr>
2011-02-22 14:35:44 +10:00
Daniel Stone ce74e7562d Input: Make CheckPassiveGrabsOnWindow return grab, export
Change CheckPassiveGrabsOnWindow to return the GrabPtr it used (or NULL
if none) rather than a boolean, and export it.  Also add an additional
boolean 'activate' parameter; use TRUE for existing behaviour, or FALSE
to only find the grab and then return it.

This will be used in forthcoming touch patches to find the grabs, rather
than open-coding same.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-01-06 17:11:00 +00:00
Jamey Sharp 32de0c1907 Move replay-window check from ComputeFreezes to CheckDeviceGrabs.
This just simplifies ComputeFreezes, eliminating some duplicated code
and a goto.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-10-13 15:58:07 +10:00
Mikhail Gusarov 7287ef9e6c Remove unnecessary parentheses around return values in functions
This patch was generated by the following Perl code:

perl -i -pe 's/([^_])return\s*\(\s*([^(]+?)\s*\)s*;(\s+(\n))?/$1return $2;$4/g;'

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-06-10 06:42:42 -07:00
Jamey Sharp e90f20eed3 Declare functions that unconditionally call FatalError as _X_NORETURN.
For AtomError, this should fix a clang warning; in the other cases it's
just good documentation.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Cc: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-05-22 01:00:04 -07:00
Jamey Sharp 35761d5f81 Introduce dixLookupFontable for "FONT or GC" parameters.
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-05-07 21:56:36 -07:00
Keith Packard 998e982b77 Move callback definitions to their own file
Needed as the privates stuff uses the callbacks before they would have
been defined in dix.h

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
2010-04-30 13:04:44 -07:00