103 Commits

Author SHA1 Message Date
pelya
95e445912d Compilation fixes for Xsdl 2012-04-24 15:12:24 +03:00
pelya
e6cef9e7aa Added back SDL backend, did not try to compile it yet 2012-04-24 15:12:24 +03:00
Michal Suchanek
240cd0675b Avoid crash on button events on device without valuators.
Backport of 2416ee4a01.

Signed-off-by: Michal Suchanek <hramrach@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-17 09:55:07 +10:00
Jeremy Huddleston
db9620c022 XQuartz: Fix the filename of our log file
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit fb55f8f790)
2012-03-13 00:08:08 -07:00
Jeremy Huddleston
42234f3cdb XQuartz: Short-circuit activateX:
This also avoids a deadlock when calling activateX: before the server
thread has initialized

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit cb6a32da27)
2012-02-24 11:33:24 -08:00
Jeremy Huddleston
53069ffd86 XQuartz: Actually install the new locales
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit 1562c4a1ca)
2012-02-24 11:33:14 -08:00
Jeremy Huddleston
4b75e41221 XQuartz: Build fix for possible conflict of BOOL type
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit d53235af85)
2012-02-19 14:58:28 -08:00
Jeremy Huddleston
fb6c043833 XQuartz: Release all buttons and keys when deactivating
http://xquartz.macosforge.org/trac/ticket/486

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 85cecd9811)
2012-02-19 14:58:14 -08:00
Jeremy Huddleston
9138bbabcd XQuartz: Toggle off fullscreen mode when XQuartz is hidden
http://xquartz.macosforge.org/trac/ticket/478

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit 47b457541b)
2012-02-19 14:58:07 -08:00
Jeremy Huddleston
fdca9c4d49 XQuartz: Localization Updates
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit c2ba3f339f)
2012-02-19 14:57:59 -08:00
Alan Coopersmith
7773e74660 Assign ids to more tags in Xserver-Dtrace.xml
Keeps xsltproc from adding random-number id tags to html output so that
it's easier to see real changes vs. different random numbers.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Matt Dew <marcoz@osource.org>
(cherry picked from commit 58d3d46d6c)
2012-02-10 15:51:35 -08:00
Jeremy Huddleston
e597f0119c configure.ac: 1.11.4
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2012-01-27 21:07:17 -08:00
Jeremy Huddleston
6c491463ee 1.11.3.902 (1.11.4 RC2)
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2012-01-20 23:56:38 -08:00
Jeremy Huddleston
b747a91485 XQuartz: Bump bundle version to 2.7.1
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2012-01-18 11:47:21 -08:00
Peter Hutterer
a1ed67fa05 render: don't bother with animated cursors on floating slaves (#39989)
X.Org Bug 39989 <http://bugs.freedesktop.org/show_bug.cgi?id=39989>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit bbb6b8c834)
2012-01-18 10:55:12 -08:00
Peter Hutterer
f89c39e6c9 dix: Update pointer limits for floating devices too (#43635)
When the screen is restructured, the pointer limits need to be reset for
floating slave devices as well, not just for master pointers. Only skip
devices that don't have a cursor (attached slaves and keyboard)

Bug reproducer: float an absolute slave device, rotate the screen - the
device is now confined to a section of the screen only.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
(cherry picked from commit 35bd77e9d0)
2012-01-18 10:54:13 -08:00
Zhigang Gong
dea9377a25 mi/mibitblt: Fix an overflow bug of bit shift.
When depth equal to 32 and planeMask equal to 0, the overflow will
occur and cause the pixmap can't be cleared. There are some test
cases in XTS hit this bug, and this fix can eliminate the corresponding
failures.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit f4956faab9)
2012-01-18 10:53:31 -08:00
Alan Coopersmith
d2db5100b1 Convert DetermineClientCmd to use strdup instead of malloc+strncpy
*cmdname is initialized to NULL earlier in the function, so it's
okay to overwrite it with NULL if strdup fails, don't need that
extra check.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit 780133f9ae)
2012-01-18 10:50:16 -08:00
Adam Jackson
5b28bcb340 dix: Tune dixLookupDrawable for success
The vast vast vast majority of resource lookups are successful.  Move some
work to the error paths so we don't punish success.

Before:
40000000 trep @   0.0009 msec (1109091.3/sec): PutImage 10x10 square
60000000 trep @   0.0005 msec (2072652.2/sec): ShmPutImage 10x10 square

After:
40000000 trep @   0.0009 msec (1148346.9/sec): PutImage 10x10 square
60000000 trep @   0.0005 msec (2091666.1/sec): ShmPutImage 10x10 square

Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit 8f9bdfd293)
2012-01-18 10:40:03 -08:00
Adam Jackson
e1ea93fec9 dix: Tune dtrace hooks around Dispatch
Don't call LookupMajorName if the hooks aren't active, it's quite expensive.

Before:
40000000 trep @   0.0009 msec (1087458.5/sec): PutImage 10x10 square
60000000 trep @   0.0005 msec (2012238.6/sec): ShmPutImage 10x10 square

After:
40000000 trep @   0.0009 msec (1109091.3/sec): PutImage 10x10 square
60000000 trep @   0.0005 msec (2072652.2/sec): ShmPutImage 10x10 square

Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit 83a98543b5)
2012-01-18 10:39:23 -08:00
Adam Jackson
9eaa0b5c89 xace: ricer tuning for XaceHook
gcc doesn't want to hoist the check for XaceHooks[hook] != NULL above the
varargs code for some reason, so do it ourselves.

Before:
40000000 trep @   0.0010 msec (1050420.2/sec): PutImage 10x10 square
60000000 trep @   0.0005 msec (1921147.6/sec): ShmPutImage 10x10 square

After:
40000000 trep @   0.0009 msec (1087458.5/sec): PutImage 10x10 square
60000000 trep @   0.0005 msec (2012238.6/sec): ShmPutImage 10x10 square

Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit 11977fab54)
2012-01-18 10:39:13 -08:00
Peter Hutterer
a3b6ecc893 xfree86: split warning about missing identifier or input driver
Check for identifier first and bail if it's missing (also remove the current
identifier check after we've already bailed due to missing identifiers)

If a driver is missing, warn but also say that we may have added this device
already. I see too many bugreports with incorrectly shortened log files.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Cyril Brulebois <kibi@debian.org>
(cherry picked from commit 75953ccb9e)
2012-01-18 10:36:34 -08:00
Julien Cristau
4a339afc58 os: don't ignore failure from dladdr
If dladdr returns 0, don't go and use the returned Dl_info, it may
contain garbage.

X.Org bug#44315 <https://bugs.freedesktop.org/show_bug.cgi?id=44315>

Reported-and-tested-by: Cyril Brulebois <kibi@debian.org>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Cyril Brulebois <kibi@debian.org>
Signed-off-by: Julien Cristau <jcristau@debian.org>
(cherry picked from commit 6269977c91)
2012-01-18 10:32:54 -08:00
Matthieu Herrb
9a4be7e99f Add OpenBSD support to DetermineClientCmd()
Uses kvm_getargv() from libkvm.

Signed-off-by: Matthieu Herrb <matthieu.herrb@laas.fr>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 6d6d4cb604)
2012-01-18 10:32:53 -08:00
Alan Coopersmith
8046717d72 Add Solaris support to DetermineClientCmd
Uses /proc/pid/psinfo to read command & partial arguments.

Moves cmdsize & argsize variables into non-Solaris #else clause
to avoid unused variable warnings.

Fixes format mismatch errors when building with DEBUG defined on
a 64-bit platform (where Mask is defined as CARD32).

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Rami Ylimäki <rami.ylimaki@vincit.fi>
Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit cfc4c3d7fa)
2012-01-18 10:32:51 -08:00
Jeremy Huddleston
cea9f9f273 configure.ac: 1.11.3.901 (1.11.4 RC1)
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2012-01-06 23:05:53 -08:00
Jeremy Huddleston
b15be8547d Xi: Fix mishandled git merge
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2012-01-06 23:05:42 -08:00
Jeremy Huddleston
82e0ae0423 Merge remote-tracking branch 'whot/server-1.11-branch' into server-1.11-branch 2012-01-02 20:58:22 -05:00
Carlos Garnacho
4e4bb319a4 Xi: assign correct grab_mode/other_device_mode in XI2 passive grabs
CreateGrab() expects the keyboard mode to be stored in grab_mode, and the
pointer mode in other_device_mode, so respect this in passive XI2 grabs,
and switch modes if needed.

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
(cherry picked from commit 5b169cb695)
2012-01-03 11:30:00 +10:00
Alan Coopersmith
8c73f6bcbd Change disable_clientpointer return type to void
It doesn't return anything, nor does it's caller expect it to.

Fixes Solaris Studio compiler error:
"xichangehierarchy.c", line 214: Function has no return statement : disable_clientpointer

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 372a6f10dc)
2012-01-03 11:29:43 +10:00
Peter Hutterer
ae4272a574 xfixes: don't dereference a NULL cursor
If the new cursor is the NULL cursor, don't dereference it and use zeros
instead.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit 1ab50be938)
2012-01-03 11:24:51 +10:00
Peter Hutterer
20efd3c158 Xi: when removing a device, reset ClientPointers where needed
if a client had the to-be-removed device as ClientPointer, reset to NULL.

Fixes #43165

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit d2ebbcdaf6)
2012-01-03 11:24:46 +10:00
Peter Hutterer
cf296f2eef Xext: don't swap CARD8 in SProcSELinuxQueryVersion
xselinux_ext.c: In function 'SELinuxSendItemsToClient':
xselinux_ext.c:340:16: warning: unused variable 'n' [-Wunused-variable]
xselinux_ext.c: In function 'SProcSELinuxQueryVersion':
xselinux_ext.c:532:62: error: call to 'wrong_size' declared with attribute
error: wrong sized variable passed to swap
xselinux_ext.c:533:62: error: call to 'wrong_size' declared with attribute
error: wrong sized variable passed to swap

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
(cherry picked from commit bb4aa1f263)

Conflicts:

	Xext/xselinux_ext.c
2012-01-03 11:23:18 +10:00
Peter Hutterer
4b38661024 dix: button state must show the logical buttons, not physical buttons
If the device is mapped 3 2 1, a click on physical button 1 sends a button 3
press, but the state was set for button 1. Fix this, the state must be set
for that button's logical mapping.

https://bugzilla.gnome.org/show_bug.cgi?id=655928

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 9567d21e85b99febe805263a4d93b15fd1f7ab42)

Conflicts:

	dix/inpututils.c
2012-01-03 10:47:53 +10:00
Peter Hutterer
f9b00c2aba Xi: when removing a device, reset ClientPointers where needed
if a client had the to-be-removed device as ClientPointer, reset to NULL.

Fixes #43165

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit d2ebbcdaf6)
2012-01-02 15:39:21 -05:00
Peter Hutterer
e4984b3023 xfixes: don't dereference a NULL cursor
If the new cursor is the NULL cursor, don't dereference it and use zeros
instead.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit 1ab50be938)
2012-01-02 15:38:52 -05:00
Peter Hutterer
625d108819 dmx: force -fno-strict-aliasing for xinput example
Compiler warning:
xinput.c:272: warning: dereferencing pointer 'e' does break strict-aliasing
rules

The code itself is the usual XInput client-side code:
        XEvent event;
        XDeviceMotionEvent *e = (XDeviceMotionEvent *)&event;
        XNextEvent(display, &event);
        printf("%d\n", e->type);

Since XDeviceMotionEvent is not guaranteed the same size as XEvent, clients
must use pointer aliasing as above when using the XNextEvent API. Disable
strict aliasing for this example.

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Gaetan Nadon <memsize@videotron.ca>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 3aca819940)
2011-12-21 12:21:58 -08:00
Keith Packard
53e347b22b Save major/minor opcodes in ClientRec for RecordAReply
The record extension needs the major and minor opcodes in the reply
hook, but the request buffer may have been freed by the time the hook
is invoked. Saving the request major and minor codes as the request is
executed avoids fetching from the defunct request buffer.

This patch also eliminates the public MinorOpcodeOfRequest function,
inlining it into Dispatch. Usages of that function have been replaced
with direct access to the new ClientRec field.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
(cherry picked from commit fb22a408c6)

Conflicts:

	include/extension.h
2011-12-21 09:55:58 -08:00
Julien Cristau
b736f8c92b Fix ShmPutImage for XYBitmap
We can't call CopyArea in that case because the image has depth 1, which
might not match the target drawable, so we might overrun the shm
segment.  Commit 11817a881c apparently
fixed a similar bug for XYPixmap, but missed the bitmap case.

Fixes: http://bugs.debian.org/629611

Thanks to Alan Curry for diagnosing this and providing a test case.

Reported-and-tested-by: Alan Curry <pacman@kosh.dhis.org>
Reviewed-by: Peter Harris <pharris@opentext.com>
Signed-off-by: Julien Cristau <jcristau@debian.org>
(cherry picked from commit 08ec4da6a7)
2011-12-21 09:52:21 -08:00
Jeremy Huddleston
b2a4c09507 kdrive/linux: Fix compilation with -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast
Reported-by: Arkadiusz Miśkiewicz <arekm@maven.pl>
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
(cherry picked from commit 1deede3c48)
2011-12-20 01:13:26 -08:00
Jeremy Huddleston
beaa7ad2ec configure.ac: Make Xephyr dependency error message more informative
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
(cherry picked from commit d0170d54c7)
2011-12-20 01:13:21 -08:00
Jeremy Huddleston
41524dd610 configure.ac: 1.11.3
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-12-16 17:47:46 -08:00
Gaetan Nadon
ee66474eb2 dmx: fix distcheck failure, missing compsize.h in Makefile.am
which was added in commit:
dmx: Build fix for -Werror=implicit-function-declaration

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 2c1d0a539c)
2011-12-15 14:55:37 -08:00
Jeremy Huddleston
0ca8869e45 configure.ac: 1.11.2.902 (1.11.3 RC2)
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-12-09 12:58:30 -08:00
Dave Airlie
e76c397eb9 kdrive: drop screen crossing code.
The only kdrive server we probably care about anymore is Xephyr,
and this screen enable/disable code totally breaks it in multi-screen mode.

When you are in one screen the other stops updating.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=757457

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 98c4a888a4)
2011-12-09 12:35:59 -08:00
Dave Airlie
db418ff750 hal: free tmp_val in one missing case
Pointed out by coverity scan.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
(cherry picked from commit 8d3731a811)
2011-12-09 12:35:44 -08:00
Dave Airlie
6b11b18ab6 xv: test correct number of requests. (v2)
Pointed out by coverity.

v2: fix swapped as well, as pointed out by Alan

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit 41229392b7)
2011-12-09 12:35:37 -08:00
Dave Airlie
df16b789aa xaa: avoid possible freed pointer reuse in epilogue
If the pGCPriv->flags == 2, then we try to assign the freed pGCPriv->XAAOps
avoid this by clearing the flags in to be destroyed pGCPriv.

Reported by coverity.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit 1049139499)
2011-12-09 12:35:27 -08:00
Dave Airlie
befa8a3b83 Xi: avoid overrun of callback array.
This code had an off-by-one and would allow writing one past the end of
the callbacks array.

Pointed out by coverity.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit 682c09a2ce)
2011-12-09 12:35:18 -08:00
Dave Airlie
b22783f483 xext: don't free uninitialised pointer when malloc fails. (v2)
Initialise the pAttr->values to values so if the values allocation
fails it just ends up as free(NULL).

Pointed out by coverity.

v2: use Alan's suggestion.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit b62dc4fcbc)
2011-12-09 12:34:41 -08:00
Adam Jackson
083599c559 fbdevhw: iterate over all modes that match a mode. (v3)
So on RHEL5 anaconda sets an xorg.conf with a fixed 800x600 mode in it,
we run radeonfb and fbdev since ati won't work in userspace due to domain
issues in the older codebase.

On certain pseries blades the built-in KVM can't accept an 800x600-43 mode,
it requires the 800x600-60 mode, so we have to have the kernel radeonfb
driver reject the 800x600-43 mode when it sees it. However then fbdev
doesn't try any of the other 800x600 modes in the modelist, and we end up
getting a default 640x480 mode we don't want.

This patch changes the mode validation loop to continue on with the other modes
that match to find one that works.

v2: move code around to avoid extra loop, after comment from Jamey.
v3: move loop setup back into loop as per Jeremy's review.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit 22605effd1)
2011-12-09 12:34:22 -08:00
Alan Coopersmith
05a890df0a LoaderOpen returns either a valid pointer or NULL, so don't check for < 0
Fixes Sun cc warning that was recently elevated to error by the
stricter default CFLAGS changes to xorg-macros:

"loadmod.c", line 914: improper pointer/integer combination: op "<"

Should have been changed when commit ab7f057ce9 changed the
LoaderOpen return type from int to void *.

Changes log message when file is found but dlopen() fails from:
 (EE) LoadModule: Module dbe does not have a dbeModuleData data object.
 (EE) Failed to load module "dbe" (invalid module, 0)
to:
 (EE) Failed to load module "dbe" (loader failed, 7)

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit e4dcf580f0)
2011-12-09 12:33:42 -08:00
Alan Coopersmith
f494410842 Limit the number of screens Xvfb will attempt to allocate memory for
Commit f9e3a2955d removing the MAXSCREEN limit left the screen
number too unlimited, and allowed any positive int for a screen number:

Xvfb :1 -screen 2147483647 1024x1024x8

Fatal server error:
Not enough memory for screen 2147483647

Found by Parfait 0.3.7:
Error: Integer overflow (CWE 190)
   Integer parameter of memory allocation function realloc() may overflow due to multiplication with constant value 1112
        at line 293 of hw/vfb/InitOutput.c in function 'ddxProcessArgument'.

Since the X11 connection setup only has a CARD8 for number of SCREENS,
limit to 255 screens, which is also low enough to avoid overflow on the
sizeof(*vfbScreens) * (screenNum + 1) calculation for realloc.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
(cherry picked from commit feebf67463)
2011-12-09 12:32:43 -08:00
Rui Matos
bed7d7f31e randr: Make the RRConstrainCursorHarder logic the same as miPointerSetPosition
The constraining logic in RRConstrainCursorHarder allows the cursor to reach
crtc positions of x = width and y = height while the constraining code in
miPointerSetPosition only allows it to reach x = width - 1 and y = height - 1
for the analogous screen case.

This patch makes the former's logic equivalent to the latter's which allows
applications to benefit from Fitts's law. E.g. a maximized application
adjacent to a crtc border wouldn't get pointer events if the user moved the
pointer all the way until it's contained.

Signed-off-by: Rui Matos <tiagomatos@gmail.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 9cc44b955b)
2011-11-28 09:00:52 -08:00
Jeremy Huddleston
4689c84a07 configure.ac: 1.11.2.901 (1.11.3 RC1)
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-28 00:07:29 -08:00
Derek Buitenhuis
e2661ddbc5 Fix vesa's VBE PanelID interpretation
xserver's VESA driver's VBE (Vesa BIOS Extensions) code
includes a PanelID probe, which can get a monitor's native
resolution. From this, using CVT formulas, it derives
horizontal sync rate and a vertical refresh rate ranges.

It however, only derives the upper bounds of the ranges, and
the lower bounds cannot de derived. By default, they are set
to hardcoded constants which represent the lowest supported
resolution: 640x480. The constants in vbe.c however, were
not actually derived from forulas, but carried over from
other code from the bad old days, and are not relevant
to flat panel displays. This caused, for example, EEEPC701's
panel, with a native resolution of 800x480, to end up with
a upper bound of the horizontal sync rate that was lower
than the hardcoded lower bound, which of course broke things.

These numbers have been rederived using both my own CVT tool
based on xf86CVTMode(), and using the provided 'cvt' tool
that comes with xserver.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit f0d50cc665)
2011-11-24 12:15:00 -08:00
Jeremy Huddleston
2e3406fc67 dmx: Build fix for -Werror=implicit-function-declaration
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit f405dfffe7)
2011-11-24 12:05:59 -08:00
dtakahashi42
b440fc9c1b rootless: Fix a server crash when choosing a color with the gimp color wheel
https://trac.macports.org/ticket/30927

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit 328074890e)
2011-11-21 18:44:34 -08:00
Ross Burton
40c1287f36 edid: Add quirk for Acer Aspire One 110
At least one revision of the AAO reports a 190x110mm maximum size but a
451x113mm mode.

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

Signed-off-by: Ross Burton <ross@linux.intel.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit 58864146fb)
2011-11-21 18:44:24 -08:00
Chris Wilson
7972e2dade dri2: Register the DRI2DrawableType after server regeneration
The Resource database is reset upon regeneration and so the dri2 module
needs to re-register its RESTYPE for the drawable or else it will
clobber the next unsuspecting user of the database. Fortunately, DRI2 is
loaded late in the initialisation sequence and was last up until
xf86-video-intel started using the Resource database to track
outstanding swaps...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Tested-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
(cherry picked from commit 34b0e4eee9)
2011-11-21 18:44:17 -08:00
Chris Wilson
73beaf9033 DRI2: Avoid a NULL pointer dereference
Bugzilla:  https://bugs.freedesktop.org/show_bug.cgi?id=41211

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit bfa1a0dd19)
2011-11-21 18:43:49 -08:00
Chris Wilson
6105fcaa35 VidMode: prevent crash with no modes
Bugzilla:  https://bugs.freedesktop.org/show_bug.cgi?id=17431

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit eeb21a133b)
2011-11-21 18:43:43 -08:00
Rami Ylimäki
d113b29115 record: Prevent out of bounds access when recording a reply.
Any pad bytes in replies are written to the client from a zeroed
array. However, record extension tries to incorrectly access the pad
bytes from the end of reply data.

Signed-off-by: Rami Ylimäki <rami.ylimaki@vincit.fi>
Reviewed-by: Erkki Seppälä <erkki.seppala@vincit.fi>
(cherry picked from commit c1bb8f43b9)
2011-11-21 18:43:32 -08:00
Jeremy Huddleston
4dc5b6ea9f xfree86: Fix powerpc build with -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast
memType is a uint64_t on powerpc. Using memType only really makes
sense for *physical* addresses, which can be 64-bit for 32-bit
systems running on 64-bit hardware.

However, unmapVidMem() only deals with *virtual* addresses, which
are guaranteed to fit into an uintptr_t.

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
(cherry picked from commit eb3377ffb8)
2011-11-21 18:42:42 -08:00
Peter Hutterer
a1925f0879 include: export GetProximityEvents and QueueProximityEvents
This is mainly needed for consistency with GetPointerEvents and friend.
No-one seems to actually need this function from outside the usual DDXs.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit fc16917ad6)
2011-11-21 17:59:17 -08:00
Peter Hutterer
a6a21f84bb dix: Don't let a driver without a ProximityClassRec post events
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit 11840595a1)
2011-11-21 17:58:49 -08:00
Peter Hutterer
2f2d871ccd Xi: allow passive keygrabs on the XIAll(Master)Devices fake devices
They don't have a KeyClassRec, but we must still allow passive grabs on
them.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Bastien Nocera <hadess@hadess.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
(cherry picked from commit 22715e465b)
2011-11-21 17:58:31 -08:00
Peter Hutterer
34bb83b9df dix: block signals when closing all devices
When closing down all devices, we manually unset master for all attached
devices, but the device's sprite info still points to the master's sprite
info. This leaves us a window where the master is freed already but the
device isn't yet. A signal during that window causes dereference of the
already freed spriteInfo in mieqEnqueue's EnqueueScreen macro.

Simply block signals when removing all devices. It's not like we're really
worrying about high-responsive input at this stage.

https://bugzilla.redhat.com/show_bug.cgi?id=737031

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
(cherry picked from commit d7c44a7c97)
2011-11-07 18:00:33 -08:00
Christopher Yeleighton
97f2ae60fc Bug 38420: Xvfb crashes in miInitVisuals() when started with depth=2
https://bugs.freedesktop.org/show_bug.cgi?id=38420

Exit with fatal error message, not segfault.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 7d50211ab5)
2011-11-06 16:53:06 -08:00
Dave Airlie
89626304ea xf86Crtc: handle no outputs with no modes harder.
If you started an X server with no connected outputs, we pick a default
1024x768 mode, however if you then ran an xvidmode using app against that
server it would segfault the server due to not finding any valid modes.

This was due to the no output mode set code, only adding the modes to the
scrn->modes once, when something called randr 1.2 xf86SetScrnInfoModes would
get called and remove all the modes and we'd end up with 0.

This change fixes xf86SetScrnInfoModes to always report a scrn mode of at
least 1024x768, and pushes the initial configuration to just call it instead
of setting up the mode itself.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=746926

I've seen other bugs like this on other distros so it might also actually fix them.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 17416e88dc)
2011-11-06 16:52:56 -08:00
Jeremy Huddleston
c68a84e73d configure.ac: Bump to 1.11.2
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-04 10:24:08 -07:00
Jeremy Huddleston
2d6760f591 Revert "dix: don't XWarpPointer through the last slave anymore (#38313)"
This reverts commit bbe6a69da3.

This commit caused a regression.

See: http://xquartz.macosforge.org/trac/ticket/517#comment:10
2011-11-03 15:01:35 -07:00
Jeremy Huddleston
0bffe6b38c configure.ac: Bump to 1.11.1.902 (1.11.2 RC2)
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-10-28 18:32:28 -07:00
Jeremy Huddleston
a1d638da0d XWin: windowswm: Correct byte swapping in event notifications
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
(cherry picked from commit 286fa9bf9b)
2011-10-28 18:31:15 -07:00
Jeremy Huddleston
0715469f1c XQuartz: appledri: Correct byte swapping in event notifications
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit dc054fefc5)
2011-10-28 18:31:10 -07:00
Jeremy Huddleston
bc2600466e XQuartz: applewm: Correct byte swapping in event notifications
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit d5fee2b638)
2011-10-28 18:31:05 -07:00
Jeremy Huddleston
7be5492bcf XQuartz: appledri: Allow byte swapped requests
Even though it's only valid when local, it is possible for a local
client and the server to not match endianness, such as when running
a ppc application under Rosetta.

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit 1c8bda798b)
2011-10-24 18:25:10 -07:00
Jeremy Huddleston
0ad049706d XQuartz: appledri: Fix byte swapping in replies
Even though it's only valid when local, it is possible for a local
client and the server to not match endianness, such as when running
a ppc application under Rosetta.

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
(cherry picked from commit 14205ade0c)

Conflicts:

	hw/xquartz/xpr/appledri.c

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-10-24 18:25:10 -07:00
Jeremy Huddleston
3b931c9276 XQuartz: appledri: Set the correct reply length for XAppleDRICreatePixmap
http://xquartz.macosforge.org/trac/ticket/508

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
(cherry picked from commit 2ba0ac202a)
2011-10-24 18:16:57 -07:00
Jeremy Huddleston
f22a41416b Xnest: Match the host's keymap
This was a regression.

Introduced by: 08363c5830 and
               32db27a7f8
Masked by: 1e69fd4a60

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
(cherry picked from commit 83fef4235d)
2011-10-24 18:16:46 -07:00
Tomáš Trnka
82445286d5 Fix drain_console unregistration
Bug introduced by 9dca441670
xfree86: add a hook to replace the new console handler.

console_handler was not being set, making the server eat up CPU spinning
in WaitForSomething selecting consoleFd over and over again, every time
trying to unregister drain_console without success due to
console_handler being NULL.

Let's just fix the unregistration in xf86SetConsoleHandler() and use that.

But wait, there could be a catch: If some driver replaced the handler using
xf86SetConsoleHandler(), the unregistration in xf86CloseConsole will unregister
that one. I don't understand Xorg well enough to know whether this poses a
problem (could mess up driver deinit somehow or something like that). As it is,
xf86SetConsoleHandler() doesn't offer any way to prevent this (i.e. check which
handler is currently registered).

I had been using it for two days on my machine that previously hit 100% CPU
several times a day. That has now gone away without any new problems appearing.

Signed-off-by: Tomas Trnka <tomastrnka@gmx.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 323869f329)
2011-10-24 16:36:06 -07:00
Jesse Barnes
c8c5ed998a crtc: match full preferred modes if possible when choosing an initial config
It's fairly common to have multiple, identical monitors plugged in.  In
that case, it's preferable to run the monitor's preferred mode on each
output, rather than just matching the width & height and end up with
different timings or refresh rates.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 3e145d3d67)
2011-10-24 10:19:15 -07:00
Ville Syrjala
d780c6f630 composite: Update borderClip in compAllocPixmap()
Previously the parent constrained borderClip was copied over
when compRedirectWindow() is called. That is insufficient eg. in
case the window was already redirected, but not yet realized. So
copy the borderClip over in compAllocPixmap() instead.

Example:
Window 1 is below an automatically redirect window 2. Window 2 is
unmapped and moved outside the extents of window 1. Window 2 is
then mapped again, and MarkOverlappedWindows() uses the up to
date borderSize of window 2 to mark windows, which leaves
window 1 unmarked. Then exposures are calculated using the stale
borderClip of window 2, which causes the window below window 2,
to be exposed through an apparent hole in window 1.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=22566

Signed-off-by: Ville Syrjala <syrjala@sci.fi>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit a5266dcb3a)
2011-10-24 10:06:26 -07:00
Matthieu Herrb
12f65819ff Fix CVE-2011-4029: File permission change vulnerability.
Use fchmod() to change permissions of the lock file instead
of chmod(), thus avoid the race that can be exploited to set
a symbolic link to any file or directory in the system.

Signed-off-by: Matthieu Herrb <matthieu.herrb@laas.fr>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit b67581cf82)
2011-10-18 09:25:07 -07:00
Matthieu Herrb
f80d233578 Fix CVE-2011-4028: File disclosure vulnerability.
use O_NOFOLLOW to open the existing lock file, so symbolic links
aren't followed, thus avoid revealing if it point to an existing
file.

Signed-off-by: Matthieu Herrb <matthieu.herrb@laas.fr>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit 6ba44b91e3)
2011-10-18 09:25:07 -07:00
Jeremy Huddleston
374be44d13 configure.ac: Bump to 1.11.1.901 (1.11.2 RC1)
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-10-14 16:29:54 -07:00
Peter Hutterer
bbe6a69da3 dix: don't XWarpPointer through the last slave anymore (#38313)
This line was introduced pre-1.6 to fix Bug 19297. The effect of warping
through the VCP then was that if a device had custom valuator ranges, the
warp position would be wrong. The better device for this effect is the the
XTest device.

This fixes a server crash where the lastSlave is a pointer device without
valuators (Bug 38313#0).

And while we're at it, make sure the Xinerama code-path does the same.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
(cherry picked from commit 2bfb802839)
2011-10-14 15:35:33 +10:00
Nobuhiro Iwamatsu
2e28ff155f Disable check of double-aligned in test/input.c on Renesas SH
Renesas SH is not aligned at size of double.
When structure has double value, It is aligned in 4byte (long).

Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit b29ce0726d)
2011-10-14 15:35:31 +10:00
Peter Hutterer
79ac611d31 dix: don't use the pointer as modifier device in UngrabKey.
Modifier device is always the keyboard.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
(cherry picked from commit 8c5a4d6fbe)
2011-10-14 15:35:23 +10:00
Peter Hutterer
843737b4f9 dix: ignore devices when adding passive core grabs to list (#39545)
Passive core grabs are mostly device-independent. In an MPX scenario, they
may change to reflect whichever master pair activated the grab last. For
adding new grabs to the list, ignore the device for core grabs to return
failures when trying to set the same grab combo twice on a window.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
(cherry picked from commit 09496996ac)
2011-10-14 15:35:06 +10:00
Peter Hutterer
cb9c1d6d6c dix: avoid using the VCP as modifier device
Core grabs may change device when they're activated to reflect the master
they apply to. If the device is a keyboard, modifierDevice is erroneously
set to the Virtual Core Pointer.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
(cherry picked from commit 80c3704853)
2011-10-14 15:34:59 +10:00
Peter Hutterer
ef5c31430c config: fix a log message
PRODUCT was taken from the parent, hence ppath.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
(cherry picked from commit e684e816ac)
2011-10-14 15:34:35 +10:00
Peter Harris
ec8ee3a9f7 xkb: add missing swaps for xkbGetDeviceInfoReply
Caught during review of e095369bf.

Signed-off-by: Peter Harris <pharris@opentext.com>
Reviewed-by-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Matt Turner <mattst88@gmail.com>
(cherry picked from commit c90903b4f7)

Conflicts:

	xkb/xkb.c

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-10-14 15:33:56 +10:00
Jeremy Huddleston
603ad6608a XQuartz: pbproxy: Add missing AM_OBJCFLAGS
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit fae7ed62ad)
2011-10-09 01:36:11 -07:00
vdb@picaros.org
65469f5ea9 Fix a rare memory leak
Signed-off-by: Servaas Vandenberghe <vdb@picaros.org>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit e4cddf509e)
2011-10-09 01:36:01 -07:00
Kirill Elagin
bec15eb73a Fix server crash due to invalid images
See https://bugs.freedesktop.org/show_bug.cgi?id=39383

Signed-off-by: Kirill Elagin <kirelagin@gmail.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit 5361121339)
2011-10-09 01:35:49 -07:00
Alan Hourihane
b45e226753 dixfonts: Don't overwrite local c variable until new_closure is safely initialized.
Signed-off-by: Alan Hourihane <alanh@vmware.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit 7a33c5b934)
2011-10-09 01:35:37 -07:00
Sam Spilsbury
e9ae333160 Remove the SendEvent bit (0x80) before doing range checks on event type.
Some extension libraries may set this bit before converting the event to
wire protocol and as such range checking the event will cause an invalid
BadValue error to result. As the documentation suggests the the bit
should be "forced on", remove it before doing range checks and continue
to force it on in the server.

Reviewed-by: Jamey Sharp <jamey@minilop.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 2d2dce558d)
2011-10-04 20:08:33 -07:00
Carlos Garnacho
347f5610ca Xi: Fix passive XI2 ungrabs on XIAll[Master]Devices
The corresponding DeviceIntPtr wasn't being gotten properly,
resulting in BadDevice from dixLookupDevice().

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit f52d5cd374)
2011-10-04 20:08:24 -07:00
Jeremy Huddleston
7b74bb6752 XQuartz: Use set_front_process rather than X11ApplicationSetFrontProcess since we're already in the AppKit thread
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit 38e9e28ba2)
2011-10-04 20:02:29 -07:00
Jamey Sharp
bd6ea85209 Fix pixmap double-frees on error paths.
If AddResource fails, it will automatically free the object that was
passed to it by calling the appropriate deleteFunc; and of course
FreeResource also calls the deleteFunc. In both cases it's wrong to call
the destroy hook manually.

Commit by Jamey Sharp and Josh Triplett.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
(cherry picked from commit 0f380a5005)
2011-10-04 19:59:27 -07:00
Jeremy Huddleston
aabd25bd0b configure.ac: Version bumped to 1.11.1
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-09-24 00:06:32 -07:00
Aaron Plattner
8988105166 fb: Rename wfbTriangles and wfbTrapezoids
These symbols were not renamed when they were added to libfb:

 # nm -D libwfb.so | grep ' fb'
 0000000000028d00 T fbTrapezoids
 0000000000028d60 T fbTriangles

This causes corruption and/or crashes on wfb-ful drivers like nvidia:

 Program received signal SIGABRT, Aborted.
 0x00007fd67f3a0405 in *__GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
 64      ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
     in ../nptl/sysdeps/unix/sysv/linux/raise.c
 (gdb) bt
 #0  0x00007fd67f3a0405 in *__GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
 #1  0x00007fd67f3a3680 in *__GI_abort () at abort.c:92
 #2  0x00007fd67f3995b1 in *__GI___assert_fail (assertion=0x7fd679ecb804 "key->initialized", file=<optimized out>, line=116, function=0x7fd679ecbbc0 "dixGetPrivateAddr")
     at assert.c:81
 #3  0x00007fd679ec55b6 in ?? () from /usr/lib/xorg/modules/libfb.so
 #4  0x00007fd679eca9ef in ?? () from /usr/lib/xorg/modules/libfb.so
 #5  0x00007fd679ecae20 in fbTriangles () from /usr/lib/xorg/modules/libfb.so
 #6  0x00007fd67a58fc55 in ?? () from /usr/lib/xorg/modules/drivers/nvidia_drv.so
 #7  0x00000000004f38d1 in ?? ()
 #8  0x0000000000437ae9 in ?? ()
 #9  0x0000000000426eaa in ?? ()
 #10 0x00007fd67f38cead in __libc_start_main (main=<optimized out>, argc=<optimized out>, ubp_av=<optimized out>, init=<optimized out>, fini=<optimized out>,
     rtld_fini=<optimized out>, stack_end=0x7fff99860d78) at libc-start.c:228
 #11 0x000000000042719d in _start ()

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 03d032991d)
2011-09-21 14:32:58 -07:00
1770 changed files with 321008 additions and 315475 deletions

View File

@@ -1,33 +0,0 @@
branches:
except:
- /travis.*/
version: '{build}'
skip_tags: true
clone_depth: 8
environment:
CYGWIN_MIRROR: http://cygwin.mirror.constant.com
CACHE: C:\cache
matrix:
- BUILD: i686-pc-cygwin
- BUILD: x86_64-pc-cygwin
install:
- if "%BUILD%"=="x86_64-pc-cygwin" set SETUP=setup-x86_64.exe && set CYGWIN_ROOT=C:\cygwin64
- if "%BUILD%"=="i686-pc-cygwin" set SETUP=setup-x86.exe && set CYGWIN_ROOT=C:\cygwin
- curl -fsSL https://gist.githubusercontent.com/jon-turney/0338af595313f598bfab15a0ac0df847/raw/bd0eeca6be899e7846aa988fbcf15e4e12f5f842/zp_libtool_cleanlafiles.sh -o %CYGWIN_ROOT%\etc\postinstall\zp_libtool_cleanlafiles.sh
- echo Updating Cygwin and installing build prerequisites
- '%CYGWIN_ROOT%\%SETUP% -qnNdO -R "%CYGWIN_ROOT%" -s "%CYGWIN_MIRROR%" -l "%CACHE%" -g -P "meson,binutils,bison,bzip2,diffutils,fileutils,findutils,flex,gawk,gcc-core,make,patch,pkg-config,python3,sed,tar,xorgproto,windowsdriproto,libdmx-devel,libfontenc-devel,libfreetype-devel,libGL-devel,libpixman1-devel,libX11-devel,libXRes-devel,libXau-devel,libXaw-devel,libXdmcp-devel,libXext-devel,libXfont2-devel,libXi-devel,libXinerama-devel,libXmu-devel,libXpm-devel,libXrender-devel,libXtst-devel,libxcb-ewmh-devel,libxcb-icccm-devel,libxcb-image-devel,libxcb-keysyms-devel,libxcb-randr-devel,libxcb-render-devel,libxcb-render-util-devel,libxcb-shape-devel,libxcb-util-devel,libxcb-xkb-devel,libxkbfile-devel,zlib,font-util,khronos-opengl-registry,python3-lxml,xorg-util-macros,xtrans,xkbcomp,xkeyboard-config,libnettle-devel,libepoxy-devel,libtirpc-devel"'
- echo Install done
cache:
- C:\cache
build_script:
- SET PATH=%CYGWIN_ROOT%/bin
- '%CYGWIN_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; meson setup --prefix=/usr -Dxv=false -Dxf86bigfont=true -Ddmx=true -Dxephyr=true -Dxnest=true -Dxvfb=true -Dxwin=true -Dxorg=true -Dhal=false -Dudev=false -Dpciaccess=false -Dint10=false build"'
- '%CYGWIN_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; meson configure build"'
- '%CYGWIN_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; ninja -C build"'
test_script:
- '%CYGWIN_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; ninja -C build test"'
after_test:
- '%CYGWIN_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; ninja -C build install"'
artifacts:
- path: staging
deploy: off

View File

@@ -1 +0,0 @@
((c-mode . ((c-basic-offset . 4) (indent-tabs-mode . nil))))

1
.gitignore vendored
View File

@@ -41,7 +41,6 @@ mkinstalldirs
py-compile
stamp-h?
symlink-tree
test-driver
texinfo.tex
ylwrap

View File

@@ -1,13 +0,0 @@
image: docker:latest
services:
- docker:dind
before_script:
- echo FROM nwnk/xserver-travis-rawhide:v5 > Dockerfile
- echo ADD . /root >> Dockerfile
- echo WORKDIR /root >> Dockerfile
- docker build -t withgit .
job:
script:
- docker run --volume $HOME/.ccache:/root/.ccache withgit ./test/scripts/build-travis-deps.sh

View File

@@ -1,29 +0,0 @@
language: c
cache: ccache
branches:
except:
- /appveyor.*/
matrix:
include:
- os: linux
dist: trusty
services: docker
env: DISTRO=rawhide:v5
- os: osx
osx_image: xcode9.2
env: DISTRO=xcode9.2
install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then HOMEBREW_NO_AUTO_UPDATE=1 brew install ccache ; fi
before_script:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker pull nwnk/xserver-travis-$DISTRO ; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo FROM nwnk/xserver-travis-$DISTRO > Dockerfile ; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo ADD . /root >> Dockerfile ; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker build -t withgit . ; fi
script:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker run --volume $HOME/.ccache:/root/.ccache withgit /bin/sh -c "cd /root && ./test/scripts/build-travis-deps.sh" ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./test/scripts/build-travis-osx.sh ; fi
- ccache -s

48
COPYING
View File

@@ -8,7 +8,6 @@ possible, and insert their name to this list. Please sort by surname
for people, and by the full name for other entities (e.g. Juliusz
Chroboczek sorts before Intel Corporation sorts before Daniel Stone).
Copyright © 2011 Dave Airlie
Copyright © 2000-2001 Juliusz Chroboczek
Copyright © 1998 Egbert Eich
Copyright © 2006-2007 Intel Corporation
@@ -21,7 +20,6 @@ Copyright © 1999 Keith Packard
Copyright © 2007-2009 Red Hat, Inc.
Copyright © 2005-2008 Daniel Stone
Copyright © 2006-2009 Simon Thum
Copyright © 2003-2008, 2013 Geert Uytterhoeven
Copyright © 2006 Luc Verhaegen
Permission is hereby granted, free of charge, to any person obtaining a
@@ -146,29 +144,6 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.
Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sub license, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice (including the
next paragraph) shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright © 1999-2000 SuSE, Inc.
Copyright © 2007 Red Hat, Inc.
@@ -1258,6 +1233,27 @@ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
Copyright © 2004 PillowElephantBadgerBankPond
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation, and that the name of PillowElephantBadgerBankPond not be used in
advertising or publicity pertaining to distribution of the software without
specific, written prior permission. PillowElephantBadgerBankPond makes no
representations about the suitability of this software for any purpose. It
is provided "as is" without express or implied warranty.
PillowElephantBadgerBankPond DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
EVENT SHALL PillowElephantBadgerBankPond BE LIABLE FOR ANY SPECIAL, INDIRECT OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
Permission to use, copy, modify, and distribute this software for any
@@ -1813,7 +1809,7 @@ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
Copyright (c) 1987, 1990, 1993
Copyright (c) 1989, 1990, 1993, 1994
The Regents of the University of California. All rights reserved.
This code is derived from software contributed to Berkeley by

View File

@@ -1,6 +1,4 @@
AUTOMAKE_OPTIONS=nostdinc
# Required for automake < 1.14
ACLOCAL_AMFLAGS = -I m4
if COMPOSITE
@@ -19,22 +17,6 @@ if RECORD
RECORD_DIR=record
endif
if DRI3
DRI3_DIR=dri3
endif
if PRESENT
PRESENT_DIR=present
endif
if PSEUDORAMIX
PSEUDORAMIX_DIR=pseudoramiX
endif
if GLAMOR
GLAMOR_DIR=glamor
endif
SUBDIRS = \
doc \
man \
@@ -49,17 +31,13 @@ SUBDIRS = \
render \
Xi \
xkb \
$(PSEUDORAMIX_DIR) \
$(DBE_DIR) \
$(RECORD_DIR) \
xfixes \
damageext \
$(COMPOSITE_DIR) \
$(GLX_DIR) \
$(PRESENT_DIR) \
$(DRI3_DIR) \
exa \
$(GLAMOR_DIR) \
config \
hw \
test
@@ -99,7 +77,6 @@ DIST_SUBDIRS = \
Xext \
miext \
os \
pseudoramiX \
randr \
render \
Xi \
@@ -111,105 +88,10 @@ DIST_SUBDIRS = \
composite \
glx \
exa \
glamor \
config \
dri3 \
present \
hw \
test
# gross hack
relink: all
$(AM_V_at)$(MAKE) -C hw relink
install-headers: Makefile
+find . -name Makefile | while read m; do \
if grep -q install-sdkHEADERS $$m; then \
(cd `dirname "$$m"` && make install-sdkHEADERS) \
fi \
done
distcheck-hook:
cd $(srcdir) && \
meson setup _distcheck_build && \
meson configure _distcheck_build && \
ninja -C _distcheck_build && \
rm -rf _distcheck_build && \
cd -
EXTRA_DIST += \
meson_options.txt \
include/xorg-config.h.meson.in \
include/xwin-config.h.meson.in \
hw/xfree86/loader/symbol-test.c \
hw/xfree86/common/xf86Build.sh \
composite/meson.build \
config/meson.build \
damageext/meson.build \
dbe/meson.build \
dix/meson.build \
dri3/meson.build \
exa/meson.build \
fb/meson.build \
glamor/meson.build \
glx/meson.build \
hw/dmx/config/meson.build \
hw/dmx/examples/meson.build \
hw/dmx/glxProxy/meson.build \
hw/dmx/input/meson.build \
hw/dmx/meson.build \
hw/kdrive/ephyr/meson.build \
hw/kdrive/meson.build \
hw/kdrive/src/meson.build \
hw/meson.build \
hw/vfb/meson.build \
hw/xfree86/common/meson.build \
hw/xfree86/ddc/meson.build \
hw/xfree86/dixmods/meson.build \
hw/xfree86/dri2/meson.build \
hw/xfree86/dri/meson.build \
hw/xfree86/drivers/modesetting/meson.build \
hw/xfree86/exa/meson.build \
hw/xfree86/fbdevhw/meson.build \
hw/xfree86/glamor_egl/meson.build \
hw/xfree86/i2c/meson.build \
hw/xfree86/int10/meson.build \
hw/xfree86/loader/meson.build \
hw/xfree86/meson.build \
hw/xfree86/modes/meson.build \
hw/xfree86/os-support/meson.build \
hw/xfree86/parser/meson.build \
hw/xfree86/ramdac/meson.build \
hw/xfree86/shadowfb/meson.build \
hw/xfree86/vbe/meson.build \
hw/xfree86/vgahw/meson.build \
hw/xfree86/x86emu/meson.build \
hw/xfree86/xkb/meson.build \
hw/xnest/meson.build \
hw/xquartz/meson.build \
hw/xwayland/meson.build \
hw/xwin/dri/meson.build \
hw/xwin/glx/meson.build \
hw/xwin/meson.build \
hw/xwin/winclipboard/meson.build \
include/meson.build \
meson.build \
miext/damage/meson.build \
miext/shadow/meson.build \
miext/sync/meson.build \
mi/meson.build \
os/meson.build \
present/meson.build \
pseudoramiX/meson.build \
randr/meson.build \
record/meson.build \
render/meson.build \
test/bigreq/meson.build \
test/bigreq/request-length.c \
test/meson.build \
test/sync/meson.build \
test/sync/sync.c \
Xext/meson.build \
xfixes/meson.build \
Xi/meson.build \
xkb/meson.build

16
README
View File

@@ -11,12 +11,12 @@ and draggable titlebars and borders.
For a comprehensive overview of X Server and X Window System, consult the
following article:
https://en.wikipedia.org/wiki/X_server
http://en.wikipedia.org/wiki/X_server
All questions regarding this software should be directed at the
Xorg mailing list:
https://lists.freedesktop.org/mailman/listinfo/xorg
http://lists.freedesktop.org/mailman/listinfo/xorg
Please submit bug reports to the Xorg bugzilla:
@@ -26,19 +26,13 @@ The master development code repository can be found at:
git://anongit.freedesktop.org/git/xorg/xserver
https://cgit.freedesktop.org/xorg/xserver
http://cgit.freedesktop.org/xorg/xserver
For patch submission instructions, see:
https://www.x.org/wiki/Development/Documentation/SubmittingPatches
http://www.x.org/wiki/Development/Documentation/SubmittingPatches
For more information on the git code manager, see:
https://wiki.x.org/wiki/GitPage
http://wiki.x.org/wiki/GitPage
As with other projects hosted on freedesktop.org, X.Org follows its
Code of Conduct, based on the Contributor Covenant. Please conduct
yourself in a respectful and civilized manner when using the above
mailing lists, bug trackers, etc:
https://www.freedesktop.org/wiki/CodeOfConduct

View File

@@ -1,4 +1,16 @@
noinst_LTLIBRARIES = libXext.la libXvidmode.la
# libXext.la: includes all extensions and should be linked into Xvfb,
# Xnest, Xdmx and Xprt
# libXextbuiltin.la: includes those extensions that are built directly into
# Xorg by default
# libXextmodule.la: includes those extensions that are built into a module
# that Xorg loads
if XORG
noinst_LTLIBRARIES = libXext.la libXextbuiltin.la libXextmodule.la
else
noinst_LTLIBRARIES = libXext.la
endif
INCLUDES = -I$(top_srcdir)/hw/xfree86/dixmods/extmod
AM_CFLAGS = $(DIX_CFLAGS)
@@ -6,7 +18,7 @@ if XORG
sdk_HEADERS = xvdix.h xvmcext.h geext.h geint.h shmint.h syncsdk.h
endif
# Sources always included in libXextbuiltin.la, libXext.la
# Sources always included in libXextbuiltin.la & libXext.la
BUILTIN_SRCS = \
bigreq.c \
geext.c \
@@ -18,7 +30,10 @@ BUILTIN_SRCS = \
syncsrv.h \
xcmisc.c \
xtest.c
BUILTIN_LIBS =
# Sources always included in libXextmodule.la & libXext.la. That's right, zero.
MODULE_SRCS =
MODULE_LIBS =
# Optional sources included if extension enabled by configure.ac rules
@@ -31,19 +46,19 @@ endif
# XVideo extension
XV_SRCS = xvmain.c xvdisp.c xvmc.c xvdix.h xvmcext.h xvdisp.h
if XV
BUILTIN_SRCS += $(XV_SRCS)
MODULE_SRCS += $(XV_SRCS)
endif
# XResource extension: lets clients get data about per-client resource usage
RES_SRCS = hashtable.c hashtable.h xres.c
RES_SRCS = xres.c
if RES
BUILTIN_SRCS += $(RES_SRCS)
MODULE_SRCS += $(RES_SRCS)
endif
# MIT ScreenSaver extension
SCREENSAVER_SRCS = saver.c
if SCREENSAVER
BUILTIN_SRCS += $(SCREENSAVER_SRCS)
MODULE_SRCS += $(SCREENSAVER_SRCS)
endif
# Xinerama extension: making multiple video devices act as one virtual screen
@@ -69,8 +84,8 @@ endif
# requires X-ACE extension
XSELINUX_SRCS = xselinux_ext.c xselinux_hooks.c xselinux_label.c xselinux.h xselinuxint.h
if XSELINUX
BUILTIN_SRCS += $(XSELINUX_SRCS)
BUILTIN_LIBS += $(SELINUX_LIBS)
MODULE_SRCS += $(XSELINUX_SRCS)
MODULE_LIBS += $(SELINUX_LIBS)
endif
# Security extension: multi-level security to protect clients from each other
@@ -88,16 +103,20 @@ endif
# DPMS extension
DPMS_SRCS = dpms.c dpmsproc.h
if DPMSExtension
BUILTIN_SRCS += $(DPMS_SRCS)
MODULE_SRCS += $(DPMS_SRCS)
endif
# Now take all of the above, mix well, bake for 10 minutes and get libXext*.la
libXext_la_SOURCES = $(BUILTIN_SRCS)
libXext_la_LIBADD = $(BUILTIN_LIBS)
libXext_la_SOURCES = $(BUILTIN_SRCS) $(MODULE_SRCS)
libXext_la_LIBADD = $(MODULE_LIBS)
# XVidMode extension
libXvidmode_la_SOURCES = vidmode.c
if XORG
libXextbuiltin_la_SOURCES = $(BUILTIN_SRCS)
libXextmodule_la_SOURCES = $(MODULE_SRCS)
libXextmodule_la_LIBADD = $(MODULE_LIBS)
endif
EXTRA_DIST = \
$(MITSHM_SRCS) \

View File

@@ -38,39 +38,41 @@ from The Open Group.
#include "extnsionst.h"
#include <X11/extensions/bigreqsproto.h>
#include "opaque.h"
#include "extinit.h"
#include "modinit.h"
void BigReqExtensionInit(INITARGS);
static int
ProcBigReqDispatch(ClientPtr client)
ProcBigReqDispatch (ClientPtr client)
{
REQUEST(xBigReqEnableReq);
xBigReqEnableReply rep;
int n;
if (client->swapped) {
swaps(&stuff->length);
swaps(&stuff->length, n);
}
if (stuff->brReqType != X_BigReqEnable)
return BadRequest;
return BadRequest;
REQUEST_SIZE_MATCH(xBigReqEnableReq);
client->big_requests = TRUE;
rep = (xBigReqEnableReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.max_request_size = maxBigRequestSize
};
memset(&rep, 0, sizeof(xBigReqEnableReply));
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.max_request_size = maxBigRequestSize;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.max_request_size);
swaps(&rep.sequenceNumber, n);
swapl(&rep.max_request_size, n);
}
WriteToClient(client, sizeof(xBigReqEnableReply), &rep);
WriteToClient(client, sizeof(xBigReqEnableReply), (char *)&rep);
return Success;
}
void
BigReqExtensionInit(void)
BigReqExtensionInit(INITARGS)
{
AddExtension(XBigReqExtensionName, 0, 0,
ProcBigReqDispatch, ProcBigReqDispatch,
NULL, StandardMinorOpcode);
ProcBigReqDispatch, ProcBigReqDispatch,
NULL, StandardMinorOpcode);
}

View File

@@ -14,14 +14,14 @@ all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of Digital Equipment Corporation
Except as contained in this notice, the name of Digital Equipment Corporation
shall not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from Digital
dealings in this Software without prior written authorization from Digital
Equipment Corporation.
******************************************************************/
@@ -39,99 +39,28 @@ Equipment Corporation.
#include "opaque.h"
#include <X11/extensions/dpmsproto.h>
#include "dpmsproc.h"
#include "extinit.h"
#include "scrnintstr.h"
#include "windowstr.h"
CARD16 DPMSPowerLevel = 0;
Bool DPMSDisabledSwitch = FALSE;
CARD32 DPMSStandbyTime = -1;
CARD32 DPMSSuspendTime = -1;
CARD32 DPMSOffTime = -1;
Bool DPMSEnabled;
Bool
DPMSSupported(void)
{
int i;
/* For each screen, check if DPMS is supported */
for (i = 0; i < screenInfo.numScreens; i++)
if (screenInfo.screens[i]->DPMS != NULL)
return TRUE;
for (i = 0; i < screenInfo.numGPUScreens; i++)
if (screenInfo.gpuscreens[i]->DPMS != NULL)
return TRUE;
return FALSE;
}
static Bool
isUnblank(int mode)
{
switch (mode) {
case SCREEN_SAVER_OFF:
case SCREEN_SAVER_FORCER:
return TRUE;
case SCREEN_SAVER_ON:
case SCREEN_SAVER_CYCLE:
return FALSE;
default:
return TRUE;
}
}
int
DPMSSet(ClientPtr client, int level)
{
int rc, i;
DPMSPowerLevel = level;
if (level != DPMSModeOn) {
if (isUnblank(screenIsSaved)) {
rc = dixSaveScreens(client, SCREEN_SAVER_FORCER, ScreenSaverActive);
if (rc != Success)
return rc;
}
} else if (!isUnblank(screenIsSaved)) {
rc = dixSaveScreens(client, SCREEN_SAVER_OFF, ScreenSaverReset);
if (rc != Success)
return rc;
}
for (i = 0; i < screenInfo.numScreens; i++)
if (screenInfo.screens[i]->DPMS != NULL)
screenInfo.screens[i]->DPMS(screenInfo.screens[i], level);
for (i = 0; i < screenInfo.numGPUScreens; i++)
if (screenInfo.gpuscreens[i]->DPMS != NULL)
screenInfo.gpuscreens[i]->DPMS(screenInfo.gpuscreens[i], level);
return Success;
}
#include "modinit.h"
static int
ProcDPMSGetVersion(ClientPtr client)
{
/* REQUEST(xDPMSGetVersionReq); */
xDPMSGetVersionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.majorVersion = DPMSMajorVersion,
.minorVersion = DPMSMinorVersion
};
xDPMSGetVersionReply rep;
int n;
REQUEST_SIZE_MATCH(xDPMSGetVersionReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.majorVersion = DPMSMajorVersion;
rep.minorVersion = DPMSMinorVersion;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.majorVersion);
swaps(&rep.minorVersion);
swaps(&rep.sequenceNumber, n);
swaps(&rep.majorVersion, n);
swaps(&rep.minorVersion, n);
}
WriteToClient(client, sizeof(xDPMSGetVersionReply), &rep);
WriteToClient(client, sizeof(xDPMSGetVersionReply), (char *)&rep);
return Success;
}
@@ -139,19 +68,20 @@ static int
ProcDPMSCapable(ClientPtr client)
{
/* REQUEST(xDPMSCapableReq); */
xDPMSCapableReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.capable = TRUE
};
xDPMSCapableReply rep;
int n;
REQUEST_SIZE_MATCH(xDPMSCapableReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.capable = DPMSCapableFlag;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.sequenceNumber, n);
}
WriteToClient(client, sizeof(xDPMSCapableReply), &rep);
WriteToClient(client, sizeof(xDPMSCapableReply), (char *)&rep);
return Success;
}
@@ -159,24 +89,25 @@ static int
ProcDPMSGetTimeouts(ClientPtr client)
{
/* REQUEST(xDPMSGetTimeoutsReq); */
xDPMSGetTimeoutsReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.standby = DPMSStandbyTime / MILLI_PER_SECOND,
.suspend = DPMSSuspendTime / MILLI_PER_SECOND,
.off = DPMSOffTime / MILLI_PER_SECOND
};
xDPMSGetTimeoutsReply rep;
int n;
REQUEST_SIZE_MATCH(xDPMSGetTimeoutsReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.standby = DPMSStandbyTime / MILLI_PER_SECOND;
rep.suspend = DPMSSuspendTime / MILLI_PER_SECOND;
rep.off = DPMSOffTime / MILLI_PER_SECOND;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.standby);
swaps(&rep.suspend);
swaps(&rep.off);
swaps(&rep.sequenceNumber, n);
swaps(&rep.standby, n);
swaps(&rep.suspend, n);
swaps(&rep.off, n);
}
WriteToClient(client, sizeof(xDPMSGetTimeoutsReply), &rep);
WriteToClient(client, sizeof(xDPMSGetTimeoutsReply), (char *)&rep);
return Success;
}
@@ -187,14 +118,16 @@ ProcDPMSSetTimeouts(ClientPtr client)
REQUEST_SIZE_MATCH(xDPMSSetTimeoutsReq);
if ((stuff->off != 0) && (stuff->off < stuff->suspend)) {
client->errorValue = stuff->off;
return BadValue;
}
if ((stuff->suspend != 0) && (stuff->suspend < stuff->standby)) {
client->errorValue = stuff->suspend;
return BadValue;
if ((stuff->off != 0)&&(stuff->off < stuff->suspend))
{
client->errorValue = stuff->off;
return BadValue;
}
if ((stuff->suspend != 0)&&(stuff->suspend < stuff->standby))
{
client->errorValue = stuff->suspend;
return BadValue;
}
DPMSStandbyTime = stuff->standby * MILLI_PER_SECOND;
DPMSSuspendTime = stuff->suspend * MILLI_PER_SECOND;
@@ -211,9 +144,11 @@ ProcDPMSEnable(ClientPtr client)
REQUEST_SIZE_MATCH(xDPMSEnableReq);
DPMSEnabled = TRUE;
if (!was_enabled)
SetScreenSaverTimer();
if (DPMSCapableFlag) {
DPMSEnabled = TRUE;
if (!was_enabled)
SetScreenSaverTimer();
}
return Success;
}
@@ -240,13 +175,14 @@ ProcDPMSForceLevel(ClientPtr client)
REQUEST_SIZE_MATCH(xDPMSForceLevelReq);
if (!DPMSEnabled)
return BadMatch;
return BadMatch;
if (stuff->level != DPMSModeOn &&
stuff->level != DPMSModeStandby &&
stuff->level != DPMSModeSuspend && stuff->level != DPMSModeOff) {
client->errorValue = stuff->level;
return BadValue;
stuff->level != DPMSModeSuspend &&
stuff->level != DPMSModeOff) {
client->errorValue = stuff->level;
return BadValue;
}
DPMSSet(client, stuff->level);
@@ -258,194 +194,186 @@ static int
ProcDPMSInfo(ClientPtr client)
{
/* REQUEST(xDPMSInfoReq); */
xDPMSInfoReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.power_level = DPMSPowerLevel,
.state = DPMSEnabled
};
xDPMSInfoReply rep;
int n;
REQUEST_SIZE_MATCH(xDPMSInfoReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.power_level = DPMSPowerLevel;
rep.state = DPMSEnabled;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.power_level);
swaps(&rep.sequenceNumber, n);
swaps(&rep.power_level, n);
}
WriteToClient(client, sizeof(xDPMSInfoReply), &rep);
WriteToClient(client, sizeof(xDPMSInfoReply), (char *)&rep);
return Success;
}
static int
ProcDPMSDispatch(ClientPtr client)
ProcDPMSDispatch (ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
switch (stuff->data)
{
case X_DPMSGetVersion:
return ProcDPMSGetVersion(client);
return ProcDPMSGetVersion(client);
case X_DPMSCapable:
return ProcDPMSCapable(client);
return ProcDPMSCapable(client);
case X_DPMSGetTimeouts:
return ProcDPMSGetTimeouts(client);
return ProcDPMSGetTimeouts(client);
case X_DPMSSetTimeouts:
return ProcDPMSSetTimeouts(client);
return ProcDPMSSetTimeouts(client);
case X_DPMSEnable:
return ProcDPMSEnable(client);
return ProcDPMSEnable(client);
case X_DPMSDisable:
return ProcDPMSDisable(client);
return ProcDPMSDisable(client);
case X_DPMSForceLevel:
return ProcDPMSForceLevel(client);
return ProcDPMSForceLevel(client);
case X_DPMSInfo:
return ProcDPMSInfo(client);
return ProcDPMSInfo(client);
default:
return BadRequest;
return BadRequest;
}
}
static int _X_COLD
static int
SProcDPMSGetVersion(ClientPtr client)
{
int n;
REQUEST(xDPMSGetVersionReq);
swaps(&stuff->length);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xDPMSGetVersionReq);
swaps(&stuff->majorVersion);
swaps(&stuff->minorVersion);
swaps(&stuff->majorVersion, n);
swaps(&stuff->minorVersion, n);
return ProcDPMSGetVersion(client);
}
static int _X_COLD
static int
SProcDPMSCapable(ClientPtr client)
{
REQUEST(xDPMSCapableReq);
int n;
swaps(&stuff->length);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xDPMSCapableReq);
return ProcDPMSCapable(client);
}
static int _X_COLD
static int
SProcDPMSGetTimeouts(ClientPtr client)
{
REQUEST(xDPMSGetTimeoutsReq);
int n;
swaps(&stuff->length);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xDPMSGetTimeoutsReq);
return ProcDPMSGetTimeouts(client);
}
static int _X_COLD
static int
SProcDPMSSetTimeouts(ClientPtr client)
{
REQUEST(xDPMSSetTimeoutsReq);
int n;
swaps(&stuff->length);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xDPMSSetTimeoutsReq);
swaps(&stuff->standby);
swaps(&stuff->suspend);
swaps(&stuff->off);
swaps(&stuff->standby, n);
swaps(&stuff->suspend, n);
swaps(&stuff->off, n);
return ProcDPMSSetTimeouts(client);
}
static int _X_COLD
static int
SProcDPMSEnable(ClientPtr client)
{
REQUEST(xDPMSEnableReq);
int n;
swaps(&stuff->length);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xDPMSEnableReq);
return ProcDPMSEnable(client);
}
static int _X_COLD
static int
SProcDPMSDisable(ClientPtr client)
{
REQUEST(xDPMSDisableReq);
int n;
swaps(&stuff->length);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xDPMSDisableReq);
return ProcDPMSDisable(client);
}
static int _X_COLD
static int
SProcDPMSForceLevel(ClientPtr client)
{
REQUEST(xDPMSForceLevelReq);
int n;
swaps(&stuff->length);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xDPMSForceLevelReq);
swaps(&stuff->level);
swaps(&stuff->level, n);
return ProcDPMSForceLevel(client);
}
static int _X_COLD
static int
SProcDPMSInfo(ClientPtr client)
{
REQUEST(xDPMSInfoReq);
int n;
swaps(&stuff->length);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xDPMSInfoReq);
return ProcDPMSInfo(client);
}
static int _X_COLD
SProcDPMSDispatch(ClientPtr client)
static int
SProcDPMSDispatch (ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
switch (stuff->data)
{
case X_DPMSGetVersion:
return SProcDPMSGetVersion(client);
return SProcDPMSGetVersion(client);
case X_DPMSCapable:
return SProcDPMSCapable(client);
return SProcDPMSCapable(client);
case X_DPMSGetTimeouts:
return SProcDPMSGetTimeouts(client);
return SProcDPMSGetTimeouts(client);
case X_DPMSSetTimeouts:
return SProcDPMSSetTimeouts(client);
return SProcDPMSSetTimeouts(client);
case X_DPMSEnable:
return SProcDPMSEnable(client);
return SProcDPMSEnable(client);
case X_DPMSDisable:
return SProcDPMSDisable(client);
return SProcDPMSDisable(client);
case X_DPMSForceLevel:
return SProcDPMSForceLevel(client);
return SProcDPMSForceLevel(client);
case X_DPMSInfo:
return SProcDPMSInfo(client);
return SProcDPMSInfo(client);
default:
return BadRequest;
return BadRequest;
}
}
static void
DPMSCloseDownExtension(ExtensionEntry *e)
{
DPMSSet(serverClient, DPMSModeOn);
}
void
DPMSExtensionInit(void)
DPMSExtensionInit(INITARGS)
{
#define CONDITIONALLY_SET_DPMS_TIMEOUT(_timeout_value_) \
if (_timeout_value_ == -1) { /* not yet set from config */ \
_timeout_value_ = ScreenSaverTime; \
}
CONDITIONALLY_SET_DPMS_TIMEOUT(DPMSStandbyTime)
CONDITIONALLY_SET_DPMS_TIMEOUT(DPMSSuspendTime)
CONDITIONALLY_SET_DPMS_TIMEOUT(DPMSOffTime)
DPMSPowerLevel = DPMSModeOn;
DPMSEnabled = DPMSSupported();
if (DPMSEnabled)
AddExtension(DPMSExtensionName, 0, 0,
ProcDPMSDispatch, SProcDPMSDispatch,
DPMSCloseDownExtension, StandardMinorOpcode);
AddExtension(DPMSExtensionName, 0, 0,
ProcDPMSDispatch, SProcDPMSDispatch,
NULL, StandardMinorOpcode);
}

View File

@@ -9,14 +9,7 @@
#include "dixstruct.h"
extern int DPMSSet(ClientPtr client, int level);
extern Bool DPMSSupported(void);
extern CARD32 DPMSStandbyTime;
extern CARD32 DPMSSuspendTime;
extern CARD32 DPMSOffTime;
extern CARD16 DPMSPowerLevel;
extern Bool DPMSEnabled;
extern Bool DPMSDisabledSwitch;
int DPMSSet(ClientPtr client, int level);
Bool DPMSSupported(void);
#endif

45
Xext/dpmsstubs.c Normal file
View File

@@ -0,0 +1,45 @@
/*****************************************************************
Copyright (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of Digital Equipment Corporation
shall not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from Digital
Equipment Corporation.
******************************************************************/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "dpmsproc.h"
#define FALSE 0
Bool DPMSSupported(void)
{
return FALSE;
}
int DPMSSet(ClientPtr client, int level)
{
return Success;
}

View File

@@ -32,21 +32,23 @@
#include "geint.h"
#include "geext.h"
#include "protocol-versions.h"
#include "extinit.h"
DevPrivateKeyRec GEClientPrivateKeyRec;
int RT_GECLIENT = 0;
GEExtension GEExtensions[MAXEXTENSIONS];
/* Major available requests */
static const int version_requests[] = {
X_GEQueryVersion, /* before client sends QueryVersion */
X_GEQueryVersion, /* must be set to last request in version 1 */
X_GEQueryVersion, /* before client sends QueryVersion */
X_GEQueryVersion, /* must be set to last request in version 1 */
};
/* Forward declarations */
static void SGEGenericEvent(xEvent *from, xEvent *to);
static void SGEGenericEvent(xEvent* from, xEvent* to);
#define NUM_VERSION_REQUESTS (sizeof (version_requests) / sizeof (version_requests[0]))
#define EXT_MASK(ext) ((ext) & 0x7F)
/************************************************************/
@@ -56,64 +58,65 @@ static void SGEGenericEvent(xEvent *from, xEvent *to);
static int
ProcGEQueryVersion(ClientPtr client)
{
int n;
GEClientInfoPtr pGEClient = GEGetClient(client);
xGEQueryVersionReply rep;
REQUEST(xGEQueryVersionReq);
REQUEST_SIZE_MATCH(xGEQueryVersionReq);
rep = (xGEQueryVersionReply) {
.repType = X_Reply,
.RepType = X_GEQueryVersion,
.sequenceNumber = client->sequence,
.length = 0,
rep.repType = X_Reply;
rep.RepType = X_GEQueryVersion;
rep.length = 0;
rep.sequenceNumber = client->sequence;
/* return the supported version by the server */
.majorVersion = SERVER_GE_MAJOR_VERSION,
.minorVersion = SERVER_GE_MINOR_VERSION
};
/* return the supported version by the server */
rep.majorVersion = SERVER_GE_MAJOR_VERSION;
rep.minorVersion = SERVER_GE_MINOR_VERSION;
/* Remember version the client requested */
pGEClient->major_version = stuff->majorVersion;
pGEClient->minor_version = stuff->minorVersion;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.majorVersion);
swaps(&rep.minorVersion);
if (client->swapped)
{
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
swaps(&rep.majorVersion, n);
swaps(&rep.minorVersion, n);
}
WriteToClient(client, sizeof(xGEQueryVersionReply), &rep);
WriteToClient(client, sizeof(xGEQueryVersionReply), (char*)&rep);
return Success;
}
static int (*ProcGEVector[GENumberRequests]) (ClientPtr) = {
int (*ProcGEVector[GENumberRequests])(ClientPtr) = {
/* Version 1.0 */
ProcGEQueryVersion,
ProcGEQueryVersion
};
/************************************************************/
/* swapped request handlers */
/************************************************************/
static int _X_COLD
static int
SProcGEQueryVersion(ClientPtr client)
{
int n;
REQUEST(xGEQueryVersionReq);
swaps(&stuff->length);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xGEQueryVersionReq);
swaps(&stuff->majorVersion);
swaps(&stuff->minorVersion);
return (*ProcGEVector[stuff->ReqType]) (client);
swaps(&stuff->majorVersion, n);
swaps(&stuff->minorVersion, n);
return(*ProcGEVector[stuff->ReqType])(client);
}
static int (*SProcGEVector[GENumberRequests]) (ClientPtr) = {
int (*SProcGEVector[GENumberRequests])(ClientPtr) = {
/* Version 1.0 */
SProcGEQueryVersion
};
/************************************************************/
/* callbacks */
/************************************************************/
@@ -123,31 +126,50 @@ static int
ProcGEDispatch(ClientPtr client)
{
GEClientInfoPtr pGEClient = GEGetClient(client);
REQUEST(xGEReq);
if (pGEClient->major_version >= ARRAY_SIZE(version_requests))
if (pGEClient->major_version >= NUM_VERSION_REQUESTS)
return BadRequest;
if (stuff->ReqType > version_requests[pGEClient->major_version])
return BadRequest;
return (ProcGEVector[stuff->ReqType]) (client);
return (ProcGEVector[stuff->ReqType])(client);
}
/* dispatch swapped requests */
static int _X_COLD
static int
SProcGEDispatch(ClientPtr client)
{
REQUEST(xGEReq);
if (stuff->ReqType >= GENumberRequests)
return BadRequest;
return (*SProcGEVector[stuff->ReqType]) (client);
return (*SProcGEVector[stuff->ReqType])(client);
}
/**
* Called when a new client inits a connection to the X server.
*
* We alloc a simple struct to store the client's major/minor version. Can be
* used in the furture for versioning support.
*/
static void
GEClientCallback(CallbackListPtr *list,
pointer closure,
pointer data)
{
NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
ClientPtr pClient = clientinfo->client;
GEClientInfoPtr pGEClient = GEGetClient(pClient);
pGEClient->major_version = 0;
pGEClient->minor_version = 0;
}
/* Reset extension. Called on server shutdown. */
static void
GEResetProc(ExtensionEntry * extEntry)
GEResetProc(ExtensionEntry *extEntry)
{
DeleteCallback(&ClientStateCallback, GEClientCallback, 0);
EventSwapVector[GenericEvent] = NotImplemented;
}
@@ -158,13 +180,14 @@ GEResetProc(ExtensionEntry * extEntry)
* written on the wire, this one calls the registered swap function to do the
* work.
*/
static void _X_COLD
SGEGenericEvent(xEvent *from, xEvent *to)
static void
SGEGenericEvent(xEvent* from, xEvent* to)
{
xGenericEvent *gefrom = (xGenericEvent *) from;
xGenericEvent *geto = (xGenericEvent *) to;
xGenericEvent* gefrom = (xGenericEvent*)from;
xGenericEvent* geto = (xGenericEvent*)to;
if ((gefrom->extension & 0x7f) > MAXEXTENSIONS) {
if ((gefrom->extension & 0x7f) > MAXEXTENSIONS)
{
ErrorF("GE: Invalid extension offset for event.\n");
return;
}
@@ -182,19 +205,23 @@ GEExtensionInit(void)
{
ExtensionEntry *extEntry;
if (!dixRegisterPrivateKey
(&GEClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(GEClientInfoRec)))
if (!dixRegisterPrivateKey(&GEClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(GEClientInfoRec)))
FatalError("GEExtensionInit: GE private request failed.\n");
if ((extEntry = AddExtension(GE_NAME,
0, GENumberErrors,
ProcGEDispatch, SProcGEDispatch,
GEResetProc, StandardMinorOpcode)) != 0) {
if(!AddCallback(&ClientStateCallback, GEClientCallback, 0))
{
FatalError("GEExtensionInit: register client callback failed.\n");
}
if((extEntry = AddExtension(GE_NAME,
0, GENumberErrors,
ProcGEDispatch, SProcGEDispatch,
GEResetProc, StandardMinorOpcode)) != 0)
{
memset(GEExtensions, 0, sizeof(GEExtensions));
EventSwapVector[GenericEvent] = (EventSwapPtr) SGEGenericEvent;
}
else {
} else {
FatalError("GEInit: AddExtensions failed.\n");
}
@@ -213,22 +240,24 @@ GEExtensionInit(void)
*/
void
GERegisterExtension(int extension,
void (*ev_swap) (xGenericEvent *from, xGenericEvent *to))
void (*ev_swap)(xGenericEvent* from, xGenericEvent* to))
{
if (EXT_MASK(extension) >= MAXEXTENSIONS)
if (EXT_MASK(extension) >= MAXEXTENSIONS)
FatalError("GE: extension > MAXEXTENSIONS. This should not happen.\n");
/* extension opcodes are > 128, might as well save some space here */
GEExtensions[EXT_MASK(extension)].evswap = ev_swap;
}
/* Sets type and extension field for a generic event. This is just an
* auxiliary function, extensions could do it manually too.
*/
void
GEInitEvent(xGenericEvent *ev, int extension)
GEInitEvent(xGenericEvent* ev, int extension)
{
ev->type = GenericEvent;
ev->extension = extension;
ev->length = 0;
}

View File

@@ -37,9 +37,10 @@ from the author.
/** Struct to keep information about registered extensions */
typedef struct _GEExtension {
/** Event swapping routine */
void (*evswap) (xGenericEvent *from, xGenericEvent *to);
void (*evswap)(xGenericEvent* from, xGenericEvent* to);
} GEExtension, *GEExtensionPtr;
/* All registered extensions and their handling functions. */
extern _X_EXPORT GEExtension GEExtensions[MAXEXTENSIONS];
@@ -69,13 +70,14 @@ extern _X_EXPORT GEExtension GEExtensions[MAXEXTENSIONS];
GEEXT(ev) == (ext) && \
GEV(ev)->evtype == (ev_type))
/* Interface for other extensions */
extern _X_EXPORT void GERegisterExtension(int extension,
void (*ev_dispatch) (xGenericEvent
*from,
xGenericEvent
*to));
extern _X_EXPORT void GERegisterExtension(
int extension,
void (*ev_dispatch)(xGenericEvent* from, xGenericEvent* to));
extern _X_EXPORT void GEInitEvent(xGenericEvent *ev, int extension);
extern _X_EXPORT void GEInitEvent(xGenericEvent* ev, int extension);
#endif /* _GEEXT_H_ */
extern _X_EXPORT void GEExtensionInit(void);
#endif /* _GEEXT_H_ */

View File

@@ -37,15 +37,17 @@
#include "extnsionst.h"
#include <X11/extensions/geproto.h>
extern DevPrivateKeyRec GEClientPrivateKeyRec;
extern _X_EXPORT DevPrivateKeyRec GEClientPrivateKeyRec;
#define GEClientPrivateKey (&GEClientPrivateKeyRec)
typedef struct _GEClientInfo {
CARD32 major_version;
CARD32 minor_version;
CARD32 major_version;
CARD32 minor_version;
} GEClientInfoRec, *GEClientInfoPtr;
#define GEGetClient(pClient) ((GEClientInfoPtr)(dixLookupPrivate(&((pClient)->devPrivates), GEClientPrivateKey)))
#endif /* _GEINT_H_ */
extern _X_EXPORT int (*ProcGEVector[/*GENumRequests*/])(ClientPtr);
extern _X_EXPORT int (*SProcGEVector[/*GENumRequests*/])(ClientPtr);
#endif /* _GEINT_H_ */

View File

@@ -1,298 +0,0 @@
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <stdlib.h>
#include "misc.h"
#include "hashtable.h"
/* HashResourceID */
#include "resource.h"
#define INITHASHSIZE 6
#define MAXHASHSIZE 11
struct HashTableRec {
int keySize;
int dataSize;
int elements; /* number of elements inserted */
int bucketBits; /* number of buckets is 1 << bucketBits */
struct xorg_list *buckets; /* array of bucket list heads */
HashFunc hash;
HashCompareFunc compare;
void *cdata;
};
typedef struct {
struct xorg_list l;
void *key;
void *data;
} BucketRec, *BucketPtr;
HashTable
ht_create(int keySize,
int dataSize,
HashFunc hash,
HashCompareFunc compare,
void *cdata)
{
int c;
int numBuckets;
HashTable ht = malloc(sizeof(struct HashTableRec));
if (!ht) {
return NULL;
}
ht->keySize = keySize;
ht->dataSize = dataSize;
ht->hash = hash;
ht->compare = compare;
ht->elements = 0;
ht->bucketBits = INITHASHSIZE;
numBuckets = 1 << ht->bucketBits;
ht->buckets = xallocarray(numBuckets, sizeof(*ht->buckets));
ht->cdata = cdata;
if (ht->buckets) {
for (c = 0; c < numBuckets; ++c) {
xorg_list_init(&ht->buckets[c]);
}
return ht;
} else {
free(ht);
return NULL;
}
}
void
ht_destroy(HashTable ht)
{
int c;
BucketPtr it, tmp;
int numBuckets = 1 << ht->bucketBits;
for (c = 0; c < numBuckets; ++c) {
xorg_list_for_each_entry_safe(it, tmp, &ht->buckets[c], l) {
xorg_list_del(&it->l);
free(it->key);
free(it->data);
free(it);
}
}
free(ht->buckets);
free(ht);
}
static Bool
double_size(HashTable ht)
{
struct xorg_list *newBuckets;
int numBuckets = 1 << ht->bucketBits;
int newBucketBits = ht->bucketBits + 1;
int newNumBuckets = 1 << newBucketBits;
int c;
newBuckets = xallocarray(newNumBuckets, sizeof(*ht->buckets));
if (newBuckets) {
for (c = 0; c < newNumBuckets; ++c) {
xorg_list_init(&newBuckets[c]);
}
for (c = 0; c < numBuckets; ++c) {
BucketPtr it, tmp;
xorg_list_for_each_entry_safe(it, tmp, &ht->buckets[c], l) {
struct xorg_list *newBucket =
&newBuckets[ht->hash(ht->cdata, it->key, newBucketBits)];
xorg_list_del(&it->l);
xorg_list_add(&it->l, newBucket);
}
}
free(ht->buckets);
ht->buckets = newBuckets;
ht->bucketBits = newBucketBits;
return TRUE;
} else {
return FALSE;
}
}
void *
ht_add(HashTable ht, const void *key)
{
unsigned index = ht->hash(ht->cdata, key, ht->bucketBits);
struct xorg_list *bucket = &ht->buckets[index];
BucketRec *elem = calloc(1, sizeof(BucketRec));
if (!elem) {
goto outOfMemory;
}
elem->key = malloc(ht->keySize);
if (!elem->key) {
goto outOfMemory;
}
/* we avoid signaling an out-of-memory error if dataSize is 0 */
elem->data = calloc(1, ht->dataSize);
if (ht->dataSize && !elem->data) {
goto outOfMemory;
}
xorg_list_add(&elem->l, bucket);
++ht->elements;
memcpy(elem->key, key, ht->keySize);
if (ht->elements > 4 * (1 << ht->bucketBits) &&
ht->bucketBits < MAXHASHSIZE) {
if (!double_size(ht)) {
--ht->elements;
xorg_list_del(&elem->l);
goto outOfMemory;
}
}
/* if memory allocation has failed due to dataSize being 0, return
a "dummy" pointer pointing at the of the key */
return elem->data ? elem->data : ((char*) elem->key + ht->keySize);
outOfMemory:
if (elem) {
free(elem->key);
free(elem->data);
free(elem);
}
return NULL;
}
void
ht_remove(HashTable ht, const void *key)
{
unsigned index = ht->hash(ht->cdata, key, ht->bucketBits);
struct xorg_list *bucket = &ht->buckets[index];
BucketPtr it;
xorg_list_for_each_entry(it, bucket, l) {
if (ht->compare(ht->cdata, key, it->key) == 0) {
xorg_list_del(&it->l);
--ht->elements;
free(it->key);
free(it->data);
free(it);
return;
}
}
}
void *
ht_find(HashTable ht, const void *key)
{
unsigned index = ht->hash(ht->cdata, key, ht->bucketBits);
struct xorg_list *bucket = &ht->buckets[index];
BucketPtr it;
xorg_list_for_each_entry(it, bucket, l) {
if (ht->compare(ht->cdata, key, it->key) == 0) {
return it->data ? it->data : ((char*) it->key + ht->keySize);
}
}
return NULL;
}
void
ht_dump_distribution(HashTable ht)
{
int c;
int numBuckets = 1 << ht->bucketBits;
for (c = 0; c < numBuckets; ++c) {
BucketPtr it;
int n = 0;
xorg_list_for_each_entry(it, &ht->buckets[c], l) {
++n;
}
printf("%d: %d\n", c, n);
}
}
/* Picked the function from http://burtleburtle.net/bob/hash/doobs.html by
Bob Jenkins, which is released in public domain */
static CARD32
one_at_a_time_hash(const void *data, int len)
{
CARD32 hash;
int i;
const char *key = data;
for (hash=0, i=0; i<len; ++i) {
hash += key[i];
hash += (hash << 10);
hash ^= (hash >> 6);
}
hash += (hash << 3);
hash ^= (hash >> 11);
hash += (hash << 15);
return hash;
}
unsigned
ht_generic_hash(void *cdata, const void *ptr, int numBits)
{
HtGenericHashSetupPtr setup = cdata;
return one_at_a_time_hash(ptr, setup->keySize) & ~((~0) << numBits);
}
int
ht_generic_compare(void *cdata, const void *l, const void *r)
{
HtGenericHashSetupPtr setup = cdata;
return memcmp(l, r, setup->keySize);
}
unsigned
ht_resourceid_hash(void * cdata, const void * data, int numBits)
{
const XID* idPtr = data;
XID id = *idPtr & RESOURCE_ID_MASK;
(void) cdata;
return HashResourceID(id, numBits);
}
int
ht_resourceid_compare(void* cdata, const void* a, const void* b)
{
const XID* xa = a;
const XID* xb = b;
(void) cdata;
return
*xa < *xb ? -1 :
*xa > *xb ? 1 :
0;
}
void
ht_dump_contents(HashTable ht,
void (*print_key)(void *opaque, void *key),
void (*print_value)(void *opaque, void *value),
void* opaque)
{
int c;
int numBuckets = 1 << ht->bucketBits;
for (c = 0; c < numBuckets; ++c) {
BucketPtr it;
int n = 0;
printf("%d: ", c);
xorg_list_for_each_entry(it, &ht->buckets[c], l) {
if (n > 0) {
printf(", ");
}
print_key(opaque, it->key);
printf("->");
print_value(opaque, it->data);
++n;
}
printf("\n");
}
}

View File

@@ -1,137 +0,0 @@
#ifndef HASHTABLE_H
#define HASHTABLE_H 1
#include <dix-config.h>
#include <X11/Xfuncproto.h>
#include <X11/Xdefs.h>
#include "list.h"
/** @brief A hashing function.
@param[in/out] cdata Opaque data that can be passed to HtInit that will
eventually end up here
@param[in] ptr The data to be hashed. The size of the data, if
needed, can be configured via a record that can be
passed via cdata.
@param[in] numBits The number of bits this hash needs to have in the
resulting hash
@return A numBits-bit hash of the data
*/
typedef unsigned (*HashFunc)(void * cdata, const void * ptr, int numBits);
/** @brief A comparison function for hashed keys.
@param[in/out] cdata Opaque data that ca be passed to Htinit that will
eventually end up here
@param[in] l The left side data to be compared
@param[in] r The right side data to be compared
@return -1 if l < r, 0 if l == r, 1 if l > r
*/
typedef int (*HashCompareFunc)(void * cdata, const void * l, const void * r);
struct HashTableRec;
typedef struct HashTableRec *HashTable;
/** @brief A configuration for HtGenericHash */
typedef struct {
int keySize;
} HtGenericHashSetupRec, *HtGenericHashSetupPtr;
/** @brief ht_create initalizes a hash table for a certain hash table
configuration
@param[out] ht The hash table structure to initialize
@param[in] keySize The key size in bytes
@param[in] dataSize The data size in bytes
@param[in] hash The hash function to use for hashing keys
@param[in] compare The comparison function for hashing keys
@param[in] cdata Opaque data that will be passed to hash and
comparison functions
*/
extern _X_EXPORT HashTable ht_create(int keySize,
int dataSize,
HashFunc hash,
HashCompareFunc compare,
void *cdata);
/** @brief HtDestruct deinitializes the structure. It does not free the
memory allocated to HashTableRec
*/
extern _X_EXPORT void ht_destroy(HashTable ht);
/** @brief Adds a new key to the hash table. The key will be copied
and a pointer to the value will be returned. The data will
be initialized with zeroes.
@param[in/out] ht The hash table
@param[key] key The key. The contents of the key will be copied.
@return On error NULL is returned, otherwise a pointer to the data
associated with the newly inserted key.
@note If dataSize is 0, a pointer to the end of the key may be returned
to avoid returning NULL. Obviously the data pointed cannot be
modified, as implied by dataSize being 0.
*/
extern _X_EXPORT void *ht_add(HashTable ht, const void *key);
/** @brief Removes a key from the hash table along with its
associated data, which will be free'd.
*/
extern _X_EXPORT void ht_remove(HashTable ht, const void *key);
/** @brief Finds the associated data of a key from the hash table.
@return If the key cannot be found, the function returns NULL.
Otherwise it returns a pointer to the data associated
with the key.
@note If dataSize == 0, this function may return NULL
even if the key has been inserted! If dataSize == NULL,
use HtMember instead to determine if a key has been
inserted.
*/
extern _X_EXPORT void *ht_find(HashTable ht, const void *key);
/** @brief A generic hash function */
extern _X_EXPORT unsigned ht_generic_hash(void *cdata,
const void *ptr,
int numBits);
/** @brief A generic comparison function. It compares data byte-wise. */
extern _X_EXPORT int ht_generic_compare(void *cdata,
const void *l,
const void *r);
/** @brief A debugging function that dumps the distribution of the
hash table: for each bucket, list the number of elements
contained within. */
extern _X_EXPORT void ht_dump_distribution(HashTable ht);
/** @brief A debugging function that dumps the contents of the hash
table: for each bucket, list the elements contained
within. */
extern _X_EXPORT void ht_dump_contents(HashTable ht,
void (*print_key)(void *opaque, void *key),
void (*print_value)(void *opaque, void *value),
void* opaque);
/** @brief A hashing function to be used for hashing resource IDs when
used with HashTables. It makes no use of cdata, so that can
be NULL. It uses HashXID underneath, and should HashXID be
unable to hash the value, it switches into using the generic
hash function. */
extern _X_EXPORT unsigned ht_resourceid_hash(void *cdata,
const void * data,
int numBits);
/** @brief A comparison function to be used for comparing resource
IDs when used with HashTables. It makes no use of cdata,
so that can be NULL. */
extern _X_EXPORT int ht_resourceid_compare(void *cdata,
const void *a,
const void *b);
#endif // HASHTABLE_H

View File

@@ -1,77 +0,0 @@
srcs_xext = [
'bigreq.c',
'geext.c',
'shape.c',
'sleepuntil.c',
'sync.c',
'xcmisc.c',
'xtest.c',
]
hdrs_xext = [
'geext.h',
'geint.h',
'syncsdk.h',
]
if build_dpms
srcs_xext += 'dpms.c'
endif
if build_mitshm
srcs_xext += 'shm.c'
hdrs_xext += ['shmint.h']
endif
if build_hashtable
srcs_xext += 'hashtable.c'
endif
if build_res
srcs_xext += 'xres.c'
endif
if build_screensaver
srcs_xext += 'saver.c'
endif
if build_xace
srcs_xext += 'xace.c'
hdrs_xext += ['xace.h', 'xacestr.h']
endif
if build_xf86bigfont
srcs_xext += 'xf86bigfont.c'
endif
if build_xinerama
srcs_xext += ['panoramiX.c', 'panoramiXprocs.c', 'panoramiXSwap.c']
hdrs_xext += ['panoramiX.h', 'panoramiXsrv.h']
endif
if build_xsecurity
srcs_xext += ['security.c']
endif
if build_xselinux
srcs_xext += ['xselinux_ext.c', 'xselinux_hooks.c', 'xselinux_label.c']
endif
if build_xv
srcs_xext += ['xvmain.c', 'xvdisp.c', 'xvmc.c']
hdrs_xext += ['xvdix.h', 'xvmcext.h']
endif
libxserver_xext = static_library('libxserver_xext',
srcs_xext,
include_directories: inc,
dependencies: common_dep,
)
libxserver_xext_vidmode = static_library('libxserver_xext_vidmode',
'vidmode.c',
include_directories: inc,
dependencies: common_dep,
)
install_data(hdrs_xext, install_dir: xorgsdkdir)

File diff suppressed because it is too large Load Diff

View File

@@ -26,9 +26,10 @@ Equipment Corporation.
******************************************************************/
/* THIS IS NOT AN X PROJECT TEAM SPECIFICATION */
/*
/*
* PanoramiX definitions
*/
@@ -46,25 +47,25 @@ Equipment Corporation.
#include "dixstruct.h"
typedef struct _PanoramiXInfo {
XID id;
XID id ;
} PanoramiXInfo;
typedef struct {
PanoramiXInfo info[MAXSCREENS];
RESTYPE type;
union {
struct {
char visibility;
char class;
char root;
} win;
struct {
Bool shared;
} pix;
struct {
Bool root;
} pict;
char raw_data[4];
struct {
char visibility;
char class;
char root;
} win;
struct {
Bool shared;
} pix;
struct {
Bool root;
} pict;
char raw_data[4];
} u;
} PanoramiXRes;
@@ -76,4 +77,4 @@ typedef struct {
#define IS_SHARED_PIXMAP(r) (((r)->type == XRT_PIXMAP) && (r)->u.pix.shared)
#define IS_ROOT_DRAWABLE(d) (((d)->type == XRT_WINDOW) && (d)->u.win.root)
#endif /* _PANORAMIX_H_ */
#endif /* _PANORAMIX_H_ */

View File

@@ -47,87 +47,96 @@ Equipment Corporation.
#include "globals.h"
#include "panoramiXh.h"
static int _X_COLD
SProcPanoramiXQueryVersion(ClientPtr client)
static int
SProcPanoramiXQueryVersion (ClientPtr client)
{
REQUEST(xPanoramiXQueryVersionReq);
REQUEST(xPanoramiXQueryVersionReq);
int n;
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq);
return ProcPanoramiXQueryVersion(client);
swaps(&stuff->length,n);
REQUEST_SIZE_MATCH (xPanoramiXQueryVersionReq);
return ProcPanoramiXQueryVersion(client);
}
static int _X_COLD
static int
SProcPanoramiXGetState(ClientPtr client)
{
REQUEST(xPanoramiXGetStateReq);
REQUEST(xPanoramiXGetStateReq);
int n;
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
swapl(&stuff->window);
return ProcPanoramiXGetState(client);
swaps (&stuff->length, n);
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
swapl (&stuff->window, n);
return ProcPanoramiXGetState(client);
}
static int _X_COLD
static int
SProcPanoramiXGetScreenCount(ClientPtr client)
{
REQUEST(xPanoramiXGetScreenCountReq);
REQUEST(xPanoramiXGetScreenCountReq);
int n;
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
swapl(&stuff->window);
return ProcPanoramiXGetScreenCount(client);
swaps (&stuff->length, n);
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
swapl (&stuff->window, n);
return ProcPanoramiXGetScreenCount(client);
}
static int _X_COLD
static int
SProcPanoramiXGetScreenSize(ClientPtr client)
{
REQUEST(xPanoramiXGetScreenSizeReq);
REQUEST(xPanoramiXGetScreenSizeReq);
int n;
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
swapl(&stuff->window);
swapl(&stuff->screen);
return ProcPanoramiXGetScreenSize(client);
swaps (&stuff->length, n);
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
swapl (&stuff->window, n);
swapl (&stuff->screen, n);
return ProcPanoramiXGetScreenSize(client);
}
static int _X_COLD
static int
SProcXineramaIsActive(ClientPtr client)
{
REQUEST(xXineramaIsActiveReq);
REQUEST(xXineramaIsActiveReq);
int n;
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
return ProcXineramaIsActive(client);
swaps (&stuff->length, n);
REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
return ProcXineramaIsActive(client);
}
static int _X_COLD
static int
SProcXineramaQueryScreens(ClientPtr client)
{
REQUEST(xXineramaQueryScreensReq);
REQUEST(xXineramaQueryScreensReq);
int n;
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
return ProcXineramaQueryScreens(client);
swaps (&stuff->length, n);
REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
return ProcXineramaQueryScreens(client);
}
int _X_COLD
SProcPanoramiXDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
case X_PanoramiXQueryVersion:
return SProcPanoramiXQueryVersion(client);
case X_PanoramiXGetState:
return SProcPanoramiXGetState(client);
case X_PanoramiXGetScreenCount:
return SProcPanoramiXGetScreenCount(client);
case X_PanoramiXGetScreenSize:
return SProcPanoramiXGetScreenSize(client);
case X_XineramaIsActive:
return SProcXineramaIsActive(client);
case X_XineramaQueryScreens:
return SProcXineramaQueryScreens(client);
int
SProcPanoramiXDispatch (ClientPtr client)
{ REQUEST(xReq);
switch (stuff->data)
{
case X_PanoramiXQueryVersion:
return SProcPanoramiXQueryVersion(client);
case X_PanoramiXGetState:
return SProcPanoramiXGetState(client);
case X_PanoramiXGetScreenCount:
return SProcPanoramiXGetScreenCount(client);
case X_PanoramiXGetScreenSize:
return SProcPanoramiXGetScreenSize(client);
case X_XineramaIsActive:
return SProcXineramaIsActive(client);
case X_XineramaQueryScreens:
return SProcXineramaQueryScreens(client);
}
return BadRequest;
}

View File

@@ -16,7 +16,7 @@ extern int PanoramiXUnmapSubwindows(ClientPtr client);
extern int PanoramiXConfigureWindow(ClientPtr client);
extern int PanoramiXCirculateWindow(ClientPtr client);
extern int PanoramiXGetGeometry(ClientPtr client);
extern int PanoramiXTranslateCoords(ClientPtr client);
extern int PanoramiXTranslateCoords(ClientPtr client);
extern int PanoramiXCreatePixmap(ClientPtr client);
extern int PanoramiXFreePixmap(ClientPtr client);
extern int PanoramiXChangeGC(ClientPtr client);
@@ -40,7 +40,7 @@ extern int PanoramiXPolyFillRectangle(ClientPtr client);
extern int PanoramiXPutImage(ClientPtr client);
extern int PanoramiXGetImage(ClientPtr client);
extern int PanoramiXPolyText8(ClientPtr client);
extern int PanoramiXPolyText16(ClientPtr client);
extern int PanoramiXPolyText16(ClientPtr client);
extern int PanoramiXImageText8(ClientPtr client);
extern int PanoramiXImageText16(ClientPtr client);
extern int PanoramiXCreateColormap(ClientPtr client);
@@ -57,11 +57,11 @@ extern int PanoramiXAllocColorPlanes(ClientPtr client);
#define PROC_EXTERN(pfunc) extern int pfunc(ClientPtr)
PROC_EXTERN(ProcPanoramiXQueryVersion);
PROC_EXTERN(ProcPanoramiXGetState);
PROC_EXTERN(ProcPanoramiXGetScreenCount);
PROC_EXTERN(ProcPanoramiXGetScreenSize);
PROC_EXTERN(ProcPanoramiXQueryVersion);
PROC_EXTERN(ProcPanoramiXGetState);
PROC_EXTERN(ProcPanoramiXGetScreenCount);
PROC_EXTERN(ProcPanoramiXGetScreenSize);
PROC_EXTERN(ProcXineramaQueryScreens);
PROC_EXTERN(ProcXineramaIsActive);
@@ -70,4 +70,4 @@ extern int SProcPanoramiXDispatch(ClientPtr client);
extern int connBlockScreenStart;
extern xConnSetupPrefix connSetupPrefix;
extern int (*SavedProcVector[256]) (ClientPtr client);
extern int (* SavedProcVector[256]) (ClientPtr client);

File diff suppressed because it is too large Load Diff

View File

@@ -11,17 +11,15 @@
extern _X_EXPORT int PanoramiXNumScreens;
extern _X_EXPORT int PanoramiXPixWidth;
extern _X_EXPORT int PanoramiXPixHeight;
extern _X_EXPORT RegionRec PanoramiXScreenRegion;
extern _X_EXPORT VisualID PanoramiXTranslateVisualID(int screen, VisualID orig);
extern _X_EXPORT void PanoramiXConsolidate(void);
extern _X_EXPORT Bool PanoramiXCreateConnectionBlock(void);
extern _X_EXPORT PanoramiXRes *PanoramiXFindIDByScrnum(RESTYPE, XID, int);
extern _X_EXPORT Bool
XineramaRegisterConnectionBlockCallback(void (*func) (void));
extern _X_EXPORT int XineramaDeleteResource(void *, XID);
extern _X_EXPORT PanoramiXRes * PanoramiXFindIDByScrnum(RESTYPE, XID, int);
extern _X_EXPORT Bool XineramaRegisterConnectionBlockCallback(void (*func)(void));
extern _X_EXPORT int XineramaDeleteResource(pointer, XID);
extern _X_EXPORT void XineramaReinitData(void);
extern _X_EXPORT void XineramaReinitData(ScreenPtr);
extern _X_EXPORT RESTYPE XRC_DRAWABLE;
extern _X_EXPORT RESTYPE XRT_WINDOW;
@@ -37,20 +35,24 @@ extern _X_EXPORT RESTYPE XRT_PICTURE;
* layers agree that the visuals are equal. The first visual is always from
* screen 0.
*/
typedef Bool (*XineramaVisualsEqualProcPtr) (VisualPtr, ScreenPtr, VisualPtr);
typedef Bool (*XineramaVisualsEqualProcPtr)(VisualPtr, ScreenPtr, VisualPtr);
extern _X_EXPORT XineramaVisualsEqualProcPtr XineramaVisualsEqualPtr;
extern _X_EXPORT void XineramaGetImageData(DrawablePtr *pDrawables,
int left,
int top,
int width,
int height,
unsigned int format,
unsigned long planemask,
char *data, int pitch, Bool isRoot);
extern _X_EXPORT void XineramaGetImageData(
DrawablePtr *pDrawables,
int left,
int top,
int width,
int height,
unsigned int format,
unsigned long planemask,
char *data,
int pitch,
Bool isRoot
);
static inline void
panoramix_setup_ids(PanoramiXRes * resource, ClientPtr client, XID base_id)
static inline void panoramix_setup_ids(PanoramiXRes *resource,
ClientPtr client, XID base_id)
{
int j;
@@ -60,4 +62,4 @@ panoramix_setup_ids(PanoramiXRes * resource, ClientPtr client, XID base_id)
}
}
#endif /* _PANORAMIXSRV_H_ */
#endif /* _PANORAMIXSRV_H_ */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -32,51 +32,52 @@ from The Open Group.
/* Allow client side portions of <X11/extensions/security.h> to compile */
#ifndef Status
#define Status int
#define NEED_UNDEF_Status
# define Status int
# define NEED_UNDEF_Status
#endif
#ifndef Display
#define Display void
#define NEED_UNDEF_Display
# define Display void
# define NEED_UNDEF_Display
#endif
#include <X11/extensions/secur.h>
#ifdef NEED_UNDEF_Status
#undef Status
#undef NEED_UNDEF_Status
# undef Status
# undef NEED_UNDEF_Status
#endif
#ifdef NEED_UNDEF_Display
#undef Display
#undef NEED_UNDEF_Display
# undef Display
# undef NEED_UNDEF_Display
#endif
#include "input.h" /* for DeviceIntPtr */
#include "property.h" /* for PropertyPtr */
#include "pixmap.h" /* for DrawablePtr */
#include "resource.h" /* for RESTYPE */
#include "input.h" /* for DeviceIntPtr */
#include "property.h" /* for PropertyPtr */
#include "pixmap.h" /* for DrawablePtr */
#include "resource.h" /* for RESTYPE */
/* resource type to pass in LookupIDByType for authorizations */
extern RESTYPE SecurityAuthorizationResType;
/* this is what we store for an authorization */
typedef struct {
XID id; /* resource ID */
CARD32 timeout; /* how long to live in seconds after refcnt == 0 */
unsigned int trustLevel; /* trusted/untrusted */
XID group; /* see embedding extension */
unsigned int refcnt; /* how many clients connected with this auth */
unsigned int secondsRemaining; /* overflow time amount for >49 days */
OsTimerPtr timer; /* timer for this auth */
XID id; /* resource ID */
CARD32 timeout; /* how long to live in seconds after refcnt == 0 */
unsigned int trustLevel; /* trusted/untrusted */
XID group; /* see embedding extension */
unsigned int refcnt; /* how many clients connected with this auth */
unsigned int secondsRemaining; /* overflow time amount for >49 days */
OsTimerPtr timer; /* timer for this auth */
struct _OtherClients *eventClients; /* clients wanting events */
} SecurityAuthorizationRec, *SecurityAuthorizationPtr;
typedef struct {
XID group; /* the group that was sent in GenerateAuthorization */
Bool valid; /* did anyone recognize it? if so, set to TRUE */
XID group; /* the group that was sent in GenerateAuthorization */
Bool valid; /* did anyone recognize it? if so, set to TRUE */
} SecurityValidateGroupInfoRec;
/* Give this value or higher to the -audit option to get security messages */
#define SECURITY_AUDIT_LEVEL 4
#endif /* _SECURITY_SRV_H */
#endif /* _SECURITY_SRV_H */

File diff suppressed because it is too large Load Diff

1519
Xext/shm.c

File diff suppressed because it is too large Load Diff

View File

@@ -42,52 +42,28 @@
int /* sh */, \
int /* dx */, \
int /* dy */, \
char * /* data */
char * /* data */
#define XSHM_CREATE_PIXMAP_ARGS \
ScreenPtr /* pScreen */, \
int /* width */, \
int /* height */, \
int /* depth */, \
char * /* addr */
char * /* addr */
typedef struct _ShmFuncs {
PixmapPtr (*CreatePixmap) (XSHM_CREATE_PIXMAP_ARGS);
void (*PutImage) (XSHM_PUT_IMAGE_ARGS);
PixmapPtr (* CreatePixmap)(XSHM_CREATE_PIXMAP_ARGS);
void (* PutImage)(XSHM_PUT_IMAGE_ARGS);
} ShmFuncs, *ShmFuncsPtr;
#if XTRANS_SEND_FDS
#define SHM_FD_PASSING 1
#endif
typedef struct _ShmDesc {
struct _ShmDesc *next;
int shmid;
int refcnt;
char *addr;
Bool writable;
unsigned long size;
#ifdef SHM_FD_PASSING
Bool is_fd;
struct busfault *busfault;
XID resource;
#endif
} ShmDescRec, *ShmDescPtr;
#ifdef SHM_FD_PASSING
#define SHMDESC_IS_FD(shmdesc) ((shmdesc)->is_fd)
#else
#define SHMDESC_IS_FD(shmdesc) (0)
#endif
extern _X_EXPORT void
ShmRegisterFuncs(ScreenPtr pScreen, ShmFuncsPtr funcs);
extern _X_EXPORT void
ShmRegisterFuncs(ScreenPtr pScreen, ShmFuncsPtr funcs);
extern _X_EXPORT void
ShmRegisterFbFuncs(ScreenPtr pScreen);
ShmRegisterFbFuncs(ScreenPtr pScreen);
extern _X_EXPORT RESTYPE ShmSegType;
extern _X_EXPORT int ShmCompletionCode;
extern _X_EXPORT int BadShmSegCode;
#endif /* _SHMINT_H_ */
#endif /* _SHMINT_H_ */

View File

@@ -41,166 +41,185 @@ in this Software without prior written authorization from The Open Group.
#include "scrnintstr.h"
typedef struct _Sertafied {
struct _Sertafied *next;
TimeStamp revive;
ClientPtr pClient;
XID id;
void (*notifyFunc) (ClientPtr /* client */ ,
void * /* closure */
);
struct _Sertafied *next;
TimeStamp revive;
ClientPtr pClient;
XID id;
void (*notifyFunc)(
ClientPtr /* client */,
pointer /* closure */
);
void *closure;
pointer closure;
} SertafiedRec, *SertafiedPtr;
static SertafiedPtr pPending;
static RESTYPE SertafiedResType;
static Bool BlockHandlerRegistered;
static int SertafiedGeneration;
static RESTYPE SertafiedResType;
static Bool BlockHandlerRegistered;
static int SertafiedGeneration;
static void ClientAwaken(ClientPtr /* client */ ,
void * /* closure */
);
static int SertafiedDelete(void * /* value */ ,
XID /* id */
);
static void SertafiedBlockHandler(void *data,
void *timeout);
static void SertafiedWakeupHandler(void *data,
int i);
static void ClientAwaken(
ClientPtr /* client */,
pointer /* closure */
);
static int SertafiedDelete(
pointer /* value */,
XID /* id */
);
static void SertafiedBlockHandler(
pointer /* data */,
OSTimePtr /* wt */,
pointer /* LastSelectMask */
);
static void SertafiedWakeupHandler(
pointer /* data */,
int /* i */,
pointer /* LastSelectMask */
);
int
ClientSleepUntil(ClientPtr client,
TimeStamp *revive,
void (*notifyFunc) (ClientPtr, void *), void *closure)
ClientSleepUntil (ClientPtr client,
TimeStamp *revive,
void (*notifyFunc)(ClientPtr, pointer),
pointer closure)
{
SertafiedPtr pRequest, pReq, pPrev;
SertafiedPtr pRequest, pReq, pPrev;
if (SertafiedGeneration != serverGeneration) {
SertafiedResType = CreateNewResourceType(SertafiedDelete,
"ClientSleep");
if (!SertafiedResType)
return FALSE;
SertafiedGeneration = serverGeneration;
BlockHandlerRegistered = FALSE;
if (SertafiedGeneration != serverGeneration)
{
SertafiedResType = CreateNewResourceType (SertafiedDelete,
"ClientSleep");
if (!SertafiedResType)
return FALSE;
SertafiedGeneration = serverGeneration;
BlockHandlerRegistered = FALSE;
}
pRequest = malloc(sizeof(SertafiedRec));
pRequest = malloc(sizeof (SertafiedRec));
if (!pRequest)
return FALSE;
return FALSE;
pRequest->pClient = client;
pRequest->revive = *revive;
pRequest->id = FakeClientID(client->index);
pRequest->id = FakeClientID (client->index);
pRequest->closure = closure;
if (!BlockHandlerRegistered) {
if (!RegisterBlockAndWakeupHandlers(SertafiedBlockHandler,
SertafiedWakeupHandler,
(void *) 0)) {
free(pRequest);
return FALSE;
}
BlockHandlerRegistered = TRUE;
if (!BlockHandlerRegistered)
{
if (!RegisterBlockAndWakeupHandlers (SertafiedBlockHandler,
SertafiedWakeupHandler,
(pointer) 0))
{
free(pRequest);
return FALSE;
}
BlockHandlerRegistered = TRUE;
}
pRequest->notifyFunc = 0;
if (!AddResource(pRequest->id, SertafiedResType, (void *) pRequest))
return FALSE;
if (!AddResource (pRequest->id, SertafiedResType, (pointer) pRequest))
return FALSE;
if (!notifyFunc)
notifyFunc = ClientAwaken;
notifyFunc = ClientAwaken;
pRequest->notifyFunc = notifyFunc;
/* Insert into time-ordered queue, with earliest activation time coming first. */
pPrev = 0;
for (pReq = pPending; pReq; pReq = pReq->next) {
if (CompareTimeStamps(pReq->revive, *revive) == LATER)
break;
pPrev = pReq;
for (pReq = pPending; pReq; pReq = pReq->next)
{
if (CompareTimeStamps (pReq->revive, *revive) == LATER)
break;
pPrev = pReq;
}
if (pPrev)
pPrev->next = pRequest;
pPrev->next = pRequest;
else
pPending = pRequest;
pPending = pRequest;
pRequest->next = pReq;
IgnoreClient(client);
IgnoreClient (client);
return TRUE;
}
static void
ClientAwaken(ClientPtr client, void *closure)
ClientAwaken (ClientPtr client, pointer closure)
{
if (!client->clientGone)
AttendClient(client);
AttendClient (client);
}
static int
SertafiedDelete(void *value, XID id)
SertafiedDelete (pointer value, XID id)
{
SertafiedPtr pRequest = (SertafiedPtr) value;
SertafiedPtr pReq, pPrev;
SertafiedPtr pRequest = (SertafiedPtr)value;
SertafiedPtr pReq, pPrev;
pPrev = 0;
for (pReq = pPending; pReq; pPrev = pReq, pReq = pReq->next)
if (pReq == pRequest) {
if (pPrev)
pPrev->next = pReq->next;
else
pPending = pReq->next;
break;
}
if (pReq == pRequest)
{
if (pPrev)
pPrev->next = pReq->next;
else
pPending = pReq->next;
break;
}
if (pRequest->notifyFunc)
(*pRequest->notifyFunc) (pRequest->pClient, pRequest->closure);
(*pRequest->notifyFunc) (pRequest->pClient, pRequest->closure);
free(pRequest);
return TRUE;
}
static void
SertafiedBlockHandler(void *data, void *wt)
SertafiedBlockHandler (pointer data, OSTimePtr wt, pointer LastSelectMask)
{
SertafiedPtr pReq, pNext;
unsigned long delay;
TimeStamp now;
SertafiedPtr pReq, pNext;
unsigned long delay;
TimeStamp now;
if (!pPending)
return;
now.milliseconds = GetTimeInMillis();
return;
now.milliseconds = GetTimeInMillis ();
now.months = currentTime.months;
if ((int) (now.milliseconds - currentTime.milliseconds) < 0)
now.months++;
for (pReq = pPending; pReq; pReq = pNext) {
pNext = pReq->next;
if (CompareTimeStamps(pReq->revive, now) == LATER)
break;
FreeResource(pReq->id, RT_NONE);
now.months++;
for (pReq = pPending; pReq; pReq = pNext)
{
pNext = pReq->next;
if (CompareTimeStamps (pReq->revive, now) == LATER)
break;
FreeResource (pReq->id, RT_NONE);
/* AttendClient() may have been called via the resource delete
* function so a client may have input to be processed and so
* set delay to 0 to prevent blocking in WaitForSomething().
*/
AdjustWaitForDelay(wt, 0);
/* AttendClient() may have been called via the resource delete
* function so a client may have input to be processed and so
* set delay to 0 to prevent blocking in WaitForSomething().
*/
AdjustWaitForDelay (wt, 0);
}
pReq = pPending;
if (!pReq)
return;
return;
delay = pReq->revive.milliseconds - now.milliseconds;
AdjustWaitForDelay(wt, delay);
AdjustWaitForDelay (wt, delay);
}
static void
SertafiedWakeupHandler(void *data, int i)
SertafiedWakeupHandler (pointer data, int i, pointer LastSelectMask)
{
SertafiedPtr pReq, pNext;
TimeStamp now;
SertafiedPtr pReq, pNext;
TimeStamp now;
now.milliseconds = GetTimeInMillis();
now.milliseconds = GetTimeInMillis ();
now.months = currentTime.months;
if ((int) (now.milliseconds - currentTime.milliseconds) < 0)
now.months++;
for (pReq = pPending; pReq; pReq = pNext) {
pNext = pReq->next;
if (CompareTimeStamps(pReq->revive, now) == LATER)
break;
FreeResource(pReq->id, RT_NONE);
now.months++;
for (pReq = pPending; pReq; pReq = pNext)
{
pNext = pReq->next;
if (CompareTimeStamps (pReq->revive, now) == LATER)
break;
FreeResource (pReq->id, RT_NONE);
}
if (!pPending) {
RemoveBlockAndWakeupHandlers(SertafiedBlockHandler,
SertafiedWakeupHandler, (void *) 0);
BlockHandlerRegistered = FALSE;
if (!pPending)
{
RemoveBlockAndWakeupHandlers (SertafiedBlockHandler,
SertafiedWakeupHandler,
(pointer) 0);
BlockHandlerRegistered = FALSE;
}
}

View File

@@ -33,10 +33,14 @@
#include "dix.h"
extern int ClientSleepUntil(ClientPtr client,
TimeStamp *revive,
void (*notifyFunc) (ClientPtr /* client */ ,
void * /* closure */
), void *Closure);
extern int ClientSleepUntil(
ClientPtr client,
TimeStamp *revive,
void (*notifyFunc)(
ClientPtr /* client */,
pointer /* closure */
),
pointer Closure
);
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -27,7 +27,7 @@
#include "misync.h"
extern _X_EXPORT int
SyncVerifyFence(SyncFence ** ppFence, XID fid, ClientPtr client, Mask mode);
SyncVerifyFence(SyncFence **ppFence, XID fid, ClientPtr client, Mask mode);
#define VERIFY_SYNC_FENCE(pFence, fid, client, mode) \
do { \
@@ -43,4 +43,5 @@ extern _X_EXPORT int
VERIFY_SYNC_FENCE((pFence), (fid), (client), (mode)); \
} while (0)
#endif /* _SYNCSDK_H_ */
#endif /* _SYNCSDK_H_ */

View File

@@ -30,13 +30,13 @@ and Olivetti Research Limited, Cambridge, England.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Digital or Olivetti
not be used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
software without specific, written prior permission.
DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
@@ -51,7 +51,6 @@ PERFORMANCE OF THIS SOFTWARE.
#ifndef _SYNCSRV_H_
#define _SYNCSRV_H_
#include "list.h"
#include "misync.h"
#include "misyncstr.h"
@@ -66,86 +65,82 @@ typedef enum {
XSyncCounterUnrestricted
} SyncCounterType;
typedef void (*SyncSystemCounterQueryValue)(void *counter,
int64_t *value_return
);
typedef void (*SyncSystemCounterBracketValues)(void *counter,
int64_t *pbracket_less,
int64_t *pbracket_greater
);
typedef struct _SysCounterInfo {
SyncCounter *pCounter;
char *name;
int64_t resolution;
int64_t bracket_greater;
int64_t bracket_less;
SyncCounterType counterType; /* how can this counter change */
SyncSystemCounterQueryValue QueryValue;
SyncSystemCounterBracketValues BracketValues;
void *private;
struct xorg_list entry;
char *name;
CARD64 resolution;
CARD64 bracket_greater;
CARD64 bracket_less;
SyncCounterType counterType; /* how can this counter change */
void (*QueryValue)(
pointer /*pCounter*/,
CARD64 * /*freshvalue*/
);
void (*BracketValues)(
pointer /*pCounter*/,
CARD64 * /*lessthan*/,
CARD64 * /*greaterthan*/
);
} SysCounterInfo;
typedef struct _SyncAlarmClientList {
ClientPtr client;
XID delete_id;
ClientPtr client;
XID delete_id;
struct _SyncAlarmClientList *next;
} SyncAlarmClientList;
typedef struct _SyncAlarm {
SyncTrigger trigger;
ClientPtr client;
XSyncAlarm alarm_id;
int64_t delta;
int events;
int state;
ClientPtr client;
XSyncAlarm alarm_id;
CARD64 delta;
int events;
int state;
SyncAlarmClientList *pEventClients;
} SyncAlarm;
typedef struct {
ClientPtr client;
CARD32 delete_id;
int num_waitconditions;
ClientPtr client;
CARD32 delete_id;
int num_waitconditions;
} SyncAwaitHeader;
typedef struct {
SyncTrigger trigger;
int64_t event_threshold;
CARD64 event_threshold;
SyncAwaitHeader *pHeader;
} SyncAwait;
typedef union {
SyncAwaitHeader header;
SyncAwait await;
SyncAwait await;
} SyncAwaitUnion;
extern SyncCounter* SyncCreateSystemCounter(const char *name,
int64_t initial_value,
int64_t resolution,
SyncCounterType counterType,
SyncSystemCounterQueryValue QueryValue,
SyncSystemCounterBracketValues BracketValues
);
extern pointer SyncCreateSystemCounter(
char * /* name */,
CARD64 /* inital_value */,
CARD64 /* resolution */,
SyncCounterType /* change characterization */,
void (* /*QueryValue*/ ) (
pointer /* pCounter */,
CARD64 * /* pValue_return */), /* XXX prototype */
void (* /*BracketValues*/) (
pointer /* pCounter */,
CARD64 * /* pbracket_less */,
CARD64 * /* pbracket_greater */)
);
extern void SyncChangeCounter(SyncCounter *pCounter,
int64_t new_value);
extern void SyncChangeCounter(
SyncCounter * /* pCounter*/,
CARD64 /* new_value */
);
extern void SyncDestroySystemCounter(void *pCounter);
extern void SyncDestroySystemCounter(
pointer pCounter
);
extern SyncCounter *SyncInitDeviceIdleTime(DeviceIntPtr dev);
extern void SyncRemoveDeviceIdleTime(SyncCounter *counter);
extern void InitServertime(void);
int
SyncCreateFenceFromFD(ClientPtr client, DrawablePtr pDraw, XID id, int fd, BOOL initially_triggered);
int
SyncFDFromFence(ClientPtr client, DrawablePtr pDraw, SyncFence *fence);
void
SyncDeleteTriggerFromSyncObject(SyncTrigger * pTrigger);
int
SyncAddTriggerToSyncObject(SyncTrigger * pTrigger);
#endif /* _SYNCSRV_H_ */
extern void SyncExtensionInit(void);
#endif /* _SYNCSRV_H_ */

File diff suppressed because it is too large Load Diff

View File

@@ -29,62 +29,81 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "gcstruct.h"
#include "xacestr.h"
_X_EXPORT CallbackListPtr XaceHooks[XACE_NUM_HOOKS] = { 0 };
#define XSERV_t
#define TRANS_SERVER
#include <X11/Xtrans/Xtrans.h>
#include "../os/osdep.h"
_X_EXPORT CallbackListPtr XaceHooks[XACE_NUM_HOOKS] = {0};
/* Special-cased hook functions. Called by Xserver.
*/
#undef XaceHookDispatch
int
XaceHookDispatch(ClientPtr client, int major)
int XaceHookDispatch(ClientPtr client, int major)
{
/* Call the extension dispatch hook */
ExtensionEntry *ext = GetExtensionEntry(major);
XaceExtAccessRec erec = { client, ext, DixUseAccess, Success };
if (ext)
CallCallbacks(&XaceHooks[XACE_EXT_DISPATCH], &erec);
/* On error, pretend extension doesn't exist */
return (erec.status == Success) ? Success : BadRequest;
/* Call the audit begin callback, there is no return value. */
XaceAuditRec rec = { client, 0 };
CallCallbacks(&XaceHooks[XACE_AUDIT_BEGIN], &rec);
if (major < 128) {
/* Call the core dispatch hook */
XaceCoreDispatchRec rec = { client, Success /* default allow */ };
CallCallbacks(&XaceHooks[XACE_CORE_DISPATCH], &rec);
return rec.status;
} else {
/* Call the extension dispatch hook */
ExtensionEntry *ext = GetExtensionEntry(major);
XaceExtAccessRec rec = { client, ext, DixUseAccess, Success };
if (ext)
CallCallbacks(&XaceHooks[XACE_EXT_DISPATCH], &rec);
/* On error, pretend extension doesn't exist */
return (rec.status == Success) ? Success : BadRequest;
}
}
int
XaceHookPropertyAccess(ClientPtr client, WindowPtr pWin,
PropertyPtr *ppProp, Mask access_mode)
int XaceHookPropertyAccess(ClientPtr client, WindowPtr pWin,
PropertyPtr *ppProp, Mask access_mode)
{
XacePropertyAccessRec rec = { client, pWin, ppProp, access_mode, Success };
CallCallbacks(&XaceHooks[XACE_PROPERTY_ACCESS], &rec);
return rec.status;
}
int
XaceHookSelectionAccess(ClientPtr client, Selection ** ppSel, Mask access_mode)
int XaceHookSelectionAccess(ClientPtr client,
Selection **ppSel, Mask access_mode)
{
XaceSelectionAccessRec rec = { client, ppSel, access_mode, Success };
CallCallbacks(&XaceHooks[XACE_SELECTION_ACCESS], &rec);
return rec.status;
}
void XaceHookAuditEnd(ClientPtr ptr, int result)
{
XaceAuditRec rec = { ptr, result };
/* call callbacks, there is no return value. */
CallCallbacks(&XaceHooks[XACE_AUDIT_END], &rec);
}
/* Entry point for hook functions. Called by Xserver.
*/
int
XaceHook(int hook, ...)
int XaceHook(int hook, ...)
{
union {
XaceResourceAccessRec res;
XaceDeviceAccessRec dev;
XaceSendAccessRec send;
XaceReceiveAccessRec recv;
XaceClientAccessRec client;
XaceExtAccessRec ext;
XaceServerAccessRec server;
XaceScreenAccessRec screen;
XaceAuthAvailRec auth;
XaceKeyAvailRec key;
XaceResourceAccessRec res;
XaceDeviceAccessRec dev;
XaceSendAccessRec send;
XaceReceiveAccessRec recv;
XaceClientAccessRec client;
XaceExtAccessRec ext;
XaceServerAccessRec server;
XaceScreenAccessRec screen;
XaceAuthAvailRec auth;
XaceKeyAvailRec key;
} u;
int *prv = NULL; /* points to return value from callback */
va_list ap; /* argument list */
int *prv = NULL; /* points to return value from callback */
va_list ap; /* argument list */
if (!XaceHooks[hook])
return Success;
return Success;
va_start(ap, hook);
@@ -93,117 +112,91 @@ XaceHook(int hook, ...)
* the arguments and integer return parameter, or in some cases just
* sets calldata directly to a single argument (with no return result)
*/
switch (hook) {
case XACE_RESOURCE_ACCESS:
u.res.client = va_arg(ap, ClientPtr);
u.res.id = va_arg(ap, XID);
u.res.rtype = va_arg(ap, RESTYPE);
u.res.res = va_arg(ap, void *);
u.res.ptype = va_arg(ap, RESTYPE);
u.res.parent = va_arg(ap, void *);
u.res.access_mode = va_arg(ap, Mask);
u.res.status = Success; /* default allow */
prv = &u.res.status;
break;
case XACE_DEVICE_ACCESS:
u.dev.client = va_arg(ap, ClientPtr);
u.dev.dev = va_arg(ap, DeviceIntPtr);
u.dev.access_mode = va_arg(ap, Mask);
u.dev.status = Success; /* default allow */
prv = &u.dev.status;
break;
case XACE_SEND_ACCESS:
u.send.client = va_arg(ap, ClientPtr);
u.send.dev = va_arg(ap, DeviceIntPtr);
u.send.pWin = va_arg(ap, WindowPtr);
u.send.events = va_arg(ap, xEventPtr);
u.send.count = va_arg(ap, int);
u.send.status = Success; /* default allow */
prv = &u.send.status;
break;
case XACE_RECEIVE_ACCESS:
u.recv.client = va_arg(ap, ClientPtr);
u.recv.pWin = va_arg(ap, WindowPtr);
u.recv.events = va_arg(ap, xEventPtr);
u.recv.count = va_arg(ap, int);
u.recv.status = Success; /* default allow */
prv = &u.recv.status;
break;
case XACE_CLIENT_ACCESS:
u.client.client = va_arg(ap, ClientPtr);
u.client.target = va_arg(ap, ClientPtr);
u.client.access_mode = va_arg(ap, Mask);
u.client.status = Success; /* default allow */
prv = &u.client.status;
break;
case XACE_EXT_ACCESS:
u.ext.client = va_arg(ap, ClientPtr);
u.ext.ext = va_arg(ap, ExtensionEntry *);
u.ext.access_mode = DixGetAttrAccess;
u.ext.status = Success; /* default allow */
prv = &u.ext.status;
break;
case XACE_SERVER_ACCESS:
u.server.client = va_arg(ap, ClientPtr);
u.server.access_mode = va_arg(ap, Mask);
u.server.status = Success; /* default allow */
prv = &u.server.status;
break;
case XACE_SCREEN_ACCESS:
case XACE_SCREENSAVER_ACCESS:
u.screen.client = va_arg(ap, ClientPtr);
u.screen.screen = va_arg(ap, ScreenPtr);
u.screen.access_mode = va_arg(ap, Mask);
u.screen.status = Success; /* default allow */
prv = &u.screen.status;
break;
case XACE_AUTH_AVAIL:
u.auth.client = va_arg(ap, ClientPtr);
u.auth.authId = va_arg(ap, XID);
break;
case XACE_KEY_AVAIL:
u.key.event = va_arg(ap, xEventPtr);
u.key.keybd = va_arg(ap, DeviceIntPtr);
u.key.count = va_arg(ap, int);
break;
default:
va_end(ap);
return 0; /* unimplemented hook number */
switch (hook)
{
case XACE_RESOURCE_ACCESS:
u.res.client = va_arg(ap, ClientPtr);
u.res.id = va_arg(ap, XID);
u.res.rtype = va_arg(ap, RESTYPE);
u.res.res = va_arg(ap, pointer);
u.res.ptype = va_arg(ap, RESTYPE);
u.res.parent = va_arg(ap, pointer);
u.res.access_mode = va_arg(ap, Mask);
u.res.status = Success; /* default allow */
prv = &u.res.status;
break;
case XACE_DEVICE_ACCESS:
u.dev.client = va_arg(ap, ClientPtr);
u.dev.dev = va_arg(ap, DeviceIntPtr);
u.dev.access_mode = va_arg(ap, Mask);
u.dev.status = Success; /* default allow */
prv = &u.dev.status;
break;
case XACE_SEND_ACCESS:
u.send.client = va_arg(ap, ClientPtr);
u.send.dev = va_arg(ap, DeviceIntPtr);
u.send.pWin = va_arg(ap, WindowPtr);
u.send.events = va_arg(ap, xEventPtr);
u.send.count = va_arg(ap, int);
u.send.status = Success; /* default allow */
prv = &u.send.status;
break;
case XACE_RECEIVE_ACCESS:
u.recv.client = va_arg(ap, ClientPtr);
u.recv.pWin = va_arg(ap, WindowPtr);
u.recv.events = va_arg(ap, xEventPtr);
u.recv.count = va_arg(ap, int);
u.recv.status = Success; /* default allow */
prv = &u.recv.status;
break;
case XACE_CLIENT_ACCESS:
u.client.client = va_arg(ap, ClientPtr);
u.client.target = va_arg(ap, ClientPtr);
u.client.access_mode = va_arg(ap, Mask);
u.client.status = Success; /* default allow */
prv = &u.client.status;
break;
case XACE_EXT_ACCESS:
u.ext.client = va_arg(ap, ClientPtr);
u.ext.ext = va_arg(ap, ExtensionEntry*);
u.ext.access_mode = DixGetAttrAccess;
u.ext.status = Success; /* default allow */
prv = &u.ext.status;
break;
case XACE_SERVER_ACCESS:
u.server.client = va_arg(ap, ClientPtr);
u.server.access_mode = va_arg(ap, Mask);
u.server.status = Success; /* default allow */
prv = &u.server.status;
break;
case XACE_SCREEN_ACCESS:
case XACE_SCREENSAVER_ACCESS:
u.screen.client = va_arg(ap, ClientPtr);
u.screen.screen = va_arg(ap, ScreenPtr);
u.screen.access_mode = va_arg(ap, Mask);
u.screen.status = Success; /* default allow */
prv = &u.screen.status;
break;
case XACE_AUTH_AVAIL:
u.auth.client = va_arg(ap, ClientPtr);
u.auth.authId = va_arg(ap, XID);
break;
case XACE_KEY_AVAIL:
u.key.event = va_arg(ap, xEventPtr);
u.key.keybd = va_arg(ap, DeviceIntPtr);
u.key.count = va_arg(ap, int);
break;
default:
va_end(ap);
return 0; /* unimplemented hook number */
}
va_end(ap);
/* call callbacks and return result, if any. */
CallCallbacks(&XaceHooks[hook], &u);
return prv ? *prv : Success;
}
/* XaceHookIsSet
*
* Utility function to determine whether there are any callbacks listening on a
* particular XACE hook.
*
* Returns non-zero if there is a callback, zero otherwise.
*/
int
XaceHookIsSet(int hook)
{
if (hook < 0 || hook >= XACE_NUM_HOOKS)
return 0;
return XaceHooks[hook] != NULL;
}
/* XaceCensorImage
*
* Called after pScreen->GetImage to prevent pieces or trusted windows from
@@ -225,104 +218,114 @@ XaceHookIsSet(int hook)
* region of the window will be destroyed (overwritten) in pBuf.
*/
void
XaceCensorImage(ClientPtr client,
RegionPtr pVisibleRegion,
long widthBytesLine,
DrawablePtr pDraw,
int x, int y, int w, int h, unsigned int format, char *pBuf)
XaceCensorImage(
ClientPtr client,
RegionPtr pVisibleRegion,
long widthBytesLine,
DrawablePtr pDraw,
int x, int y, int w, int h,
unsigned int format,
char *pBuf)
{
RegionRec imageRegion; /* region representing x,y,w,h */
RegionRec censorRegion; /* region to obliterate */
RegionRec imageRegion; /* region representing x,y,w,h */
RegionRec censorRegion; /* region to obliterate */
BoxRec imageBox;
int nRects;
imageBox.x1 = pDraw->x + x;
imageBox.y1 = pDraw->y + y;
imageBox.x2 = pDraw->x + x + w;
imageBox.y2 = pDraw->y + y + h;
imageBox.x1 = x;
imageBox.y1 = y;
imageBox.x2 = x + w;
imageBox.y2 = y + h;
RegionInit(&imageRegion, &imageBox, 1);
RegionNull(&censorRegion);
/* censorRegion = imageRegion - visibleRegion */
RegionSubtract(&censorRegion, &imageRegion, pVisibleRegion);
nRects = RegionNumRects(&censorRegion);
if (nRects > 0) { /* we have something to censor */
GCPtr pScratchGC = NULL;
PixmapPtr pPix = NULL;
xRectangle *pRects = NULL;
Bool failed = FALSE;
int depth = 1;
int bitsPerPixel = 1;
int i;
BoxPtr pBox;
if (nRects > 0)
{ /* we have something to censor */
GCPtr pScratchGC = NULL;
PixmapPtr pPix = NULL;
xRectangle *pRects = NULL;
Bool failed = FALSE;
int depth = 1;
int bitsPerPixel = 1;
int i;
BoxPtr pBox;
/* convert region to list-of-rectangles for PolyFillRect */
/* convert region to list-of-rectangles for PolyFillRect */
pRects = malloc(nRects * sizeof(xRectangle));
if (!pRects) {
failed = TRUE;
goto failSafe;
}
for (pBox = RegionRects(&censorRegion), i = 0; i < nRects; i++, pBox++) {
pRects[i].x = pBox->x1 - imageBox.x1;
pRects[i].y = pBox->y1 - imageBox.y1;
pRects[i].width = pBox->x2 - pBox->x1;
pRects[i].height = pBox->y2 - pBox->y1;
}
pRects = malloc(nRects * sizeof(xRectangle));
if (!pRects)
{
failed = TRUE;
goto failSafe;
}
for (pBox = RegionRects(&censorRegion), i = 0;
i < nRects;
i++, pBox++)
{
pRects[i].x = pBox->x1;
pRects[i].y = pBox->y1 - imageBox.y1;
pRects[i].width = pBox->x2 - pBox->x1;
pRects[i].height = pBox->y2 - pBox->y1;
}
/* use pBuf as a fake pixmap */
/* use pBuf as a fake pixmap */
if (format == ZPixmap) {
depth = pDraw->depth;
bitsPerPixel = pDraw->bitsPerPixel;
}
if (format == ZPixmap)
{
depth = pDraw->depth;
bitsPerPixel = pDraw->bitsPerPixel;
}
pPix = GetScratchPixmapHeader(pDraw->pScreen, w, h,
depth, bitsPerPixel,
widthBytesLine, (void *) pBuf);
if (!pPix) {
failed = TRUE;
goto failSafe;
}
pPix = GetScratchPixmapHeader(pDraw->pScreen, w, h,
depth, bitsPerPixel,
widthBytesLine, (pointer)pBuf);
if (!pPix)
{
failed = TRUE;
goto failSafe;
}
pScratchGC = GetScratchGC(depth, pPix->drawable.pScreen);
if (!pScratchGC) {
failed = TRUE;
goto failSafe;
}
pScratchGC = GetScratchGC(depth, pPix->drawable.pScreen);
if (!pScratchGC)
{
failed = TRUE;
goto failSafe;
}
ValidateGC(&pPix->drawable, pScratchGC);
(*pScratchGC->ops->PolyFillRect) (&pPix->drawable,
pScratchGC, nRects, pRects);
ValidateGC(&pPix->drawable, pScratchGC);
(* pScratchGC->ops->PolyFillRect)(&pPix->drawable,
pScratchGC, nRects, pRects);
failSafe:
if (failed) {
/* Censoring was not completed above. To be safe, wipe out
* all the image data so that nothing trusted gets out.
*/
memset(pBuf, 0, (int) (widthBytesLine * h));
}
free(pRects);
if (pScratchGC)
FreeScratchGC(pScratchGC);
if (pPix)
FreeScratchPixmapHeader(pPix);
failSafe:
if (failed)
{
/* Censoring was not completed above. To be safe, wipe out
* all the image data so that nothing trusted gets out.
*/
memset(pBuf, 0, (int)(widthBytesLine * h));
}
free(pRects);
if (pScratchGC) FreeScratchGC(pScratchGC);
if (pPix) FreeScratchPixmapHeader(pPix);
}
RegionUninit(&imageRegion);
RegionUninit(&censorRegion);
} /* XaceCensorImage */
} /* XaceCensorImage */
/*
* Xtrans wrappers for use by modules
*/
int
XaceGetConnectionNumber(ClientPtr client)
int XaceGetConnectionNumber(ClientPtr client)
{
return GetClientFd(client);
XtransConnInfo ci = ((OsCommPtr)client->osPrivate)->trans_conn;
return _XSERVTransGetConnectionNumber(ci);
}
int
XaceIsLocal(ClientPtr client)
int XaceIsLocal(ClientPtr client)
{
return ClientIsLocal(client);
XtransConnInfo ci = ((OsCommPtr)client->osPrivate)->trans_conn;
return _XSERVTransIsLocal(ci);
}

View File

@@ -52,33 +52,28 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define XACE_SCREENSAVER_ACCESS 12
#define XACE_AUTH_AVAIL 13
#define XACE_KEY_AVAIL 14
#define XACE_NUM_HOOKS 15
#define XACE_AUDIT_BEGIN 15
#define XACE_AUDIT_END 16
#define XACE_NUM_HOOKS 17
extern _X_EXPORT CallbackListPtr XaceHooks[XACE_NUM_HOOKS];
/* Entry point for hook functions. Called by Xserver.
* Required by libdbe and libextmod
*/
extern _X_EXPORT int XaceHook(int /*hook */ ,
... /*appropriate args for hook */
);
/* determine whether any callbacks are present for the XACE hook */
extern _X_EXPORT int XaceHookIsSet(int hook);
extern _X_EXPORT int XaceHook(
int /*hook*/,
... /*appropriate args for hook*/
);
/* Special-cased hook functions
*/
extern _X_EXPORT int XaceHookDispatch(ClientPtr ptr, int major);
#define XaceHookDispatch(c, m) \
((XaceHooks[XACE_EXT_DISPATCH] && (m) >= EXTENSION_BASE) ? \
XaceHookDispatch((c), (m)) : \
Success)
extern _X_EXPORT int XaceHookPropertyAccess(ClientPtr ptr, WindowPtr pWin,
PropertyPtr *ppProp,
Mask access_mode);
extern _X_EXPORT int XaceHookSelectionAccess(ClientPtr ptr, Selection ** ppSel,
Mask access_mode);
PropertyPtr *ppProp, Mask access_mode);
extern _X_EXPORT int XaceHookSelectionAccess(ClientPtr ptr,
Selection **ppSel, Mask access_mode);
extern _X_EXPORT void XaceHookAuditEnd(ClientPtr ptr, int result);
/* Register a callback for a given hook.
*/
@@ -98,14 +93,17 @@ extern _X_EXPORT int XaceIsLocal(ClientPtr ptr);
/* From the original Security extension...
*/
extern _X_EXPORT void XaceCensorImage(ClientPtr client,
RegionPtr pVisibleRegion,
long widthBytesLine,
DrawablePtr pDraw,
int x, int y, int w, int h,
unsigned int format, char *pBuf);
extern _X_EXPORT void XaceCensorImage(
ClientPtr client,
RegionPtr pVisibleRegion,
long widthBytesLine,
DrawablePtr pDraw,
int x, int y, int w, int h,
unsigned int format,
char * pBuf
);
#else /* XACE */
#else /* XACE */
/* Default window background */
#define XaceBackgroundNoneState(w) None
@@ -114,20 +112,20 @@ extern _X_EXPORT void XaceCensorImage(ClientPtr client,
#ifdef __GNUC__
#define XaceHook(args...) Success
#define XaceHookIsSet(args...) 0
#define XaceHookDispatch(args...) Success
#define XaceHookPropertyAccess(args...) Success
#define XaceHookSelectionAccess(args...) Success
#define XaceHookAuditEnd(args...) { ; }
#define XaceCensorImage(args...) { ; }
#else
#define XaceHook(...) Success
#define XaceHookIsSet(...) 0
#define XaceHookDispatch(...) Success
#define XaceHookPropertyAccess(...) Success
#define XaceHookSelectionAccess(...) Success
#define XaceHookAuditEnd(...) { ; }
#define XaceCensorImage(...) { ; }
#endif
#endif /* XACE */
#endif /* XACE */
#endif /* _XACE_H */
#endif /* _XACE_H */

View File

@@ -40,9 +40,9 @@ typedef struct {
ClientPtr client;
XID id;
RESTYPE rtype;
void *res;
pointer res;
RESTYPE ptype;
void *parent;
pointer parent;
Mask access_mode;
int status;
} XaceResourceAccessRec;
@@ -144,4 +144,4 @@ typedef struct {
int requestResult;
} XaceAuditRec;
#endif /* _XACESTR_H */
#endif /* _XACESTR_H */

View File

@@ -38,29 +38,33 @@ from The Open Group.
#include "extnsionst.h"
#include "swaprep.h"
#include <X11/extensions/xcmiscproto.h>
#include "extinit.h"
#include "modinit.h"
#if HAVE_STDINT_H
#include <stdint.h>
#elif !defined(UINT32_MAX)
#define UINT32_MAX 0xffffffffU
#endif
static int
ProcXCMiscGetVersion(ClientPtr client)
{
xXCMiscGetVersionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.majorVersion = XCMiscMajorVersion,
.minorVersion = XCMiscMinorVersion
};
xXCMiscGetVersionReply rep;
int n;
REQUEST_SIZE_MATCH(xXCMiscGetVersionReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.majorVersion = XCMiscMajorVersion;
rep.minorVersion = XCMiscMinorVersion;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.majorVersion);
swaps(&rep.minorVersion);
swaps(&rep.sequenceNumber, n);
swaps(&rep.majorVersion, n);
swaps(&rep.minorVersion, n);
}
WriteToClient(client, sizeof(xXCMiscGetVersionReply), &rep);
WriteToClient(client, sizeof(xXCMiscGetVersionReply), (char *)&rep);
return Success;
}
@@ -68,23 +72,22 @@ static int
ProcXCMiscGetXIDRange(ClientPtr client)
{
xXCMiscGetXIDRangeReply rep;
int n;
XID min_id, max_id;
REQUEST_SIZE_MATCH(xXCMiscGetXIDRangeReq);
GetXIDRange(client->index, FALSE, &min_id, &max_id);
rep = (xXCMiscGetXIDRangeReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.start_id = min_id,
.count = max_id - min_id + 1
};
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.start_id = min_id;
rep.count = max_id - min_id + 1;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.start_id);
swapl(&rep.count);
swaps(&rep.sequenceNumber, n);
swapl(&rep.start_id, n);
swapl(&rep.count, n);
}
WriteToClient(client, sizeof(xXCMiscGetXIDRangeReply), &rep);
WriteToClient(client, sizeof(xXCMiscGetXIDRangeReply), (char *)&rep);
return Success;
}
@@ -93,107 +96,112 @@ ProcXCMiscGetXIDList(ClientPtr client)
{
REQUEST(xXCMiscGetXIDListReq);
xXCMiscGetXIDListReply rep;
int n;
XID *pids;
unsigned int count;
REQUEST_SIZE_MATCH(xXCMiscGetXIDListReq);
if (stuff->count > UINT32_MAX / sizeof(XID))
return BadAlloc;
return BadAlloc;
pids = xallocarray(stuff->count, sizeof(XID));
if (!pids) {
return BadAlloc;
pids = (XID *)malloc(stuff->count * sizeof(XID));
if (!pids)
{
return BadAlloc;
}
count = GetXIDList(client, stuff->count, pids);
rep = (xXCMiscGetXIDListReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = count,
.count = count
};
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.length = count;
rep.count = count;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.count);
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
swapl(&rep.count, n);
}
WriteToClient(client, sizeof(xXCMiscGetXIDListReply), &rep);
if (count) {
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, count * sizeof(XID), pids);
WriteToClient(client, sizeof(xXCMiscGetXIDListReply), (char *)&rep);
if (count)
{
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, count * sizeof(XID), pids);
}
free(pids);
return Success;
}
static int
ProcXCMiscDispatch(ClientPtr client)
ProcXCMiscDispatch (ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
switch (stuff->data)
{
case X_XCMiscGetVersion:
return ProcXCMiscGetVersion(client);
return ProcXCMiscGetVersion(client);
case X_XCMiscGetXIDRange:
return ProcXCMiscGetXIDRange(client);
return ProcXCMiscGetXIDRange(client);
case X_XCMiscGetXIDList:
return ProcXCMiscGetXIDList(client);
return ProcXCMiscGetXIDList(client);
default:
return BadRequest;
return BadRequest;
}
}
static int _X_COLD
static int
SProcXCMiscGetVersion(ClientPtr client)
{
int n;
REQUEST(xXCMiscGetVersionReq);
swaps(&stuff->length);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xXCMiscGetVersionReq);
swaps(&stuff->majorVersion);
swaps(&stuff->minorVersion);
swaps(&stuff->majorVersion, n);
swaps(&stuff->minorVersion, n);
return ProcXCMiscGetVersion(client);
}
static int _X_COLD
static int
SProcXCMiscGetXIDRange(ClientPtr client)
{
int n;
REQUEST(xReq);
swaps(&stuff->length);
swaps(&stuff->length, n);
return ProcXCMiscGetXIDRange(client);
}
static int _X_COLD
static int
SProcXCMiscGetXIDList(ClientPtr client)
{
int n;
REQUEST(xXCMiscGetXIDListReq);
REQUEST_SIZE_MATCH(xXCMiscGetXIDListReq);
swaps(&stuff->length);
swapl(&stuff->count);
swaps(&stuff->length, n);
swapl(&stuff->count, n);
return ProcXCMiscGetXIDList(client);
}
static int _X_COLD
SProcXCMiscDispatch(ClientPtr client)
static int
SProcXCMiscDispatch (ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
switch (stuff->data)
{
case X_XCMiscGetVersion:
return SProcXCMiscGetVersion(client);
return SProcXCMiscGetVersion(client);
case X_XCMiscGetXIDRange:
return SProcXCMiscGetXIDRange(client);
return SProcXCMiscGetXIDRange(client);
case X_XCMiscGetXIDList:
return SProcXCMiscGetXIDList(client);
return SProcXCMiscGetXIDList(client);
default:
return BadRequest;
return BadRequest;
}
}
void
XCMiscExtensionInit(void)
XCMiscExtensionInit(INITARGS)
{
AddExtension(XCMiscExtensionName, 0, 0,
ProcXCMiscDispatch, SProcXCMiscDispatch,
NULL, StandardMinorOpcode);
ProcXCMiscDispatch, SProcXCMiscDispatch,
NULL, StandardMinorOpcode);
}

File diff suppressed because it is too large Load Diff

View File

@@ -27,6 +27,7 @@
#include <X11/fonts/font.h>
extern void XFree86BigfontExtensionInit(void);
extern void XF86BigfontFreeFontShm(FontPtr);
extern void XF86BigfontCleanup(void);

File diff suppressed because it is too large Load Diff

View File

@@ -53,87 +53,87 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define X_SELinuxGetClientContext 22
typedef struct {
CARD8 reqType;
CARD8 SELinuxReqType;
CARD16 length;
CARD8 client_major;
CARD8 client_minor;
CARD8 reqType;
CARD8 SELinuxReqType;
CARD16 length;
CARD8 client_major;
CARD8 client_minor;
} SELinuxQueryVersionReq;
typedef struct {
CARD8 type;
CARD8 pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD16 server_major;
CARD16 server_minor;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
CARD8 type;
CARD8 pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD16 server_major;
CARD16 server_minor;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} SELinuxQueryVersionReply;
typedef struct {
CARD8 reqType;
CARD8 SELinuxReqType;
CARD16 length;
CARD32 context_len;
CARD8 reqType;
CARD8 SELinuxReqType;
CARD16 length;
CARD32 context_len;
} SELinuxSetCreateContextReq;
typedef struct {
CARD8 reqType;
CARD8 SELinuxReqType;
CARD16 length;
CARD8 reqType;
CARD8 SELinuxReqType;
CARD16 length;
} SELinuxGetCreateContextReq;
typedef struct {
CARD8 reqType;
CARD8 SELinuxReqType;
CARD16 length;
CARD32 id;
CARD32 context_len;
CARD8 reqType;
CARD8 SELinuxReqType;
CARD16 length;
CARD32 id;
CARD32 context_len;
} SELinuxSetContextReq;
typedef struct {
CARD8 reqType;
CARD8 SELinuxReqType;
CARD16 length;
CARD32 id;
CARD8 reqType;
CARD8 SELinuxReqType;
CARD16 length;
CARD32 id;
} SELinuxGetContextReq;
typedef struct {
CARD8 reqType;
CARD8 SELinuxReqType;
CARD16 length;
CARD32 window;
CARD32 property;
CARD8 reqType;
CARD8 SELinuxReqType;
CARD16 length;
CARD32 window;
CARD32 property;
} SELinuxGetPropertyContextReq;
typedef struct {
CARD8 type;
CARD8 pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 context_len;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
CARD8 type;
CARD8 pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 context_len;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} SELinuxGetContextReply;
typedef struct {
CARD8 type;
CARD8 pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 count;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
CARD8 type;
CARD8 pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 count;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} SELinuxListItemsReply;
#endif /* _XSELINUX_H */
#endif /* _XSELINUX_H */

View File

@@ -26,7 +26,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "windowstr.h"
#include "propertyst.h"
#include "extnsionst.h"
#include "extinit.h"
#include "modinit.h"
#include "xselinuxint.h"
#define CTX_DEV offsetof(SELinuxSubjectRec, dev_create_sid)
@@ -44,6 +44,7 @@ typedef struct {
CARD32 id;
} SELinuxListItemRec;
/*
* Extension Dispatch
*/
@@ -52,9 +53,8 @@ static security_context_t
SELinuxCopyContext(char *ptr, unsigned len)
{
security_context_t copy = malloc(len + 1);
if (!copy)
return NULL;
return NULL;
strncpy(copy, ptr, len);
copy[len] = '\0';
return copy;
@@ -63,20 +63,21 @@ SELinuxCopyContext(char *ptr, unsigned len)
static int
ProcSELinuxQueryVersion(ClientPtr client)
{
SELinuxQueryVersionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.server_major = SELINUX_MAJOR_VERSION,
.server_minor = SELINUX_MINOR_VERSION
};
SELinuxQueryVersionReply rep;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.server_major = SELINUX_MAJOR_VERSION;
rep.server_minor = SELINUX_MINOR_VERSION;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.server_major);
swaps(&rep.server_minor);
int n;
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
swaps(&rep.server_major, n);
swaps(&rep.server_minor, n);
}
WriteToClient(client, sizeof(rep), &rep);
WriteToClient(client, sizeof(rep), (char *)&rep);
return Success;
}
@@ -88,25 +89,24 @@ SELinuxSendContextReply(ClientPtr client, security_id_t sid)
int len = 0;
if (sid) {
if (avc_sid_to_context_raw(sid, &ctx) < 0)
return BadValue;
len = strlen(ctx) + 1;
if (avc_sid_to_context_raw(sid, &ctx) < 0)
return BadValue;
len = strlen(ctx) + 1;
}
rep = (SELinuxGetContextReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = bytes_to_int32(len),
.context_len = len
};
rep.type = X_Reply;
rep.length = bytes_to_int32(len);
rep.sequenceNumber = client->sequence;
rep.context_len = len;
if (client->swapped) {
swapl(&rep.length);
swaps(&rep.sequenceNumber);
swapl(&rep.context_len);
int n;
swapl(&rep.length, n);
swaps(&rep.sequenceNumber, n);
swapl(&rep.context_len, n);
}
WriteToClient(client, sizeof(SELinuxGetContextReply), &rep);
WriteToClient(client, sizeof(SELinuxGetContextReply), (char *)&rep);
WriteToClient(client, len, ctx);
freecon(ctx);
return Success;
@@ -125,20 +125,20 @@ ProcSELinuxSetCreateContext(ClientPtr client, unsigned offset)
REQUEST_FIXED_SIZE(SELinuxSetCreateContextReq, stuff->context_len);
if (stuff->context_len > 0) {
ctx = SELinuxCopyContext((char *) (stuff + 1), stuff->context_len);
if (!ctx)
return BadAlloc;
ctx = SELinuxCopyContext((char *)(stuff + 1), stuff->context_len);
if (!ctx)
return BadAlloc;
}
ptr = dixLookupPrivate(privPtr, subjectKey);
pSid = (security_id_t *) (ptr + offset);
pSid = (security_id_t *)(ptr + offset);
*pSid = NULL;
rc = Success;
if (stuff->context_len > 0) {
if (security_check_context_raw(ctx) < 0 ||
avc_context_to_sid_raw(ctx, pSid) < 0)
rc = BadValue;
if (security_check_context_raw(ctx) < 0 ||
avc_context_to_sid_raw(ctx, pSid) < 0)
rc = BadValue;
}
free(ctx);
@@ -154,11 +154,11 @@ ProcSELinuxGetCreateContext(ClientPtr client, unsigned offset)
REQUEST_SIZE_MATCH(SELinuxGetCreateContextReq);
if (offset == CTX_DEV)
ptr = dixLookupPrivate(&serverClient->devPrivates, subjectKey);
ptr = dixLookupPrivate(&serverClient->devPrivates, subjectKey);
else
ptr = dixLookupPrivate(&client->devPrivates, subjectKey);
ptr = dixLookupPrivate(&client->devPrivates, subjectKey);
pSid = (security_id_t *) (ptr + offset);
pSid = (security_id_t *)(ptr + offset);
return SELinuxSendContextReply(client, *pSid);
}
@@ -176,19 +176,19 @@ ProcSELinuxSetDeviceContext(ClientPtr client)
REQUEST_FIXED_SIZE(SELinuxSetContextReq, stuff->context_len);
if (stuff->context_len < 1)
return BadLength;
ctx = SELinuxCopyContext((char *) (stuff + 1), stuff->context_len);
return BadLength;
ctx = SELinuxCopyContext((char *)(stuff + 1), stuff->context_len);
if (!ctx)
return BadAlloc;
return BadAlloc;
rc = dixLookupDevice(&dev, stuff->id, client, DixManageAccess);
if (rc != Success)
goto out;
goto out;
if (security_check_context_raw(ctx) < 0 ||
avc_context_to_sid_raw(ctx, &sid) < 0) {
rc = BadValue;
goto out;
avc_context_to_sid_raw(ctx, &sid) < 0) {
rc = BadValue;
goto out;
}
subj = dixLookupPrivate(&dev->devPrivates, subjectKey);
@@ -197,7 +197,7 @@ ProcSELinuxSetDeviceContext(ClientPtr client)
obj->sid = sid;
rc = Success;
out:
out:
free(ctx);
return rc;
}
@@ -214,7 +214,7 @@ ProcSELinuxGetDeviceContext(ClientPtr client)
rc = dixLookupDevice(&dev, stuff->id, client, DixGetAttrAccess);
if (rc != Success)
return rc;
return rc;
subj = dixLookupPrivate(&dev->devPrivates, subjectKey);
return SELinuxSendContextReply(client, subj->sid);
@@ -233,19 +233,19 @@ ProcSELinuxGetDrawableContext(ClientPtr client)
rc = dixLookupDrawable(&pDraw, stuff->id, client, 0, DixGetAttrAccess);
if (rc != Success)
return rc;
return rc;
if (pDraw->type == DRAWABLE_PIXMAP)
privatePtr = &((PixmapPtr) pDraw)->devPrivates;
privatePtr = &((PixmapPtr)pDraw)->devPrivates;
else
privatePtr = &((WindowPtr) pDraw)->devPrivates;
privatePtr = &((WindowPtr)pDraw)->devPrivates;
obj = dixLookupPrivate(privatePtr, objectKey);
return SELinuxSendContextReply(client, obj->sid);
}
static int
ProcSELinuxGetPropertyContext(ClientPtr client, void *privKey)
ProcSELinuxGetPropertyContext(ClientPtr client, pointer privKey)
{
WindowPtr pWin;
PropertyPtr pProp;
@@ -257,19 +257,19 @@ ProcSELinuxGetPropertyContext(ClientPtr client, void *privKey)
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetPropAccess);
if (rc != Success)
return rc;
return rc;
rc = dixLookupProperty(&pProp, pWin, stuff->property, client,
DixGetAttrAccess);
DixGetAttrAccess);
if (rc != Success)
return rc;
return rc;
obj = dixLookupPrivate(&pProp->devPrivates, privKey);
return SELinuxSendContextReply(client, obj->sid);
}
static int
ProcSELinuxGetSelectionContext(ClientPtr client, void *privKey)
ProcSELinuxGetSelectionContext(ClientPtr client, pointer privKey)
{
Selection *pSel;
SELinuxObjectRec *obj;
@@ -280,7 +280,7 @@ ProcSELinuxGetSelectionContext(ClientPtr client, void *privKey)
rc = dixLookupSelection(&pSel, stuff->id, client, DixGetAttrAccess);
if (rc != Success)
return rc;
return rc;
obj = dixLookupPrivate(&pSel->devPrivates, privKey);
return SELinuxSendContextReply(client, obj->sid);
@@ -298,23 +298,23 @@ ProcSELinuxGetClientContext(ClientPtr client)
rc = dixLookupClient(&target, stuff->id, client, DixGetAttrAccess);
if (rc != Success)
return rc;
return rc;
subj = dixLookupPrivate(&target->devPrivates, subjectKey);
return SELinuxSendContextReply(client, subj->sid);
}
static int
SELinuxPopulateItem(SELinuxListItemRec * i, PrivateRec ** privPtr, CARD32 id,
int *size)
SELinuxPopulateItem(SELinuxListItemRec *i, PrivateRec **privPtr, CARD32 id,
int *size)
{
SELinuxObjectRec *obj = dixLookupPrivate(privPtr, objectKey);
SELinuxObjectRec *data = dixLookupPrivate(privPtr, dataKey);
if (avc_sid_to_context_raw(obj->sid, &i->octx) < 0)
return BadValue;
return BadValue;
if (avc_sid_to_context_raw(data->sid, &i->dctx) < 0)
return BadValue;
return BadValue;
i->id = id;
i->octx_len = bytes_to_int32(strlen(i->octx) + 1);
@@ -325,75 +325,72 @@ SELinuxPopulateItem(SELinuxListItemRec * i, PrivateRec ** privPtr, CARD32 id,
}
static void
SELinuxFreeItems(SELinuxListItemRec * items, int count)
SELinuxFreeItems(SELinuxListItemRec *items, int count)
{
int k;
for (k = 0; k < count; k++) {
freecon(items[k].octx);
freecon(items[k].dctx);
freecon(items[k].octx);
freecon(items[k].dctx);
}
free(items);
}
static int
SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec * items,
int size, int count)
SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec *items,
int size, int count)
{
int rc, k, pos = 0;
int rc, k, n, pos = 0;
SELinuxListItemsReply rep;
CARD32 *buf;
buf = calloc(size, sizeof(CARD32));
if (size && !buf) {
rc = BadAlloc;
goto out;
rc = BadAlloc;
goto out;
}
/* Fill in the buffer */
for (k = 0; k < count; k++) {
buf[pos] = items[k].id;
if (client->swapped)
swapl(buf + pos);
pos++;
buf[pos] = items[k].id;
if (client->swapped)
swapl(buf + pos, n);
pos++;
buf[pos] = items[k].octx_len * 4;
if (client->swapped)
swapl(buf + pos);
pos++;
buf[pos] = items[k].octx_len * 4;
if (client->swapped)
swapl(buf + pos, n);
pos++;
buf[pos] = items[k].dctx_len * 4;
if (client->swapped)
swapl(buf + pos);
pos++;
buf[pos] = items[k].dctx_len * 4;
if (client->swapped)
swapl(buf + pos, n);
pos++;
memcpy((char *) (buf + pos), items[k].octx, strlen(items[k].octx) + 1);
pos += items[k].octx_len;
memcpy((char *) (buf + pos), items[k].dctx, strlen(items[k].dctx) + 1);
pos += items[k].dctx_len;
memcpy((char *)(buf + pos), items[k].octx, strlen(items[k].octx) + 1);
pos += items[k].octx_len;
memcpy((char *)(buf + pos), items[k].dctx, strlen(items[k].dctx) + 1);
pos += items[k].dctx_len;
}
/* Send reply to client */
rep = (SELinuxListItemsReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = size,
.count = count
};
rep.type = X_Reply;
rep.length = size;
rep.sequenceNumber = client->sequence;
rep.count = count;
if (client->swapped) {
swapl(&rep.length);
swaps(&rep.sequenceNumber);
swapl(&rep.count);
swapl(&rep.length, n);
swaps(&rep.sequenceNumber, n);
swapl(&rep.count, n);
}
WriteToClient(client, sizeof(SELinuxListItemsReply), &rep);
WriteToClient(client, size * 4, buf);
WriteToClient(client, sizeof(SELinuxListItemsReply), (char *)&rep);
WriteToClient(client, size * 4, (char *)buf);
/* Free stuff and return */
rc = Success;
free(buf);
out:
out:
SELinuxFreeItems(items, count);
return rc;
}
@@ -412,27 +409,27 @@ ProcSELinuxListProperties(ClientPtr client)
rc = dixLookupWindow(&pWin, stuff->id, client, DixListPropAccess);
if (rc != Success)
return rc;
return rc;
/* Count the number of properties and allocate items */
count = 0;
for (pProp = wUserProps(pWin); pProp; pProp = pProp->next)
count++;
count++;
items = calloc(count, sizeof(SELinuxListItemRec));
if (count && !items)
return BadAlloc;
return BadAlloc;
/* Fill in the items and calculate size */
i = 0;
size = 0;
for (pProp = wUserProps(pWin); pProp; pProp = pProp->next) {
id = pProp->propertyName;
rc = SELinuxPopulateItem(items + i, &pProp->devPrivates, id, &size);
if (rc != Success) {
SELinuxFreeItems(items, count);
return rc;
}
i++;
id = pProp->propertyName;
rc = SELinuxPopulateItem(items + i, &pProp->devPrivates, id, &size);
if (rc != Success) {
SELinuxFreeItems(items, count);
return rc;
}
i++;
}
return SELinuxSendItemsToClient(client, items, size, count);
@@ -451,22 +448,22 @@ ProcSELinuxListSelections(ClientPtr client)
/* Count the number of selections and allocate items */
count = 0;
for (pSel = CurrentSelections; pSel; pSel = pSel->next)
count++;
count++;
items = calloc(count, sizeof(SELinuxListItemRec));
if (count && !items)
return BadAlloc;
return BadAlloc;
/* Fill in the items and calculate size */
i = 0;
size = 0;
for (pSel = CurrentSelections; pSel; pSel = pSel->next) {
id = pSel->selection;
rc = SELinuxPopulateItem(items + i, &pSel->devPrivates, id, &size);
if (rc != Success) {
SELinuxFreeItems(items, count);
return rc;
}
i++;
id = pSel->selection;
rc = SELinuxPopulateItem(items + i, &pSel->devPrivates, id, &size);
if (rc != Success) {
SELinuxFreeItems(items, count);
return rc;
}
i++;
}
return SELinuxSendItemsToClient(client, items, size, count);
@@ -478,230 +475,240 @@ ProcSELinuxDispatch(ClientPtr client)
REQUEST(xReq);
switch (stuff->data) {
case X_SELinuxQueryVersion:
return ProcSELinuxQueryVersion(client);
return ProcSELinuxQueryVersion(client);
case X_SELinuxSetDeviceCreateContext:
return ProcSELinuxSetCreateContext(client, CTX_DEV);
return ProcSELinuxSetCreateContext(client, CTX_DEV);
case X_SELinuxGetDeviceCreateContext:
return ProcSELinuxGetCreateContext(client, CTX_DEV);
return ProcSELinuxGetCreateContext(client, CTX_DEV);
case X_SELinuxSetDeviceContext:
return ProcSELinuxSetDeviceContext(client);
return ProcSELinuxSetDeviceContext(client);
case X_SELinuxGetDeviceContext:
return ProcSELinuxGetDeviceContext(client);
return ProcSELinuxGetDeviceContext(client);
case X_SELinuxSetDrawableCreateContext:
return ProcSELinuxSetCreateContext(client, CTX_WIN);
return ProcSELinuxSetCreateContext(client, CTX_WIN);
case X_SELinuxGetDrawableCreateContext:
return ProcSELinuxGetCreateContext(client, CTX_WIN);
return ProcSELinuxGetCreateContext(client, CTX_WIN);
case X_SELinuxGetDrawableContext:
return ProcSELinuxGetDrawableContext(client);
return ProcSELinuxGetDrawableContext(client);
case X_SELinuxSetPropertyCreateContext:
return ProcSELinuxSetCreateContext(client, CTX_PRP);
return ProcSELinuxSetCreateContext(client, CTX_PRP);
case X_SELinuxGetPropertyCreateContext:
return ProcSELinuxGetCreateContext(client, CTX_PRP);
return ProcSELinuxGetCreateContext(client, CTX_PRP);
case X_SELinuxSetPropertyUseContext:
return ProcSELinuxSetCreateContext(client, USE_PRP);
return ProcSELinuxSetCreateContext(client, USE_PRP);
case X_SELinuxGetPropertyUseContext:
return ProcSELinuxGetCreateContext(client, USE_PRP);
return ProcSELinuxGetCreateContext(client, USE_PRP);
case X_SELinuxGetPropertyContext:
return ProcSELinuxGetPropertyContext(client, objectKey);
return ProcSELinuxGetPropertyContext(client, objectKey);
case X_SELinuxGetPropertyDataContext:
return ProcSELinuxGetPropertyContext(client, dataKey);
return ProcSELinuxGetPropertyContext(client, dataKey);
case X_SELinuxListProperties:
return ProcSELinuxListProperties(client);
return ProcSELinuxListProperties(client);
case X_SELinuxSetSelectionCreateContext:
return ProcSELinuxSetCreateContext(client, CTX_SEL);
return ProcSELinuxSetCreateContext(client, CTX_SEL);
case X_SELinuxGetSelectionCreateContext:
return ProcSELinuxGetCreateContext(client, CTX_SEL);
return ProcSELinuxGetCreateContext(client, CTX_SEL);
case X_SELinuxSetSelectionUseContext:
return ProcSELinuxSetCreateContext(client, USE_SEL);
return ProcSELinuxSetCreateContext(client, USE_SEL);
case X_SELinuxGetSelectionUseContext:
return ProcSELinuxGetCreateContext(client, USE_SEL);
return ProcSELinuxGetCreateContext(client, USE_SEL);
case X_SELinuxGetSelectionContext:
return ProcSELinuxGetSelectionContext(client, objectKey);
return ProcSELinuxGetSelectionContext(client, objectKey);
case X_SELinuxGetSelectionDataContext:
return ProcSELinuxGetSelectionContext(client, dataKey);
return ProcSELinuxGetSelectionContext(client, dataKey);
case X_SELinuxListSelections:
return ProcSELinuxListSelections(client);
return ProcSELinuxListSelections(client);
case X_SELinuxGetClientContext:
return ProcSELinuxGetClientContext(client);
return ProcSELinuxGetClientContext(client);
default:
return BadRequest;
return BadRequest;
}
}
static int _X_COLD
static int
SProcSELinuxQueryVersion(ClientPtr client)
{
return ProcSELinuxQueryVersion(client);
}
static int _X_COLD
static int
SProcSELinuxSetCreateContext(ClientPtr client, unsigned offset)
{
REQUEST(SELinuxSetCreateContextReq);
int n;
REQUEST_AT_LEAST_SIZE(SELinuxSetCreateContextReq);
swapl(&stuff->context_len);
swapl(&stuff->context_len, n);
return ProcSELinuxSetCreateContext(client, offset);
}
static int _X_COLD
static int
SProcSELinuxSetDeviceContext(ClientPtr client)
{
REQUEST(SELinuxSetContextReq);
int n;
REQUEST_AT_LEAST_SIZE(SELinuxSetContextReq);
swapl(&stuff->id);
swapl(&stuff->context_len);
swapl(&stuff->id, n);
swapl(&stuff->context_len, n);
return ProcSELinuxSetDeviceContext(client);
}
static int _X_COLD
static int
SProcSELinuxGetDeviceContext(ClientPtr client)
{
REQUEST(SELinuxGetContextReq);
int n;
REQUEST_SIZE_MATCH(SELinuxGetContextReq);
swapl(&stuff->id);
swapl(&stuff->id, n);
return ProcSELinuxGetDeviceContext(client);
}
static int _X_COLD
static int
SProcSELinuxGetDrawableContext(ClientPtr client)
{
REQUEST(SELinuxGetContextReq);
int n;
REQUEST_SIZE_MATCH(SELinuxGetContextReq);
swapl(&stuff->id);
swapl(&stuff->id, n);
return ProcSELinuxGetDrawableContext(client);
}
static int _X_COLD
SProcSELinuxGetPropertyContext(ClientPtr client, void *privKey)
static int
SProcSELinuxGetPropertyContext(ClientPtr client, pointer privKey)
{
REQUEST(SELinuxGetPropertyContextReq);
int n;
REQUEST_SIZE_MATCH(SELinuxGetPropertyContextReq);
swapl(&stuff->window);
swapl(&stuff->property);
swapl(&stuff->window, n);
swapl(&stuff->property, n);
return ProcSELinuxGetPropertyContext(client, privKey);
}
static int _X_COLD
SProcSELinuxGetSelectionContext(ClientPtr client, void *privKey)
static int
SProcSELinuxGetSelectionContext(ClientPtr client, pointer privKey)
{
REQUEST(SELinuxGetContextReq);
int n;
REQUEST_SIZE_MATCH(SELinuxGetContextReq);
swapl(&stuff->id);
swapl(&stuff->id, n);
return ProcSELinuxGetSelectionContext(client, privKey);
}
static int _X_COLD
static int
SProcSELinuxListProperties(ClientPtr client)
{
REQUEST(SELinuxGetContextReq);
int n;
REQUEST_SIZE_MATCH(SELinuxGetContextReq);
swapl(&stuff->id);
swapl(&stuff->id, n);
return ProcSELinuxListProperties(client);
}
static int _X_COLD
static int
SProcSELinuxGetClientContext(ClientPtr client)
{
REQUEST(SELinuxGetContextReq);
int n;
REQUEST_SIZE_MATCH(SELinuxGetContextReq);
swapl(&stuff->id);
swapl(&stuff->id, n);
return ProcSELinuxGetClientContext(client);
}
static int _X_COLD
static int
SProcSELinuxDispatch(ClientPtr client)
{
REQUEST(xReq);
int n;
swaps(&stuff->length);
swaps(&stuff->length, n);
switch (stuff->data) {
case X_SELinuxQueryVersion:
return SProcSELinuxQueryVersion(client);
return SProcSELinuxQueryVersion(client);
case X_SELinuxSetDeviceCreateContext:
return SProcSELinuxSetCreateContext(client, CTX_DEV);
return SProcSELinuxSetCreateContext(client, CTX_DEV);
case X_SELinuxGetDeviceCreateContext:
return ProcSELinuxGetCreateContext(client, CTX_DEV);
return ProcSELinuxGetCreateContext(client, CTX_DEV);
case X_SELinuxSetDeviceContext:
return SProcSELinuxSetDeviceContext(client);
return SProcSELinuxSetDeviceContext(client);
case X_SELinuxGetDeviceContext:
return SProcSELinuxGetDeviceContext(client);
return SProcSELinuxGetDeviceContext(client);
case X_SELinuxSetDrawableCreateContext:
return SProcSELinuxSetCreateContext(client, CTX_WIN);
return SProcSELinuxSetCreateContext(client, CTX_WIN);
case X_SELinuxGetDrawableCreateContext:
return ProcSELinuxGetCreateContext(client, CTX_WIN);
return ProcSELinuxGetCreateContext(client, CTX_WIN);
case X_SELinuxGetDrawableContext:
return SProcSELinuxGetDrawableContext(client);
return SProcSELinuxGetDrawableContext(client);
case X_SELinuxSetPropertyCreateContext:
return SProcSELinuxSetCreateContext(client, CTX_PRP);
return SProcSELinuxSetCreateContext(client, CTX_PRP);
case X_SELinuxGetPropertyCreateContext:
return ProcSELinuxGetCreateContext(client, CTX_PRP);
return ProcSELinuxGetCreateContext(client, CTX_PRP);
case X_SELinuxSetPropertyUseContext:
return SProcSELinuxSetCreateContext(client, USE_PRP);
return SProcSELinuxSetCreateContext(client, USE_PRP);
case X_SELinuxGetPropertyUseContext:
return ProcSELinuxGetCreateContext(client, USE_PRP);
return ProcSELinuxGetCreateContext(client, USE_PRP);
case X_SELinuxGetPropertyContext:
return SProcSELinuxGetPropertyContext(client, objectKey);
return SProcSELinuxGetPropertyContext(client, objectKey);
case X_SELinuxGetPropertyDataContext:
return SProcSELinuxGetPropertyContext(client, dataKey);
return SProcSELinuxGetPropertyContext(client, dataKey);
case X_SELinuxListProperties:
return SProcSELinuxListProperties(client);
return SProcSELinuxListProperties(client);
case X_SELinuxSetSelectionCreateContext:
return SProcSELinuxSetCreateContext(client, CTX_SEL);
return SProcSELinuxSetCreateContext(client, CTX_SEL);
case X_SELinuxGetSelectionCreateContext:
return ProcSELinuxGetCreateContext(client, CTX_SEL);
return ProcSELinuxGetCreateContext(client, CTX_SEL);
case X_SELinuxSetSelectionUseContext:
return SProcSELinuxSetCreateContext(client, USE_SEL);
return SProcSELinuxSetCreateContext(client, USE_SEL);
case X_SELinuxGetSelectionUseContext:
return ProcSELinuxGetCreateContext(client, USE_SEL);
return ProcSELinuxGetCreateContext(client, USE_SEL);
case X_SELinuxGetSelectionContext:
return SProcSELinuxGetSelectionContext(client, objectKey);
return SProcSELinuxGetSelectionContext(client, objectKey);
case X_SELinuxGetSelectionDataContext:
return SProcSELinuxGetSelectionContext(client, dataKey);
return SProcSELinuxGetSelectionContext(client, dataKey);
case X_SELinuxListSelections:
return ProcSELinuxListSelections(client);
return ProcSELinuxListSelections(client);
case X_SELinuxGetClientContext:
return SProcSELinuxGetClientContext(client);
return SProcSELinuxGetClientContext(client);
default:
return BadRequest;
return BadRequest;
}
}
/*
* Extension Setup / Teardown
*/
static void
SELinuxResetProc(ExtensionEntry * extEntry)
SELinuxResetProc(ExtensionEntry *extEntry)
{
SELinuxFlaskReset();
SELinuxLabelReset();
}
void
SELinuxExtensionInit(void)
SELinuxExtensionInit(INITARGS)
{
ExtensionEntry *extEntry;
/* Check SELinux mode on system, configuration file, and boolean */
if (!is_selinux_enabled()) {
LogMessage(X_INFO, "SELinux: Disabled on system\n");
return;
LogMessage(X_INFO, "SELinux: Disabled on system\n");
return;
}
if (selinuxEnforcingState == SELINUX_MODE_DISABLED) {
LogMessage(X_INFO, "SELinux: Disabled in configuration file\n");
return;
LogMessage(X_INFO, "SELinux: Disabled in configuration file\n");
return;
}
if (!security_get_boolean_active("xserver_object_manager")) {
LogMessage(X_INFO, "SELinux: Disabled by boolean\n");
LogMessage(X_INFO, "SELinux: Disabled by boolean\n");
return;
}
@@ -711,7 +718,9 @@ SELinuxExtensionInit(void)
/* Add extension to server */
extEntry = AddExtension(SELINUX_EXTENSION_NAME,
SELinuxNumberEvents, SELinuxNumberErrors,
ProcSELinuxDispatch, SProcSELinuxDispatch,
SELinuxResetProc, StandardMinorOpcode);
SELinuxNumberEvents, SELinuxNumberErrors,
ProcSELinuxDispatch, SProcSELinuxDispatch,
SELinuxResetProc, StandardMinorOpcode);
AddExtensionAlias("Flask", extEntry);
}

File diff suppressed because it is too large Load Diff

View File

@@ -43,10 +43,8 @@ static struct selabel_handle *label_hnd;
/* Array of object classes indexed by resource type */
SELinuxArrayRec arr_types;
/* Array of event SIDs indexed by event type */
SELinuxArrayRec arr_events;
/* Array of property and selection SID structures */
SELinuxArrayRec arr_atoms;
@@ -54,21 +52,21 @@ SELinuxArrayRec arr_atoms;
* Dynamic array helpers
*/
static void *
SELinuxArrayGet(SELinuxArrayRec * rec, unsigned key)
SELinuxArrayGet(SELinuxArrayRec *rec, unsigned key)
{
return (rec->size > key) ? rec->array[key] : 0;
}
static int
SELinuxArraySet(SELinuxArrayRec * rec, unsigned key, void *val)
SELinuxArraySet(SELinuxArrayRec *rec, unsigned key, void *val)
{
if (key >= rec->size) {
/* Need to increase size of array */
rec->array = reallocarray(rec->array, key + 1, sizeof(val));
if (!rec->array)
return FALSE;
memset(rec->array + rec->size, 0, (key - rec->size + 1) * sizeof(val));
rec->size = key + 1;
/* Need to increase size of array */
rec->array = realloc(rec->array, (key + 1) * sizeof(val));
if (!rec->array)
return FALSE;
memset(rec->array + rec->size, 0, (key - rec->size + 1) * sizeof(val));
rec->size = key + 1;
}
rec->array[key] = val;
@@ -76,13 +74,12 @@ SELinuxArraySet(SELinuxArrayRec * rec, unsigned key, void *val)
}
static void
SELinuxArrayFree(SELinuxArrayRec * rec, int free_elements)
SELinuxArrayFree(SELinuxArrayRec *rec, int free_elements)
{
if (free_elements) {
unsigned i = rec->size;
while (i)
free(rec->array[--i]);
unsigned i = rec->size;
while (i)
free(rec->array[--i]);
}
free(rec->array);
@@ -94,7 +91,7 @@ SELinuxArrayFree(SELinuxArrayRec * rec, int free_elements)
* Looks up a name in the selection or property mappings
*/
static int
SELinuxAtomToSIDLookup(Atom atom, SELinuxObjectRec * obj, int map, int polymap)
SELinuxAtomToSIDLookup(Atom atom, SELinuxObjectRec *obj, int map, int polymap)
{
const char *name = NameForAtom(atom);
security_context_t ctx;
@@ -104,21 +101,19 @@ SELinuxAtomToSIDLookup(Atom atom, SELinuxObjectRec * obj, int map, int polymap)
/* Look in the mappings of names to contexts */
if (selabel_lookup_raw(label_hnd, &ctx, name, map) == 0) {
obj->poly = 0;
}
else if (errno != ENOENT) {
ErrorF("SELinux: a property label lookup failed!\n");
return BadValue;
}
else if (selabel_lookup_raw(label_hnd, &ctx, name, polymap) < 0) {
ErrorF("SELinux: a property label lookup failed!\n");
return BadValue;
obj->poly = 0;
} else if (errno != ENOENT) {
ErrorF("SELinux: a property label lookup failed!\n");
return BadValue;
} else if (selabel_lookup_raw(label_hnd, &ctx, name, polymap) < 0) {
ErrorF("SELinux: a property label lookup failed!\n");
return BadValue;
}
/* Get a SID for context */
if (avc_context_to_sid_raw(ctx, &obj->sid) < 0) {
ErrorF("SELinux: a context_to_SID_raw call failed!\n");
rc = BadAlloc;
ErrorF("SELinux: a context_to_SID_raw call failed!\n");
rc = BadAlloc;
}
freecon(ctx);
@@ -129,7 +124,7 @@ SELinuxAtomToSIDLookup(Atom atom, SELinuxObjectRec * obj, int map, int polymap)
* Looks up the SID corresponding to the given property or selection atom
*/
int
SELinuxAtomToSID(Atom atom, int prop, SELinuxObjectRec ** obj_rtn)
SELinuxAtomToSID(Atom atom, int prop, SELinuxObjectRec **obj_rtn)
{
SELinuxAtomRec *rec;
SELinuxObjectRec *obj;
@@ -137,31 +132,30 @@ SELinuxAtomToSID(Atom atom, int prop, SELinuxObjectRec ** obj_rtn)
rec = SELinuxArrayGet(&arr_atoms, atom);
if (!rec) {
rec = calloc(1, sizeof(SELinuxAtomRec));
if (!rec || !SELinuxArraySet(&arr_atoms, atom, rec))
return BadAlloc;
rec = calloc(1, sizeof(SELinuxAtomRec));
if (!rec || !SELinuxArraySet(&arr_atoms, atom, rec))
return BadAlloc;
}
if (prop) {
obj = &rec->prp;
map = SELABEL_X_PROP;
polymap = SELABEL_X_POLYPROP;
}
else {
obj = &rec->sel;
map = SELABEL_X_SELN;
polymap = SELABEL_X_POLYSELN;
obj = &rec->prp;
map = SELABEL_X_PROP;
polymap = SELABEL_X_POLYPROP;
} else {
obj = &rec->sel;
map = SELABEL_X_SELN;
polymap = SELABEL_X_POLYSELN;
}
if (!obj->sid) {
rc = SELinuxAtomToSIDLookup(atom, obj, map, polymap);
if (rc != Success)
goto out;
rc = SELinuxAtomToSIDLookup(atom, obj, map, polymap);
if (rc != Success)
goto out;
}
*obj_rtn = obj;
rc = Success;
out:
out:
return rc;
}
@@ -169,8 +163,8 @@ SELinuxAtomToSID(Atom atom, int prop, SELinuxObjectRec ** obj_rtn)
* Looks up a SID for a selection/subject pair
*/
int
SELinuxSelectionToSID(Atom selection, SELinuxSubjectRec * subj,
security_id_t * sid_rtn, int *poly_rtn)
SELinuxSelectionToSID(Atom selection, SELinuxSubjectRec *subj,
security_id_t *sid_rtn, int *poly_rtn)
{
int rc;
SELinuxObjectRec *obj;
@@ -179,26 +173,26 @@ SELinuxSelectionToSID(Atom selection, SELinuxSubjectRec * subj,
/* Get the default context and polyinstantiation bit */
rc = SELinuxAtomToSID(selection, 0, &obj);
if (rc != Success)
return rc;
return rc;
/* Check for an override context next */
if (subj->sel_use_sid) {
tsid = subj->sel_use_sid;
goto out;
tsid = subj->sel_use_sid;
goto out;
}
tsid = obj->sid;
/* Polyinstantiate if necessary to obtain the final SID */
if (obj->poly && avc_compute_member(subj->sid, obj->sid,
SECCLASS_X_SELECTION, &tsid) < 0) {
ErrorF("SELinux: a compute_member call failed!\n");
return BadValue;
SECCLASS_X_SELECTION, &tsid) < 0) {
ErrorF("SELinux: a compute_member call failed!\n");
return BadValue;
}
out:
out:
*sid_rtn = tsid;
if (poly_rtn)
*poly_rtn = obj->poly;
*poly_rtn = obj->poly;
return Success;
}
@@ -206,8 +200,8 @@ SELinuxSelectionToSID(Atom selection, SELinuxSubjectRec * subj,
* Looks up a SID for a property/subject pair
*/
int
SELinuxPropertyToSID(Atom property, SELinuxSubjectRec * subj,
security_id_t * sid_rtn, int *poly_rtn)
SELinuxPropertyToSID(Atom property, SELinuxSubjectRec *subj,
security_id_t *sid_rtn, int *poly_rtn)
{
int rc;
SELinuxObjectRec *obj;
@@ -216,33 +210,34 @@ SELinuxPropertyToSID(Atom property, SELinuxSubjectRec * subj,
/* Get the default context and polyinstantiation bit */
rc = SELinuxAtomToSID(property, 1, &obj);
if (rc != Success)
return rc;
return rc;
/* Check for an override context next */
if (subj->prp_use_sid) {
tsid = subj->prp_use_sid;
goto out;
tsid = subj->prp_use_sid;
goto out;
}
/* Perform a transition */
if (avc_compute_create(subj->sid, obj->sid, SECCLASS_X_PROPERTY, &tsid) < 0) {
ErrorF("SELinux: a compute_create call failed!\n");
return BadValue;
if (avc_compute_create(subj->sid, obj->sid,
SECCLASS_X_PROPERTY, &tsid) < 0) {
ErrorF("SELinux: a compute_create call failed!\n");
return BadValue;
}
/* Polyinstantiate if necessary to obtain the final SID */
if (obj->poly) {
tsid2 = tsid;
if (avc_compute_member(subj->sid, tsid2,
SECCLASS_X_PROPERTY, &tsid) < 0) {
ErrorF("SELinux: a compute_member call failed!\n");
return BadValue;
}
tsid2 = tsid;
if (avc_compute_member(subj->sid, tsid2,
SECCLASS_X_PROPERTY, &tsid) < 0) {
ErrorF("SELinux: a compute_member call failed!\n");
return BadValue;
}
}
out:
out:
*sid_rtn = tsid;
if (poly_rtn)
*poly_rtn = obj->poly;
*poly_rtn = obj->poly;
return Success;
}
@@ -251,58 +246,57 @@ SELinuxPropertyToSID(Atom property, SELinuxSubjectRec * subj,
*/
int
SELinuxEventToSID(unsigned type, security_id_t sid_of_window,
SELinuxObjectRec * sid_return)
SELinuxObjectRec *sid_return)
{
const char *name = LookupEventName(type);
security_id_t sid;
security_context_t ctx;
type &= 127;
sid = SELinuxArrayGet(&arr_events, type);
if (!sid) {
/* Look in the mappings of event names to contexts */
if (selabel_lookup_raw(label_hnd, &ctx, name, SELABEL_X_EVENT) < 0) {
ErrorF("SELinux: an event label lookup failed!\n");
return BadValue;
}
/* Get a SID for context */
if (avc_context_to_sid_raw(ctx, &sid) < 0) {
ErrorF("SELinux: a context_to_SID_raw call failed!\n");
freecon(ctx);
return BadAlloc;
}
freecon(ctx);
/* Cache the SID value */
if (!SELinuxArraySet(&arr_events, type, sid))
return BadAlloc;
/* Look in the mappings of event names to contexts */
if (selabel_lookup_raw(label_hnd, &ctx, name, SELABEL_X_EVENT) < 0) {
ErrorF("SELinux: an event label lookup failed!\n");
return BadValue;
}
/* Get a SID for context */
if (avc_context_to_sid_raw(ctx, &sid) < 0) {
ErrorF("SELinux: a context_to_SID_raw call failed!\n");
freecon(ctx);
return BadAlloc;
}
freecon(ctx);
/* Cache the SID value */
if (!SELinuxArraySet(&arr_events, type, sid))
return BadAlloc;
}
/* Perform a transition to obtain the final SID */
if (avc_compute_create(sid_of_window, sid, SECCLASS_X_EVENT,
&sid_return->sid) < 0) {
ErrorF("SELinux: a compute_create call failed!\n");
return BadValue;
&sid_return->sid) < 0) {
ErrorF("SELinux: a compute_create call failed!\n");
return BadValue;
}
return Success;
}
int
SELinuxExtensionToSID(const char *name, security_id_t * sid_rtn)
SELinuxExtensionToSID(const char *name, security_id_t *sid_rtn)
{
security_context_t ctx;
/* Look in the mappings of extension names to contexts */
if (selabel_lookup_raw(label_hnd, &ctx, name, SELABEL_X_EXT) < 0) {
ErrorF("SELinux: a property label lookup failed!\n");
return BadValue;
ErrorF("SELinux: a property label lookup failed!\n");
return BadValue;
}
/* Get a SID for context */
if (avc_context_to_sid_raw(ctx, sid_rtn) < 0) {
ErrorF("SELinux: a context_to_SID_raw call failed!\n");
freecon(ctx);
return BadAlloc;
ErrorF("SELinux: a context_to_SID_raw call failed!\n");
freecon(ctx);
return BadAlloc;
}
freecon(ctx);
return Success;
@@ -318,33 +312,32 @@ SELinuxTypeToClass(RESTYPE type)
tmp = SELinuxArrayGet(&arr_types, type & TypeMask);
if (!tmp) {
unsigned long class = SECCLASS_X_RESOURCE;
unsigned long class = SECCLASS_X_RESOURCE;
if (type & RC_DRAWABLE)
class = SECCLASS_X_DRAWABLE;
else if (type == RT_GC)
class = SECCLASS_X_GC;
else if (type == RT_FONT)
class = SECCLASS_X_FONT;
else if (type == RT_CURSOR)
class = SECCLASS_X_CURSOR;
else if (type == RT_COLORMAP)
class = SECCLASS_X_COLORMAP;
else {
/* Need to do a string lookup */
const char *str = LookupResourceName(type);
if (type & RC_DRAWABLE)
class = SECCLASS_X_DRAWABLE;
else if (type == RT_GC)
class = SECCLASS_X_GC;
else if (type == RT_FONT)
class = SECCLASS_X_FONT;
else if (type == RT_CURSOR)
class = SECCLASS_X_CURSOR;
else if (type == RT_COLORMAP)
class = SECCLASS_X_COLORMAP;
else {
/* Need to do a string lookup */
const char *str = LookupResourceName(type);
if (!strcmp(str, "PICTURE"))
class = SECCLASS_X_DRAWABLE;
else if (!strcmp(str, "GLYPHSET"))
class = SECCLASS_X_FONT;
}
if (!strcmp(str, "PICTURE"))
class = SECCLASS_X_DRAWABLE;
else if (!strcmp(str, "GLYPHSET"))
class = SECCLASS_X_FONT;
}
tmp = (void *) class;
SELinuxArraySet(&arr_types, type & TypeMask, tmp);
tmp = (void *)class;
SELinuxArraySet(&arr_types, type & TypeMask, tmp);
}
return (security_class_t) (unsigned long) tmp;
return (security_class_t)(unsigned long)tmp;
}
security_context_t
@@ -353,7 +346,7 @@ SELinuxDefaultClientLabel(void)
security_context_t ctx;
if (selabel_lookup_raw(label_hnd, &ctx, "remote", SELABEL_X_CLIENT) < 0)
FatalError("SELinux: failed to look up remote-client context\n");
FatalError("SELinux: failed to look up remote-client context\n");
return ctx;
}
@@ -361,11 +354,11 @@ SELinuxDefaultClientLabel(void)
void
SELinuxLabelInit(void)
{
struct selinux_opt selabel_option = { SELABEL_OPT_VALIDATE, (char *) 1 };
struct selinux_opt selabel_option = { SELABEL_OPT_VALIDATE, (char *)1 };
label_hnd = selabel_open(SELABEL_CTX_X, &selabel_option, 1);
if (!label_hnd)
FatalError("SELinux: Failed to open x_contexts mapping in policy\n");
FatalError("SELinux: Failed to open x_contexts mapping in policy\n");
}
void

View File

@@ -63,13 +63,10 @@ typedef struct {
*/
extern DevPrivateKeyRec subjectKeyRec;
#define subjectKey (&subjectKeyRec)
extern DevPrivateKeyRec objectKeyRec;
#define objectKey (&objectKeyRec)
extern DevPrivateKeyRec dataKeyRec;
#define dataKey (&dataKeyRec)
/*
@@ -77,45 +74,45 @@ extern DevPrivateKeyRec dataKeyRec;
*/
int
SELinuxAtomToSID(Atom atom, int prop, SELinuxObjectRec ** obj_rtn);
SELinuxAtomToSID(Atom atom, int prop, SELinuxObjectRec **obj_rtn);
int
SELinuxSelectionToSID(Atom selection, SELinuxSubjectRec * subj,
security_id_t * sid_rtn, int *poly_rtn);
SELinuxSelectionToSID(Atom selection, SELinuxSubjectRec *subj,
security_id_t *sid_rtn, int *poly_rtn);
int
SELinuxPropertyToSID(Atom property, SELinuxSubjectRec * subj,
security_id_t * sid_rtn, int *poly_rtn);
SELinuxPropertyToSID(Atom property, SELinuxSubjectRec *subj,
security_id_t *sid_rtn, int *poly_rtn);
int
SELinuxEventToSID(unsigned type, security_id_t sid_of_window,
SELinuxObjectRec * sid_return);
SELinuxObjectRec *sid_return);
int
SELinuxExtensionToSID(const char *name, security_id_t * sid_rtn);
SELinuxExtensionToSID(const char *name, security_id_t *sid_rtn);
security_class_t SELinuxTypeToClass(RESTYPE type);
security_class_t
SELinuxTypeToClass(RESTYPE type);
security_context_t SELinuxDefaultClientLabel(void);
security_context_t
SELinuxDefaultClientLabel(void);
void
SELinuxLabelInit(void);
SELinuxLabelInit(void);
void
SELinuxLabelReset(void);
SELinuxLabelReset(void);
/*
* Security module functions
*/
void
SELinuxFlaskInit(void);
SELinuxFlaskInit(void);
void
SELinuxFlaskReset(void);
SELinuxFlaskReset(void);
/*
* Private Flask definitions
@@ -142,416 +139,416 @@ void
#ifdef _XSELINUX_NEED_FLASK_MAP
/* Mapping from DixAccess bits to Flask permissions */
static struct security_class_mapping map[] = {
{"x_drawable",
{"read", /* DixReadAccess */
"write", /* DixWriteAccess */
"destroy", /* DixDestroyAccess */
"create", /* DixCreateAccess */
"getattr", /* DixGetAttrAccess */
"setattr", /* DixSetAttrAccess */
"list_property", /* DixListPropAccess */
"get_property", /* DixGetPropAccess */
"set_property", /* DixSetPropAccess */
"", /* DixGetFocusAccess */
"", /* DixSetFocusAccess */
"list_child", /* DixListAccess */
"add_child", /* DixAddAccess */
"remove_child", /* DixRemoveAccess */
"hide", /* DixHideAccess */
"show", /* DixShowAccess */
"blend", /* DixBlendAccess */
"override", /* DixGrabAccess */
"", /* DixFreezeAccess */
"", /* DixForceAccess */
"", /* DixInstallAccess */
"", /* DixUninstallAccess */
"send", /* DixSendAccess */
"receive", /* DixReceiveAccess */
"", /* DixUseAccess */
"manage", /* DixManageAccess */
NULL}},
{"x_screen",
{"", /* DixReadAccess */
"", /* DixWriteAccess */
"", /* DixDestroyAccess */
"", /* DixCreateAccess */
"getattr", /* DixGetAttrAccess */
"setattr", /* DixSetAttrAccess */
"saver_getattr", /* DixListPropAccess */
"saver_setattr", /* DixGetPropAccess */
"", /* DixSetPropAccess */
"", /* DixGetFocusAccess */
"", /* DixSetFocusAccess */
"", /* DixListAccess */
"", /* DixAddAccess */
"", /* DixRemoveAccess */
"hide_cursor", /* DixHideAccess */
"show_cursor", /* DixShowAccess */
"saver_hide", /* DixBlendAccess */
"saver_show", /* DixGrabAccess */
NULL}},
{"x_gc",
{"", /* DixReadAccess */
"", /* DixWriteAccess */
"destroy", /* DixDestroyAccess */
"create", /* DixCreateAccess */
"getattr", /* DixGetAttrAccess */
"setattr", /* DixSetAttrAccess */
"", /* DixListPropAccess */
"", /* DixGetPropAccess */
"", /* DixSetPropAccess */
"", /* DixGetFocusAccess */
"", /* DixSetFocusAccess */
"", /* DixListAccess */
"", /* DixAddAccess */
"", /* DixRemoveAccess */
"", /* DixHideAccess */
"", /* DixShowAccess */
"", /* DixBlendAccess */
"", /* DixGrabAccess */
"", /* DixFreezeAccess */
"", /* DixForceAccess */
"", /* DixInstallAccess */
"", /* DixUninstallAccess */
"", /* DixSendAccess */
"", /* DixReceiveAccess */
"use", /* DixUseAccess */
NULL}},
{"x_font",
{"", /* DixReadAccess */
"", /* DixWriteAccess */
"destroy", /* DixDestroyAccess */
"create", /* DixCreateAccess */
"getattr", /* DixGetAttrAccess */
"", /* DixSetAttrAccess */
"", /* DixListPropAccess */
"", /* DixGetPropAccess */
"", /* DixSetPropAccess */
"", /* DixGetFocusAccess */
"", /* DixSetFocusAccess */
"", /* DixListAccess */
"add_glyph", /* DixAddAccess */
"remove_glyph", /* DixRemoveAccess */
"", /* DixHideAccess */
"", /* DixShowAccess */
"", /* DixBlendAccess */
"", /* DixGrabAccess */
"", /* DixFreezeAccess */
"", /* DixForceAccess */
"", /* DixInstallAccess */
"", /* DixUninstallAccess */
"", /* DixSendAccess */
"", /* DixReceiveAccess */
"use", /* DixUseAccess */
NULL}},
{"x_colormap",
{"read", /* DixReadAccess */
"write", /* DixWriteAccess */
"destroy", /* DixDestroyAccess */
"create", /* DixCreateAccess */
"getattr", /* DixGetAttrAccess */
"", /* DixSetAttrAccess */
"", /* DixListPropAccess */
"", /* DixGetPropAccess */
"", /* DixSetPropAccess */
"", /* DixGetFocusAccess */
"", /* DixSetFocusAccess */
"", /* DixListAccess */
"add_color", /* DixAddAccess */
"remove_color", /* DixRemoveAccess */
"", /* DixHideAccess */
"", /* DixShowAccess */
"", /* DixBlendAccess */
"", /* DixGrabAccess */
"", /* DixFreezeAccess */
"", /* DixForceAccess */
"install", /* DixInstallAccess */
"uninstall", /* DixUninstallAccess */
"", /* DixSendAccess */
"", /* DixReceiveAccess */
"use", /* DixUseAccess */
NULL}},
{"x_property",
{"read", /* DixReadAccess */
"write", /* DixWriteAccess */
"destroy", /* DixDestroyAccess */
"create", /* DixCreateAccess */
"getattr", /* DixGetAttrAccess */
"setattr", /* DixSetAttrAccess */
"", /* DixListPropAccess */
"", /* DixGetPropAccess */
"", /* DixSetPropAccess */
"", /* DixGetFocusAccess */
"", /* DixSetFocusAccess */
"", /* DixListAccess */
"", /* DixAddAccess */
"", /* DixRemoveAccess */
"", /* DixHideAccess */
"", /* DixShowAccess */
"write", /* DixBlendAccess */
NULL}},
{"x_selection",
{"read", /* DixReadAccess */
"", /* DixWriteAccess */
"", /* DixDestroyAccess */
"setattr", /* DixCreateAccess */
"getattr", /* DixGetAttrAccess */
"setattr", /* DixSetAttrAccess */
NULL}},
{"x_cursor",
{"read", /* DixReadAccess */
"write", /* DixWriteAccess */
"destroy", /* DixDestroyAccess */
"create", /* DixCreateAccess */
"getattr", /* DixGetAttrAccess */
"setattr", /* DixSetAttrAccess */
"", /* DixListPropAccess */
"", /* DixGetPropAccess */
"", /* DixSetPropAccess */
"", /* DixGetFocusAccess */
"", /* DixSetFocusAccess */
"", /* DixListAccess */
"", /* DixAddAccess */
"", /* DixRemoveAccess */
"", /* DixHideAccess */
"", /* DixShowAccess */
"", /* DixBlendAccess */
"", /* DixGrabAccess */
"", /* DixFreezeAccess */
"", /* DixForceAccess */
"", /* DixInstallAccess */
"", /* DixUninstallAccess */
"", /* DixSendAccess */
"", /* DixReceiveAccess */
"use", /* DixUseAccess */
NULL}},
{"x_client",
{"", /* DixReadAccess */
"", /* DixWriteAccess */
"destroy", /* DixDestroyAccess */
"", /* DixCreateAccess */
"getattr", /* DixGetAttrAccess */
"setattr", /* DixSetAttrAccess */
"", /* DixListPropAccess */
"", /* DixGetPropAccess */
"", /* DixSetPropAccess */
"", /* DixGetFocusAccess */
"", /* DixSetFocusAccess */
"", /* DixListAccess */
"", /* DixAddAccess */
"", /* DixRemoveAccess */
"", /* DixHideAccess */
"", /* DixShowAccess */
"", /* DixBlendAccess */
"", /* DixGrabAccess */
"", /* DixFreezeAccess */
"", /* DixForceAccess */
"", /* DixInstallAccess */
"", /* DixUninstallAccess */
"", /* DixSendAccess */
"", /* DixReceiveAccess */
"", /* DixUseAccess */
"manage", /* DixManageAccess */
NULL}},
{"x_pointer",
{"read", /* DixReadAccess */
"write", /* DixWriteAccess */
"destroy", /* DixDestroyAccess */
"create", /* DixCreateAccess */
"getattr", /* DixGetAttrAccess */
"setattr", /* DixSetAttrAccess */
"list_property", /* DixListPropAccess */
"get_property", /* DixGetPropAccess */
"set_property", /* DixSetPropAccess */
"getfocus", /* DixGetFocusAccess */
"setfocus", /* DixSetFocusAccess */
"", /* DixListAccess */
"add", /* DixAddAccess */
"remove", /* DixRemoveAccess */
"", /* DixHideAccess */
"", /* DixShowAccess */
"", /* DixBlendAccess */
"grab", /* DixGrabAccess */
"freeze", /* DixFreezeAccess */
"force_cursor", /* DixForceAccess */
"", /* DixInstallAccess */
"", /* DixUninstallAccess */
"", /* DixSendAccess */
"", /* DixReceiveAccess */
"use", /* DixUseAccess */
"manage", /* DixManageAccess */
"", /* DixDebugAccess */
"bell", /* DixBellAccess */
NULL}},
{"x_keyboard",
{"read", /* DixReadAccess */
"write", /* DixWriteAccess */
"destroy", /* DixDestroyAccess */
"create", /* DixCreateAccess */
"getattr", /* DixGetAttrAccess */
"setattr", /* DixSetAttrAccess */
"list_property", /* DixListPropAccess */
"get_property", /* DixGetPropAccess */
"set_property", /* DixSetPropAccess */
"getfocus", /* DixGetFocusAccess */
"setfocus", /* DixSetFocusAccess */
"", /* DixListAccess */
"add", /* DixAddAccess */
"remove", /* DixRemoveAccess */
"", /* DixHideAccess */
"", /* DixShowAccess */
"", /* DixBlendAccess */
"grab", /* DixGrabAccess */
"freeze", /* DixFreezeAccess */
"force_cursor", /* DixForceAccess */
"", /* DixInstallAccess */
"", /* DixUninstallAccess */
"", /* DixSendAccess */
"", /* DixReceiveAccess */
"use", /* DixUseAccess */
"manage", /* DixManageAccess */
"", /* DixDebugAccess */
"bell", /* DixBellAccess */
NULL}},
{"x_server",
{"record", /* DixReadAccess */
"", /* DixWriteAccess */
"", /* DixDestroyAccess */
"", /* DixCreateAccess */
"getattr", /* DixGetAttrAccess */
"setattr", /* DixSetAttrAccess */
"", /* DixListPropAccess */
"", /* DixGetPropAccess */
"", /* DixSetPropAccess */
"", /* DixGetFocusAccess */
"", /* DixSetFocusAccess */
"", /* DixListAccess */
"", /* DixAddAccess */
"", /* DixRemoveAccess */
"", /* DixHideAccess */
"", /* DixShowAccess */
"", /* DixBlendAccess */
"grab", /* DixGrabAccess */
"", /* DixFreezeAccess */
"", /* DixForceAccess */
"", /* DixInstallAccess */
"", /* DixUninstallAccess */
"", /* DixSendAccess */
"", /* DixReceiveAccess */
"", /* DixUseAccess */
"manage", /* DixManageAccess */
"debug", /* DixDebugAccess */
NULL}},
{"x_extension",
{"", /* DixReadAccess */
"", /* DixWriteAccess */
"", /* DixDestroyAccess */
"", /* DixCreateAccess */
"query", /* DixGetAttrAccess */
"", /* DixSetAttrAccess */
"", /* DixListPropAccess */
"", /* DixGetPropAccess */
"", /* DixSetPropAccess */
"", /* DixGetFocusAccess */
"", /* DixSetFocusAccess */
"", /* DixListAccess */
"", /* DixAddAccess */
"", /* DixRemoveAccess */
"", /* DixHideAccess */
"", /* DixShowAccess */
"", /* DixBlendAccess */
"", /* DixGrabAccess */
"", /* DixFreezeAccess */
"", /* DixForceAccess */
"", /* DixInstallAccess */
"", /* DixUninstallAccess */
"", /* DixSendAccess */
"", /* DixReceiveAccess */
"use", /* DixUseAccess */
NULL}},
{"x_event",
{"", /* DixReadAccess */
"", /* DixWriteAccess */
"", /* DixDestroyAccess */
"", /* DixCreateAccess */
"", /* DixGetAttrAccess */
"", /* DixSetAttrAccess */
"", /* DixListPropAccess */
"", /* DixGetPropAccess */
"", /* DixSetPropAccess */
"", /* DixGetFocusAccess */
"", /* DixSetFocusAccess */
"", /* DixListAccess */
"", /* DixAddAccess */
"", /* DixRemoveAccess */
"", /* DixHideAccess */
"", /* DixShowAccess */
"", /* DixBlendAccess */
"", /* DixGrabAccess */
"", /* DixFreezeAccess */
"", /* DixForceAccess */
"", /* DixInstallAccess */
"", /* DixUninstallAccess */
"send", /* DixSendAccess */
"receive", /* DixReceiveAccess */
NULL}},
{"x_synthetic_event",
{"", /* DixReadAccess */
"", /* DixWriteAccess */
"", /* DixDestroyAccess */
"", /* DixCreateAccess */
"", /* DixGetAttrAccess */
"", /* DixSetAttrAccess */
"", /* DixListPropAccess */
"", /* DixGetPropAccess */
"", /* DixSetPropAccess */
"", /* DixGetFocusAccess */
"", /* DixSetFocusAccess */
"", /* DixListAccess */
"", /* DixAddAccess */
"", /* DixRemoveAccess */
"", /* DixHideAccess */
"", /* DixShowAccess */
"", /* DixBlendAccess */
"", /* DixGrabAccess */
"", /* DixFreezeAccess */
"", /* DixForceAccess */
"", /* DixInstallAccess */
"", /* DixUninstallAccess */
"send", /* DixSendAccess */
"receive", /* DixReceiveAccess */
NULL}},
{"x_resource",
{"read", /* DixReadAccess */
"write", /* DixWriteAccess */
"write", /* DixDestroyAccess */
"write", /* DixCreateAccess */
"read", /* DixGetAttrAccess */
"write", /* DixSetAttrAccess */
"read", /* DixListPropAccess */
"read", /* DixGetPropAccess */
"write", /* DixSetPropAccess */
"read", /* DixGetFocusAccess */
"write", /* DixSetFocusAccess */
"read", /* DixListAccess */
"write", /* DixAddAccess */
"write", /* DixRemoveAccess */
"write", /* DixHideAccess */
"read", /* DixShowAccess */
"read", /* DixBlendAccess */
"write", /* DixGrabAccess */
"write", /* DixFreezeAccess */
"write", /* DixForceAccess */
"write", /* DixInstallAccess */
"write", /* DixUninstallAccess */
"write", /* DixSendAccess */
"read", /* DixReceiveAccess */
"read", /* DixUseAccess */
"write", /* DixManageAccess */
"read", /* DixDebugAccess */
"write", /* DixBellAccess */
NULL}},
{NULL}
{ "x_drawable",
{ "read", /* DixReadAccess */
"write", /* DixWriteAccess */
"destroy", /* DixDestroyAccess */
"create", /* DixCreateAccess */
"getattr", /* DixGetAttrAccess */
"setattr", /* DixSetAttrAccess */
"list_property", /* DixListPropAccess */
"get_property", /* DixGetPropAccess */
"set_property", /* DixSetPropAccess */
"", /* DixGetFocusAccess */
"", /* DixSetFocusAccess */
"list_child", /* DixListAccess */
"add_child", /* DixAddAccess */
"remove_child", /* DixRemoveAccess */
"hide", /* DixHideAccess */
"show", /* DixShowAccess */
"blend", /* DixBlendAccess */
"override", /* DixGrabAccess */
"", /* DixFreezeAccess */
"", /* DixForceAccess */
"", /* DixInstallAccess */
"", /* DixUninstallAccess */
"send", /* DixSendAccess */
"receive", /* DixReceiveAccess */
"", /* DixUseAccess */
"manage", /* DixManageAccess */
NULL }},
{ "x_screen",
{ "", /* DixReadAccess */
"", /* DixWriteAccess */
"", /* DixDestroyAccess */
"", /* DixCreateAccess */
"getattr", /* DixGetAttrAccess */
"setattr", /* DixSetAttrAccess */
"saver_getattr", /* DixListPropAccess */
"saver_setattr", /* DixGetPropAccess */
"", /* DixSetPropAccess */
"", /* DixGetFocusAccess */
"", /* DixSetFocusAccess */
"", /* DixListAccess */
"", /* DixAddAccess */
"", /* DixRemoveAccess */
"hide_cursor", /* DixHideAccess */
"show_cursor", /* DixShowAccess */
"saver_hide", /* DixBlendAccess */
"saver_show", /* DixGrabAccess */
NULL }},
{ "x_gc",
{ "", /* DixReadAccess */
"", /* DixWriteAccess */
"destroy", /* DixDestroyAccess */
"create", /* DixCreateAccess */
"getattr", /* DixGetAttrAccess */
"setattr", /* DixSetAttrAccess */
"", /* DixListPropAccess */
"", /* DixGetPropAccess */
"", /* DixSetPropAccess */
"", /* DixGetFocusAccess */
"", /* DixSetFocusAccess */
"", /* DixListAccess */
"", /* DixAddAccess */
"", /* DixRemoveAccess */
"", /* DixHideAccess */
"", /* DixShowAccess */
"", /* DixBlendAccess */
"", /* DixGrabAccess */
"", /* DixFreezeAccess */
"", /* DixForceAccess */
"", /* DixInstallAccess */
"", /* DixUninstallAccess */
"", /* DixSendAccess */
"", /* DixReceiveAccess */
"use", /* DixUseAccess */
NULL }},
{ "x_font",
{ "", /* DixReadAccess */
"", /* DixWriteAccess */
"destroy", /* DixDestroyAccess */
"create", /* DixCreateAccess */
"getattr", /* DixGetAttrAccess */
"", /* DixSetAttrAccess */
"", /* DixListPropAccess */
"", /* DixGetPropAccess */
"", /* DixSetPropAccess */
"", /* DixGetFocusAccess */
"", /* DixSetFocusAccess */
"", /* DixListAccess */
"add_glyph", /* DixAddAccess */
"remove_glyph", /* DixRemoveAccess */
"", /* DixHideAccess */
"", /* DixShowAccess */
"", /* DixBlendAccess */
"", /* DixGrabAccess */
"", /* DixFreezeAccess */
"", /* DixForceAccess */
"", /* DixInstallAccess */
"", /* DixUninstallAccess */
"", /* DixSendAccess */
"", /* DixReceiveAccess */
"use", /* DixUseAccess */
NULL }},
{ "x_colormap",
{ "read", /* DixReadAccess */
"write", /* DixWriteAccess */
"destroy", /* DixDestroyAccess */
"create", /* DixCreateAccess */
"getattr", /* DixGetAttrAccess */
"", /* DixSetAttrAccess */
"", /* DixListPropAccess */
"", /* DixGetPropAccess */
"", /* DixSetPropAccess */
"", /* DixGetFocusAccess */
"", /* DixSetFocusAccess */
"", /* DixListAccess */
"add_color", /* DixAddAccess */
"remove_color", /* DixRemoveAccess */
"", /* DixHideAccess */
"", /* DixShowAccess */
"", /* DixBlendAccess */
"", /* DixGrabAccess */
"", /* DixFreezeAccess */
"", /* DixForceAccess */
"install", /* DixInstallAccess */
"uninstall", /* DixUninstallAccess */
"", /* DixSendAccess */
"", /* DixReceiveAccess */
"use", /* DixUseAccess */
NULL }},
{ "x_property",
{ "read", /* DixReadAccess */
"write", /* DixWriteAccess */
"destroy", /* DixDestroyAccess */
"create", /* DixCreateAccess */
"getattr", /* DixGetAttrAccess */
"setattr", /* DixSetAttrAccess */
"", /* DixListPropAccess */
"", /* DixGetPropAccess */
"", /* DixSetPropAccess */
"", /* DixGetFocusAccess */
"", /* DixSetFocusAccess */
"", /* DixListAccess */
"", /* DixAddAccess */
"", /* DixRemoveAccess */
"", /* DixHideAccess */
"", /* DixShowAccess */
"write", /* DixBlendAccess */
NULL }},
{ "x_selection",
{ "read", /* DixReadAccess */
"", /* DixWriteAccess */
"", /* DixDestroyAccess */
"setattr", /* DixCreateAccess */
"getattr", /* DixGetAttrAccess */
"setattr", /* DixSetAttrAccess */
NULL }},
{ "x_cursor",
{ "read", /* DixReadAccess */
"write", /* DixWriteAccess */
"destroy", /* DixDestroyAccess */
"create", /* DixCreateAccess */
"getattr", /* DixGetAttrAccess */
"setattr", /* DixSetAttrAccess */
"", /* DixListPropAccess */
"", /* DixGetPropAccess */
"", /* DixSetPropAccess */
"", /* DixGetFocusAccess */
"", /* DixSetFocusAccess */
"", /* DixListAccess */
"", /* DixAddAccess */
"", /* DixRemoveAccess */
"", /* DixHideAccess */
"", /* DixShowAccess */
"", /* DixBlendAccess */
"", /* DixGrabAccess */
"", /* DixFreezeAccess */
"", /* DixForceAccess */
"", /* DixInstallAccess */
"", /* DixUninstallAccess */
"", /* DixSendAccess */
"", /* DixReceiveAccess */
"use", /* DixUseAccess */
NULL }},
{ "x_client",
{ "", /* DixReadAccess */
"", /* DixWriteAccess */
"destroy", /* DixDestroyAccess */
"", /* DixCreateAccess */
"getattr", /* DixGetAttrAccess */
"setattr", /* DixSetAttrAccess */
"", /* DixListPropAccess */
"", /* DixGetPropAccess */
"", /* DixSetPropAccess */
"", /* DixGetFocusAccess */
"", /* DixSetFocusAccess */
"", /* DixListAccess */
"", /* DixAddAccess */
"", /* DixRemoveAccess */
"", /* DixHideAccess */
"", /* DixShowAccess */
"", /* DixBlendAccess */
"", /* DixGrabAccess */
"", /* DixFreezeAccess */
"", /* DixForceAccess */
"", /* DixInstallAccess */
"", /* DixUninstallAccess */
"", /* DixSendAccess */
"", /* DixReceiveAccess */
"", /* DixUseAccess */
"manage", /* DixManageAccess */
NULL }},
{ "x_pointer",
{ "read", /* DixReadAccess */
"write", /* DixWriteAccess */
"destroy", /* DixDestroyAccess */
"create", /* DixCreateAccess */
"getattr", /* DixGetAttrAccess */
"setattr", /* DixSetAttrAccess */
"list_property", /* DixListPropAccess */
"get_property", /* DixGetPropAccess */
"set_property", /* DixSetPropAccess */
"getfocus", /* DixGetFocusAccess */
"setfocus", /* DixSetFocusAccess */
"", /* DixListAccess */
"add", /* DixAddAccess */
"remove", /* DixRemoveAccess */
"", /* DixHideAccess */
"", /* DixShowAccess */
"", /* DixBlendAccess */
"grab", /* DixGrabAccess */
"freeze", /* DixFreezeAccess */
"force_cursor", /* DixForceAccess */
"", /* DixInstallAccess */
"", /* DixUninstallAccess */
"", /* DixSendAccess */
"", /* DixReceiveAccess */
"use", /* DixUseAccess */
"manage", /* DixManageAccess */
"", /* DixDebugAccess */
"bell", /* DixBellAccess */
NULL }},
{ "x_keyboard",
{ "read", /* DixReadAccess */
"write", /* DixWriteAccess */
"destroy", /* DixDestroyAccess */
"create", /* DixCreateAccess */
"getattr", /* DixGetAttrAccess */
"setattr", /* DixSetAttrAccess */
"list_property", /* DixListPropAccess */
"get_property", /* DixGetPropAccess */
"set_property", /* DixSetPropAccess */
"getfocus", /* DixGetFocusAccess */
"setfocus", /* DixSetFocusAccess */
"", /* DixListAccess */
"add", /* DixAddAccess */
"remove", /* DixRemoveAccess */
"", /* DixHideAccess */
"", /* DixShowAccess */
"", /* DixBlendAccess */
"grab", /* DixGrabAccess */
"freeze", /* DixFreezeAccess */
"force_cursor", /* DixForceAccess */
"", /* DixInstallAccess */
"", /* DixUninstallAccess */
"", /* DixSendAccess */
"", /* DixReceiveAccess */
"use", /* DixUseAccess */
"manage", /* DixManageAccess */
"", /* DixDebugAccess */
"bell", /* DixBellAccess */
NULL }},
{ "x_server",
{ "record", /* DixReadAccess */
"", /* DixWriteAccess */
"", /* DixDestroyAccess */
"", /* DixCreateAccess */
"getattr", /* DixGetAttrAccess */
"setattr", /* DixSetAttrAccess */
"", /* DixListPropAccess */
"", /* DixGetPropAccess */
"", /* DixSetPropAccess */
"", /* DixGetFocusAccess */
"", /* DixSetFocusAccess */
"", /* DixListAccess */
"", /* DixAddAccess */
"", /* DixRemoveAccess */
"", /* DixHideAccess */
"", /* DixShowAccess */
"", /* DixBlendAccess */
"grab", /* DixGrabAccess */
"", /* DixFreezeAccess */
"", /* DixForceAccess */
"", /* DixInstallAccess */
"", /* DixUninstallAccess */
"", /* DixSendAccess */
"", /* DixReceiveAccess */
"", /* DixUseAccess */
"manage", /* DixManageAccess */
"debug", /* DixDebugAccess */
NULL }},
{ "x_extension",
{ "", /* DixReadAccess */
"", /* DixWriteAccess */
"", /* DixDestroyAccess */
"", /* DixCreateAccess */
"query", /* DixGetAttrAccess */
"", /* DixSetAttrAccess */
"", /* DixListPropAccess */
"", /* DixGetPropAccess */
"", /* DixSetPropAccess */
"", /* DixGetFocusAccess */
"", /* DixSetFocusAccess */
"", /* DixListAccess */
"", /* DixAddAccess */
"", /* DixRemoveAccess */
"", /* DixHideAccess */
"", /* DixShowAccess */
"", /* DixBlendAccess */
"", /* DixGrabAccess */
"", /* DixFreezeAccess */
"", /* DixForceAccess */
"", /* DixInstallAccess */
"", /* DixUninstallAccess */
"", /* DixSendAccess */
"", /* DixReceiveAccess */
"use", /* DixUseAccess */
NULL }},
{ "x_event",
{ "", /* DixReadAccess */
"", /* DixWriteAccess */
"", /* DixDestroyAccess */
"", /* DixCreateAccess */
"", /* DixGetAttrAccess */
"", /* DixSetAttrAccess */
"", /* DixListPropAccess */
"", /* DixGetPropAccess */
"", /* DixSetPropAccess */
"", /* DixGetFocusAccess */
"", /* DixSetFocusAccess */
"", /* DixListAccess */
"", /* DixAddAccess */
"", /* DixRemoveAccess */
"", /* DixHideAccess */
"", /* DixShowAccess */
"", /* DixBlendAccess */
"", /* DixGrabAccess */
"", /* DixFreezeAccess */
"", /* DixForceAccess */
"", /* DixInstallAccess */
"", /* DixUninstallAccess */
"send", /* DixSendAccess */
"receive", /* DixReceiveAccess */
NULL }},
{ "x_synthetic_event",
{ "", /* DixReadAccess */
"", /* DixWriteAccess */
"", /* DixDestroyAccess */
"", /* DixCreateAccess */
"", /* DixGetAttrAccess */
"", /* DixSetAttrAccess */
"", /* DixListPropAccess */
"", /* DixGetPropAccess */
"", /* DixSetPropAccess */
"", /* DixGetFocusAccess */
"", /* DixSetFocusAccess */
"", /* DixListAccess */
"", /* DixAddAccess */
"", /* DixRemoveAccess */
"", /* DixHideAccess */
"", /* DixShowAccess */
"", /* DixBlendAccess */
"", /* DixGrabAccess */
"", /* DixFreezeAccess */
"", /* DixForceAccess */
"", /* DixInstallAccess */
"", /* DixUninstallAccess */
"send", /* DixSendAccess */
"receive", /* DixReceiveAccess */
NULL }},
{ "x_resource",
{ "read", /* DixReadAccess */
"write", /* DixWriteAccess */
"write", /* DixDestroyAccess */
"write", /* DixCreateAccess */
"read", /* DixGetAttrAccess */
"write", /* DixSetAttrAccess */
"read", /* DixListPropAccess */
"read", /* DixGetPropAccess */
"write", /* DixSetPropAccess */
"read", /* DixGetFocusAccess */
"write", /* DixSetFocusAccess */
"read", /* DixListAccess */
"write", /* DixAddAccess */
"write", /* DixRemoveAccess */
"write", /* DixHideAccess */
"read", /* DixShowAccess */
"read", /* DixBlendAccess */
"write", /* DixGrabAccess */
"write", /* DixFreezeAccess */
"write", /* DixForceAccess */
"write", /* DixInstallAccess */
"write", /* DixUninstallAccess */
"write", /* DixSendAccess */
"read", /* DixReceiveAccess */
"read", /* DixUseAccess */
"write", /* DixManageAccess */
"read", /* DixDebugAccess */
"write", /* DixBellAccess */
NULL }},
{ NULL }
};
/* x_resource "read" bits from the list above */
@@ -560,5 +557,5 @@ static struct security_class_mapping map[] = {
DixShowAccess|DixBlendAccess|DixReceiveAccess| \
DixUseAccess|DixDebugAccess)
#endif /* _XSELINUX_NEED_FLASK_MAP */
#endif /* _XSELINUXINT_H */
#endif /* _XSELINUX_NEED_FLASK_MAP */
#endif /* _XSELINUXINT_H */

View File

@@ -55,12 +55,14 @@
#include "eventstr.h"
#include "inpututils.h"
#include "extinit.h"
#include "modinit.h"
extern int DeviceValuator;
/* XTest events are sent during request processing and may be interruped by
* a SIGIO. We need a separate event list to avoid events overwriting each
* other's memory */
static InternalEvent *xtest_evlist;
static InternalEvent* xtest_evlist;
/**
* xtestpointer
@@ -79,28 +81,29 @@ DeviceIntPtr xtestpointer, xtestkeyboard;
#include "panoramiXsrv.h"
#endif
static int XTestSwapFakeInput(ClientPtr /* client */ ,
xReq * /* req */
);
static int XTestSwapFakeInput(
ClientPtr /* client */,
xReq * /* req */
);
static int
ProcXTestGetVersion(ClientPtr client)
{
xXTestGetVersionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.majorVersion = XTestMajorVersion,
.minorVersion = XTestMinorVersion
};
xXTestGetVersionReply rep;
int n;
REQUEST_SIZE_MATCH(xXTestGetVersionReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.majorVersion = XTestMajorVersion;
rep.minorVersion = XTestMinorVersion;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.minorVersion);
swaps(&rep.sequenceNumber, n);
swaps(&rep.minorVersion, n);
}
WriteToClient(client, sizeof(xXTestGetVersionReply), &rep);
WriteToClient(client, sizeof(xXTestGetVersionReply), (char *)&rep);
return Success;
}
@@ -111,39 +114,34 @@ ProcXTestCompareCursor(ClientPtr client)
xXTestCompareCursorReply rep;
WindowPtr pWin;
CursorPtr pCursor;
int rc;
int n, rc;
DeviceIntPtr ptr = PickPointer(client);
REQUEST_SIZE_MATCH(xXTestCompareCursorReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
return rc;
if (!ptr)
return BadAccess;
if (stuff->cursor == None)
pCursor = NullCursor;
else if (stuff->cursor == XTestCurrentCursor)
pCursor = GetSpriteCursor(ptr);
else {
rc = dixLookupResourceByType((void **) &pCursor, stuff->cursor,
RT_CURSOR, client, DixReadAccess);
if (rc != Success) {
rc = dixLookupResourceByType((pointer *)&pCursor, stuff->cursor, RT_CURSOR,
client, DixReadAccess);
if (rc != Success)
{
client->errorValue = stuff->cursor;
return rc;
}
}
rep = (xXTestCompareCursorReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.same = (wCursor(pWin) == pCursor)
};
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.same = (wCursor(pWin) == pCursor);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.sequenceNumber, n);
}
WriteToClient(client, sizeof(xXTestCompareCursorReply), &rep);
WriteToClient(client, sizeof(xXTestCompareCursorReply), (char *)&rep);
return Success;
}
@@ -156,8 +154,9 @@ ProcXTestFakeInput(ClientPtr client)
DeviceIntPtr dev = NULL;
WindowPtr root;
Bool extension = FALSE;
deviceValuator *dv = NULL;
ValuatorMask mask;
int valuators[MAX_VALUATORS] = { 0 };
int valuators[MAX_VALUATORS] = {0};
int numValuators = 0;
int firstValuator = 0;
int nevents = 0;
@@ -171,16 +170,18 @@ ProcXTestFakeInput(ClientPtr client)
return BadLength;
nev /= sizeof(xEvent);
UpdateCurrentTime();
ev = (xEvent *) &((xReq *) stuff)[1];
ev = (xEvent *)&((xReq *)stuff)[1];
type = ev->u.u.type & 0177;
if (type >= EXTENSION_EVENT_BASE) {
if (type >= EXTENSION_EVENT_BASE)
{
extension = TRUE;
/* check device */
rc = dixLookupDevice(&dev, stuff->deviceid & 0177, client,
DixWriteAccess);
if (rc != Success) {
DixWriteAccess);
if (rc != Success)
{
client->errorValue = stuff->deviceid & 0177;
return rc;
}
@@ -188,141 +189,144 @@ ProcXTestFakeInput(ClientPtr client)
/* check type */
type -= DeviceValuator;
switch (type) {
case XI_DeviceKeyPress:
case XI_DeviceKeyRelease:
if (!dev->key) {
case XI_DeviceKeyPress:
case XI_DeviceKeyRelease:
if (!dev->key)
{
client->errorValue = ev->u.u.type;
return BadValue;
}
break;
case XI_DeviceButtonPress:
case XI_DeviceButtonRelease:
if (!dev->button)
{
client->errorValue = ev->u.u.type;
return BadValue;
}
break;
case XI_DeviceMotionNotify:
if (!dev->valuator)
{
client->errorValue = ev->u.u.type;
return BadValue;
}
break;
case XI_ProximityIn:
case XI_ProximityOut:
if (!dev->proximity)
{
client->errorValue = ev->u.u.type;
return BadValue;
}
break;
default:
client->errorValue = ev->u.u.type;
return BadValue;
}
break;
case XI_DeviceButtonPress:
case XI_DeviceButtonRelease:
if (!dev->button) {
client->errorValue = ev->u.u.type;
return BadValue;
}
break;
case XI_DeviceMotionNotify:
if (!dev->valuator) {
client->errorValue = ev->u.u.type;
return BadValue;
}
break;
case XI_ProximityIn:
case XI_ProximityOut:
if (!dev->proximity) {
client->errorValue = ev->u.u.type;
return BadValue;
}
break;
default:
client->errorValue = ev->u.u.type;
return BadValue;
}
/* check validity */
if (nev == 1 && type == XI_DeviceMotionNotify)
return BadLength; /* DevMotion must be followed by DevValuator */
return BadLength; /* DevMotion must be followed by DevValuator */
if (type == XI_DeviceMotionNotify) {
firstValuator = ((deviceValuator *) (ev + 1))->first_valuator;
if (firstValuator > dev->valuator->numAxes) {
if (type == XI_DeviceMotionNotify)
{
firstValuator = ((deviceValuator *)(ev+1))->first_valuator;
if (firstValuator > dev->valuator->numAxes)
{
client->errorValue = ev->u.u.type;
return BadValue;
}
if (ev->u.u.detail == xFalse)
flags |= POINTER_ABSOLUTE;
}
else {
} else
{
firstValuator = 0;
flags |= POINTER_ABSOLUTE;
}
if (nev > 1 && !dev->valuator) {
client->errorValue = firstValuator;
if (nev > 1 && !dev->valuator)
{
client->errorValue = dv->first_valuator;
return BadValue;
}
/* check validity of valuator events */
base = firstValuator;
for (n = 1; n < nev; n++) {
deviceValuator *dv = (deviceValuator *) (ev + n);
if (dv->type != DeviceValuator) {
for (n = 1; n < nev; n++)
{
dv = (deviceValuator *)(ev + n);
if (dv->type != DeviceValuator)
{
client->errorValue = dv->type;
return BadValue;
}
if (dv->first_valuator != base) {
if (dv->first_valuator != base)
{
client->errorValue = dv->first_valuator;
return BadValue;
}
switch (dv->num_valuators) {
case 6:
valuators[base + 5] = dv->valuator5;
case 5:
valuators[base + 4] = dv->valuator4;
case 4:
valuators[base + 3] = dv->valuator3;
case 3:
valuators[base + 2] = dv->valuator2;
case 2:
valuators[base + 1] = dv->valuator1;
case 1:
valuators[base] = dv->valuator0;
break;
default:
client->errorValue = dv->num_valuators;
return BadValue;
switch(dv->num_valuators)
{
case 6: valuators[base + 5] = dv->valuator5;
case 5: valuators[base + 4] = dv->valuator4;
case 4: valuators[base + 3] = dv->valuator3;
case 3: valuators[base + 2] = dv->valuator2;
case 2: valuators[base + 1] = dv->valuator1;
case 1: valuators[base] = dv->valuator0;
break;
default:
client->errorValue = dv->num_valuators;
return BadValue;
}
base += dv->num_valuators;
numValuators += dv->num_valuators;
if (firstValuator + numValuators > dev->valuator->numAxes) {
if (firstValuator + numValuators > dev->valuator->numAxes)
{
client->errorValue = dv->num_valuators;
return BadValue;
}
}
type = type - XI_DeviceKeyPress + KeyPress;
}
else {
} else
{
if (nev != 1)
return BadLength;
switch (type) {
case KeyPress:
case KeyRelease:
dev = PickKeyboard(client);
break;
case ButtonPress:
case ButtonRelease:
dev = PickPointer(client);
break;
case MotionNotify:
dev = PickPointer(client);
valuators[0] = ev->u.keyButtonPointer.rootX;
valuators[1] = ev->u.keyButtonPointer.rootY;
numValuators = 2;
firstValuator = 0;
if (ev->u.u.detail == xFalse)
flags = POINTER_ABSOLUTE | POINTER_DESKTOP;
break;
default:
client->errorValue = ev->u.u.type;
return BadValue;
switch (type)
{
case KeyPress:
case KeyRelease:
dev = PickKeyboard(client);
break;
case ButtonPress:
case ButtonRelease:
dev = PickPointer(client);
break;
case MotionNotify:
dev = PickPointer(client);
valuators[0] = ev->u.keyButtonPointer.rootX;
valuators[1] = ev->u.keyButtonPointer.rootY;
numValuators = 2;
firstValuator = 0;
if (ev->u.u.detail == xFalse)
flags = POINTER_ABSOLUTE | POINTER_SCREEN;
break;
default:
client->errorValue = ev->u.u.type;
return BadValue;
}
/* Technically the protocol doesn't allow for BadAccess here but
* this can only happen when all MDs are disabled. */
if (!dev)
return BadAccess;
dev = GetXTestDevice(dev);
}
/* If the event has a time set, wait for it to pass */
if (ev->u.keyButtonPointer.time) {
if (ev->u.keyButtonPointer.time)
{
TimeStamp activateTime;
CARD32 ms;
@@ -336,97 +340,96 @@ ProcXTestFakeInput(ClientPtr client)
/* see mbuf.c:QueueDisplayRequest (from the deprecated Multibuffer
* extension) for code similar to this */
if (!ClientSleepUntil(client, &activateTime, NULL, NULL)) {
if (!ClientSleepUntil(client, &activateTime, NULL, NULL))
{
return BadAlloc;
}
/* swap the request back so we can simply re-execute it */
if (client->swapped) {
(void) XTestSwapFakeInput(client, (xReq *) stuff);
swaps(&stuff->length);
if (client->swapped)
{
(void) XTestSwapFakeInput(client, (xReq *)stuff);
swaps(&stuff->length, n);
}
ResetCurrentRequest(client);
ResetCurrentRequest (client);
client->sequence--;
return Success;
}
switch (type) {
case KeyPress:
case KeyRelease:
if (!dev->key)
return BadDevice;
switch (type)
{
case KeyPress:
case KeyRelease:
if (!dev->key)
return BadDevice;
if (ev->u.u.detail < dev->key->xkbInfo->desc->min_key_code ||
ev->u.u.detail > dev->key->xkbInfo->desc->max_key_code) {
client->errorValue = ev->u.u.detail;
return BadValue;
}
need_ptr_update = 0;
break;
case MotionNotify:
if (!dev->valuator)
return BadDevice;
if (!(extension || ev->u.keyButtonPointer.root == None)) {
rc = dixLookupWindow(&root, ev->u.keyButtonPointer.root,
client, DixGetAttrAccess);
if (rc != Success)
return rc;
if (root->parent) {
client->errorValue = ev->u.keyButtonPointer.root;
if (ev->u.u.detail < dev->key->xkbInfo->desc->min_key_code ||
ev->u.u.detail > dev->key->xkbInfo->desc->max_key_code)
{
client->errorValue = ev->u.u.detail;
return BadValue;
}
/* Add the root window's offset to the valuators */
if ((flags & POINTER_ABSOLUTE) && firstValuator <= 1 && numValuators > 0) {
if (firstValuator == 0)
valuators[0] += root->drawable.pScreen->x;
if (firstValuator < 2 && firstValuator + numValuators > 1)
valuators[1 - firstValuator] += root->drawable.pScreen->y;
need_ptr_update = 0;
break;
case MotionNotify:
if (!dev->valuator)
return BadDevice;
if (!(extension || ev->u.keyButtonPointer.root == None))
{
rc = dixLookupWindow(&root, ev->u.keyButtonPointer.root,
client, DixGetAttrAccess);
if (rc != Success)
return rc;
if (root->parent)
{
client->errorValue = ev->u.keyButtonPointer.root;
return BadValue;
}
}
if (ev->u.u.detail != xTrue && ev->u.u.detail != xFalse)
{
client->errorValue = ev->u.u.detail;
return BadValue;
}
}
if (ev->u.u.detail != xTrue && ev->u.u.detail != xFalse) {
client->errorValue = ev->u.u.detail;
return BadValue;
}
/* FIXME: Xinerama! */
/* FIXME: Xinerama! */
break;
case ButtonPress:
case ButtonRelease:
if (!dev->button)
return BadDevice;
break;
case ButtonPress:
case ButtonRelease:
if (!dev->button)
return BadDevice;
if (!ev->u.u.detail || ev->u.u.detail > dev->button->numButtons) {
client->errorValue = ev->u.u.detail;
return BadValue;
}
break;
if (!ev->u.u.detail || ev->u.u.detail > dev->button->numButtons)
{
client->errorValue = ev->u.u.detail;
return BadValue;
}
break;
}
if (screenIsSaved == SCREEN_SAVER_ON)
dixSaveScreens(serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);
switch (type) {
case MotionNotify:
valuator_mask_set_range(&mask, firstValuator, numValuators, valuators);
nevents = GetPointerEvents(xtest_evlist, dev, type, 0, flags, &mask);
break;
case ButtonPress:
case ButtonRelease:
valuator_mask_set_range(&mask, firstValuator, numValuators, valuators);
nevents = GetPointerEvents(xtest_evlist, dev, type, ev->u.u.detail,
flags, &mask);
break;
case KeyPress:
case KeyRelease:
nevents =
GetKeyboardEvents(xtest_evlist, dev, type, ev->u.u.detail);
break;
switch(type) {
case MotionNotify:
valuator_mask_set_range(&mask, firstValuator, numValuators, valuators);
nevents = GetPointerEvents(xtest_evlist, dev, type, 0, flags, &mask);
break;
case ButtonPress:
case ButtonRelease:
valuator_mask_set_range(&mask, firstValuator, numValuators, valuators);
nevents = GetPointerEvents(xtest_evlist, dev, type, ev->u.u.detail,
flags, &mask);
break;
case KeyPress:
case KeyRelease:
nevents = GetKeyboardEvents(xtest_evlist, dev, type, ev->u.u.detail, NULL);
break;
}
for (i = 0; i < nevents; i++)
mieqProcessDeviceEvent(dev, &xtest_evlist[i], miPointerGetScreen(inputInfo.pointer));
mieqProcessDeviceEvent(dev, &xtest_evlist[i], NULL);
if (need_ptr_update)
miPointerUpdateSprite(dev);
@@ -439,7 +442,8 @@ ProcXTestGrabControl(ClientPtr client)
REQUEST(xXTestGrabControlReq);
REQUEST_SIZE_MATCH(xXTestGrabControlReq);
if ((stuff->impervious != xTrue) && (stuff->impervious != xFalse)) {
if ((stuff->impervious != xTrue) && (stuff->impervious != xFalse))
{
client->errorValue = stuff->impervious;
return BadValue;
}
@@ -451,48 +455,51 @@ ProcXTestGrabControl(ClientPtr client)
}
static int
ProcXTestDispatch(ClientPtr client)
ProcXTestDispatch (ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
case X_XTestGetVersion:
return ProcXTestGetVersion(client);
case X_XTestCompareCursor:
return ProcXTestCompareCursor(client);
case X_XTestFakeInput:
return ProcXTestFakeInput(client);
case X_XTestGrabControl:
return ProcXTestGrabControl(client);
default:
return BadRequest;
switch (stuff->data)
{
case X_XTestGetVersion:
return ProcXTestGetVersion(client);
case X_XTestCompareCursor:
return ProcXTestCompareCursor(client);
case X_XTestFakeInput:
return ProcXTestFakeInput(client);
case X_XTestGrabControl:
return ProcXTestGrabControl(client);
default:
return BadRequest;
}
}
static int _X_COLD
static int
SProcXTestGetVersion(ClientPtr client)
{
int n;
REQUEST(xXTestGetVersionReq);
swaps(&stuff->length);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xXTestGetVersionReq);
swaps(&stuff->minorVersion);
swaps(&stuff->minorVersion, n);
return ProcXTestGetVersion(client);
}
static int _X_COLD
static int
SProcXTestCompareCursor(ClientPtr client)
{
int n;
REQUEST(xXTestCompareCursorReq);
swaps(&stuff->length);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xXTestCompareCursorReq);
swapl(&stuff->window);
swapl(&stuff->cursor);
swapl(&stuff->window, n);
swapl(&stuff->cursor, n);
return ProcXTestCompareCursor(client);
}
static int _X_COLD
XTestSwapFakeInput(ClientPtr client, xReq * req)
static int
XTestSwapFakeInput(ClientPtr client, xReq *req)
{
int nev;
xEvent *ev;
@@ -500,59 +507,61 @@ XTestSwapFakeInput(ClientPtr client, xReq * req)
EventSwapPtr proc;
nev = ((req->length << 2) - sizeof(xReq)) / sizeof(xEvent);
for (ev = (xEvent *) &req[1]; --nev >= 0; ev++) {
for (ev = (xEvent *)&req[1]; --nev >= 0; ev++)
{
/* Swap event */
proc = EventSwapVector[ev->u.u.type & 0177];
/* no swapping proc; invalid event type? */
if (!proc || proc == NotImplemented) {
if (!proc || proc == NotImplemented) {
client->errorValue = ev->u.u.type;
return BadValue;
}
(*proc) (ev, &sev);
(*proc)(ev, &sev);
*ev = sev;
}
return Success;
}
static int _X_COLD
static int
SProcXTestFakeInput(ClientPtr client)
{
int n;
REQUEST(xReq);
swaps(&stuff->length);
swaps(&stuff->length, n);
n = XTestSwapFakeInput(client, stuff);
if (n != Success)
return n;
return ProcXTestFakeInput(client);
}
static int _X_COLD
static int
SProcXTestGrabControl(ClientPtr client)
{
int n;
REQUEST(xXTestGrabControlReq);
swaps(&stuff->length);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xXTestGrabControlReq);
return ProcXTestGrabControl(client);
}
static int _X_COLD
SProcXTestDispatch(ClientPtr client)
static int
SProcXTestDispatch (ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
case X_XTestGetVersion:
return SProcXTestGetVersion(client);
case X_XTestCompareCursor:
return SProcXTestCompareCursor(client);
case X_XTestFakeInput:
return SProcXTestFakeInput(client);
case X_XTestGrabControl:
return SProcXTestGrabControl(client);
default:
return BadRequest;
switch (stuff->data)
{
case X_XTestGetVersion:
return SProcXTestGetVersion(client);
case X_XTestCompareCursor:
return SProcXTestCompareCursor(client);
case X_XTestFakeInput:
return SProcXTestFakeInput(client);
case X_XTestGrabControl:
return SProcXTestGrabControl(client);
default:
return BadRequest;
}
}
@@ -560,22 +569,21 @@ SProcXTestDispatch(ClientPtr client)
* Allocate an virtual slave device for xtest events, this
* is a slave device to inputInfo master devices
*/
void
InitXTestDevices(void)
void InitXTestDevices(void)
{
if (AllocXTestDevice(serverClient, "Virtual core",
&xtestpointer, &xtestkeyboard,
inputInfo.pointer, inputInfo.keyboard) != Success)
FatalError("Failed to allocate XTest devices");
if(AllocXTestDevice(serverClient, "Virtual core",
&xtestpointer, &xtestkeyboard,
inputInfo.pointer, inputInfo.keyboard) != Success)
FatalError("Failed to allocate XTest devices");
if (ActivateDevice(xtestpointer, TRUE) != Success ||
ActivateDevice(xtestkeyboard, TRUE) != Success)
FatalError("Failed to activate XTest core devices.");
if (!EnableDevice(xtestpointer, TRUE) || !EnableDevice(xtestkeyboard, TRUE))
if (!EnableDevice(xtestpointer, TRUE) ||
!EnableDevice(xtestkeyboard, TRUE))
FatalError("Failed to enable XTest core devices.");
AttachDevice(NULL, xtestpointer, inputInfo.pointer);
AttachDevice(NULL, xtestkeyboard, inputInfo.keyboard);
}
@@ -584,7 +592,7 @@ InitXTestDevices(void)
*/
static int
DeviceSetXTestProperty(DeviceIntPtr dev, Atom property,
XIPropertyValuePtr prop, BOOL checkonly)
XIPropertyValuePtr prop, BOOL checkonly)
{
if (property == XIGetKnownProperty(XI_PROP_XTEST_DEVICE))
return BadAccess;
@@ -599,42 +607,36 @@ DeviceSetXTestProperty(DeviceIntPtr dev, Atom property,
* This only creates the pair, Activate/Enable Device
* still need to be called.
*/
int
AllocXTestDevice(ClientPtr client, const char *name,
DeviceIntPtr *ptr, DeviceIntPtr *keybd,
DeviceIntPtr master_ptr, DeviceIntPtr master_keybd)
int AllocXTestDevice (ClientPtr client, char* name,
DeviceIntPtr* ptr, DeviceIntPtr* keybd,
DeviceIntPtr master_ptr, DeviceIntPtr master_keybd)
{
int retval;
char *xtestname;
int len = strlen(name);
char *xtestname = calloc(len + 7, 1 );
char dummy = 1;
if (asprintf(&xtestname, "%s XTEST", name) == -1)
return BadAlloc;
strncpy( xtestname, name, len);
strncat( xtestname, " XTEST", 6 );
retval =
AllocDevicePair(client, xtestname, ptr, keybd, CorePointerProc,
CoreKeyboardProc, FALSE);
if (retval == Success) {
(*ptr)->xtest_master_id = master_ptr->id;
(*keybd)->xtest_master_id = master_keybd->id;
retval = AllocDevicePair( client, xtestname, ptr, keybd, CorePointerProc, CoreKeyboardProc, FALSE);
if ( retval == Success ){
(*ptr)->xtest_master_id = master_ptr->id;
(*keybd)->xtest_master_id = master_keybd->id;
XIChangeDeviceProperty(*ptr, XIGetKnownProperty(XI_PROP_XTEST_DEVICE),
XA_INTEGER, 8, PropModeReplace, 1, &dummy,
FALSE);
XISetDevicePropertyDeletable(*ptr,
XIGetKnownProperty(XI_PROP_XTEST_DEVICE),
FALSE);
XA_INTEGER, 8, PropModeReplace, 1, &dummy,
FALSE);
XISetDevicePropertyDeletable(*ptr, XIGetKnownProperty(XI_PROP_XTEST_DEVICE), FALSE);
XIRegisterPropertyHandler(*ptr, DeviceSetXTestProperty, NULL, NULL);
XIChangeDeviceProperty(*keybd, XIGetKnownProperty(XI_PROP_XTEST_DEVICE),
XA_INTEGER, 8, PropModeReplace, 1, &dummy,
FALSE);
XISetDevicePropertyDeletable(*keybd,
XIGetKnownProperty(XI_PROP_XTEST_DEVICE),
FALSE);
XA_INTEGER, 8, PropModeReplace, 1, &dummy,
FALSE);
XISetDevicePropertyDeletable(*keybd, XIGetKnownProperty(XI_PROP_XTEST_DEVICE), FALSE);
XIRegisterPropertyHandler(*keybd, DeviceSetXTestProperty, NULL, NULL);
}
free(xtestname);
free( xtestname );
return retval;
}
@@ -654,7 +656,7 @@ IsXTestDevice(DeviceIntPtr dev, DeviceIntPtr master)
/* deviceid 0 is reserved for XIAllDevices, non-zero mid means XTest
* device */
if (master)
return dev->xtest_master_id == master->id;
return dev->xtest_master_id == master->id;
return dev->xtest_master_id != 0;
}
@@ -667,7 +669,8 @@ GetXTestDevice(DeviceIntPtr master)
{
DeviceIntPtr it;
for (it = inputInfo.devices; it; it = it->next) {
for (it = inputInfo.devices; it; it = it->next)
{
if (IsXTestDevice(it, master))
return it;
}
@@ -677,18 +680,18 @@ GetXTestDevice(DeviceIntPtr master)
}
static void
XTestExtensionTearDown(ExtensionEntry * e)
XTestExtensionTearDown(ExtensionEntry *e)
{
FreeEventList(xtest_evlist, GetMaximumEventsNum());
xtest_evlist = NULL;
}
void
XTestExtensionInit(void)
XTestExtensionInit(INITARGS)
{
AddExtension(XTestExtensionName, 0, 0,
ProcXTestDispatch, SProcXTestDispatch,
XTestExtensionTearDown, StandardMinorOpcode);
ProcXTestDispatch, SProcXTestDispatch,
XTestExtensionTearDown, StandardMinorOpcode);
xtest_evlist = InitEventList(GetMaximumEventsNum());
}

File diff suppressed because it is too large Load Diff

View File

@@ -4,13 +4,13 @@ and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Digital or MIT not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
@@ -25,18 +25,18 @@ SOFTWARE.
#ifndef XVDIX_H
#define XVDIX_H
/*
** File:
** File:
**
** xvdix.h --- Xv device independent header file
**
** Author:
** Author:
**
** David Carver (Digital Workstation Engineering/Project Athena)
**
** Revisions:
**
** 29.08.91 Carver
** - removed UnrealizeWindow wrapper unrealizing windows no longer
** - removed UnrealizeWindow wrapper unrealizing windows no longer
** preempts video
**
** 11.06.91 Carver
@@ -55,6 +55,7 @@ SOFTWARE.
#include "scrnintstr.h"
#include <X11/extensions/Xvproto.h>
#ifndef XorgLoader
extern _X_EXPORT unsigned long XvExtensionGeneration;
extern _X_EXPORT unsigned long XvScreenGeneration;
extern _X_EXPORT unsigned long XvResourceGeneration;
@@ -69,147 +70,155 @@ extern _X_EXPORT RESTYPE XvRTGrab;
extern _X_EXPORT RESTYPE XvRTVideoNotify;
extern _X_EXPORT RESTYPE XvRTVideoNotifyList;
extern _X_EXPORT RESTYPE XvRTPortNotify;
#endif
typedef struct {
int numerator;
int denominator;
int numerator;
int denominator;
} XvRationalRec, *XvRationalPtr;
typedef struct {
char depth;
unsigned long visual;
char depth;
unsigned long visual;
} XvFormatRec, *XvFormatPtr;
typedef struct {
unsigned long id;
ClientPtr client;
unsigned long id;
ClientPtr client;
} XvGrabRec, *XvGrabPtr;
typedef struct _XvVideoNotifyRec {
struct _XvVideoNotifyRec *next;
ClientPtr client;
unsigned long id;
unsigned long mask;
struct _XvVideoNotifyRec *next;
ClientPtr client;
unsigned long id;
unsigned long mask;
} XvVideoNotifyRec, *XvVideoNotifyPtr;
typedef struct _XvPortNotifyRec {
struct _XvPortNotifyRec *next;
ClientPtr client;
unsigned long id;
struct _XvPortNotifyRec *next;
ClientPtr client;
unsigned long id;
} XvPortNotifyRec, *XvPortNotifyPtr;
typedef struct {
int id;
ScreenPtr pScreen;
char *name;
unsigned short width, height;
XvRationalRec rate;
int id;
ScreenPtr pScreen;
char *name;
unsigned short width, height;
XvRationalRec rate;
} XvEncodingRec, *XvEncodingPtr;
typedef struct _XvAttributeRec {
int flags;
int min_value;
int max_value;
char *name;
int flags;
int min_value;
int max_value;
char *name;
} XvAttributeRec, *XvAttributePtr;
typedef struct {
int id;
int type;
int byte_order;
char guid[16];
int bits_per_pixel;
int format;
int num_planes;
int id;
int type;
int byte_order;
char guid[16];
int bits_per_pixel;
int format;
int num_planes;
/* for RGB formats only */
int depth;
unsigned int red_mask;
unsigned int green_mask;
unsigned int blue_mask;
/* for RGB formats only */
int depth;
unsigned int red_mask;
unsigned int green_mask;
unsigned int blue_mask;
/* for YUV formats only */
unsigned int y_sample_bits;
unsigned int u_sample_bits;
unsigned int v_sample_bits;
unsigned int horz_y_period;
unsigned int horz_u_period;
unsigned int horz_v_period;
unsigned int vert_y_period;
unsigned int vert_u_period;
unsigned int vert_v_period;
char component_order[32];
int scanline_order;
} XvImageRec, *XvImagePtr;
/* for YUV formats only */
unsigned int y_sample_bits;
unsigned int u_sample_bits;
unsigned int v_sample_bits;
unsigned int horz_y_period;
unsigned int horz_u_period;
unsigned int horz_v_period;
unsigned int vert_y_period;
unsigned int vert_u_period;
unsigned int vert_v_period;
char component_order[32];
int scanline_order;
} XvImageRec, *XvImagePtr;
typedef struct {
unsigned long base_id;
unsigned char type;
char *name;
int nEncodings;
XvEncodingPtr pEncodings;
int nFormats;
XvFormatPtr pFormats;
int nAttributes;
XvAttributePtr pAttributes;
int nImages;
XvImagePtr pImages;
int nPorts;
struct _XvPortRec *pPorts;
ScreenPtr pScreen;
int (*ddPutVideo) (DrawablePtr, struct _XvPortRec *, GCPtr,
INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16);
int (*ddPutStill) (DrawablePtr, struct _XvPortRec *, GCPtr,
INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16);
int (*ddGetVideo) (DrawablePtr, struct _XvPortRec *, GCPtr,
INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16);
int (*ddGetStill) (DrawablePtr, struct _XvPortRec *, GCPtr,
INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16);
int (*ddStopVideo) (struct _XvPortRec *, DrawablePtr);
int (*ddSetPortAttribute) (struct _XvPortRec *, Atom, INT32);
int (*ddGetPortAttribute) (struct _XvPortRec *, Atom, INT32 *);
int (*ddQueryBestSize) (struct _XvPortRec *, CARD8,
CARD16, CARD16, CARD16, CARD16,
unsigned int *, unsigned int *);
int (*ddPutImage) (DrawablePtr, struct _XvPortRec *, GCPtr,
INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16,
XvImagePtr, unsigned char *, Bool, CARD16, CARD16);
int (*ddQueryImageAttributes) (struct _XvPortRec *, XvImagePtr,
CARD16 *, CARD16 *, int *, int *);
DevUnion devPriv;
unsigned long base_id;
unsigned char type;
char *name;
int nEncodings;
XvEncodingPtr pEncodings;
int nFormats;
XvFormatPtr pFormats;
int nAttributes;
XvAttributePtr pAttributes;
int nImages;
XvImagePtr pImages;
int nPorts;
struct _XvPortRec *pPorts;
ScreenPtr pScreen;
int (* ddAllocatePort)(unsigned long, struct _XvPortRec*,
struct _XvPortRec**);
int (* ddFreePort)(struct _XvPortRec*);
int (* ddPutVideo)(ClientPtr, DrawablePtr,struct _XvPortRec*, GCPtr,
INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16);
int (* ddPutStill)(ClientPtr, DrawablePtr,struct _XvPortRec*, GCPtr,
INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16);
int (* ddGetVideo)(ClientPtr, DrawablePtr,struct _XvPortRec*, GCPtr,
INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16);
int (* ddGetStill)(ClientPtr, DrawablePtr,struct _XvPortRec*, GCPtr,
INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16);
int (* ddStopVideo)(ClientPtr, struct _XvPortRec*, DrawablePtr);
int (* ddSetPortAttribute)(ClientPtr, struct _XvPortRec*, Atom, INT32);
int (* ddGetPortAttribute)(ClientPtr, struct _XvPortRec*, Atom, INT32*);
int (* ddQueryBestSize)(ClientPtr, struct _XvPortRec*, CARD8,
CARD16, CARD16,CARD16, CARD16,
unsigned int*, unsigned int*);
int (* ddPutImage)(ClientPtr, DrawablePtr, struct _XvPortRec*, GCPtr,
INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16,
XvImagePtr, unsigned char*, Bool,
CARD16, CARD16);
int (* ddQueryImageAttributes)(ClientPtr, struct _XvPortRec*, XvImagePtr,
CARD16*, CARD16*, int*, int*);
DevUnion devPriv;
} XvAdaptorRec, *XvAdaptorPtr;
typedef struct _XvPortRec {
unsigned long id;
XvAdaptorPtr pAdaptor;
XvPortNotifyPtr pNotify;
DrawablePtr pDraw;
ClientPtr client;
XvGrabRec grab;
TimeStamp time;
DevUnion devPriv;
unsigned long id;
XvAdaptorPtr pAdaptor;
XvPortNotifyPtr pNotify;
DrawablePtr pDraw;
ClientPtr client;
XvGrabRec grab;
TimeStamp time;
DevUnion devPriv;
} XvPortRec, *XvPortPtr;
#define VALIDATE_XV_PORT(portID, pPort, mode)\
{\
int rc = dixLookupResourceByType((void **)&(pPort), portID,\
int rc = dixLookupResourceByType((pointer *)&(pPort), portID,\
XvRTPort, client, mode);\
if (rc != Success)\
return rc;\
}
typedef struct {
int version, revision;
int nAdaptors;
XvAdaptorPtr pAdaptors;
DestroyWindowProcPtr DestroyWindow;
DestroyPixmapProcPtr DestroyPixmap;
CloseScreenProcPtr CloseScreen;
int version, revision;
int nAdaptors;
XvAdaptorPtr pAdaptors;
DestroyWindowProcPtr DestroyWindow;
DestroyPixmapProcPtr DestroyPixmap;
CloseScreenProcPtr CloseScreen;
Bool (* ddCloseScreen)(int, ScreenPtr);
int (* ddQueryAdaptors)(ScreenPtr, XvAdaptorPtr*, int*);
DevUnion devPriv;
} XvScreenRec, *XvScreenPtr;
#define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = ((XvScreenPtr) \
@@ -223,40 +232,44 @@ typedef struct {
#define _XvBadPort (XvBadPort+XvErrorBase)
#define _XvBadEncoding (XvBadEncoding+XvErrorBase)
#ifndef XorgLoader
extern _X_EXPORT int ProcXvDispatch(ClientPtr);
extern _X_EXPORT int SProcXvDispatch(ClientPtr);
extern _X_EXPORT void XvExtensionInit(void);
extern _X_EXPORT int XvScreenInit(ScreenPtr);
extern _X_EXPORT DevPrivateKey XvGetScreenKey(void);
extern _X_EXPORT unsigned long XvGetRTPort(void);
extern _X_EXPORT void XvFreeAdaptor(XvAdaptorPtr pAdaptor);
extern void _X_EXPORT XvFillColorKey(DrawablePtr pDraw, CARD32 key,
RegionPtr region);
extern _X_EXPORT int XvdiSendPortNotify(XvPortPtr, Atom, INT32);
extern _X_EXPORT int XvdiVideoStopped(XvPortPtr, int);
extern _X_EXPORT int XvdiPutVideo(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16);
INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16);
extern _X_EXPORT int XvdiPutStill(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16);
INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16);
extern _X_EXPORT int XvdiGetVideo(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16);
INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16);
extern _X_EXPORT int XvdiGetStill(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16);
INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16);
extern _X_EXPORT int XvdiPutImage(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16,
XvImagePtr, unsigned char *, Bool,
CARD16, CARD16);
INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16,
XvImagePtr, unsigned char*, Bool,
CARD16, CARD16);
extern _X_EXPORT int XvdiSelectVideoNotify(ClientPtr, DrawablePtr, BOOL);
extern _X_EXPORT int XvdiSelectPortNotify(ClientPtr, XvPortPtr, BOOL);
extern _X_EXPORT int XvdiSetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32);
extern _X_EXPORT int XvdiGetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32 *);
extern _X_EXPORT int XvdiGetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32*);
extern _X_EXPORT int XvdiStopVideo(ClientPtr, XvPortPtr, DrawablePtr);
extern _X_EXPORT int XvdiPreemptVideo(ClientPtr, XvPortPtr, DrawablePtr);
extern _X_EXPORT int XvdiMatchPort(XvPortPtr, DrawablePtr);
extern _X_EXPORT int XvdiGrabPort(ClientPtr, XvPortPtr, Time, int *);
extern _X_EXPORT int XvdiUngrabPort(ClientPtr, XvPortPtr, Time);
#endif /* XVDIX_H */
extern _X_EXPORT int XvdiUngrabPort( ClientPtr, XvPortPtr, Time);
#endif /* XorgLoader */
#endif /* XVDIX_H */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -5,94 +5,114 @@
#include "xvdix.h"
typedef struct {
int num_xvimages;
int *xvimage_ids;
int num_xvimages;
int *xvimage_ids;
} XvMCImageIDList;
typedef struct {
int surface_type_id;
int chroma_format;
int color_description;
unsigned short max_width;
unsigned short max_height;
unsigned short subpicture_max_width;
unsigned short subpicture_max_height;
int mc_type;
int flags;
XvMCImageIDList *compatible_subpictures;
int surface_type_id;
int chroma_format;
int color_description;
unsigned short max_width;
unsigned short max_height;
unsigned short subpicture_max_width;
unsigned short subpicture_max_height;
int mc_type;
int flags;
XvMCImageIDList *compatible_subpictures;
} XvMCSurfaceInfoRec, *XvMCSurfaceInfoPtr;
typedef struct {
XID context_id;
ScreenPtr pScreen;
int adapt_num;
int surface_type_id;
unsigned short width;
unsigned short height;
CARD32 flags;
int refcnt;
void *port_priv;
void *driver_priv;
XID context_id;
ScreenPtr pScreen;
int adapt_num;
int surface_type_id;
unsigned short width;
unsigned short height;
CARD32 flags;
int refcnt;
pointer port_priv;
pointer driver_priv;
} XvMCContextRec, *XvMCContextPtr;
typedef struct {
XID surface_id;
int surface_type_id;
XvMCContextPtr context;
void *driver_priv;
XID surface_id;
int surface_type_id;
XvMCContextPtr context;
pointer driver_priv;
} XvMCSurfaceRec, *XvMCSurfacePtr;
typedef struct {
XID subpicture_id;
int xvimage_id;
unsigned short width;
unsigned short height;
int num_palette_entries;
int entry_bytes;
char component_order[4];
XvMCContextPtr context;
void *driver_priv;
XID subpicture_id;
int xvimage_id;
unsigned short width;
unsigned short height;
int num_palette_entries;
int entry_bytes;
char component_order[4];
XvMCContextPtr context;
pointer driver_priv;
} XvMCSubpictureRec, *XvMCSubpicturePtr;
typedef int (*XvMCCreateContextProcPtr) (XvPortPtr port,
XvMCContextPtr context,
int *num_priv, CARD32 **priv);
typedef int (*XvMCCreateContextProcPtr) (
XvPortPtr port,
XvMCContextPtr context,
int *num_priv,
CARD32 **priv
);
typedef void (*XvMCDestroyContextProcPtr) (XvMCContextPtr context);
typedef void (*XvMCDestroyContextProcPtr) (
XvMCContextPtr context
);
typedef int (*XvMCCreateSurfaceProcPtr) (XvMCSurfacePtr surface,
int *num_priv, CARD32 **priv);
typedef int (*XvMCCreateSurfaceProcPtr) (
XvMCSurfacePtr surface,
int *num_priv,
CARD32 **priv
);
typedef void (*XvMCDestroySurfaceProcPtr) (XvMCSurfacePtr surface);
typedef void (*XvMCDestroySurfaceProcPtr) (
XvMCSurfacePtr surface
);
typedef int (*XvMCCreateSubpictureProcPtr) (XvMCSubpicturePtr subpicture,
int *num_priv, CARD32 **priv);
typedef int (*XvMCCreateSubpictureProcPtr) (
XvMCSubpicturePtr subpicture,
int *num_priv,
CARD32 **priv
);
typedef void (*XvMCDestroySubpictureProcPtr) (
XvMCSubpicturePtr subpicture
);
typedef void (*XvMCDestroySubpictureProcPtr) (XvMCSubpicturePtr subpicture);
typedef struct {
XvAdaptorPtr xv_adaptor;
int num_surfaces;
XvMCSurfaceInfoPtr *surfaces;
int num_subpictures;
XvImagePtr *subpictures;
XvMCCreateContextProcPtr CreateContext;
XvMCDestroyContextProcPtr DestroyContext;
XvMCCreateSurfaceProcPtr CreateSurface;
XvMCDestroySurfaceProcPtr DestroySurface;
XvMCCreateSubpictureProcPtr CreateSubpicture;
XvMCDestroySubpictureProcPtr DestroySubpicture;
XvAdaptorPtr xv_adaptor;
int num_surfaces;
XvMCSurfaceInfoPtr *surfaces;
int num_subpictures;
XvImagePtr *subpictures;
XvMCCreateContextProcPtr CreateContext;
XvMCDestroyContextProcPtr DestroyContext;
XvMCCreateSurfaceProcPtr CreateSurface;
XvMCDestroySurfaceProcPtr DestroySurface;
XvMCCreateSubpictureProcPtr CreateSubpicture;
XvMCDestroySubpictureProcPtr DestroySubpicture;
} XvMCAdaptorRec, *XvMCAdaptorPtr;
extern int (*XvMCScreenInitProc)(ScreenPtr, int, XvMCAdaptorPtr);
#ifndef XorgLoader
extern _X_EXPORT void XvMCExtensionInit(void);
extern _X_EXPORT int XvMCScreenInit(ScreenPtr pScreen,
int num, XvMCAdaptorPtr adapt);
int num,
XvMCAdaptorPtr adapt);
extern _X_EXPORT XvImagePtr XvMCFindXvImage(XvPortPtr pPort, CARD32 id);
extern _X_EXPORT int xf86XvMCRegisterDRInfo(ScreenPtr pScreen, const char *name,
const char *busID, int major, int minor,
int patchLevel);
extern _X_EXPORT int xf86XvMCRegisterDRInfo(ScreenPtr pScreen, char *name,
char *busID, int major, int minor,
int patchLevel);
#endif
#endif /* _XVMC_H */
#endif /* _XVMC_H */

View File

@@ -1,4 +1,4 @@
noinst_LTLIBRARIES = libXi.la libXistubs.la
noinst_LTLIBRARIES = libXi.la
AM_CFLAGS = $(DIX_CFLAGS)
@@ -78,8 +78,6 @@ libXi_la_SOURCES = \
ungrdevk.h \
xiallowev.c \
xiallowev.h \
xibarriers.c \
xibarriers.h \
xichangecursor.c \
xichangecursor.h \
xichangehierarchy.c \
@@ -107,5 +105,4 @@ libXi_la_SOURCES = \
xiwarppointer.c \
xiwarppointer.h
libXistubs_la_SOURCES = \
stubs.c
EXTRA_DIST = stubs.c

View File

@@ -54,7 +54,7 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
@@ -69,13 +69,15 @@ SOFTWARE.
*
*/
int _X_COLD
int
SProcXAllowDeviceEvents(ClientPtr client)
{
char n;
REQUEST(xAllowDeviceEventsReq);
swaps(&stuff->length);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xAllowDeviceEventsReq);
swapl(&stuff->time);
swapl(&stuff->time, n);
return (ProcXAllowDeviceEvents(client));
}
@@ -97,31 +99,31 @@ ProcXAllowDeviceEvents(ClientPtr client)
rc = dixLookupDevice(&thisdev, stuff->deviceid, client, DixGetAttrAccess);
if (rc != Success)
return rc;
return rc;
time = ClientTimeToServerTime(stuff->time);
switch (stuff->mode) {
case ReplayThisDevice:
AllowSome(client, time, thisdev, NOT_GRABBED);
break;
AllowSome(client, time, thisdev, NOT_GRABBED);
break;
case SyncThisDevice:
AllowSome(client, time, thisdev, FREEZE_NEXT_EVENT);
break;
AllowSome(client, time, thisdev, FREEZE_NEXT_EVENT);
break;
case AsyncThisDevice:
AllowSome(client, time, thisdev, THAWED);
break;
AllowSome(client, time, thisdev, THAWED);
break;
case AsyncOtherDevices:
AllowSome(client, time, thisdev, THAW_OTHERS);
break;
AllowSome(client, time, thisdev, THAW_OTHERS);
break;
case SyncAll:
AllowSome(client, time, thisdev, FREEZE_BOTH_NEXT_EVENT);
break;
AllowSome(client, time, thisdev, FREEZE_BOTH_NEXT_EVENT);
break;
case AsyncAll:
AllowSome(client, time, thisdev, THAWED_BOTH);
break;
AllowSome(client, time, thisdev, THAWED_BOTH);
break;
default:
client->errorValue = stuff->mode;
return BadValue;
client->errorValue = stuff->mode;
return BadValue;
}
return Success;
}

View File

@@ -30,10 +30,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef ALLOWEV_H
#define ALLOWEV_H 1
int SProcXAllowDeviceEvents(ClientPtr /* client */
int SProcXAllowDeviceEvents(ClientPtr /* client */
);
int ProcXAllowDeviceEvents(ClientPtr /* client */
int ProcXAllowDeviceEvents(ClientPtr /* client */
);
#endif /* ALLOWEV_H */
#endif /* ALLOWEV_H */

View File

@@ -54,9 +54,9 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h> /* control constants */
#include <X11/extensions/XIproto.h> /* control constants */
#include "XIstubs.h"
#include "exglobals.h"
@@ -71,26 +71,27 @@ SOFTWARE.
*
*/
int _X_COLD
int
SProcXChangeDeviceControl(ClientPtr client)
{
char n;
xDeviceCtl *ctl;
REQUEST(xChangeDeviceControlReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_EXTRA_SIZE(xChangeDeviceControlReq, sizeof(xDeviceCtl));
swaps(&stuff->control);
ctl = (xDeviceCtl *) &stuff[1];
swaps(&ctl->control);
swaps(&ctl->length);
switch (stuff->control) {
case DEVICE_ABS_CALIB:
case DEVICE_ABS_AREA:
case DEVICE_CORE:
case DEVICE_ENABLE:
case DEVICE_RESOLUTION:
/* hmm. beer. *drool* */
break;
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xChangeDeviceControlReq);
swaps(&stuff->control, n);
ctl = (xDeviceCtl*)&stuff[1];
swaps(&ctl->control, n);
swaps(&ctl->length, n);
switch(stuff->control) {
case DEVICE_ABS_CALIB:
case DEVICE_ABS_AREA:
case DEVICE_CORE:
case DEVICE_ENABLE:
case DEVICE_RESOLUTION:
/* hmm. beer. *drool* */
break;
}
return (ProcXChangeDeviceControl(client));
@@ -113,72 +114,61 @@ ProcXChangeDeviceControl(ClientPtr client)
AxisInfoPtr a;
CARD32 *resolution;
xDeviceEnableCtl *e;
devicePresenceNotify dpn;
REQUEST(xChangeDeviceControlReq);
REQUEST_AT_LEAST_EXTRA_SIZE(xChangeDeviceControlReq, sizeof(xDeviceCtl));
REQUEST_AT_LEAST_SIZE(xChangeDeviceControlReq);
len = stuff->length - bytes_to_int32(sizeof(xChangeDeviceControlReq));
ret = dixLookupDevice(&dev, stuff->deviceid, client, DixManageAccess);
if (ret != Success)
goto out;
/* XTest devices are special, none of the below apply to them anyway */
if (IsXTestDevice(dev, NULL)) {
ret = BadMatch;
goto out;
}
rep = (xChangeDeviceControlReply) {
.repType = X_Reply,
.RepType = X_ChangeDeviceControl,
.sequenceNumber = client->sequence,
.length = 0,
.status = Success,
};
rep.repType = X_Reply;
rep.RepType = X_ChangeDeviceControl;
rep.length = 0;
rep.sequenceNumber = client->sequence;
switch (stuff->control) {
case DEVICE_RESOLUTION:
r = (xDeviceResolutionCtl *) &stuff[1];
if ((len < bytes_to_int32(sizeof(xDeviceResolutionCtl))) ||
(len !=
bytes_to_int32(sizeof(xDeviceResolutionCtl)) + r->num_valuators)) {
r = (xDeviceResolutionCtl *) & stuff[1];
if ((len < bytes_to_int32(sizeof(xDeviceResolutionCtl))) ||
(len != bytes_to_int32(sizeof(xDeviceResolutionCtl)) + r->num_valuators)) {
ret = BadLength;
goto out;
}
if (!dev->valuator) {
}
if (!dev->valuator) {
ret = BadMatch;
goto out;
}
if ((dev->deviceGrab.grab) && !SameClient(dev->deviceGrab.grab, client)) {
rep.status = AlreadyGrabbed;
}
if ((dev->deviceGrab.grab) && !SameClient(dev->deviceGrab.grab, client)) {
rep.status = AlreadyGrabbed;
ret = Success;
goto out;
}
resolution = (CARD32 *) (r + 1);
if (r->first_valuator + r->num_valuators > dev->valuator->numAxes) {
}
resolution = (CARD32 *) (r + 1);
if (r->first_valuator + r->num_valuators > dev->valuator->numAxes) {
ret = BadValue;
goto out;
}
status = ChangeDeviceControl(client, dev, (xDeviceCtl *) r);
if (status == Success) {
a = &dev->valuator->axes[r->first_valuator];
for (i = 0; i < r->num_valuators; i++)
if (*(resolution + i) < (a + i)->min_resolution ||
*(resolution + i) > (a + i)->max_resolution)
return BadValue;
for (i = 0; i < r->num_valuators; i++)
(a++)->resolution = *resolution++;
}
status = ChangeDeviceControl(client, dev, (xDeviceCtl *) r);
if (status == Success) {
a = &dev->valuator->axes[r->first_valuator];
for (i = 0; i < r->num_valuators; i++)
if (*(resolution + i) < (a + i)->min_resolution ||
*(resolution + i) > (a + i)->max_resolution)
return BadValue;
for (i = 0; i < r->num_valuators; i++)
(a++)->resolution = *resolution++;
ret = Success;
}
else if (status == DeviceBusy) {
rep.status = DeviceBusy;
} else if (status == DeviceBusy) {
rep.status = DeviceBusy;
ret = Success;
}
else {
} else {
ret = BadMatch;
}
break;
}
break;
case DEVICE_ABS_CALIB:
case DEVICE_ABS_AREA:
/* Calibration is now done through properties, and never had any effect
@@ -191,16 +181,9 @@ ProcXChangeDeviceControl(ClientPtr client)
ret = BadMatch;
break;
case DEVICE_ENABLE:
e = (xDeviceEnableCtl *) &stuff[1];
if ((len != bytes_to_int32(sizeof(xDeviceEnableCtl)))) {
ret = BadLength;
goto out;
}
e = (xDeviceEnableCtl *)&stuff[1];
if (IsXTestDevice(dev, NULL))
status = !Success;
else
status = ChangeDeviceControl(client, dev, (xDeviceCtl *) e);
status = ChangeDeviceControl(client, dev, (xDeviceCtl *) e);
if (status == Success) {
if (e->enable)
@@ -208,12 +191,10 @@ ProcXChangeDeviceControl(ClientPtr client)
else
DisableDevice(dev, TRUE);
ret = Success;
}
else if (status == DeviceBusy) {
} else if (status == DeviceBusy) {
rep.status = DeviceBusy;
ret = Success;
}
else {
} else {
ret = BadMatch;
}
@@ -222,15 +203,13 @@ ProcXChangeDeviceControl(ClientPtr client)
ret = BadValue;
}
out:
out:
if (ret == Success) {
devicePresenceNotify dpn = {
.type = DevicePresenceNotify,
.time = currentTime.milliseconds,
.devchange = DeviceControlChanged,
.deviceid = dev->id,
.control = stuff->control
};
dpn.type = DevicePresenceNotify;
dpn.time = currentTime.milliseconds;
dpn.devchange = DeviceControlChanged;
dpn.deviceid = dev->id;
dpn.control = stuff->control;
SendEventToAllWindows(dev, DevicePresenceNotifyMask,
(xEvent *) &dpn, 1);
@@ -247,11 +226,13 @@ ProcXChangeDeviceControl(ClientPtr client)
*
*/
void _X_COLD
void
SRepXChangeDeviceControl(ClientPtr client, int size,
xChangeDeviceControlReply * rep)
xChangeDeviceControlReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
char n;
swaps(&rep->sequenceNumber, n);
swapl(&rep->length, n);
WriteToClient(client, size, (char *)rep);
}

View File

@@ -30,15 +30,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef CHGDCTL_H
#define CHGDCTL_H 1
int SProcXChangeDeviceControl(ClientPtr /* client */
int SProcXChangeDeviceControl(ClientPtr /* client */
);
int ProcXChangeDeviceControl(ClientPtr /* client */
int ProcXChangeDeviceControl(ClientPtr /* client */
);
void SRepXChangeDeviceControl(ClientPtr /* client */ ,
int /* size */ ,
xChangeDeviceControlReply * /* rep */
int /* size */ ,
xChangeDeviceControlReply * /* rep */
);
#endif /* CHGDCTL_H */
#endif /* CHGDCTL_H */

View File

@@ -54,9 +54,9 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h> /* control constants */
#include <X11/extensions/XIproto.h> /* control constants */
#include "exglobals.h"
@@ -71,13 +71,15 @@ SOFTWARE.
*
*/
int _X_COLD
int
SProcXChangeFeedbackControl(ClientPtr client)
{
char n;
REQUEST(xChangeFeedbackControlReq);
swaps(&stuff->length);
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xChangeFeedbackControlReq);
swapl(&stuff->mask);
swapl(&stuff->mask, n);
return (ProcXChangeFeedbackControl(client));
}
@@ -89,110 +91,108 @@ SProcXChangeFeedbackControl(ClientPtr client)
static int
ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
KbdFeedbackPtr k, xKbdFeedbackCtl * f)
KbdFeedbackPtr k, xKbdFeedbackCtl * f)
{
char n;
KeybdCtrl kctrl;
int t;
int key = DO_ALL;
if (client->swapped) {
swaps(&f->length);
swaps(&f->pitch);
swaps(&f->duration);
swapl(&f->led_mask);
swapl(&f->led_values);
swaps(&f->length, n);
swaps(&f->pitch, n);
swaps(&f->duration, n);
swapl(&f->led_mask, n);
swapl(&f->led_values, n);
}
kctrl = k->ctrl;
if (mask & DvKeyClickPercent) {
t = f->click;
if (t == -1)
t = defaultKeyboardControl.click;
else if (t < 0 || t > 100) {
client->errorValue = t;
return BadValue;
}
kctrl.click = t;
t = f->click;
if (t == -1)
t = defaultKeyboardControl.click;
else if (t < 0 || t > 100) {
client->errorValue = t;
return BadValue;
}
kctrl.click = t;
}
if (mask & DvPercent) {
t = f->percent;
if (t == -1)
t = defaultKeyboardControl.bell;
else if (t < 0 || t > 100) {
client->errorValue = t;
return BadValue;
}
kctrl.bell = t;
t = f->percent;
if (t == -1)
t = defaultKeyboardControl.bell;
else if (t < 0 || t > 100) {
client->errorValue = t;
return BadValue;
}
kctrl.bell = t;
}
if (mask & DvPitch) {
t = f->pitch;
if (t == -1)
t = defaultKeyboardControl.bell_pitch;
else if (t < 0) {
client->errorValue = t;
return BadValue;
}
kctrl.bell_pitch = t;
t = f->pitch;
if (t == -1)
t = defaultKeyboardControl.bell_pitch;
else if (t < 0) {
client->errorValue = t;
return BadValue;
}
kctrl.bell_pitch = t;
}
if (mask & DvDuration) {
t = f->duration;
if (t == -1)
t = defaultKeyboardControl.bell_duration;
else if (t < 0) {
client->errorValue = t;
return BadValue;
}
kctrl.bell_duration = t;
t = f->duration;
if (t == -1)
t = defaultKeyboardControl.bell_duration;
else if (t < 0) {
client->errorValue = t;
return BadValue;
}
kctrl.bell_duration = t;
}
if (mask & DvLed) {
kctrl.leds &= ~(f->led_mask);
kctrl.leds |= (f->led_mask & f->led_values);
kctrl.leds &= ~(f->led_mask);
kctrl.leds |= (f->led_mask & f->led_values);
}
if (mask & DvKey) {
key = (KeyCode) f->key;
if (key < 8 || key > 255) {
client->errorValue = key;
return BadValue;
}
if (!(mask & DvAutoRepeatMode))
return BadMatch;
key = (KeyCode) f->key;
if (key < 8 || key > 255) {
client->errorValue = key;
return BadValue;
}
if (!(mask & DvAutoRepeatMode))
return BadMatch;
}
if (mask & DvAutoRepeatMode) {
int inx = (key >> 3);
int kmask = (1 << (key & 7));
int inx = (key >> 3);
int kmask = (1 << (key & 7));
t = (CARD8) f->auto_repeat_mode;
if (t == AutoRepeatModeOff) {
if (key == DO_ALL)
kctrl.autoRepeat = FALSE;
else
kctrl.autoRepeats[inx] &= ~kmask;
}
else if (t == AutoRepeatModeOn) {
if (key == DO_ALL)
kctrl.autoRepeat = TRUE;
else
kctrl.autoRepeats[inx] |= kmask;
}
else if (t == AutoRepeatModeDefault) {
if (key == DO_ALL)
kctrl.autoRepeat = defaultKeyboardControl.autoRepeat;
else
kctrl.autoRepeats[inx] &= ~kmask;
kctrl.autoRepeats[inx] =
(kctrl.autoRepeats[inx] & ~kmask) |
(defaultKeyboardControl.autoRepeats[inx] & kmask);
}
else {
client->errorValue = t;
return BadValue;
}
t = (CARD8) f->auto_repeat_mode;
if (t == AutoRepeatModeOff) {
if (key == DO_ALL)
kctrl.autoRepeat = FALSE;
else
kctrl.autoRepeats[inx] &= ~kmask;
} else if (t == AutoRepeatModeOn) {
if (key == DO_ALL)
kctrl.autoRepeat = TRUE;
else
kctrl.autoRepeats[inx] |= kmask;
} else if (t == AutoRepeatModeDefault) {
if (key == DO_ALL)
kctrl.autoRepeat = defaultKeyboardControl.autoRepeat;
else
kctrl.autoRepeats[inx] &= ~kmask;
kctrl.autoRepeats[inx] =
(kctrl.autoRepeats[inx] & ~kmask) |
(defaultKeyboardControl.autoRepeats[inx] & kmask);
} else {
client->errorValue = t;
return BadValue;
}
}
k->ctrl = kctrl;
@@ -208,58 +208,56 @@ ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
static int
ChangePtrFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
PtrFeedbackPtr p, xPtrFeedbackCtl * f)
PtrFeedbackPtr p, xPtrFeedbackCtl * f)
{
PtrCtrl pctrl; /* might get BadValue part way through */
char n;
PtrCtrl pctrl; /* might get BadValue part way through */
if (client->swapped) {
swaps(&f->length);
swaps(&f->num);
swaps(&f->denom);
swaps(&f->thresh);
swaps(&f->length, n);
swaps(&f->num, n);
swaps(&f->denom, n);
swaps(&f->thresh, n);
}
pctrl = p->ctrl;
if (mask & DvAccelNum) {
int accelNum;
int accelNum;
accelNum = f->num;
if (accelNum == -1)
pctrl.num = defaultPointerControl.num;
else if (accelNum < 0) {
client->errorValue = accelNum;
return BadValue;
}
else
pctrl.num = accelNum;
accelNum = f->num;
if (accelNum == -1)
pctrl.num = defaultPointerControl.num;
else if (accelNum < 0) {
client->errorValue = accelNum;
return BadValue;
} else
pctrl.num = accelNum;
}
if (mask & DvAccelDenom) {
int accelDenom;
int accelDenom;
accelDenom = f->denom;
if (accelDenom == -1)
pctrl.den = defaultPointerControl.den;
else if (accelDenom <= 0) {
client->errorValue = accelDenom;
return BadValue;
}
else
pctrl.den = accelDenom;
accelDenom = f->denom;
if (accelDenom == -1)
pctrl.den = defaultPointerControl.den;
else if (accelDenom <= 0) {
client->errorValue = accelDenom;
return BadValue;
} else
pctrl.den = accelDenom;
}
if (mask & DvThreshold) {
int threshold;
int threshold;
threshold = f->thresh;
if (threshold == -1)
pctrl.threshold = defaultPointerControl.threshold;
else if (threshold < 0) {
client->errorValue = threshold;
return BadValue;
}
else
pctrl.threshold = threshold;
threshold = f->thresh;
if (threshold == -1)
pctrl.threshold = defaultPointerControl.threshold;
else if (threshold < 0) {
client->errorValue = threshold;
return BadValue;
} else
pctrl.threshold = threshold;
}
p->ctrl = pctrl;
@@ -275,12 +273,14 @@ ChangePtrFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
static int
ChangeIntegerFeedback(ClientPtr client, DeviceIntPtr dev,
long unsigned int mask, IntegerFeedbackPtr i,
xIntegerFeedbackCtl * f)
long unsigned int mask, IntegerFeedbackPtr i,
xIntegerFeedbackCtl * f)
{
char n;
if (client->swapped) {
swaps(&f->length);
swapl(&f->int_to_display);
swaps(&f->length, n);
swapl(&f->int_to_display, n);
}
i->ctrl.integer_displayed = f->int_to_display;
@@ -296,33 +296,34 @@ ChangeIntegerFeedback(ClientPtr client, DeviceIntPtr dev,
static int
ChangeStringFeedback(ClientPtr client, DeviceIntPtr dev,
long unsigned int mask, StringFeedbackPtr s,
xStringFeedbackCtl * f)
long unsigned int mask, StringFeedbackPtr s,
xStringFeedbackCtl * f)
{
char n;
int i, j;
KeySym *syms, *sup_syms;
syms = (KeySym *) (f + 1);
if (client->swapped) {
swaps(&f->length); /* swapped num_keysyms in calling proc */
SwapLongs((CARD32 *) syms, f->num_keysyms);
swaps(&f->length, n); /* swapped num_keysyms in calling proc */
SwapLongs((CARD32 *) syms, f->num_keysyms);
}
if (f->num_keysyms > s->ctrl.max_symbols)
return BadValue;
return BadValue;
sup_syms = s->ctrl.symbols_supported;
for (i = 0; i < f->num_keysyms; i++) {
for (j = 0; j < s->ctrl.num_symbols_supported; j++)
if (*(syms + i) == *(sup_syms + j))
break;
if (j == s->ctrl.num_symbols_supported)
return BadMatch;
for (j = 0; j < s->ctrl.num_symbols_supported; j++)
if (*(syms + i) == *(sup_syms + j))
break;
if (j == s->ctrl.num_symbols_supported)
return BadMatch;
}
s->ctrl.num_symbols_displayed = f->num_keysyms;
for (i = 0; i < f->num_keysyms; i++)
*(s->ctrl.symbols_displayed + i) = *(syms + i);
*(s->ctrl.symbols_displayed + i) = *(syms + i);
(*s->CtrlProc) (dev, &s->ctrl);
return Success;
}
@@ -335,50 +336,51 @@ ChangeStringFeedback(ClientPtr client, DeviceIntPtr dev,
static int
ChangeBellFeedback(ClientPtr client, DeviceIntPtr dev,
long unsigned int mask, BellFeedbackPtr b,
xBellFeedbackCtl * f)
long unsigned int mask, BellFeedbackPtr b,
xBellFeedbackCtl * f)
{
char n;
int t;
BellCtrl bctrl; /* might get BadValue part way through */
BellCtrl bctrl; /* might get BadValue part way through */
if (client->swapped) {
swaps(&f->length);
swaps(&f->pitch);
swaps(&f->duration);
swaps(&f->length, n);
swaps(&f->pitch, n);
swaps(&f->duration, n);
}
bctrl = b->ctrl;
if (mask & DvPercent) {
t = f->percent;
if (t == -1)
t = defaultKeyboardControl.bell;
else if (t < 0 || t > 100) {
client->errorValue = t;
return BadValue;
}
bctrl.percent = t;
t = f->percent;
if (t == -1)
t = defaultKeyboardControl.bell;
else if (t < 0 || t > 100) {
client->errorValue = t;
return BadValue;
}
bctrl.percent = t;
}
if (mask & DvPitch) {
t = f->pitch;
if (t == -1)
t = defaultKeyboardControl.bell_pitch;
else if (t < 0) {
client->errorValue = t;
return BadValue;
}
bctrl.pitch = t;
t = f->pitch;
if (t == -1)
t = defaultKeyboardControl.bell_pitch;
else if (t < 0) {
client->errorValue = t;
return BadValue;
}
bctrl.pitch = t;
}
if (mask & DvDuration) {
t = f->duration;
if (t == -1)
t = defaultKeyboardControl.bell_duration;
else if (t < 0) {
client->errorValue = t;
return BadValue;
}
bctrl.duration = t;
t = f->duration;
if (t == -1)
t = defaultKeyboardControl.bell_duration;
else if (t < 0) {
client->errorValue = t;
return BadValue;
}
bctrl.duration = t;
}
b->ctrl = bctrl;
(*b->CtrlProc) (dev, &b->ctrl);
@@ -393,24 +395,25 @@ ChangeBellFeedback(ClientPtr client, DeviceIntPtr dev,
static int
ChangeLedFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
LedFeedbackPtr l, xLedFeedbackCtl * f)
LedFeedbackPtr l, xLedFeedbackCtl * f)
{
LedCtrl lctrl; /* might get BadValue part way through */
char n;
LedCtrl lctrl; /* might get BadValue part way through */
if (client->swapped) {
swaps(&f->length);
swapl(&f->led_values);
swapl(&f->led_mask);
swaps(&f->length, n);
swapl(&f->led_values, n);
swapl(&f->led_mask, n);
}
f->led_mask &= l->ctrl.led_mask; /* set only supported leds */
f->led_values &= l->ctrl.led_mask; /* set only supported leds */
f->led_mask &= l->ctrl.led_mask; /* set only supported leds */
f->led_values &= l->ctrl.led_mask; /* set only supported leds */
if (mask & DvLed) {
lctrl.led_mask = f->led_mask;
lctrl.led_values = f->led_values;
(*l->CtrlProc) (dev, &lctrl);
l->ctrl.led_values &= ~(f->led_mask); /* zero changed leds */
l->ctrl.led_values |= (f->led_mask & f->led_values); /* OR in set leds */
lctrl.led_mask = f->led_mask;
lctrl.led_values = f->led_values;
(*l->CtrlProc) (dev, &lctrl);
l->ctrl.led_values &= ~(f->led_mask); /* zero changed leds */
l->ctrl.led_values |= (f->led_mask & f->led_values); /* OR in set leds */
}
return Success;
@@ -441,77 +444,75 @@ ProcXChangeFeedbackControl(ClientPtr client)
len = stuff->length - bytes_to_int32(sizeof(xChangeFeedbackControlReq));
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixManageAccess);
if (rc != Success)
return rc;
return rc;
switch (stuff->feedbackid) {
case KbdFeedbackClass:
if (len != bytes_to_int32(sizeof(xKbdFeedbackCtl)))
return BadLength;
if (len != bytes_to_int32(sizeof(xKbdFeedbackCtl)))
return BadLength;
for (k = dev->kbdfeed; k; k = k->next)
if (k->ctrl.id == ((xKbdFeedbackCtl *) &stuff[1])->id)
return ChangeKbdFeedback(client, dev, stuff->mask, k,
(xKbdFeedbackCtl *) &stuff[1]);
break;
for (k = dev->kbdfeed; k; k = k->next)
if (k->ctrl.id == ((xKbdFeedbackCtl *) & stuff[1])->id)
return ChangeKbdFeedback(client, dev, stuff->mask, k,
(xKbdFeedbackCtl *) & stuff[1]);
break;
case PtrFeedbackClass:
if (len != bytes_to_int32(sizeof(xPtrFeedbackCtl)))
return BadLength;
if (len != bytes_to_int32(sizeof(xPtrFeedbackCtl)))
return BadLength;
for (p = dev->ptrfeed; p; p = p->next)
if (p->ctrl.id == ((xPtrFeedbackCtl *) &stuff[1])->id)
return ChangePtrFeedback(client, dev, stuff->mask, p,
(xPtrFeedbackCtl *) &stuff[1]);
break;
for (p = dev->ptrfeed; p; p = p->next)
if (p->ctrl.id == ((xPtrFeedbackCtl *) & stuff[1])->id)
return ChangePtrFeedback(client, dev, stuff->mask, p,
(xPtrFeedbackCtl *) & stuff[1]);
break;
case StringFeedbackClass:
{
xStringFeedbackCtl *f = ((xStringFeedbackCtl *) &stuff[1]);
char n;
xStringFeedbackCtl *f = ((xStringFeedbackCtl *) & stuff[1]);
if (client->swapped) {
if (len < bytes_to_int32(sizeof(xStringFeedbackCtl)))
return BadLength;
swaps(&f->num_keysyms);
}
if (len !=
(bytes_to_int32(sizeof(xStringFeedbackCtl)) + f->num_keysyms))
return BadLength;
if (client->swapped) {
swaps(&f->num_keysyms, n);
}
if (len != (bytes_to_int32(sizeof(xStringFeedbackCtl)) + f->num_keysyms))
return BadLength;
for (s = dev->stringfeed; s; s = s->next)
if (s->ctrl.id == ((xStringFeedbackCtl *) &stuff[1])->id)
return ChangeStringFeedback(client, dev, stuff->mask, s,
(xStringFeedbackCtl *) &stuff[1]);
break;
for (s = dev->stringfeed; s; s = s->next)
if (s->ctrl.id == ((xStringFeedbackCtl *) & stuff[1])->id)
return ChangeStringFeedback(client, dev, stuff->mask, s,
(xStringFeedbackCtl *) & stuff[1]);
break;
}
case IntegerFeedbackClass:
if (len != bytes_to_int32(sizeof(xIntegerFeedbackCtl)))
return BadLength;
if (len != bytes_to_int32(sizeof(xIntegerFeedbackCtl)))
return BadLength;
for (i = dev->intfeed; i; i = i->next)
if (i->ctrl.id == ((xIntegerFeedbackCtl *) &stuff[1])->id)
return ChangeIntegerFeedback(client, dev, stuff->mask, i,
(xIntegerFeedbackCtl *) &
stuff[1]);
break;
for (i = dev->intfeed; i; i = i->next)
if (i->ctrl.id == ((xIntegerFeedbackCtl *) & stuff[1])->id)
return ChangeIntegerFeedback(client, dev, stuff->mask, i,
(xIntegerFeedbackCtl *)&stuff[1]);
break;
case LedFeedbackClass:
if (len != bytes_to_int32(sizeof(xLedFeedbackCtl)))
return BadLength;
if (len != bytes_to_int32(sizeof(xLedFeedbackCtl)))
return BadLength;
for (l = dev->leds; l; l = l->next)
if (l->ctrl.id == ((xLedFeedbackCtl *) &stuff[1])->id)
return ChangeLedFeedback(client, dev, stuff->mask, l,
(xLedFeedbackCtl *) &stuff[1]);
break;
for (l = dev->leds; l; l = l->next)
if (l->ctrl.id == ((xLedFeedbackCtl *) & stuff[1])->id)
return ChangeLedFeedback(client, dev, stuff->mask, l,
(xLedFeedbackCtl *) & stuff[1]);
break;
case BellFeedbackClass:
if (len != bytes_to_int32(sizeof(xBellFeedbackCtl)))
return BadLength;
if (len != bytes_to_int32(sizeof(xBellFeedbackCtl)))
return BadLength;
for (b = dev->bell; b; b = b->next)
if (b->ctrl.id == ((xBellFeedbackCtl *) &stuff[1])->id)
return ChangeBellFeedback(client, dev, stuff->mask, b,
(xBellFeedbackCtl *) &stuff[1]);
break;
for (b = dev->bell; b; b = b->next)
if (b->ctrl.id == ((xBellFeedbackCtl *) & stuff[1])->id)
return ChangeBellFeedback(client, dev, stuff->mask, b,
(xBellFeedbackCtl *) & stuff[1]);
break;
default:
break;
break;
}
return BadMatch;
}

View File

@@ -30,10 +30,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef CHGFCTL_H
#define CHGFCTL_H 1
int SProcXChangeFeedbackControl(ClientPtr /* client */
int SProcXChangeFeedbackControl(ClientPtr /* client */
);
int ProcXChangeFeedbackControl(ClientPtr /* client */
int ProcXChangeFeedbackControl(ClientPtr /* client */
);
#endif /* CHGFCTL_H */
#endif /* CHGFCTL_H */

View File

@@ -54,7 +54,7 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "XIstubs.h"
@@ -72,11 +72,13 @@ SOFTWARE.
*
*/
int _X_COLD
int
SProcXChangeKeyboardDevice(ClientPtr client)
{
char n;
REQUEST(xChangeKeyboardDeviceReq);
swaps(&stuff->length);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xChangeKeyboardDeviceReq);
return (ProcXChangeKeyboardDevice(client));
}

View File

@@ -30,10 +30,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef CHGKBD_H
#define CHGKBD_H 1
int SProcXChangeKeyboardDevice(ClientPtr /* client */
int SProcXChangeKeyboardDevice(ClientPtr /* client */
);
int ProcXChangeKeyboardDevice(ClientPtr /* client */
int ProcXChangeKeyboardDevice(ClientPtr /* client */
);
#endif /* CHGKBD_H */
#endif /* CHGKBD_H */

View File

@@ -54,7 +54,7 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exevents.h"
@@ -69,13 +69,14 @@ SOFTWARE.
*
*/
int _X_COLD
int
SProcXChangeDeviceKeyMapping(ClientPtr client)
{
char n;
unsigned int count;
REQUEST(xChangeDeviceKeyMappingReq);
swaps(&stuff->length);
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xChangeDeviceKeyMappingReq);
count = stuff->keyCodes * stuff->keySymsPerKeyCode;
REQUEST_FIXED_SIZE(xChangeDeviceKeyMappingReq, count * sizeof(CARD32));
@@ -105,12 +106,12 @@ ProcXChangeDeviceKeyMapping(ClientPtr client)
ret = dixLookupDevice(&dev, stuff->deviceid, client, DixManageAccess);
if (ret != Success)
return ret;
return ret;
len = stuff->length - bytes_to_int32(sizeof(xChangeDeviceKeyMappingReq));
ret = ChangeKeyMapping(client, dev, len, DeviceMappingNotify,
stuff->firstKeyCode, stuff->keyCodes,
stuff->keySymsPerKeyCode, (KeySym *) &stuff[1]);
stuff->firstKeyCode, stuff->keyCodes,
stuff->keySymsPerKeyCode, (KeySym *) & stuff[1]);
return ret;
}

View File

@@ -30,10 +30,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef CHGKMAP_H
#define CHGKMAP_H 1
int SProcXChangeDeviceKeyMapping(ClientPtr /* client */
int SProcXChangeDeviceKeyMapping(ClientPtr /* client */
);
int ProcXChangeDeviceKeyMapping(ClientPtr /* client */
int ProcXChangeDeviceKeyMapping(ClientPtr /* client */
);
#endif /* CHGKMAP_H */
#endif /* CHGKMAP_H */

View File

@@ -54,7 +54,7 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h"
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
@@ -71,16 +71,18 @@ SOFTWARE.
*
*/
int _X_COLD
int
SProcXChangeDeviceDontPropagateList(ClientPtr client)
{
char n;
REQUEST(xChangeDeviceDontPropagateListReq);
swaps(&stuff->length);
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xChangeDeviceDontPropagateListReq);
swapl(&stuff->window);
swaps(&stuff->count);
swapl(&stuff->window, n);
swaps(&stuff->count, n);
REQUEST_FIXED_SIZE(xChangeDeviceDontPropagateListReq,
stuff->count * sizeof(CARD32));
stuff->count * sizeof(CARD32));
SwapLongs((CARD32 *) (&stuff[1]), stuff->count);
return (ProcXChangeDeviceDontPropagateList(client));
}
@@ -102,40 +104,39 @@ ProcXChangeDeviceDontPropagateList(ClientPtr client)
REQUEST(xChangeDeviceDontPropagateListReq);
REQUEST_AT_LEAST_SIZE(xChangeDeviceDontPropagateListReq);
if (stuff->length !=
bytes_to_int32(sizeof(xChangeDeviceDontPropagateListReq)) +
stuff->count)
return BadLength;
if (stuff->length != bytes_to_int32(sizeof(xChangeDeviceDontPropagateListReq)) +
stuff->count)
return BadLength;
rc = dixLookupWindow(&pWin, stuff->window, client, DixSetAttrAccess);
if (rc != Success)
return rc;
return rc;
if (stuff->mode != AddToList && stuff->mode != DeleteFromList) {
client->errorValue = stuff->window;
return BadMode;
client->errorValue = stuff->window;
return BadMode;
}
if ((rc = CreateMaskFromList(client, (XEventClass *) &stuff[1],
stuff->count, tmp, NULL,
X_ChangeDeviceDontPropagateList)) != Success)
return rc;
if ((rc = CreateMaskFromList(client, (XEventClass *) & stuff[1],
stuff->count, tmp, NULL,
X_ChangeDeviceDontPropagateList)) != Success)
return rc;
others = wOtherInputMasks(pWin);
if (!others && stuff->mode == DeleteFromList)
return Success;
return Success;
for (i = 0; i < EMASKSIZE; i++) {
if (tmp[i].mask == 0)
continue;
if (tmp[i].mask == 0)
continue;
if (stuff->mode == DeleteFromList)
tmp[i].mask = (others->dontPropagateMask[i] & ~tmp[i].mask);
else if (others)
tmp[i].mask |= others->dontPropagateMask[i];
if (stuff->mode == DeleteFromList)
tmp[i].mask = (others->dontPropagateMask[i] & ~tmp[i].mask);
else if (others)
tmp[i].mask |= others->dontPropagateMask[i];
if (DeviceEventSuppressForWindow(pWin, client, tmp[i].mask, i) !=
Success)
return BadClass;
if (DeviceEventSuppressForWindow(pWin, client, tmp[i].mask, i) !=
Success)
return BadClass;
}
return Success;

View File

@@ -30,10 +30,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef CHGPROP_H
#define CHGPROP_H 1
int SProcXChangeDeviceDontPropagateList(ClientPtr /* client */
int SProcXChangeDeviceDontPropagateList(ClientPtr /* client */
);
int ProcXChangeDeviceDontPropagateList(ClientPtr /* client */
int ProcXChangeDeviceDontPropagateList(ClientPtr /* client */
);
#endif /* CHGPROP_H */
#endif /* CHGPROP_H */

View File

@@ -54,12 +54,12 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "XIstubs.h"
#include "windowstr.h" /* window structure */
#include "scrnintstr.h" /* screen structure */
#include "windowstr.h" /* window structure */
#include "scrnintstr.h" /* screen structure */
#include "dixevents.h"
#include "exevents.h"
@@ -74,11 +74,13 @@ SOFTWARE.
*
*/
int _X_COLD
int
SProcXChangePointerDevice(ClientPtr client)
{
char n;
REQUEST(xChangePointerDeviceReq);
swaps(&stuff->length);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xChangePointerDeviceReq);
return (ProcXChangePointerDevice(client));
}

View File

@@ -30,13 +30,19 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef CHGPTR_H
#define CHGPTR_H 1
int SProcXChangePointerDevice(ClientPtr /* client */
int SProcXChangePointerDevice(ClientPtr /* client */
);
int ProcXChangePointerDevice(ClientPtr /* client */
int ProcXChangePointerDevice(ClientPtr /* client */
);
void DeleteFocusClassDeviceStruct(DeviceIntPtr /* dev */
void DeleteFocusClassDeviceStruct(DeviceIntPtr /* dev */
);
#endif /* CHGPTR_H */
void SendEventToAllWindows(DeviceIntPtr /* dev */ ,
Mask /* mask */ ,
xEvent * /* ev */ ,
int /* count */
);
#endif /* CHGPTR_H */

View File

@@ -54,9 +54,9 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include "scrnintstr.h" /* screen structure */
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include "scrnintstr.h" /* screen structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "XIstubs.h"
@@ -70,11 +70,13 @@ SOFTWARE.
*
*/
int _X_COLD
int
SProcXCloseDevice(ClientPtr client)
{
char n;
REQUEST(xCloseDeviceReq);
swaps(&stuff->length);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xCloseDeviceReq);
return (ProcXCloseDevice(client));
}
@@ -94,15 +96,15 @@ DeleteDeviceEvents(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client)
GrabPtr grab, next;
if ((pOthers = wOtherInputMasks(pWin)) != 0)
for (others = pOthers->inputClients; others; others = others->next)
if (SameClient(others, client))
others->mask[dev->id] = NoEventMask;
for (others = pOthers->inputClients; others; others = others->next)
if (SameClient(others, client))
others->mask[dev->id] = NoEventMask;
for (grab = wPassiveGrabs(pWin); grab; grab = next) {
next = grab->next;
if ((grab->device == dev) &&
(client->clientAsMask == CLIENT_BITS(grab->resource)))
FreeResource(grab->resource, RT_NONE);
next = grab->next;
if ((grab->device == dev) &&
(client->clientAsMask == CLIENT_BITS(grab->resource)))
FreeResource(grab->resource, RT_NONE);
}
}
@@ -119,10 +121,10 @@ DeleteEventsFromChildren(DeviceIntPtr dev, WindowPtr p1, ClientPtr client)
WindowPtr p2;
while (p1) {
p2 = p1->firstChild;
DeleteDeviceEvents(dev, p1, client);
DeleteEventsFromChildren(dev, p2, client);
p1 = p1->nextSib;
p2 = p1->firstChild;
DeleteDeviceEvents(dev, p1, client);
DeleteEventsFromChildren(dev, p2, client);
p1 = p1->nextSib;
}
}
@@ -144,20 +146,20 @@ ProcXCloseDevice(ClientPtr client)
rc = dixLookupDevice(&d, stuff->deviceid, client, DixUseAccess);
if (rc != Success)
return rc;
return rc;
if (d->deviceGrab.grab && SameClient(d->deviceGrab.grab, client))
(*d->deviceGrab.DeactivateGrab) (d); /* release active grab */
(*d->deviceGrab.DeactivateGrab) (d); /* release active grab */
/* Remove event selections from all windows for events from this device
* and selected by this client.
* Delete passive grabs from all windows for this device. */
for (i = 0; i < screenInfo.numScreens; i++) {
pWin = screenInfo.screens[i]->root;
DeleteDeviceEvents(d, pWin, client);
p1 = pWin->firstChild;
DeleteEventsFromChildren(d, p1, client);
pWin = screenInfo.screens[i]->root;
DeleteDeviceEvents(d, pWin, client);
p1 = pWin->firstChild;
DeleteEventsFromChildren(d, p1, client);
}
return Success;

View File

@@ -30,10 +30,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef CLOSEDEV_H
#define CLOSEDEV_H 1
int SProcXCloseDevice(ClientPtr /* client */
int SProcXCloseDevice(ClientPtr /* client */
);
int ProcXCloseDevice(ClientPtr /* client */
int ProcXCloseDevice(ClientPtr /* client */
);
#endif /* CLOSEDEV_H */
#endif /* CLOSEDEV_H */

View File

@@ -54,7 +54,7 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exglobals.h"
@@ -68,11 +68,13 @@ SOFTWARE.
*
*/
int _X_COLD
int
SProcXDeviceBell(ClientPtr client)
{
char n;
REQUEST(xDeviceBellReq);
swaps(&stuff->length);
swaps(&stuff->length, n);
return (ProcXDeviceBell(client));
}
@@ -91,7 +93,7 @@ ProcXDeviceBell(ClientPtr client)
int rc, base;
int newpercent;
CARD8 class;
void *ctrl;
pointer ctrl;
BellProcPtr proc;
REQUEST(xDeviceBellReq);
@@ -99,51 +101,48 @@ ProcXDeviceBell(ClientPtr client)
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixBellAccess);
if (rc != Success) {
client->errorValue = stuff->deviceid;
return rc;
client->errorValue = stuff->deviceid;
return rc;
}
if (stuff->percent < -100 || stuff->percent > 100) {
client->errorValue = stuff->percent;
return BadValue;
client->errorValue = stuff->percent;
return BadValue;
}
if (stuff->feedbackclass == KbdFeedbackClass) {
for (k = dev->kbdfeed; k; k = k->next)
if (k->ctrl.id == stuff->feedbackid)
break;
if (!k) {
client->errorValue = stuff->feedbackid;
return BadValue;
}
base = k->ctrl.bell;
proc = k->BellProc;
ctrl = (void *) &(k->ctrl);
class = KbdFeedbackClass;
}
else if (stuff->feedbackclass == BellFeedbackClass) {
for (b = dev->bell; b; b = b->next)
if (b->ctrl.id == stuff->feedbackid)
break;
if (!b) {
client->errorValue = stuff->feedbackid;
return BadValue;
}
base = b->ctrl.percent;
proc = b->BellProc;
ctrl = (void *) &(b->ctrl);
class = BellFeedbackClass;
}
else {
client->errorValue = stuff->feedbackclass;
return BadValue;
for (k = dev->kbdfeed; k; k = k->next)
if (k->ctrl.id == stuff->feedbackid)
break;
if (!k) {
client->errorValue = stuff->feedbackid;
return BadValue;
}
base = k->ctrl.bell;
proc = k->BellProc;
ctrl = (pointer) & (k->ctrl);
class = KbdFeedbackClass;
} else if (stuff->feedbackclass == BellFeedbackClass) {
for (b = dev->bell; b; b = b->next)
if (b->ctrl.id == stuff->feedbackid)
break;
if (!b) {
client->errorValue = stuff->feedbackid;
return BadValue;
}
base = b->ctrl.percent;
proc = b->BellProc;
ctrl = (pointer) & (b->ctrl);
class = BellFeedbackClass;
} else {
client->errorValue = stuff->feedbackclass;
return BadValue;
}
newpercent = (base * stuff->percent) / 100;
if (stuff->percent < 0)
newpercent = base + newpercent;
newpercent = base + newpercent;
else
newpercent = base - newpercent + stuff->percent;
if (proc == NULL)
return BadValue;
newpercent = base - newpercent + stuff->percent;
(*proc) (newpercent, dev, ctrl, class);
return Success;
}

View File

@@ -30,10 +30,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef DEVBELL_H
#define DEVBELL_H 1
int SProcXDeviceBell(ClientPtr /* client */
int SProcXDeviceBell(ClientPtr /* client */
);
int ProcXDeviceBell(ClientPtr /* client */
int ProcXDeviceBell(ClientPtr /* client */
);
#endif /* DEVBELL_H */
#endif /* DEVBELL_H */

File diff suppressed because it is too large Load Diff

View File

@@ -79,7 +79,6 @@ extern int DevicePropertyNotify;
extern RESTYPE RT_INPUTCLIENT;
extern DevPrivateKeyRec XIClientPrivateKeyRec;
#define XIClientPrivateKey (&XIClientPrivateKeyRec)
#endif /* EXGLOBALS_H */
#endif /* EXGLOBALS_H */

File diff suppressed because it is too large Load Diff

View File

@@ -54,7 +54,7 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exglobals.h"
@@ -67,11 +67,13 @@ SOFTWARE.
*
*/
int _X_COLD
int
SProcXGetDeviceButtonMapping(ClientPtr client)
{
char n;
REQUEST(xGetDeviceButtonMappingReq);
swaps(&stuff->length);
swaps(&stuff->length, n);
return (ProcXGetDeviceButtonMapping(client));
}
@@ -92,26 +94,24 @@ ProcXGetDeviceButtonMapping(ClientPtr client)
REQUEST(xGetDeviceButtonMappingReq);
REQUEST_SIZE_MATCH(xGetDeviceButtonMappingReq);
rep = (xGetDeviceButtonMappingReply) {
.repType = X_Reply,
.RepType = X_GetDeviceButtonMapping,
.sequenceNumber = client->sequence,
.nElts = 0,
.length = 0
};
rep.repType = X_Reply;
rep.RepType = X_GetDeviceButtonMapping;
rep.nElts = 0;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess);
if (rc != Success)
return rc;
return rc;
b = dev->button;
if (b == NULL)
return BadMatch;
return BadMatch;
rep.nElts = b->numButtons;
rep.length = bytes_to_int32(rep.nElts);
WriteReplyToClient(client, sizeof(xGetDeviceButtonMappingReply), &rep);
WriteToClient(client, rep.nElts, &b->map[1]);
(void)WriteToClient(client, rep.nElts, (char *)&b->map[1]);
return Success;
}
@@ -122,11 +122,13 @@ ProcXGetDeviceButtonMapping(ClientPtr client)
*
*/
void _X_COLD
void
SRepXGetDeviceButtonMapping(ClientPtr client, int size,
xGetDeviceButtonMappingReply * rep)
xGetDeviceButtonMappingReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
char n;
swaps(&rep->sequenceNumber, n);
swapl(&rep->length, n);
WriteToClient(client, size, (char *)rep);
}

View File

@@ -30,15 +30,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef GETBMAP_H
#define GETBMAP_H 1
int SProcXGetDeviceButtonMapping(ClientPtr /* client */
int SProcXGetDeviceButtonMapping(ClientPtr /* client */
);
int ProcXGetDeviceButtonMapping(ClientPtr /* client */
int ProcXGetDeviceButtonMapping(ClientPtr /* client */
);
void SRepXGetDeviceButtonMapping(ClientPtr /* client */ ,
int /* size */ ,
xGetDeviceButtonMappingReply * /* rep */
int /* size */ ,
xGetDeviceButtonMappingReply * /* rep */
);
#endif /* GETBMAP_H */
#endif /* GETBMAP_H */

View File

@@ -54,7 +54,7 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exglobals.h"
@@ -68,13 +68,15 @@ SOFTWARE.
*
*/
int _X_COLD
int
SProcXGetDeviceControl(ClientPtr client)
{
char n;
REQUEST(xGetDeviceControlReq);
swaps(&stuff->length);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xGetDeviceControlReq);
swaps(&stuff->control);
swaps(&stuff->control, n);
return (ProcXGetDeviceControl(client));
}
@@ -86,8 +88,9 @@ SProcXGetDeviceControl(ClientPtr client)
static void
CopySwapDeviceResolution(ClientPtr client, ValuatorClassPtr v, char *buf,
int length)
int length)
{
char n;
AxisInfoPtr a;
xDeviceResolutionState *r;
int i, *iptr;
@@ -97,27 +100,27 @@ CopySwapDeviceResolution(ClientPtr client, ValuatorClassPtr v, char *buf,
r->length = length;
r->num_valuators = v->numAxes;
buf += sizeof(xDeviceResolutionState);
iptr = (int *) buf;
iptr = (int *)buf;
for (i = 0, a = v->axes; i < v->numAxes; i++, a++)
*iptr++ = a->resolution;
*iptr++ = a->resolution;
for (i = 0, a = v->axes; i < v->numAxes; i++, a++)
*iptr++ = a->min_resolution;
*iptr++ = a->min_resolution;
for (i = 0, a = v->axes; i < v->numAxes; i++, a++)
*iptr++ = a->max_resolution;
*iptr++ = a->max_resolution;
if (client->swapped) {
swaps(&r->control);
swaps(&r->length);
swapl(&r->num_valuators);
iptr = (int *) buf;
for (i = 0; i < (3 * v->numAxes); i++, iptr++) {
swapl(iptr);
}
swaps(&r->control, n);
swaps(&r->length, n);
swapl(&r->num_valuators, n);
iptr = (int *)buf;
for (i = 0; i < (3 * v->numAxes); i++, iptr++) {
swapl(iptr, n);
}
}
}
static void
CopySwapDeviceCore(ClientPtr client, DeviceIntPtr dev, char *buf)
static void CopySwapDeviceCore (ClientPtr client, DeviceIntPtr dev, char *buf)
{
char n;
xDeviceCoreState *c = (xDeviceCoreState *) buf;
c->control = DEVICE_CORE;
@@ -126,14 +129,15 @@ CopySwapDeviceCore(ClientPtr client, DeviceIntPtr dev, char *buf)
c->iscore = (dev == inputInfo.keyboard || dev == inputInfo.pointer);
if (client->swapped) {
swaps(&c->control);
swaps(&c->length);
swaps(&c->control, n);
swaps(&c->length, n);
swaps(&c->status, n);
}
}
static void
CopySwapDeviceEnable(ClientPtr client, DeviceIntPtr dev, char *buf)
static void CopySwapDeviceEnable (ClientPtr client, DeviceIntPtr dev, char *buf)
{
char n;
xDeviceEnableState *e = (xDeviceEnableState *) buf;
e->control = DEVICE_ENABLE;
@@ -141,8 +145,9 @@ CopySwapDeviceEnable(ClientPtr client, DeviceIntPtr dev, char *buf)
e->enable = dev->enabled;
if (client->swapped) {
swaps(&e->control);
swaps(&e->length);
swaps(&e->control, n);
swaps(&e->length, n);
swaps(&e->enable, n);
}
}
@@ -153,12 +158,14 @@ CopySwapDeviceEnable(ClientPtr client, DeviceIntPtr dev, char *buf)
*
*/
void _X_COLD
void
SRepXGetDeviceControl(ClientPtr client, int size, xGetDeviceControlReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
char n;
swaps(&rep->sequenceNumber, n);
swapl(&rep->length, n);
WriteToClient(client, size, (char *)rep);
}
/***********************************************************************
@@ -180,22 +187,20 @@ ProcXGetDeviceControl(ClientPtr client)
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess);
if (rc != Success)
return rc;
return rc;
rep = (xGetDeviceControlReply) {
.repType = X_Reply,
.RepType = X_GetDeviceControl,
.sequenceNumber = client->sequence,
.length = 0
};
rep.repType = X_Reply;
rep.RepType = X_GetDeviceControl;
rep.length = 0;
rep.sequenceNumber = client->sequence;
switch (stuff->control) {
case DEVICE_RESOLUTION:
if (!dev->valuator)
return BadMatch;
total_length = sizeof(xDeviceResolutionState) +
(3 * sizeof(int) * dev->valuator->numAxes);
break;
if (!dev->valuator)
return BadMatch;
total_length = sizeof(xDeviceResolutionState) +
(3 * sizeof(int) * dev->valuator->numAxes);
break;
case DEVICE_ABS_CALIB:
case DEVICE_ABS_AREA:
return BadMatch;
@@ -206,18 +211,18 @@ ProcXGetDeviceControl(ClientPtr client)
total_length = sizeof(xDeviceEnableState);
break;
default:
return BadValue;
return BadValue;
}
buf = (char *) malloc(total_length);
buf = (char *)malloc(total_length);
if (!buf)
return BadAlloc;
return BadAlloc;
savbuf = buf;
switch (stuff->control) {
case DEVICE_RESOLUTION:
CopySwapDeviceResolution(client, dev->valuator, buf, total_length);
break;
CopySwapDeviceResolution(client, dev->valuator, buf, total_length);
break;
case DEVICE_CORE:
CopySwapDeviceCore(client, dev, buf);
break;
@@ -225,7 +230,7 @@ ProcXGetDeviceControl(ClientPtr client)
CopySwapDeviceEnable(client, dev, buf);
break;
default:
break;
break;
}
rep.length = bytes_to_int32(total_length);

View File

@@ -30,15 +30,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef GETDCTL_H
#define GETDCTL_H 1
int SProcXGetDeviceControl(ClientPtr /* client */
int SProcXGetDeviceControl(ClientPtr /* client */
);
int ProcXGetDeviceControl(ClientPtr /* client */
int ProcXGetDeviceControl(ClientPtr /* client */
);
void SRepXGetDeviceControl(ClientPtr /* client */ ,
int /* size */ ,
xGetDeviceControlReply * /* rep */
int /* size */ ,
xGetDeviceControlReply * /* rep */
);
#endif /* GETDCTL_H */
#endif /* GETDCTL_H */

View File

@@ -54,7 +54,7 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exglobals.h"
@@ -68,11 +68,13 @@ SOFTWARE.
*
*/
int _X_COLD
int
SProcXGetFeedbackControl(ClientPtr client)
{
char n;
REQUEST(xGetFeedbackControlReq);
swaps(&stuff->length);
swaps(&stuff->length, n);
return (ProcXGetFeedbackControl(client));
}
@@ -86,6 +88,7 @@ static void
CopySwapKbdFeedback(ClientPtr client, KbdFeedbackPtr k, char **buf)
{
int i;
char n;
xKbdFeedbackState *k2;
k2 = (xKbdFeedbackState *) * buf;
@@ -99,13 +102,13 @@ CopySwapKbdFeedback(ClientPtr client, KbdFeedbackPtr k, char **buf)
k2->led_mask = k->ctrl.leds;
k2->global_auto_repeat = k->ctrl.autoRepeat;
for (i = 0; i < 32; i++)
k2->auto_repeats[i] = k->ctrl.autoRepeats[i];
k2->auto_repeats[i] = k->ctrl.autoRepeats[i];
if (client->swapped) {
swaps(&k2->length);
swaps(&k2->pitch);
swaps(&k2->duration);
swapl(&k2->led_mask);
swapl(&k2->led_values);
swaps(&k2->length, n);
swaps(&k2->pitch, n);
swaps(&k2->duration, n);
swapl(&k2->led_mask, n);
swapl(&k2->led_values, n);
}
*buf += sizeof(xKbdFeedbackState);
}
@@ -119,6 +122,7 @@ CopySwapKbdFeedback(ClientPtr client, KbdFeedbackPtr k, char **buf)
static void
CopySwapPtrFeedback(ClientPtr client, PtrFeedbackPtr p, char **buf)
{
char n;
xPtrFeedbackState *p2;
p2 = (xPtrFeedbackState *) * buf;
@@ -129,10 +133,10 @@ CopySwapPtrFeedback(ClientPtr client, PtrFeedbackPtr p, char **buf)
p2->accelDenom = p->ctrl.den;
p2->threshold = p->ctrl.threshold;
if (client->swapped) {
swaps(&p2->length);
swaps(&p2->accelNum);
swaps(&p2->accelDenom);
swaps(&p2->threshold);
swaps(&p2->length, n);
swaps(&p2->accelNum, n);
swaps(&p2->accelDenom, n);
swaps(&p2->threshold, n);
}
*buf += sizeof(xPtrFeedbackState);
}
@@ -146,6 +150,7 @@ CopySwapPtrFeedback(ClientPtr client, PtrFeedbackPtr p, char **buf)
static void
CopySwapIntegerFeedback(ClientPtr client, IntegerFeedbackPtr i, char **buf)
{
char n;
xIntegerFeedbackState *i2;
i2 = (xIntegerFeedbackState *) * buf;
@@ -156,10 +161,10 @@ CopySwapIntegerFeedback(ClientPtr client, IntegerFeedbackPtr i, char **buf)
i2->min_value = i->ctrl.min_value;
i2->max_value = i->ctrl.max_value;
if (client->swapped) {
swaps(&i2->length);
swapl(&i2->resolution);
swapl(&i2->min_value);
swapl(&i2->max_value);
swaps(&i2->length, n);
swapl(&i2->resolution, n);
swapl(&i2->min_value, n);
swapl(&i2->max_value, n);
}
*buf += sizeof(xIntegerFeedbackState);
}
@@ -174,28 +179,29 @@ static void
CopySwapStringFeedback(ClientPtr client, StringFeedbackPtr s, char **buf)
{
int i;
char n;
xStringFeedbackState *s2;
KeySym *kptr;
s2 = (xStringFeedbackState *) * buf;
s2->class = StringFeedbackClass;
s2->length = sizeof(xStringFeedbackState) +
s->ctrl.num_symbols_supported * sizeof(KeySym);
s->ctrl.num_symbols_supported * sizeof(KeySym);
s2->id = s->ctrl.id;
s2->max_symbols = s->ctrl.max_symbols;
s2->num_syms_supported = s->ctrl.num_symbols_supported;
*buf += sizeof(xStringFeedbackState);
kptr = (KeySym *) (*buf);
for (i = 0; i < s->ctrl.num_symbols_supported; i++)
*kptr++ = *(s->ctrl.symbols_supported + i);
*kptr++ = *(s->ctrl.symbols_supported + i);
if (client->swapped) {
swaps(&s2->length);
swaps(&s2->max_symbols);
swaps(&s2->num_syms_supported);
kptr = (KeySym *) (*buf);
for (i = 0; i < s->ctrl.num_symbols_supported; i++, kptr++) {
swapl(kptr);
}
swaps(&s2->length, n);
swaps(&s2->max_symbols, n);
swaps(&s2->num_syms_supported, n);
kptr = (KeySym *) (*buf);
for (i = 0; i < s->ctrl.num_symbols_supported; i++, kptr++) {
swapl(kptr, n);
}
}
*buf += (s->ctrl.num_symbols_supported * sizeof(KeySym));
}
@@ -209,6 +215,7 @@ CopySwapStringFeedback(ClientPtr client, StringFeedbackPtr s, char **buf)
static void
CopySwapLedFeedback(ClientPtr client, LedFeedbackPtr l, char **buf)
{
char n;
xLedFeedbackState *l2;
l2 = (xLedFeedbackState *) * buf;
@@ -218,9 +225,9 @@ CopySwapLedFeedback(ClientPtr client, LedFeedbackPtr l, char **buf)
l2->led_values = l->ctrl.led_values;
l2->led_mask = l->ctrl.led_mask;
if (client->swapped) {
swaps(&l2->length);
swapl(&l2->led_values);
swapl(&l2->led_mask);
swaps(&l2->length, n);
swapl(&l2->led_values, n);
swapl(&l2->led_mask, n);
}
*buf += sizeof(xLedFeedbackState);
}
@@ -234,6 +241,7 @@ CopySwapLedFeedback(ClientPtr client, LedFeedbackPtr l, char **buf)
static void
CopySwapBellFeedback(ClientPtr client, BellFeedbackPtr b, char **buf)
{
char n;
xBellFeedbackState *b2;
b2 = (xBellFeedbackState *) * buf;
@@ -244,9 +252,9 @@ CopySwapBellFeedback(ClientPtr client, BellFeedbackPtr b, char **buf)
b2->pitch = b->ctrl.pitch;
b2->duration = b->ctrl.duration;
if (client->swapped) {
swaps(&b2->length);
swaps(&b2->pitch);
swaps(&b2->duration);
swaps(&b2->length, n);
swaps(&b2->pitch, n);
swaps(&b2->duration, n);
}
*buf += sizeof(xBellFeedbackState);
}
@@ -258,14 +266,16 @@ CopySwapBellFeedback(ClientPtr client, BellFeedbackPtr b, char **buf)
*
*/
void _X_COLD
void
SRepXGetFeedbackControl(ClientPtr client, int size,
xGetFeedbackControlReply * rep)
xGetFeedbackControlReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swaps(&rep->num_feedbacks);
WriteToClient(client, size, rep);
char n;
swaps(&rep->sequenceNumber, n);
swapl(&rep->length, n);
swaps(&rep->num_feedbacks, n);
WriteToClient(client, size, (char *)rep);
}
/***********************************************************************
@@ -293,62 +303,60 @@ ProcXGetFeedbackControl(ClientPtr client)
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess);
if (rc != Success)
return rc;
return rc;
rep = (xGetFeedbackControlReply) {
.repType = X_Reply,
.RepType = X_GetFeedbackControl,
.sequenceNumber = client->sequence,
.length = 0,
.num_feedbacks = 0
};
rep.repType = X_Reply;
rep.RepType = X_GetFeedbackControl;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.num_feedbacks = 0;
for (k = dev->kbdfeed; k; k = k->next) {
rep.num_feedbacks++;
total_length += sizeof(xKbdFeedbackState);
rep.num_feedbacks++;
total_length += sizeof(xKbdFeedbackState);
}
for (p = dev->ptrfeed; p; p = p->next) {
rep.num_feedbacks++;
total_length += sizeof(xPtrFeedbackState);
rep.num_feedbacks++;
total_length += sizeof(xPtrFeedbackState);
}
for (s = dev->stringfeed; s; s = s->next) {
rep.num_feedbacks++;
total_length += sizeof(xStringFeedbackState) +
(s->ctrl.num_symbols_supported * sizeof(KeySym));
rep.num_feedbacks++;
total_length += sizeof(xStringFeedbackState) +
(s->ctrl.num_symbols_supported * sizeof(KeySym));
}
for (i = dev->intfeed; i; i = i->next) {
rep.num_feedbacks++;
total_length += sizeof(xIntegerFeedbackState);
rep.num_feedbacks++;
total_length += sizeof(xIntegerFeedbackState);
}
for (l = dev->leds; l; l = l->next) {
rep.num_feedbacks++;
total_length += sizeof(xLedFeedbackState);
rep.num_feedbacks++;
total_length += sizeof(xLedFeedbackState);
}
for (b = dev->bell; b; b = b->next) {
rep.num_feedbacks++;
total_length += sizeof(xBellFeedbackState);
rep.num_feedbacks++;
total_length += sizeof(xBellFeedbackState);
}
if (total_length == 0)
return BadMatch;
return BadMatch;
buf = (char *) malloc(total_length);
buf = (char *)malloc(total_length);
if (!buf)
return BadAlloc;
return BadAlloc;
savbuf = buf;
for (k = dev->kbdfeed; k; k = k->next)
CopySwapKbdFeedback(client, k, &buf);
CopySwapKbdFeedback(client, k, &buf);
for (p = dev->ptrfeed; p; p = p->next)
CopySwapPtrFeedback(client, p, &buf);
CopySwapPtrFeedback(client, p, &buf);
for (s = dev->stringfeed; s; s = s->next)
CopySwapStringFeedback(client, s, &buf);
CopySwapStringFeedback(client, s, &buf);
for (i = dev->intfeed; i; i = i->next)
CopySwapIntegerFeedback(client, i, &buf);
CopySwapIntegerFeedback(client, i, &buf);
for (l = dev->leds; l; l = l->next)
CopySwapLedFeedback(client, l, &buf);
CopySwapLedFeedback(client, l, &buf);
for (b = dev->bell; b; b = b->next)
CopySwapBellFeedback(client, b, &buf);
CopySwapBellFeedback(client, b, &buf);
rep.length = bytes_to_int32(total_length);
WriteReplyToClient(client, sizeof(xGetFeedbackControlReply), &rep);

View File

@@ -30,15 +30,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef GETFCTL_H
#define GETFCTL_H 1
int SProcXGetFeedbackControl(ClientPtr /* client */
int SProcXGetFeedbackControl(ClientPtr /* client */
);
int ProcXGetFeedbackControl(ClientPtr /* client */
int ProcXGetFeedbackControl(ClientPtr /* client */
);
void SRepXGetFeedbackControl(ClientPtr /* client */ ,
int /* size */ ,
xGetFeedbackControlReply * /* rep */
int /* size */ ,
xGetFeedbackControlReply * /* rep */
);
#endif /* GETFCTL_H */
#endif /* GETFCTL_H */

View File

@@ -54,8 +54,8 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include "windowstr.h" /* focus struct */
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* focus struct */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exglobals.h"
@@ -68,11 +68,13 @@ SOFTWARE.
*
*/
int _X_COLD
int
SProcXGetDeviceFocus(ClientPtr client)
{
char n;
REQUEST(xGetDeviceFocusReq);
swaps(&stuff->length);
swaps(&stuff->length, n);
return (ProcXGetDeviceFocus(client));
}
@@ -95,27 +97,25 @@ ProcXGetDeviceFocus(ClientPtr client)
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetFocusAccess);
if (rc != Success)
return rc;
return rc;
if (!dev->focus)
return BadDevice;
return BadDevice;
rep = (xGetDeviceFocusReply) {
.repType = X_Reply,
.RepType = X_GetDeviceFocus,
.sequenceNumber = client->sequence,
.length = 0
};
rep.repType = X_Reply;
rep.RepType = X_GetDeviceFocus;
rep.length = 0;
rep.sequenceNumber = client->sequence;
focus = dev->focus;
if (focus->win == NoneWin)
rep.focus = None;
rep.focus = None;
else if (focus->win == PointerRootWin)
rep.focus = PointerRoot;
rep.focus = PointerRoot;
else if (focus->win == FollowKeyboardWin)
rep.focus = FollowKeyboard;
rep.focus = FollowKeyboard;
else
rep.focus = focus->win->drawable.id;
rep.focus = focus->win->drawable.id;
rep.time = focus->time.milliseconds;
rep.revertTo = focus->revert;
@@ -130,12 +130,14 @@ ProcXGetDeviceFocus(ClientPtr client)
*
*/
void _X_COLD
void
SRepXGetDeviceFocus(ClientPtr client, int size, xGetDeviceFocusReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swapl(&rep->focus);
swapl(&rep->time);
WriteToClient(client, size, rep);
char n;
swaps(&rep->sequenceNumber, n);
swapl(&rep->length, n);
swapl(&rep->focus, n);
swapl(&rep->time, n);
WriteToClient(client, size, (char *)rep);
}

View File

@@ -30,15 +30,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef GETFOCUS_H
#define GETFOCUS_H 1
int SProcXGetDeviceFocus(ClientPtr /* client */
int SProcXGetDeviceFocus(ClientPtr /* client */
);
int ProcXGetDeviceFocus(ClientPtr /* client */
int ProcXGetDeviceFocus(ClientPtr /* client */
);
void SRepXGetDeviceFocus(ClientPtr /* client */ ,
int /* size */ ,
xGetDeviceFocusReply * /* rep */
int /* size */ ,
xGetDeviceFocusReply * /* rep */
);
#endif /* GETFOCUS_H */
#endif /* GETFOCUS_H */

View File

@@ -54,7 +54,7 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exglobals.h"
@@ -71,11 +71,13 @@ SOFTWARE.
*
*/
int _X_COLD
int
SProcXGetDeviceKeyMapping(ClientPtr client)
{
char n;
REQUEST(xGetDeviceKeyMappingReq);
swaps(&stuff->length);
swaps(&stuff->length, n);
return (ProcXGetDeviceKeyMapping(client));
}
@@ -99,33 +101,31 @@ ProcXGetDeviceKeyMapping(ClientPtr client)
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess);
if (rc != Success)
return rc;
return rc;
if (dev->key == NULL)
return BadMatch;
return BadMatch;
xkb = dev->key->xkbInfo->desc;
if (stuff->firstKeyCode < xkb->min_key_code ||
stuff->firstKeyCode > xkb->max_key_code) {
client->errorValue = stuff->firstKeyCode;
return BadValue;
stuff->firstKeyCode > xkb->max_key_code) {
client->errorValue = stuff->firstKeyCode;
return BadValue;
}
if (stuff->firstKeyCode + stuff->count > xkb->max_key_code + 1) {
client->errorValue = stuff->count;
return BadValue;
client->errorValue = stuff->count;
return BadValue;
}
syms = XkbGetCoreMap(dev);
if (!syms)
return BadAlloc;
rep = (xGetDeviceKeyMappingReply) {
.repType = X_Reply,
.RepType = X_GetDeviceKeyMapping,
.sequenceNumber = client->sequence,
.keySymsPerKeyCode = syms->mapWidth,
.length = (syms->mapWidth * stuff->count) /* KeySyms are 4 bytes */
};
rep.repType = X_Reply;
rep.RepType = X_GetDeviceKeyMapping;
rep.sequenceNumber = client->sequence;
rep.keySymsPerKeyCode = syms->mapWidth;
rep.length = (syms->mapWidth * stuff->count); /* KeySyms are 4 bytes */
WriteReplyToClient(client, sizeof(xGetDeviceKeyMappingReply), &rep);
client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
@@ -146,11 +146,13 @@ ProcXGetDeviceKeyMapping(ClientPtr client)
*
*/
void _X_COLD
void
SRepXGetDeviceKeyMapping(ClientPtr client, int size,
xGetDeviceKeyMappingReply * rep)
xGetDeviceKeyMappingReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
char n;
swaps(&rep->sequenceNumber, n);
swapl(&rep->length, n);
WriteToClient(client, size, (char *)rep);
}

View File

@@ -30,15 +30,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef GETKMAP_H
#define GETKMAP_H 1
int SProcXGetDeviceKeyMapping(ClientPtr /* client */
int SProcXGetDeviceKeyMapping(ClientPtr /* client */
);
int ProcXGetDeviceKeyMapping(ClientPtr /* client */
int ProcXGetDeviceKeyMapping(ClientPtr /* client */
);
void SRepXGetDeviceKeyMapping(ClientPtr /* client */ ,
int /* size */ ,
xGetDeviceKeyMappingReply * /* rep */
int /* size */ ,
xGetDeviceKeyMappingReply * /* rep */
);
#endif /* GETKMAP_H */
#endif /* GETKMAP_H */

View File

@@ -54,9 +54,9 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h> /* Request macro */
#include <X11/extensions/XIproto.h> /* Request macro */
#include "exglobals.h"
#include "getmmap.h"
@@ -68,11 +68,13 @@ SOFTWARE.
*
*/
int _X_COLD
int
SProcXGetDeviceModifierMapping(ClientPtr client)
{
char n;
REQUEST(xGetDeviceModifierMappingReq);
swaps(&stuff->length);
swaps(&stuff->length, n);
return (ProcXGetDeviceModifierMapping(client));
}
@@ -95,23 +97,21 @@ ProcXGetDeviceModifierMapping(ClientPtr client)
ret = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess);
if (ret != Success)
return ret;
return ret;
ret = generate_modkeymap(client, dev, &modkeymap, &max_keys_per_mod);
if (ret != Success)
return ret;
rep = (xGetDeviceModifierMappingReply) {
.repType = X_Reply,
.RepType = X_GetDeviceModifierMapping,
.sequenceNumber = client->sequence,
.numKeyPerModifier = max_keys_per_mod,
rep.repType = X_Reply;
rep.RepType = X_GetDeviceModifierMapping;
rep.numKeyPerModifier = max_keys_per_mod;
rep.sequenceNumber = client->sequence;
/* length counts 4 byte quantities - there are 8 modifiers 1 byte big */
.length = max_keys_per_mod << 1
};
rep.length = max_keys_per_mod << 1;
WriteReplyToClient(client, sizeof(xGetDeviceModifierMappingReply), &rep);
WriteToClient(client, max_keys_per_mod * 8, modkeymap);
WriteToClient(client, max_keys_per_mod * 8, (char *) modkeymap);
free(modkeymap);
@@ -125,11 +125,13 @@ ProcXGetDeviceModifierMapping(ClientPtr client)
*
*/
void _X_COLD
void
SRepXGetDeviceModifierMapping(ClientPtr client, int size,
xGetDeviceModifierMappingReply * rep)
xGetDeviceModifierMappingReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
char n;
swaps(&rep->sequenceNumber, n);
swapl(&rep->length, n);
WriteToClient(client, size, (char *)rep);
}

View File

@@ -30,15 +30,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef GETMMAP_H
#define GETMMAP_H 1
int SProcXGetDeviceModifierMapping(ClientPtr /* client */
int SProcXGetDeviceModifierMapping(ClientPtr /* client */
);
int ProcXGetDeviceModifierMapping(ClientPtr /* client */
int ProcXGetDeviceModifierMapping(ClientPtr /* client */
);
void SRepXGetDeviceModifierMapping(ClientPtr /* client */ ,
int /* size */ ,
xGetDeviceModifierMappingReply * /* rep */
int /* size */ ,
xGetDeviceModifierMappingReply * /* rep */
);
#endif /* GETMMAP_H */
#endif /* GETMMAP_H */

View File

@@ -54,8 +54,8 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structs */
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structs */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exglobals.h"
@@ -72,13 +72,15 @@ extern int ExtEventIndex;
*
*/
int _X_COLD
int
SProcXGetDeviceDontPropagateList(ClientPtr client)
{
char n;
REQUEST(xGetDeviceDontPropagateListReq);
swaps(&stuff->length);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xGetDeviceDontPropagateListReq);
swapl(&stuff->window);
swapl(&stuff->window, n);
return (ProcXGetDeviceDontPropagateList(client));
}
@@ -101,39 +103,38 @@ ProcXGetDeviceDontPropagateList(ClientPtr client)
REQUEST(xGetDeviceDontPropagateListReq);
REQUEST_SIZE_MATCH(xGetDeviceDontPropagateListReq);
rep = (xGetDeviceDontPropagateListReply) {
.repType = X_Reply,
.RepType = X_GetDeviceDontPropagateList,
.sequenceNumber = client->sequence,
.length = 0,
.count = 0
};
rep.repType = X_Reply;
rep.RepType = X_GetDeviceDontPropagateList;
rep.sequenceNumber = client->sequence;
rep.length = 0;
rep.count = 0;
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
return rc;
return rc;
if ((others = wOtherInputMasks(pWin)) != 0) {
for (i = 0; i < EMASKSIZE; i++)
ClassFromMask(NULL, others->dontPropagateMask[i], i, &count, COUNT);
if (count) {
rep.count = count;
buf = xallocarray(rep.count, sizeof(XEventClass));
rep.length = bytes_to_int32(rep.count * sizeof(XEventClass));
for (i = 0; i < EMASKSIZE; i++)
ClassFromMask(NULL, others->dontPropagateMask[i], i,
&count, COUNT);
if (count) {
rep.count = count;
buf = (XEventClass *) malloc(rep.count * sizeof(XEventClass));
rep.length = bytes_to_int32(rep.count * sizeof(XEventClass));
tbuf = buf;
for (i = 0; i < EMASKSIZE; i++)
tbuf = ClassFromMask(tbuf, others->dontPropagateMask[i], i,
NULL, CREATE);
}
tbuf = buf;
for (i = 0; i < EMASKSIZE; i++)
tbuf = ClassFromMask(tbuf, others->dontPropagateMask[i], i,
NULL, CREATE);
}
}
WriteReplyToClient(client, sizeof(xGetDeviceDontPropagateListReply), &rep);
if (count) {
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, count * sizeof(XEventClass), buf);
free(buf);
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, count * sizeof(XEventClass), buf);
free(buf);
}
return Success;
}
@@ -146,23 +147,23 @@ ProcXGetDeviceDontPropagateList(ClientPtr client)
*/
XEventClass
* ClassFromMask(XEventClass * buf, Mask mask, int maskndx, CARD16 *count,
int mode)
* ClassFromMask(XEventClass * buf, Mask mask, int maskndx, CARD16 * count,
int mode)
{
int i, j;
int id = maskndx;
Mask tmask = 0x80000000;
for (i = 0; i < 32; i++, tmask >>= 1)
if (tmask & mask) {
for (j = 0; j < ExtEventIndex; j++)
if (EventInfo[j].mask == tmask) {
if (mode == COUNT)
(*count)++;
else
*buf++ = (id << 8) | EventInfo[j].type;
}
}
if (tmask & mask) {
for (j = 0; j < ExtEventIndex; j++)
if (EventInfo[j].mask == tmask) {
if (mode == COUNT)
(*count)++;
else
*buf++ = (id << 8) | EventInfo[j].type;
}
}
return buf;
}
@@ -173,12 +174,14 @@ XEventClass
*
*/
void _X_COLD
void
SRepXGetDeviceDontPropagateList(ClientPtr client, int size,
xGetDeviceDontPropagateListReply * rep)
xGetDeviceDontPropagateListReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swaps(&rep->count);
WriteToClient(client, size, rep);
char n;
swaps(&rep->sequenceNumber, n);
swapl(&rep->length, n);
swaps(&rep->count, n);
WriteToClient(client, size, (char *)rep);
}

View File

@@ -30,22 +30,22 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef GETPROP_H
#define GETPROP_H 1
int SProcXGetDeviceDontPropagateList(ClientPtr /* client */
int SProcXGetDeviceDontPropagateList(ClientPtr /* client */
);
int ProcXGetDeviceDontPropagateList(ClientPtr /* client */
int ProcXGetDeviceDontPropagateList(ClientPtr /* client */
);
XEventClass *ClassFromMask(XEventClass * /* buf */ ,
Mask /* mask */ ,
int /* maskndx */ ,
CARD16 * /* count */ ,
int /* mode */
Mask /* mask */ ,
int /* maskndx */ ,
CARD16 * /* count */ ,
int /* mode */
);
void SRepXGetDeviceDontPropagateList(ClientPtr /* client */ ,
int /* size */ ,
xGetDeviceDontPropagateListReply * /* rep */
int /* size */ ,
xGetDeviceDontPropagateListReply * /* rep */
);
#endif /* GETPROP_H */
#endif /* GETPROP_H */

View File

@@ -56,8 +56,8 @@ SOFTWARE.
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window struct */
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window struct */
#include "exglobals.h"
#include "swaprep.h"
@@ -70,13 +70,15 @@ SOFTWARE.
*
*/
int _X_COLD
int
SProcXGetSelectedExtensionEvents(ClientPtr client)
{
char n;
REQUEST(xGetSelectedExtensionEventsReq);
swaps(&stuff->length);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xGetSelectedExtensionEventsReq);
swapl(&stuff->window);
swapl(&stuff->window, n);
return (ProcXGetSelectedExtensionEvents(client));
}
@@ -102,56 +104,54 @@ ProcXGetSelectedExtensionEvents(ClientPtr client)
REQUEST(xGetSelectedExtensionEventsReq);
REQUEST_SIZE_MATCH(xGetSelectedExtensionEventsReq);
rep = (xGetSelectedExtensionEventsReply) {
.repType = X_Reply,
.RepType = X_GetSelectedExtensionEvents,
.sequenceNumber = client->sequence,
.length = 0,
.this_client_count = 0,
.all_clients_count = 0
};
rep.repType = X_Reply;
rep.RepType = X_GetSelectedExtensionEvents;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.this_client_count = 0;
rep.all_clients_count = 0;
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
return rc;
return rc;
if ((pOthers = wOtherInputMasks(pWin)) != 0) {
for (others = pOthers->inputClients; others; others = others->next)
for (i = 0; i < EMASKSIZE; i++)
ClassFromMask(NULL, others->mask[i], i,
&rep.all_clients_count, COUNT);
for (others = pOthers->inputClients; others; others = others->next)
for (i = 0; i < EMASKSIZE; i++)
ClassFromMask(NULL, others->mask[i], i,
&rep.all_clients_count, COUNT);
for (others = pOthers->inputClients; others; others = others->next)
if (SameClient(others, client)) {
for (i = 0; i < EMASKSIZE; i++)
ClassFromMask(NULL, others->mask[i], i,
&rep.this_client_count, COUNT);
break;
}
for (others = pOthers->inputClients; others; others = others->next)
if (SameClient(others, client)) {
for (i = 0; i < EMASKSIZE; i++)
ClassFromMask(NULL, others->mask[i], i,
&rep.this_client_count, COUNT);
break;
}
total_length = (rep.all_clients_count + rep.this_client_count) *
sizeof(XEventClass);
rep.length = bytes_to_int32(total_length);
buf = (XEventClass *) malloc(total_length);
total_length = (rep.all_clients_count + rep.this_client_count) *
sizeof(XEventClass);
rep.length = bytes_to_int32(total_length);
buf = (XEventClass *) malloc(total_length);
tclient = buf;
aclient = buf + rep.this_client_count;
if (others)
for (i = 0; i < EMASKSIZE; i++)
tclient =
ClassFromMask(tclient, others->mask[i], i, NULL, CREATE);
tclient = buf;
aclient = buf + rep.this_client_count;
if (others)
for (i = 0; i < EMASKSIZE; i++)
tclient =
ClassFromMask(tclient, others->mask[i], i, NULL, CREATE);
for (others = pOthers->inputClients; others; others = others->next)
for (i = 0; i < EMASKSIZE; i++)
aclient =
ClassFromMask(aclient, others->mask[i], i, NULL, CREATE);
for (others = pOthers->inputClients; others; others = others->next)
for (i = 0; i < EMASKSIZE; i++)
aclient =
ClassFromMask(aclient, others->mask[i], i, NULL, CREATE);
}
WriteReplyToClient(client, sizeof(xGetSelectedExtensionEventsReply), &rep);
if (total_length) {
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, total_length, buf);
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, total_length, buf);
}
free(buf);
return Success;
@@ -164,13 +164,15 @@ ProcXGetSelectedExtensionEvents(ClientPtr client)
*
*/
void _X_COLD
void
SRepXGetSelectedExtensionEvents(ClientPtr client, int size,
xGetSelectedExtensionEventsReply * rep)
xGetSelectedExtensionEventsReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swaps(&rep->this_client_count);
swaps(&rep->all_clients_count);
WriteToClient(client, size, rep);
char n;
swaps(&rep->sequenceNumber, n);
swapl(&rep->length, n);
swaps(&rep->this_client_count, n);
swaps(&rep->all_clients_count, n);
WriteToClient(client, size, (char *)rep);
}

View File

@@ -30,15 +30,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef GETSELEV_H
#define GETSELEV_H 1
int SProcXGetSelectedExtensionEvents(ClientPtr /* client */
int SProcXGetSelectedExtensionEvents(ClientPtr /* client */
);
int ProcXGetSelectedExtensionEvents(ClientPtr /* client */
int ProcXGetSelectedExtensionEvents(ClientPtr /* client */
);
void SRepXGetSelectedExtensionEvents(ClientPtr /* client */ ,
int /* size */ ,
xGetSelectedExtensionEventsReply * /* rep */
int /* size */ ,
xGetSelectedExtensionEventsReply * /* rep */
);
#endif /* GETSELEV_H */
#endif /* GETSELEV_H */

View File

@@ -54,7 +54,7 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exevents.h"
@@ -70,13 +70,15 @@ XExtensionVersion XIVersion;
*
*/
int _X_COLD
int
SProcXGetExtensionVersion(ClientPtr client)
{
char n;
REQUEST(xGetExtensionVersionReq);
swaps(&stuff->length);
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xGetExtensionVersionReq);
swaps(&stuff->nbytes);
swaps(&stuff->nbytes, n);
return (ProcXGetExtensionVersion(client));
}
@@ -95,18 +97,17 @@ ProcXGetExtensionVersion(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xGetExtensionVersionReq);
if (stuff->length != bytes_to_int32(sizeof(xGetExtensionVersionReq) +
stuff->nbytes))
return BadLength;
stuff->nbytes))
return BadLength;
rep = (xGetExtensionVersionReply) {
.repType = X_Reply,
.RepType = X_GetExtensionVersion,
.sequenceNumber = client->sequence,
.length = 0,
.major_version = XIVersion.major_version,
.minor_version = XIVersion.minor_version,
.present = TRUE
};
memset(&rep, 0, sizeof(xGetExtensionVersionReply));
rep.repType = X_Reply;
rep.RepType = X_GetExtensionVersion;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.present = TRUE;
rep.major_version = XIVersion.major_version;
rep.minor_version = XIVersion.minor_version;
WriteReplyToClient(client, sizeof(xGetExtensionVersionReply), &rep);
@@ -120,13 +121,15 @@ ProcXGetExtensionVersion(ClientPtr client)
*
*/
void _X_COLD
void
SRepXGetExtensionVersion(ClientPtr client, int size,
xGetExtensionVersionReply * rep)
xGetExtensionVersionReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swaps(&rep->major_version);
swaps(&rep->minor_version);
WriteToClient(client, size, rep);
char n;
swaps(&rep->sequenceNumber, n);
swapl(&rep->length, n);
swaps(&rep->major_version, n);
swaps(&rep->minor_version, n);
WriteToClient(client, size, (char *)rep);
}

View File

@@ -30,15 +30,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef GETVERS_H
#define GETVERS_H 1
int SProcXGetExtensionVersion(ClientPtr /* client */
int SProcXGetExtensionVersion(ClientPtr /* client */
);
int ProcXGetExtensionVersion(ClientPtr /* client */
int ProcXGetExtensionVersion(ClientPtr /* client */
);
void SRepXGetExtensionVersion(ClientPtr /* client */ ,
int /* size */ ,
xGetExtensionVersionReply * /* rep */
int /* size */ ,
xGetExtensionVersionReply * /* rep */
);
#endif /* GETVERS_H */
#endif /* GETVERS_H */

View File

@@ -54,12 +54,12 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exglobals.h"
#include "dixevents.h" /* GrabDevice */
#include "dixevents.h" /* GrabDevice */
#include "grabdev.h"
@@ -72,20 +72,21 @@ extern int ExtEventIndex;
*
*/
int _X_COLD
int
SProcXGrabDevice(ClientPtr client)
{
char n;
REQUEST(xGrabDeviceReq);
swaps(&stuff->length);
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xGrabDeviceReq);
swapl(&stuff->grabWindow);
swapl(&stuff->time);
swaps(&stuff->event_count);
if (stuff->length !=
bytes_to_int32(sizeof(xGrabDeviceReq)) + stuff->event_count)
return BadLength;
swapl(&stuff->grabWindow, n);
swapl(&stuff->time, n);
swaps(&stuff->event_count, n);
if (stuff->length != bytes_to_int32(sizeof(xGrabDeviceReq)) + stuff->event_count)
return BadLength;
SwapLongs((CARD32 *) (&stuff[1]), stuff->event_count);
return (ProcXGrabDevice(client));
@@ -109,35 +110,33 @@ ProcXGrabDevice(ClientPtr client)
REQUEST(xGrabDeviceReq);
REQUEST_AT_LEAST_SIZE(xGrabDeviceReq);
if (stuff->length !=
bytes_to_int32(sizeof(xGrabDeviceReq)) + stuff->event_count)
return BadLength;
if (stuff->length != bytes_to_int32(sizeof(xGrabDeviceReq)) + stuff->event_count)
return BadLength;
rep = (xGrabDeviceReply) {
.repType = X_Reply,
.RepType = X_GrabDevice,
.sequenceNumber = client->sequence,
.length = 0,
};
rep.repType = X_Reply;
rep.RepType = X_GrabDevice;
rep.sequenceNumber = client->sequence;
rep.length = 0;
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess);
if (rc != Success)
return rc;
return rc;
if ((rc = CreateMaskFromList(client, (XEventClass *) &stuff[1],
stuff->event_count, tmp, dev,
X_GrabDevice)) != Success)
return rc;
if ((rc = CreateMaskFromList(client, (XEventClass *) & stuff[1],
stuff->event_count, tmp, dev,
X_GrabDevice)) != Success)
return rc;
mask.xi = tmp[stuff->deviceid].mask;
rc = GrabDevice(client, dev, stuff->other_devices_mode,
stuff->this_device_mode, stuff->grabWindow,
stuff->ownerEvents, stuff->time,
&mask, XI, None, None, &rep.status);
stuff->ownerEvents, stuff->time,
&mask, GRABTYPE_XI, None, None,
&rep.status);
if (rc != Success)
return rc;
return rc;
WriteReplyToClient(client, sizeof(xGrabDeviceReply), &rep);
return Success;
@@ -169,31 +168,34 @@ ProcXGrabDevice(ClientPtr client)
int
CreateMaskFromList(ClientPtr client, XEventClass * list, int count,
struct tmask *mask, DeviceIntPtr dev, int req)
struct tmask *mask, DeviceIntPtr dev, int req)
{
int rc, i, j;
int device;
DeviceIntPtr tdev;
memset(mask, 0, EMASKSIZE * sizeof(struct tmask));
for (i = 0; i < EMASKSIZE; i++) {
mask[i].mask = 0;
mask[i].dev = NULL;
}
for (i = 0; i < count; i++, list++) {
device = *list >> 8;
if (device > 255)
return BadClass;
device = *list >> 8;
if (device > 255)
return BadClass;
rc = dixLookupDevice(&tdev, device, client, DixUseAccess);
if (rc != BadDevice && rc != Success)
return rc;
if (rc == BadDevice || (dev != NULL && tdev != dev))
return BadClass;
rc = dixLookupDevice(&tdev, device, client, DixUseAccess);
if (rc != BadDevice && rc != Success)
return rc;
if (rc == BadDevice || (dev != NULL && tdev != dev))
return BadClass;
for (j = 0; j < ExtEventIndex; j++)
if (EventInfo[j].type == (*list & 0xff)) {
mask[device].mask |= EventInfo[j].mask;
mask[device].dev = (void *) tdev;
break;
}
for (j = 0; j < ExtEventIndex; j++)
if (EventInfo[j].type == (*list & 0xff)) {
mask[device].mask |= EventInfo[j].mask;
mask[device].dev = (Pointer) tdev;
break;
}
}
return Success;
}
@@ -205,10 +207,12 @@ CreateMaskFromList(ClientPtr client, XEventClass * list, int count,
*
*/
void _X_COLD
void
SRepXGrabDevice(ClientPtr client, int size, xGrabDeviceReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
char n;
swaps(&rep->sequenceNumber, n);
swapl(&rep->length, n);
WriteToClient(client, size, (char *)rep);
}

View File

@@ -30,23 +30,23 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef GRABDEV_H
#define GRABDEV_H 1
int SProcXGrabDevice(ClientPtr /* client */
int SProcXGrabDevice(ClientPtr /* client */
);
int ProcXGrabDevice(ClientPtr /* client */
int ProcXGrabDevice(ClientPtr /* client */
);
int CreateMaskFromList(ClientPtr /* client */ ,
XEventClass * /* list */ ,
int /* count */ ,
struct tmask /* mask */ [],
DeviceIntPtr /* dev */ ,
int /* req */
XEventClass * /* list */ ,
int /* count */ ,
struct tmask /* mask */ [],
DeviceIntPtr /* dev */ ,
int /* req */
);
void SRepXGrabDevice(ClientPtr /* client */ ,
int /* size */ ,
xGrabDeviceReply * /* rep */
int /* size */ ,
xGrabDeviceReply * /* rep */
);
#endif /* GRABDEV_H */
#endif /* GRABDEV_H */

View File

@@ -54,8 +54,8 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exevents.h"
@@ -71,17 +71,19 @@ SOFTWARE.
*
*/
int _X_COLD
int
SProcXGrabDeviceButton(ClientPtr client)
{
char n;
REQUEST(xGrabDeviceButtonReq);
swaps(&stuff->length);
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xGrabDeviceButtonReq);
swapl(&stuff->grabWindow);
swaps(&stuff->modifiers);
swaps(&stuff->event_count);
swapl(&stuff->grabWindow, n);
swaps(&stuff->modifiers, n);
swaps(&stuff->event_count, n);
REQUEST_FIXED_SIZE(xGrabDeviceButtonReq,
stuff->event_count * sizeof(CARD32));
stuff->event_count * sizeof(CARD32));
SwapLongs((CARD32 *) (&stuff[1]), stuff->event_count);
return (ProcXGrabDeviceButton(client));
@@ -108,46 +110,45 @@ ProcXGrabDeviceButton(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xGrabDeviceButtonReq);
if (stuff->length !=
bytes_to_int32(sizeof(xGrabDeviceButtonReq)) + stuff->event_count)
return BadLength;
bytes_to_int32(sizeof(xGrabDeviceButtonReq)) + stuff->event_count)
return BadLength;
ret = dixLookupDevice(&dev, stuff->grabbed_device, client, DixGrabAccess);
if (ret != Success)
return ret;
return ret;
if (stuff->modifier_device != UseXKeyboard) {
ret = dixLookupDevice(&mdev, stuff->modifier_device, client,
DixUseAccess);
if (ret != Success)
return ret;
if (mdev->key == NULL)
return BadMatch;
}
else {
mdev = PickKeyboard(client);
ret = XaceHook(XACE_DEVICE_ACCESS, client, mdev, DixUseAccess);
if (ret != Success)
return ret;
ret = dixLookupDevice(&mdev, stuff->modifier_device, client,
DixUseAccess);
if (ret != Success)
return ret;
if (mdev->key == NULL)
return BadMatch;
} else {
mdev = PickKeyboard(client);
ret = XaceHook(XACE_DEVICE_ACCESS, client, mdev, DixUseAccess);
if (ret != Success)
return ret;
}
class = (XEventClass *) (&stuff[1]); /* first word of values */
class = (XEventClass *) (&stuff[1]); /* first word of values */
if ((ret = CreateMaskFromList(client, class,
stuff->event_count, tmp, dev,
X_GrabDeviceButton)) != Success)
return ret;
stuff->event_count, tmp, dev,
X_GrabDeviceButton)) != Success)
return ret;
param = (GrabParameters) {
.grabtype = XI,
.ownerEvents = stuff->ownerEvents,
.this_device_mode = stuff->this_device_mode,
.other_devices_mode = stuff->other_devices_mode,
.grabWindow = stuff->grabWindow,
.modifiers = stuff->modifiers
};
memset(&param, 0, sizeof(param));
param.grabtype = GRABTYPE_XI;
param.ownerEvents = stuff->ownerEvents;
param.this_device_mode = stuff->this_device_mode;
param.other_devices_mode = stuff->other_devices_mode;
param.grabWindow = stuff->grabWindow;
param.modifiers = stuff->modifiers;
mask.xi = tmp[stuff->grabbed_device].mask;
ret = GrabButton(client, dev, mdev, stuff->button, &param, XI, &mask);
ret = GrabButton(client, dev, mdev, stuff->button, &param,
GRABTYPE_XI, &mask);
return ret;
}

View File

@@ -30,10 +30,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef GRABDEVB_H
#define GRABDEVB_H 1
int SProcXGrabDeviceButton(ClientPtr /* client */
int SProcXGrabDeviceButton(ClientPtr /* client */
);
int ProcXGrabDeviceButton(ClientPtr /* client */
int ProcXGrabDeviceButton(ClientPtr /* client */
);
#endif /* GRABDEVB_H */
#endif /* GRABDEVB_H */

View File

@@ -54,8 +54,8 @@ SOFTWARE.
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exevents.h"
@@ -71,15 +71,17 @@ SOFTWARE.
*
*/
int _X_COLD
int
SProcXGrabDeviceKey(ClientPtr client)
{
char n;
REQUEST(xGrabDeviceKeyReq);
swaps(&stuff->length);
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xGrabDeviceKeyReq);
swapl(&stuff->grabWindow);
swaps(&stuff->modifiers);
swaps(&stuff->event_count);
swapl(&stuff->grabWindow, n);
swaps(&stuff->modifiers, n);
swaps(&stuff->event_count, n);
REQUEST_FIXED_SIZE(xGrabDeviceKeyReq, stuff->event_count * sizeof(CARD32));
SwapLongs((CARD32 *) (&stuff[1]), stuff->event_count);
return (ProcXGrabDeviceKey(client));
@@ -105,47 +107,45 @@ ProcXGrabDeviceKey(ClientPtr client)
REQUEST(xGrabDeviceKeyReq);
REQUEST_AT_LEAST_SIZE(xGrabDeviceKeyReq);
if (stuff->length !=
bytes_to_int32(sizeof(xGrabDeviceKeyReq)) + stuff->event_count)
return BadLength;
if (stuff->length != bytes_to_int32(sizeof(xGrabDeviceKeyReq)) + stuff->event_count)
return BadLength;
ret = dixLookupDevice(&dev, stuff->grabbed_device, client, DixGrabAccess);
if (ret != Success)
return ret;
return ret;
if (stuff->modifier_device != UseXKeyboard) {
ret = dixLookupDevice(&mdev, stuff->modifier_device, client,
DixUseAccess);
if (ret != Success)
return ret;
if (mdev->key == NULL)
return BadMatch;
}
else {
mdev = PickKeyboard(client);
ret = XaceHook(XACE_DEVICE_ACCESS, client, mdev, DixUseAccess);
if (ret != Success)
return ret;
ret = dixLookupDevice(&mdev, stuff->modifier_device, client,
DixUseAccess);
if (ret != Success)
return ret;
if (mdev->key == NULL)
return BadMatch;
} else {
mdev = PickKeyboard(client);
ret = XaceHook(XACE_DEVICE_ACCESS, client, mdev, DixUseAccess);
if (ret != Success)
return ret;
}
class = (XEventClass *) (&stuff[1]); /* first word of values */
class = (XEventClass *) (&stuff[1]); /* first word of values */
if ((ret = CreateMaskFromList(client, class,
stuff->event_count, tmp, dev,
X_GrabDeviceKey)) != Success)
return ret;
stuff->event_count, tmp, dev,
X_GrabDeviceKey)) != Success)
return ret;
param = (GrabParameters) {
.grabtype = XI,
.ownerEvents = stuff->ownerEvents,
.this_device_mode = stuff->this_device_mode,
.other_devices_mode = stuff->other_devices_mode,
.grabWindow = stuff->grabWindow,
.modifiers = stuff->modifiers
};
memset(&param, 0, sizeof(param));
param.grabtype = GRABTYPE_XI;
param.ownerEvents = stuff->ownerEvents;
param.this_device_mode = stuff->this_device_mode;
param.other_devices_mode = stuff->other_devices_mode;
param.grabWindow = stuff->grabWindow;
param.modifiers = stuff->modifiers;
mask.xi = tmp[stuff->grabbed_device].mask;
ret = GrabKey(client, dev, mdev, stuff->key, &param, XI, &mask);
ret = GrabKey(client, dev, mdev, stuff->key, &param, GRABTYPE_XI, &mask);
return ret;
}

Some files were not shown because too many files have changed in this diff Show More