Commit Graph

54 Commits

Author SHA1 Message Date
Adam Jackson dc7ceda90f dispatch: Mark swapped dispatch as _X_COLD
This touches everything that ends up in the Xorg binary; the big missing
part is GLX since that's all generated code. Cuts about 14k from the
binary on amd64.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2017-03-01 10:16:20 -05:00
Peter Hutterer 6307d60dd5 Xi: remove superfluous cast.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-02-04 10:53:59 +10:00
Keith Packard fecc7eb1cf xi: More warning cleanup for input
Lots more const char stuff.

Remove duplicate defs of CoreKeyboardProc and CorePointerProc from
test/xi2/protocol-common.c

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2014-01-12 10:14:50 -08:00
Alan Coopersmith 2f5caeaddb Use C99 designated initializers in Xinput Replies
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:58:30 -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
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
Matt Turner 2c7c520cfe Use internal temp variable for swap macros
Also, fix whitespace, mainly around
	swaps(&rep.sequenceNumber)

Reviewed-by: Peter Harris <pharris@opentext.com>
Signed-off-by: Matt Turner <mattst88@gmail.com>
2011-09-21 17:12:04 -04:00
Peter Hutterer 88cb61e1e5 Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver into input-api
Conflicts:
	dix/getevents.c
	hw/xfree86/common/xf86Xinput.h

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-11-11 12:54:46 +10:00
Peter Hutterer fe8d122b13 Xi: reshuffle conditions for labeling a device as IsXExtensionKeyboard (#29046)
From the original bug reporter Ezra Reeves:

"I did some more digging on this today, and I found that an HP branded
wireless USB mouse has the same issue. With this mouse (as well as the
logitech wireless mouse), the return from:

xdev = XListInputDevices(GDK_WINDOW_XDISPLAY(rootwin), &ndevices_return);

lists the USB device twice, but both have xdev[num].use == 3
(IsXExtensionKeyboard as defined in X11/XI.h).

[...]

Swapping the order of the test in Xi/listdev.c that determines whether a
device is a pointer or a keyboard properly detects my devices (OEM USB
wireless mouse/kb combo) -- one as a keyboard and one as a pointer."

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

Reported-by: Erik Kilfoil <ekilfoil@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-10-29 08:28:57 +10:00
Peter Hutterer dd11f734a9 input: remove "mode" field from ValuatorClassRec.
We have per-axis mode now. For those bits that still need it (XI 1.x),
assume that the first axis holds the device's mode.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2010-10-22 16:19:00 +10:00
Peter Hutterer 4ac3be29bc input: Purge AddOtherInputDevices DDX hook.
This hook wasn't used by any DDX. Device addition and removal is handled by
the config backend, so we don't need to do anything special that during the
ListInputDevices request processing.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2010-09-01 15:26:52 +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
Mikhail Gusarov 3f3ff971ec Replace X-allocation functions with their C89 counterparts
The only remaining X-functions used in server are XNF*, the rest is converted to
plain alloc/calloc/realloc/free/strdup.

X* functions are still exported from server and x* macros are still defined in
header file, so both ABI and API are not affected by this change.

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-05-13 00:22:37 +07:00
Peter Hutterer a863d63629 Xi: remove FIXME and obsolete include.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-30 08:43:14 +10:00
Peter Hutterer 7dd415aa6a Xi: use byte-counting macros instead of manual calculation.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-14 10:05:53 +10:00
Eamon Walsh 84662e40c3 Xi: check for GetAttr permission when listing or querying devices.
If the check fails, leave the device off the returned list of info
structures.  Under XI2, this may cause inconsistent views of the device
topology after a change (for example, devices disappearing from view,
or showing as attached to a master that cannot be seen).  More work is
needed to deal with topology changes and device relabeling.

Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
2009-06-23 21:15:27 -04: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 1cce55cc03 input: rename device->type to device->xinput_type.
This type is only used in XI to give a hint of what type this device may be.
Call it xinput_type for clarity.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-21 10:42:35 +10:00
Peter Hutterer 38bba0c1b7 Xi: Change ChangeMasterDeviceClasses to new XI2 events.
Split ChangeMasterDeviceClasses into an extra XISendDeviceChangedEvent that
assembles the XI2 wire event for the DeviceChanged event. Re-use this when
detaching the last SD.

Not quite perfect yet, we still copy the device classes from the slave now
rather than from the data we had when the event occured. But it's a start.

(We can now unexport SizeDeviceInfo and CopySwapDevices, not needed anymore)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-20 15:17:55 +10:00
Peter Hutterer c7eb27f392 Xi: always only list VCP/VCK and the SD's in XListInputDevices.
If a client wants other MDs, it should use XI2's XQueryDevice() instead.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-20 15:17:54 +10:00
Peter Hutterer 801f14d4b7 Xi: don't send attachment info down with ListInputDevices. 2009-03-20 15:17:54 +10:00
Peter Åstrand ddb8d8945d xserver: Avoid sending uninitialized padding data over the network
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-16 13:28:38 +10:00
Daniel Stone 4fa3872dc2 Input: Remove core keysyms from KeyClassRec
Instead of always keeping two copies of the keymap, only generate the
core keymap from the XKB keymap when we really need to, and use the XKB
keymap as the canonical keymap.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-22 15:08:59 +11: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 18b33dd4ff Xi: stop excessive use of _X_EXPORT. 2008-04-29 15:24:55 +09:30
Peter Hutterer b5004722a2 Xi: Only return VCP, VCK and floating SDs to Xi 1.x clients.
This is better than the approach implemented with
8973a3f798 which disabled XI altogether for 1.x.
Instead, return a device list that resembles a traditional XI setup on pre XI
2.0 servers. If the client tries to open a device other than a floating SD,
return a BadDevice error.
2008-04-28 10:26:01 +09:30
Peter Hutterer 684b5d8382 Xi: whoops, stray ! caused a bit of memory mess. 2008-04-26 19:55:59 +09:30
Peter Hutterer 7447a30fb2 Xi: if a pre-XI2 client tries to list the devices, pretend we don't have any.
XI 1.x isn't supported anymore, so let's pretend we don't have any devices.
This stops clients from opening them and thus stops interference.
2008-04-26 19:03:13 +09: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 09a8fc5c7a Xi: make SizeDeviceInfo public and re-use from CreateClassesChangedEvent. 2008-02-18 18:42:46 +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 e96d926d64 Xi: remove trailing whitespaces. 2007-11-13 17:14:35 +10:30
Peter Hutterer a05f43bf3e dix: When the last slave is removed, set master to the original classes.
DeviceClassesChangedEvent is sent to the client, where device == new slave.
2007-11-12 11:35:18 +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 6dcde0e9c1 Xi: set master device's id in ListDevices Reply. 2007-10-19 11:28:50 +09:30
Peter Hutterer cfcc6e14b9 Xi: return all master devices as type IsXPointer/Keyboard when listing devs.
Slave devices are reported as IsXExtensionPointer/Keyboard.
2007-10-19 11:28:44 +09:30
Eamon Walsh 5c03d13181 xace: add new hooks + access controls: XInput extension.
Introduces new dix API to lookup a device, dixLookupDevice(), which
replaces LookupDeviceIntRec and LookupDevice.
2007-09-28 08:02:00 -04: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 a12054757d Xi: fix ProcXListInputDevices to include the virtual core devices. 2007-04-02 11:20:44 +09:30
Peter Hutterer 307d2b57bb Xi: remove 'register' keywords. 2007-03-29 15:23:41 +09:30
Adam Jackson e88fa75c9b Static cleanup on Xi/ 2007-03-25 21:18:39 -04:00
Daniel Stone 458c63a841 enable adding devices after removal of a middle device
Allow new devices to be added after a device that _wasn't_ the last on the
list was removed, by ensuring inputInfo.numDevices always increases, and
never decreases.
2006-08-07 23:02:17 +03:00
Daniel Stone 0a2068d123 Xi: add XExtension{Keyboard,Pointer} types
Report XExtensionKeyboard for non-core keyboards, and XExtensionPointer for
non-core pointers/mice.
2006-07-21 15:19:52 -04:00
Adam Jackson 6d7083bd69 indent fixes (OMG SO UGLY), and nuke old RCS keywords. 2006-02-20 22:16:49 +00:00
Adam Jackson 5480c537ce ANSIfy Xi/. Mostly automated via protoize(1). 2006-02-20 21:50:49 +00:00
Daniel Stone e03198972c Add Xtrans definitions (FONT_t, TRANS_CLIENT) to clean up warnings.
Add XSERV_t, TRANS_SERVER, TRANS_REOPEN to quash warnings.
Add #include <dix-config.h> or <xorg-config.h>, as appropriate, to all
    source files in the xserver/xorg tree, predicated on defines of
    HAVE_{DIX,XORG}_CONFIG_H. Change all Xfont includes to
    <X11/fonts/foo.h>.
2005-07-03 07:02:09 +00:00
Daniel Stone 292c4cff26 Fix includes right throughout the Xserver tree:
change "foo.h" to <X11/foo.h> for core headers, e.g. X.h, Xpoll.h;
change "foo.h", "extensions/foo.h" and "X11/foo.h" to
    <X11/extensions/foo.h> for extension headers, e.g. Xv.h;
change "foo.[ch]" to <X11/Xtrans/foo.[ch]> for Xtrans files.
2005-04-20 12:25:48 +00:00
Egbert Eich 0664db19bf Merging XORG-CURRENT into trunk 2004-04-23 18:54:16 +00:00
Egbert Eich dae90c3af9 Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004 2004-03-14 08:34:49 +00:00
Egbert Eich 867451f1ab Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004 2004-03-03 12:12:50 +00:00