Compare commits

..

92 commits

Author SHA1 Message Date
Peter Hutterer
10c42f5752 xserver 1.13.4
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-04-17 15:50:48 +10:00
Dave Airlie
8039b6b7a3 xf86: fix flush input to work with Linux evdev devices.
So when we VT switch back and attempt to flush the input devices,
we don't succeed because evdev won't return part of an event,
since we were only asking for 4 bytes, we'd only get -EINVAL back.

This could later cause events to be flushed that we shouldn't have
gotten.

This is a fix for CVE-2013-1940.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 6ca03b9161)
2013-04-17 15:46:03 +10:00
Peter Hutterer
87d7e3e352 dix: only show the cursor if a window defines one (#58398)
e02f864fdf "Suppress cursor display until the first XDefineCursor() request"
disabled cursor display a priori unless -retro is given.

On a plain server, caling XFixesHideCursor() and XFixesShowCursor() would
show the default root cursor, despite no client actually defining a cursor.

Change the logic, disable CursorVisible by default and only enable it from
the window's CWCursor logic. If no window ever defines a cursor, said cursor
stays invisible.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Bastien Nocera <hadess@hadess.net>
Reviewed-by: Daniel Martin <consume.noise@gmail.com>
(cherry picked from commit c100211034)
2013-04-02 15:37:31 +10:00
Daniel Martin
b1c01839d8 ephyr: Fix crash on 24bpp host framebuffer
Use bytes_per_line and bits_per_pixel from the created XImage to fix
    https://bugzilla.redhat.com/show_bug.cgi?id=518960

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit bd58ebe4cf)
2013-04-02 15:37:14 +10:00
Aaron Plattner
4bd8e9ecc3 xf86: use nt_list_for_each_entry_safe to walk InputHandlers in xf86Wakeup
This is necessary when the input handler deletes itself from the
list. Bug found by Maarten Lankhorst, this patch uses the list macros
instead of open-coding the fix.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit da92690107)
2013-04-02 15:36:27 +10:00
Matt Dew
eec5eb2f09 Bump version to 1.13.3 2013-03-07 23:08:09 -07:00
Dave Airlie
f7ac913019 randr: cleanup provider properly
So in the cold plug server shutdown case, we reap the resources
before we call CloseScreen handlers, so the config->randr_provider
is a dangling pointer when the xf86CrtcCloseScreen handler is called,

however in the hot screen unplug case, we can't rely on automatically
reaped resources, so we need to clean up the provider in the xf86CrtcCloseScreen
case.

This patch provides a cleanup callback from the randr provider removal
into the DDX so it can cleanup properly, this then gets called by the automatic
code for cold plug, or if hot unplug it gets called explicitly.

Fixes a number of random server crashes on shutdown
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=58174
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=891140

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-03-07 21:34:12 -07:00
Matt Dew
4d98c7da78 bump rev from 1.13.3-rc1 to 1.13.3-rc2 2013-02-28 23:48:03 -07:00
Matt Dew
412c4abbae Merge branch 'server-1.13-branch' of git://people.freedesktop.org/~whot/xserver into server-1.13-branch 2013-02-18 13:23:07 -07:00
Aaron Plattner
e604b19fc5 randr: unref the provider shared pixmap the appropriate number of times
When an RandR shared pixmap is created in rrCreateSharedPixmap, it has a refcnt
of 1.  Then, PixmapShareToSlave bumps the refcnt to 2.  However, there's no
corresponding PixmapUnshareFromSlave where the refcnt can be decreased again,
and there's no convenient common place where the refcnt can be decremented when
the slave pixmap is destroyed.

Fix this by just unreffing the pixmap twice in RRCrtcDetachScanoutPixmap.

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2013-02-18 13:19:05 -07:00
Carlos Garnacho
e7b4b83679 dix: Set focus field on XI2 crossing events
Set on DeviceEnterLeaveEvent() the xXIEnterEvent->focus field
similarly to how the CoreEnterLeaveEvent() function above does
for core events.

This fixes bug https://bugzilla.gnome.org/show_bug.cgi?id=677329
reported to GTK+, where focus handling on window managers with
sloppy focus or no window manager present was broken due to this
field being always set to FALSE.

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 509b3c3dc8)
2013-02-18 12:13:53 +10:00
Peter Hutterer
29a0c87f4d dix: when shutting down slave devices, shut down xtest devices last
XTest devices are the first ones in the list, being initialised together
with the master devices. If we disable the devices in-order and a device has
a button down when being disabled, the XTest device is checked for a
required button release (xkbAccessX.c's ProcessPointerEvent). This fails if
the device is already NULL.

Instead of putting the check there, disable the devices in the reverse order
they are initialised. Disable physical slaves first, then xtest devices,
then the master devices.

Testcase: shut down server with a button still held down on a physical
device

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 3e4be4033a)
2013-02-18 12:13:49 +10:00
Peter Hutterer
d8a09a4b15 dix: pre-scale relative events from abs devices to desktop ratio (#31636)
Absolute devices may send relative events depending on the mode (synaptics
by default, wacom per option). The relative events are added to the previous
position, converted into device coordinates and then scaled into desktop
coordinates for pointer movement.

Because the device range must be mapped into the desktop coordinate range,
this results in uneven scaling depending dimensions, e.g. on a setup with
width == 2 * height, a relative movement of 10/10 in device coordinates
results in a cursor movement of 20/10 (+ acceleration)

Other commonly user-visible results:
* the touchpad changing acceleration once an external monitor as added.
* drawing a circle on a wacom tablet in relative mode gives an ellipsis in
  the same ratio as the desktop dimensions.

Solution: pre-scale the incoming relative x/y coordinates by width/height
ratio of the total desktop size. Then add them to the previous
coordinates and scale back with the previous mapping, which will undo the
pre-scaling and give us the right movement.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 61a99aff9d)
2013-02-18 12:09:55 +10:00
Sybren van Elderen
79f5430ba6 dix: when scaling from desktop coord, take the total desktop size (#51904)
Scaled is already in desktop coordinates, take the total width into account,
not just the current screen's width.

Fixes Xdmx pointer position calculation.

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

Signed-off-by: Sybren van Elderen <sowmestno@msn.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit a191dbfe85)
2013-02-18 12:09:38 +10:00
Peter Hutterer
fa6cbd099f dmx: don't include dmx-config.h from xdmxconfig (#37502)
dmx-config.h is a server header which includes dix-config.h. That again
defines a bunch of server-specifics, including setting the size of XID to
32 bit.

libX11 uses unsigned long (8 bits on x86_64). XGCValues thus ends up being
16 bytes smaller in xdmxconfig than in the library, causing garbage to be
sent to the server.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 1058fcf57f)
2013-02-18 12:09:23 +10:00
Daniel Martin
63f928a9d7 xfixes: Fix minor number in QueryVersion
Due to a typo the major version number was passed as minor version to
version_compare().

Regression-from: ffd4874798

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 36740d02b9)
2013-02-18 12:07:25 +10:00
Peter Hutterer
bc4c3158ba xkb: only post a XTest release if the XTest device has the button down
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 5daa442fe1)
2013-02-18 11:20:34 +10:00
Peter Hutterer
b3b7be7d49 xkb: always post XTest button up when the physical button released (#28808)
Regression introduced by commit 2decff6393
  xkb: ProcesssPointerEvent must work on the VCP if it gets the VCP

XTest buttons must be released when a physical button is released. This was
fixed in 1432785839, but
2decff6393 changed a condition that this code
didn't get triggered anymore.

"dev" for pointer events is now always the VCP which doesn't have a xkbi
struct. So move this condition out and always trigger the XTest released for
button events.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Frank Roscher <Frank-Roscher@gmx.net>
(cherry picked from commit c4fee9d2ec)
2013-02-18 11:20:34 +10:00
Matt Dew
c260ae1a0c Update release to 1.13.3-rc1 2013-02-16 00:08:59 -07:00
Jeremy Huddleston Sequoia
b6c59f73d2 XORG_TLS: Pick the first option that works (ie: prefer __thread)
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2013-02-15 23:32:08 -07:00
Jeremy Huddleston Sequoia
1c7c7d407e os: Ensure <dix-config.h> is included in strndup.c
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-02-15 23:31:47 -07:00
Jeremy Huddleston Sequoia
e2f4be5ba5 XQuartz: Ensure <dix-config.h> is included in capabilities.c
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-02-15 23:31:26 -07:00
Dave Airlie
a2d9bade38 randr: bump advertised RandR version to 1.4
Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
Tested-by: Aaron Plattner <aplattner@nvidia.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2013-02-15 23:21:11 -07:00
Matt Dew
3ffa491426 Merge branch 'server-1.13-branch' of git://people.freedesktop.org/~whot/xserver into server-1.13-branch 2013-01-25 16:34:29 -07:00
Matt Dew
100027127c Bump version number to 1.13.2 2013-01-24 22:53:34 -07:00
Dave Airlie
dc1c70f299 xserver: fix build regression since 91ab237358
inputstr, double defines TouchListener typedef, maybe some gcc handles it,
but not all.

fixes tinderbox

Reported-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 605dfc6804)
2013-01-22 08:28:52 +10:00
Yuly Novikov
310ac85080 dix: Save touchpoint last coordinates before transform. #49347
DDXTouchPointInfoRec.valuators used to store axis values after transform.
This resulted in Coordinate Transformation Matrix
being applied multiple times to the last coordinates,
in the case when only pressure changes in the last touch event.

Changed DDXTouchPointInfoRec.valuators to store values before transform.

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

Signed-off-by: Yuly Novikov <ynovikov@chromium.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 3b9f1c7017)

Conflicts:
	dix/getevents.c
2013-01-21 14:09:59 +10:00
Peter Hutterer
d07dfb11c2 xfree86: don't access the old input handler after freeing it
Introduced in 323869f329

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit f4a58469a2)
2013-01-21 13:53:19 +10:00
Andreas Wettstein
f7f566f9e3 xkb: Do not use base group as an array index.
The base group is not brought into range and, therefore, using it as an array
index crashed the X server.  Also, at this place, we should ignore locked
groups, but not latched groups.  Therefore, use sum of base and latched groups,
brought into range.

Reproducible with:
key <FK07> {
    type= "ONE_LEVEL",
    symbols[Group1]= [              NoSymbol ],
    actions[Group1]= [ LatchGroup(group=-1, clearLocks) ]
};

And hitting F7 will exceed the group level and access arbitrary memory.

Signed-off-by: Andreas Wettstein <wettstein509@solnet.ch>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 3578cc3c2e)
2013-01-21 13:53:04 +10:00
Carlos Garnacho
da0c913da8 render: Unwrap early on the animated cursor BlockHandler
The loop above the previous call may end up triggering other
handlers attaching to the same function slot, so unwrapping
the handler after that could leave the just attached handler
in a dangling but not unset state.

This issue was most visible on the XO, where destroying a
window with an animated cursor set and running  would trigger
this inconsistent state, never calling the miSpriteBlockHandler
again after the animated cursor is unset.

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 df746a7341)
2013-01-21 13:53:02 +10:00
Carlos Garnacho
4cdd3bfc00 mi: Ensure pointer emulating touch events update the sprite
Different miPointerSpriteFuncRec implementations do a varying
business at ultimately calling miPointerUpdateSprite(), this
particularly fails when using the plain mi sprite on touch events,
where the sprite is just moved/updated on cursor changes.

So, ensure miPointerUpdateSprite() is called generically for
pointer emulating touch events as with regular motion events.

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 0fbd779a82)
2013-01-21 13:53:00 +10:00
Peter Hutterer
7b5b7b1467 dix: remove already-moved hunk
Should've been removed in bc1f90a615, but got
left here due to a botched rebase.

Fixes stray button events sent to clients after deactivating an async
pointer grab on a pointer-emulating-touch.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 0e1ab433f4)
2013-01-21 13:52:49 +10:00
Peter Hutterer
66299cb7b8 dix: check for the right device's xi2 mask
events.c: In function 'DeactivatePointerGrab':
events.c:1524:51: warning: 'dev' may be used uninitialized in this function
[-Wuninitialized

dev is unset when we get here, the device to check is "mouse".
Introduced in ece8157a59.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 32a6d8a6b5)
2013-01-21 13:52:47 +10:00
Peter Hutterer
7c859fd5d1 dix: add resource type to touch listeners
Instead of guessing what resource type the listener is and what property to
retrieve, store the resource type in the listener directly.

Breaks XIT test cases:
TouchGrabTestMultipleTaps.PassiveGrabPointerEmulationMultipleTouchesFastSuccession

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Chase Douglas <chase.douglas@ubuntu.com>
(cherry picked from commit f59499b5d0)
2013-01-21 13:52:46 +10:00
Keith Packard
df12c4daa7 input: Record grab pointer in TouchListener
This places a pointer to the grab related to a TouchListener directly
in the TouchListener structure rather than hoping to find the grab
later on using the resource ID.

Passive grabs have resource ID in the resource DB so they can be
removed when a client exits, and those resource IDs get copied when
activated, but implicit grabs are constructed on-the-fly and have no
resource DB entry.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 9ad0fdb135)
2013-01-21 13:52:44 +10:00
Keith Packard
5272f71cf8 input: Pull TouchListener declaration to top-level
No reason to have a struct declared inside another struct

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 91ab237358)
2013-01-21 13:52:40 +10:00
Peter Hutterer
041ab46aba xfree86: update the device state for all DGA events (#59100)
DGA only handles master devices but it does intercept slave device events as
well (since the event handlers are per event type, not per device).

The DGA code must thus call into UpdateDeviceState to reset the button/key
state on the slave device before it discards the remainder of the event.

Test case:
- Passive GrabModeSync on VCP
- Press button
- Enable DGA after ButtonPress
- AllowEvents(SyncPointer)
- Release button

The button release is handled by DGAProcessPointerEvent but the device state
is never updated, so the slave ends up with the button permanently down.
And since the master's button state is the union of the slave states, the
master has the button permanently down.

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

Reported-by: Steven Elliott <selliott4@austin.rr.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit ad3bc57134)
2013-01-21 13:52:04 +10:00
Peter Hutterer
c201d00014 xfree86: set event->detail for DGA pointer events
Reported-by: Steven Elliott <selliott4@austin.rr.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit c5f2818edb)
2013-01-21 13:52:03 +10:00
Peter Hutterer
de0ea3544f dix: don't filter RawEvents if the grab window is not the root window (#53897)
If a XI2.1+ client has a grab on a non-root window, it  must still receive
raw events on the root window.

Test case: register for XI_ButtonPress on window and XI_RawMotion on root.
No raw events are received once the press activates an implicit grab on the
window.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 4e13dd9014)
2013-01-21 13:51:59 +10:00
Peter Hutterer
5ed2523f4d xfree86: print message to the log when zapping the server
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 3420a7778c)
2013-01-21 13:50:33 +10:00
Peter Hutterer
956700d14d Xi: if a TouchEnd appears on a actively grabbing client, always accept
Once the TouchEnd appears on the device, the touch is done. If the client
still has a pointer grab, accept it to avoid clients with TouchOwnership
selections to wait indefinitely for the actual touch event.

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

Conflicts:
	Xi/exevents.c
2013-01-21 13:49:55 +10:00
Peter Hutterer
39157fd240 dix: when deactivating pointer-only grabs, don't emulate TouchEnd events
A client with a pointer grab on a touch device must reject the touch when
detactivating the grab while the touch is active. However, such a rejecting
must not trigger a ButtonRelease event to be emulated and sent to the
client.
Set the grabbing listener's state to HAS_END, so we simply skip delivery to
that client.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit ece8157a59)
2013-01-21 13:45:08 +10:00
Peter Hutterer
e162667433 dix: only reject active grabs on ungrab and do it before actually ungrabbing
An active grab ungrabbing is the same as rejecting the grab, since the
client is no longer interested in those events. So reject any touch grab,
but do so before actually deactivating since we're interested in the
TouchEnd for the current grabbing client.

A passive grab otoh is _not_ like rejecting a grab, since it deactivates
automatically when the touch ends.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit bc1f90a615)
2013-01-21 13:45:05 +10:00
Peter Hutterer
b72ffcf6ae dix: don't call ProcessInputEvents() when accepting/rejecting touches
TouchListenerAcceptReject may be called during normal event processing, but
ProcessInputEvents is not reentrant and calling it here smashes the event
queue.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 146f48c293)
2013-01-21 13:44:59 +10:00
Peter Hutterer
d5142c4e9d dix: don't allow overriding a grab with a different type of grab (#58255)
If a client has a core grab, don't allow re-grabbing with type XI2, etc.
This was the intent of the original commit
xorg-server-1.5.99.1-782-g09f9a86, but ineffective.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit dd3242c87a)
2013-01-08 12:35:42 +10:00
Peter Hutterer
7800cf99f5 dix: don't copy the wrong event mask when activating a passive grab
GrabMask is a union of core, XI1 and XI2 masks. If a XI2 grab is activated,
the value is a random pointer value, using it as mask has unpredictable
effects.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit f793b5fd3e)
2013-01-08 12:35:42 +10:00
Peter Hutterer
c15bdf3163 Xi: don't use devices after removing them
RemoveDevice() frees the DeviceIntPtr, we shouldn't use the pointer after
that

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 58bff17e43)
2013-01-08 12:35:42 +10:00
Matt Dew
3a8c618a73 version bump for 1.13.1.901 (rc1) 2013-01-03 23:36:00 -07:00
Alan Coopersmith
95780608df EnableDisableExtensionError: Use ARRAY_SIZE rather than sentinel
d785368e0e converted the other miinitext functions to use ARRAY_SIZE,
and removed the sentinel, but missed EnableDisableExtensionError so
passing an invalid extension name could cause the server to walk off
the end off the list looking for a sentinel that wasn't there.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-01-03 23:05:38 -07:00
Dave Airlie
a6d89f30dd glx/dri2: initialise api to avoid indirect rendering failing randomly
Running glxinfo under indirect rendering would randomly fail against the
intel driver, as it would create a context with no attribs, and then the
api value would be passed to the driver uninitialised.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2013-01-03 23:03:42 -07:00
Raphael Kubo da Costa
65642ccb78 vfb: Initialize the GLX extension again.
This should fix a regression in the 1.13.0 release: commit
5f5bbbe543 removed a code path used by Xvfb
and made it use the default one when initializing extensions. However, this
meant the GLX extension was not initialized anymore since it is not part of
the `staticExtensions' array.

Since it is not possible to just add it to that array after commit
aad428b8e2, adopt an approach similar to
xwin's and xquartz's and initialize the extension from vfb's `InitOutput'.

Signed-off-by: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2012-12-23 15:22:25 -07:00
Jeremy Huddleston Sequoia
e348e4afc5 XQuartz: Don't add the 15bit visual any more
Mountain Lion only supports 32bit backing stores, so don't use 15bit visuals until libXplugin adapts

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit ba4bb3bc1b)
2012-12-19 16:50:07 -08:00
Jeremy Huddleston Sequoia
34fb39a960 XQuartz: Add some verbose logging to debug xp_lock_window being unbalanced
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit f54987de97)
2012-12-18 00:31:53 -08:00
Jeremy Huddleston Sequoia
06e2ecd0df XQuartz: Avoid a possible deadlock with DRI on OS X 10.7.5 and OS X 10.8.2
<rdar://problem/12338921>
http://bugs.winehq.org/show_bug.cgi?id=31751

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 25d26875bc)
2012-12-18 00:31:53 -08:00
Matt Dew
92ecbf5f0f No changes from 1.13.0.902 (rc2)
Bump version to 1.13.1
2012-12-13 21:05:24 -07:00
Matt Dew
ede07c1af3 Bump version 2012-12-06 22:46:46 -07:00
Matt Dew
e2369dd404 Merge branch 'server-1.13-branch' of git://people.freedesktop.org/~whot/xserver into server-1.13-branch 2012-12-06 21:53:42 -07:00
Daniel Martin
79220f4390 Xi: Fix modifier swapping in XIPassiveGrabDevice
XIPassiveGrabDevice uses a list of uint32_t as modifier sets.

The ModifierInfo struct represents the current modifier states and is
therefor used in XIQueryPointer and various events.

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit aa9a9ad08b)
2012-12-05 17:37:40 +10:00
Sybren van Elderen
521f3fb566 hw/dmx: add update_desktop_dimensions() call
The Xdmx server did not update the desktop dimensions when computing screen
origins.

Signed-off-by: Sybren van Elderen <sowmestno@msn.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 6e18599d69)
2012-12-05 17:36:11 +10:00
Peter Hutterer
73bd33b4d4 xkb: fill in keycode and event type for slow keys enablement
eventType is set for the type that triggered a XkbControlsNotify event.
Technically, SlowKeys is triggered by a timer which doesn't have a matching
core event type. So we used to use 0 here.

Practically, the timer is triggered by a key press + hold and cancelled when
the key is released before the timeout expires. So we might as well set
KeyPress (keycode) in the ControlsNotify to give clients a chance to differ
between timer-triggered SlowKeys and client-triggered ones.

This is a chance in behaviour, though I suspect with little impact.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Daniel Stone <daniel@fooishbar.org>
(cherry picked from commit 2c4388a00e)
2012-12-05 17:36:07 +10:00
Jasper St. Pierre
2def985466 cursor: Revise edge cases for the pointer moving towards barriers
Since barriers block the invisible line between pixels, that means
that we need to explicitly check the boundaries, or else we'll have
a potential off-by-one error. This fixes issues when trying to move
down or right across a barrier and having the pointer visibly bounce.

Signed-off-by: Jasper St. Pierre <jstpierre@mecheye.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit a51b2c3913)
2012-12-05 17:36:04 +10:00
Peter Hutterer
4a957c9e81 When resetting device idle time, reset XIAll(Master)Devices too (#56649)
When the screen saver is forcibly deactivated, the idle time counter is
reset for all devices but not for the fake XIAllDevices and
XIAllMasterDevices. XScreenSaverQueryInfo uses XIAlldevices to fill the
"idle" field, thus returning the wrong value.

Regression introduced in
commit 6aef209ebc
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Mon Mar 12 13:51:02 2012 +1000

    Change lastDeviceIdleTime to be per-device

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Giacomo Perale <ghepeu@virgilio.it>
Reviewed-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 2dc6d92284)
2012-12-05 17:36:02 +10:00
Chris Wilson
d71a17cfab xf86: select a fake output for headless servers
Following commit 37d956e3ac
Author: Keith Packard <keithp@keithp.com>
Date:   Mon Sep 10 11:14:20 2012 +1000

    xf86: fix compat output selection for no output GPUs

headless servers can no longer startup as we no longer select a compat
output for the fake framebuffer.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=56343
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit e54f71a2c7)
2012-12-04 10:44:21 +10:00
Keith Packard
72ef659874 xf86: fix compat output selection for no output GPUs
This should work properly with dynamic outputs.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 37d956e3ac)
2012-12-04 10:44:02 +10:00
Dave Airlie
a2748aa6bd randr: call RRProviderInit in the proper place.
No idea where this got lost across development cycles, but its
definitely missing.

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

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit e9ea96d6a8)
2012-12-04 10:43:40 +10:00
Matt Dew
c0e68f8e70 Bump release info for this RC1. 2012-11-22 21:37:57 -07:00
Michel Dänzer
395c9e1708 EXA: Track source/mask pixmaps more explicitly for Composite fallback regions.
In particular, make sure pExaScr->src/maskPix are cleared when the
corresponding pictures aren't associated with drawables, i.e. solid or gradient
pictures. Without this, we would in some cases associate the source/mask region
with unrelated pixmaps from previous Composite fallbacks, resulting in random
corruption.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=47266

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 1ca096d5e0)
2012-11-07 23:34:10 -07:00
Matt Dew
7914986fb8 Merge branch 'server-1.13-branch' of git://people.freedesktop.org/~whot/xserver into server-1.13-branch 2012-11-07 23:24:53 -07:00
Carlos Garnacho
1a4ec493bf Xi: Set modifier mask on touch events
Button mask should be out-of-band with the emulated
pointer events as touch devices don't truly have
"buttons". Even though, it's handy to have the modifier
mask from the paired keyboard on touch events.

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 b4e44b285e)
2012-11-07 09:59:24 +10:00
Carlos Garnacho
2f99b38747 Xi: Update the device after delivering the emulated pointer event(#56558)
Ensure emulated pointer events contain the state that applies before the
event was processed, so the device state must be updated after delivering
such emulated events.

Co-authored-by: Peter Hutterer <peter.hutterer@who-t.net>
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 863f32c930)
2012-11-07 09:59:20 +10:00
Carlos Garnacho
10d9cd36b4 Sync TouchListener memory allocation with population in TouchSetupListeners()
The allocated TouchListener array may fall short by 1 if hitting the worst case
situation where there's an active grab, passive grabs on each window in the
sprite trace and event selection for touch in one of the windows. This may lead
to memory corruptions as the array is overflown.

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 ced56f322e)
2012-11-07 09:59:06 +10:00
Peter Hutterer
835737244f dix: fix zaphod screen scrossing (#54654)
POINTER_SCREEN coordinates are screen-relative. For a Zaphod setup, the
coordinates after a screen crossing are already relative to the new screen's
origin. Add that offset to the coordinates before re-setting.

regression introduced by
commit bafbd99080
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Wed Aug 8 11:34:32 2012 +1000

    dix: work around scaling issues during WarpPointer (#53037)

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit e7cd5cce74)
2012-11-07 09:59:01 +10:00
Peter Hutterer
a3f11d2f60 Xi: don't deliver TouchEnd to a client waiting for TouchBegin (#55738)
If a client is still waiting for the TouchBegin, don't deliver a TouchEnd
event.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Thomas Jaeger <thjaeger@gmail.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 6764471901)
2012-11-07 09:59:00 +10:00
Peter Hutterer
11319a9225 xkb: ProcesssPointerEvent must work on the VCP if it gets the VCP
For button release events, the current code picks the VCK. Because that has
a XKB struct, it thinks this is a PointerKeys event and proceeds to send the
release event through the XTest pointer. That has no effect in normal
operation as the button is never down and an attempt is silently discarded
(normal event processing continues with the VCP).

On server shutdown, the XTest device is already removed, leading to a
null-pointer derefernce when the device is checked for whether buttons are
down (XkbFakeDeviceButton → button_is_down(xtest pointer)).

The current state has only worked by accident, the right approach here is to
handle the VCP's event as such and not switch to the keyboard.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 2decff6393)
2012-11-07 09:58:54 +10:00
Chase Douglas
9ddc6ad9d0 End physically active touches when device is disabled
Otherwise:

* We can't end the touches while device is disabled
* New touches after enabling the device may erroneously be mapped to old
  logical touches

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 3b67cd2614)
2012-11-07 09:58:38 +10:00
Peter Hutterer
36f9c2d1dd dix: fix crash on shutdown if a disabled device is still grabbed (XI1 grab)
A disabled device doesn't have a sprite (less so a sprite->win) and triggers
a NULL-pointer dereference on shutdown when all active grabs are released as
part of the cleanup.

Fix this by checking for sprite being non-null and setting the focus window
to the NullWindow if it is. The rest of the patch just attempts to make
things more readable.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 4b7f00346d)
2012-11-07 09:58:18 +10:00
Matt Dew
b3d25d8d65 Merge branch 'server-1.13-branch' of git://people.freedesktop.org/~airlied/xserver into server-1.13-branch 2012-11-01 22:17:59 -06:00
Dave Airlie
b87edf1acc xf86: fix multi-seat video device support. (v2)
If we are not seat 0 the following apply:

don't probe any bus other than platform
don't probe any drivers other than platform
assume the first platform device we match on the bus is the primary GPU.

This just adds checks in the correct places to ensure this, and
with this X can now start on a secondary seat for an output device.

v2: fix Seat0 macros
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 70e5766874)
2012-11-02 10:17:53 +10:00
Dave Airlie
1e8c960f87 config/udev: ignore change on drm devices
for input devices we handle change like remove/add, but for
drm devices we get change events when we hotplug outputs,
so lets just ignore change at this level, and let the drivers
handle it. We may in the future want to route driver udev
from here instead.

Reported-by: Timo Aaltonen <timo.aaltonen@canonical.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit e0b92f5f86)
2012-11-02 10:17:40 +10:00
Dave Airlie
c7c0755891 xf86/platform: scan pci after probing devices
This solves a race if we are trying to dynamically power off
secondary GPUs. Its not the greatest fix ever but it probably
as good as we can do for now.

The GPU probing causes the devices to be powered up, then when
we scan the PCI bus we get the correct information from the kernel,
rather than a bunch of 0xff due to the device being powered off.

drop gratuitous '&'.

Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 10672a5abe)
2012-11-02 10:17:06 +10:00
Dave Airlie
39ebf87be7 dri2: invalidate drawable after sharing pixmap
After we share the pixmap, the backing storage may have changed,
and we need to invalidate and buffers pointing at it.

This fixes GL compositors and prime windows lacking contents initially.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 22746df15b)
2012-11-02 10:17:01 +10:00
Matt Dew
5a612aa44d Merge branch 'server-1.13-branch' of git://people.freedesktop.org/~jturney/xserver into server-1.13-branch 2012-10-30 22:12:56 -06:00
Jon TURNEY
0456d56092 Fix 'make distcheck' for hw/xwin
Add some missing header files to _SOURCES so they get distributed properly

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
(cherry picked from commit a69429a17b)
2012-10-16 15:14:55 +01:00
Jon TURNEY
018248136a Fix compilation of Xorg DDX without XF86VIDMODE
Fix compilation of Xorg DDX without XF86VIDMODE since 6e74fdda, by putting
xf86vmode.c back under the XF86VIDMODE automake conditional it was accidentally
taken out of.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Tested-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
(cherry picked from commit 1d9fd7ffb0)
2012-10-16 15:14:55 +01:00
Jon TURNEY
d46af34732 hw/xwin: Only add GLX extension once.
Using of LoadExtension() to add GLX onto to the end of the list of extensions on
every server regeneration leads to hilarious consequences (i.e. crashing) after
the first regeneration :-)

Possibly xf86ExtensionInit() and QuartzExtensionInit() need a similar fix.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
Tested-by: Colin Harrison <colin.harrison@virgin.net>
(cherry picked from commit 25741b1aa3)
2012-10-16 15:14:54 +01:00
Jon TURNEY
cdd7413bbe Correct description of -displayfd option in man page.
A display number, not a port number, is written to the specified fd.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit 7ceb854812)
2012-10-16 15:14:53 +01:00
Peter Hutterer
8f39a6b0b3 xfree86: add xf86UpdateDesktopDimensions()
This call is required for external drivers (specifically NVIDIA) that do
not share the xfree86 infrastructure to update the desktop dimensions.
Without it, the driver would update the ScreenRecs but not update the total
dimensions the input code relies on for transformation.

This call is a thin wrapper around the already-existing internal call and
should be backported to all stable series servers, with the minor ABI bump.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
CC: Andy Ritger <aritger@nvidia.com>
Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
(cherry picked from commit 0a75bd640b)

Conflicts:
	hw/xfree86/common/xf86Module.h
2012-10-12 09:48:10 +10:00
Yufeng Shen
bea56fc9c4 dix: fix scale_to_desktop for edge ABS events
Scale_to_desktop() converts ABS events from device coordinates
to screen coordinates:
[dev_X_min, dev_X_max]  -> [screen_X_min, screen_X_max]
[dev_Y_min, dev_Y_max]  -> [screen_Y_min, screen_Y_max]

An edge ABS event with X = dev_X_max (e.g., generated from the
edge of a touchscreen) will be converted to have screen X value
= screen_X_max, which, however, will be filterd out when xserver
tries to find proper Window to receive the event, because the
range check for a Window to receive events is
       window_X_min <= event_screen_X < window_X_max
Events with event_screen_X = screen_X_max will fail the test get
and rejected by the Window.

To fix this, we change the device to screen coordinates mapping to
[dev_X_min, dev_X_max]  -> [screen_X_min, screen_X_max-1]
[dev_Y_min, dev_Y_max]  -> [screen_Y_min, screen_Y_max-1]

Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Signed-off-by: Yufeng Shen <miletus@chromium.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 0b02150c27)
2012-10-12 09:47:21 +10:00
Daniel Drake
f9709b8a63 Xi: Don't check for TOUCH_END, it's never set
This flag is never set, so checking for it here means that we'll
never release the simulated mouse button press after the user touches
(and releases) the touchscreen for the first time.

Fixes a problem where the XO laptop touchpad became totally
unusable after touching the screen for the first time (since X then
behaved as if the mouse button was held down all the time).

Signed-off-by: Daniel Drake <dsd@laptop.org>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 3e6358ee6c)
2012-10-08 11:19:39 +10:00
Peter Hutterer
f5fad30822 dix: fix crash on XI 1.x grabs on disabled devices. (#54934)
If the device is disabled, the sprite window is NULL and dereferencing
crashes the server.

This is only triggered for XI 1.x grabs (ProcXGrabDevice) as XI2 grabs would
trigger another code path, creating a sprite for the disabled device as if
detaching it (which is wrong and fixed with this patch too).

Grabbing a disabled device doesn't make sense as it won't send events
anyway. However, the protocol specs do not prohibit it, so we need to keep
it working.
Luckily, oldWin is only used for focus out events, which aren't necessary
given that the device is disabled.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@ubuntu.com>
(cherry picked from commit 9d6b836570)
2012-10-08 11:19:33 +10:00
Daniel Stone
aacfc321b4 Touch: Fix duplicate TouchBegin selection with virtual devices
Given the following scenario:
  1) client A selects for TouchBegin on window W for device D
  2) client B selects for TouchBegin on window W for XIAllDevices
  3) client C selects for TouchBegin on window W with device E

Step 3 will fail with BadImplementation, because attempting to look up
XIAllDevices or XIAllMasterDevices with dixLookupDevices doesn't work.
This should succeed (or, if it was selecting for device D, fail with
BadAccess as it would be a duplicate selection).

Fix this by performing the appropriate lookup for virtual devices.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Chase Douglas <chase.douglas@ubuntu.com>
(cherry picked from commit 3d2b768efa)
2012-10-08 11:19:22 +10:00
Peter Hutterer
e31e272f4f dix: set the device transformation matrix
The property handler is registered after setting the property, so
dev->transform remains as all-zeros. That causes pixman_f_transform_invert()
to fail (in transformAbsolute()) and invert remains as garbage. This
may then cause a cursor jump to 0,0.

Since the axes are not yet initialized here and we need to allow for drivers
changing the matrix, we cannot use the property handler for matrix
initialization, essentially duplicating the code.

Triggered by the fix to (#49347) in 749a593e49

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@ubuntu.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 3d1051aecb)
2012-09-27 14:27:18 +10:00
1867 changed files with 309302 additions and 158682 deletions

View file

@ -1,84 +0,0 @@
branches:
except:
- /travis.*/
version: '{build}'
skip_tags: true
clone_depth: 8
environment:
APPVEYOR_SAVE_CACHE_ON_ERROR: true
CYGWIN_MIRROR: http://cygwin.mirror.constant.com
CACHE: C:\cache
matrix:
- BUILD: i686-pc-cygwin
CYGWIN_ROOT: C:\cygwin
SETUP: setup-x86.exe
- BUILD: x86_64-pc-cygwin
CYGWIN_ROOT: C:\cygwin64
SETUP: setup-x86_64.exe
install:
- echo Updating Cygwin and installing build prerequisites
- "%CYGWIN_ROOT%\\%SETUP% -qnNdO -R %CYGWIN_ROOT% -s %CYGWIN_MIRROR% -l %CACHE% -g -P \
binutils,\
bison,\
ccache,\
flex,\
gcc-core,\
meson,\
ninja,\
pkg-config,\
python38,\
windowsdriproto,\
xorgproto,\
libepoxy-devel,\
libfontenc-devel,\
libfreetype-devel,\
libGL-devel,\
libnettle-devel,\
libpixman1-devel,\
libtirpc-devel,\
libXRes-devel,\
libXaw-devel,\
libXdmcp-devel,\
libXext-devel,\
libXfont2-devel,\
libXi-devel,\
libXinerama-devel,\
libXmu-devel,\
libXpm-devel,\
libXrender-devel,\
libXtst-devel,\
libxcb-composite-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,\
libxcvt-devel,\
libxkbfile-devel,\
font-util,\
khronos-opengl-registry,\
python38-lxml,\
xkbcomp-devel,\
xkeyboard-config,\
xtrans"
- echo Install done
- "%CYGWIN_ROOT%\\%SETUP% -qnNdO -R %CYGWIN_ROOT% -s %CYGWIN_MIRROR% -l %CACHE% -g"
cache:
- C:\cache
- '%CYGWIN_ROOT%\home\%USERNAME%\.ccache'
build_script:
- SET PATH=%CYGWIN_ROOT%/bin
- '%CYGWIN_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; meson setup --prefix=/usr -Dxv=false -Dxf86bigfont=true -Dxephyr=true -Dxnest=true -Dxvfb=true -Dxwin=true -Dxorg=true -Dpciaccess=false -Dint10=false -Dglamor=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"'
- '%CYGWIN_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; ccache -s"'
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"'
deploy: off

View file

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

View file

@ -1,24 +0,0 @@
# This file contains revisions to be ignored by git blame.
# These revisions are expected to be formatting-only changes.
#
# Calling `git blame --ignore-revs-file .git-blame-ignore-revs` will
# tell git blame to ignore changes made by these revisions when assigning
# assigning blame, as if the change never happened.
#
# You can enable this as a default for your local repository by running
# `git config blame.ignoreRevsFile .git-blame-ignore-revs`
# Important: if you do this, then switch to a branch without this file,
# `git blame` will fail with an error.
#
# Introduce a consistent coding style
9838b7032ea9792bec21af424c53c07078636d21
# Drop trailing whitespaces
732fd7e571b81d63aa44d6e4cf55883479e88f2f
# glamor: Apply x-indent.sh.
d84d71029ae9e462559d64eff7259e2cc7732fac
# indent fixes (OMG SO UGLY), and nuke old RCS keywords.
6d7083bd69724586338d79784655328f1fcd2ae5

81
.gitignore vendored
View file

@ -1,4 +1,81 @@
#
# X.Org module default exclusion patterns
# The next section if for module specific patterns
#
# Do not edit the following section
# GNU Build System (Autotools)
aclocal.m4
autom4te.cache/
autoscan.log
ChangeLog
compile
config.guess
config.h
config.h.in
config.log
config-ml.in
config.py
config.status
config.status.lineno
config.sub
configure
configure.scan
depcomp
.deps/
INSTALL
install-sh
.libs/
libtool
libtool.m4
ltmain.sh
lt~obsolete.m4
ltoptions.m4
ltsugar.m4
ltversion.m4
Makefile
Makefile.in
mdate-sh
missing
mkinstalldirs
*.pc
py-compile
stamp-h?
symlink-tree
texinfo.tex
ylwrap
# Do not edit the following section
# Edit Compile Debug Document Distribute
*~
*.swp
*.[0-9]
*.[0-9]x
*.bak
*.bin
core
*.dll
*.exe
*-ISO*.bdf
*-JIS*.bdf
*-KOI8*.bdf
*.kld
*.ko
*.ko.cmd
*.lai
*.l[oa]
*.[oa]
*.obj
*.patch
tags
*.so
*.pcf.gz
*.pdb
*.tar.bz2
*.tar.gz
#
# Add & Override patterns for xserver
#
# Edit the following section as needed
# For example, !report.pc overrides *.pc. See 'man gitignore'
#
doltcompile
doltlibtool
xserver.ent

366
.mailmap
View file

@ -1,366 +0,0 @@
Adam Jackson <ajax@redhat.com> <ajax@aspartame.nwnk.net>
Adam Jackson <ajax@redhat.com> <ajax@benzedrine.nwnk.net>
Adam Jackson <ajax@redhat.com> <ajax@nwnk.net>
Adam Jackson <ajax@redhat.com> <ajax@theobromine.nwnk.net>
Adam Tkac <atkac@redhat.com> <vonsch@gmail.com>
Alan Coopersmith <alan.coopersmith@oracle.com> <alan.coopersmith@sun.com>
Alan Coopersmith <alan.coopersmith@oracle.com> <alanc@alf.(none)>
Alan Hourihane <alanh@vmware.com> <alanh@fairlite.demon.co.uk>
Alan Hourihane <alanh@vmware.com> <alanh@tungstengraphics.com>
Alex Deucher <alexdeucher@gmail.com> <agd5f@yahoo.com>
Alex Deucher <alexdeucher@gmail.com> <alex@botch2.(none)>
Alex Deucher <alexdeucher@gmail.com> <alex@botch2.com>
Alex Deucher <alexdeucher@gmail.com> <alex@cube.(none)>
Alex Deucher <alexdeucher@gmail.com> <alex@samba.(none)>
Alex Deucher <alexdeucher@gmail.com> <alexander.deucher@amd.com>
Alexandr Shadchin <alexandr.shadchin@gmail.com> <Alexandr.Shadchin@gmail.com>
Ander Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com> <ander@mandriva.com.br>
Arjan van de Ven <arjan@infradead.org> <arjan@linux.intel.com>
Arkadiusz Miśkiewicz <arekm@maven.pl>
Axel Davy <davyaxel0@gmail.com> <axel.davy@ens.fr>
Bart Trojanowski <bart@jukie.net> <bart@symbio-technologies.com>
Ben Byer <bbyer@apple.com> <bbyer@bbyer.(none)>
Ben Byer <bbyer@apple.com> <bbyer@bbyer.apple.com>
Ben Byer <bbyer@apple.com> <bbyer@bbyer.local>
Ben Byer <bbyer@apple.com> <bbyer@bushing.apple.com>
Ben Byer <bbyer@apple.com> <bbyer@freedesktop.org>
Ben Byer <bbyer@apple.com> <bbyer@xyzzy.local>
Ben Gamari <bgamari.foss@gmail.com> <bgamari@gmail.com>
Ben Skeggs <bskeggs@redhat.com> <skeggsb@gmail.com>
Benjamin Close <benjamin.close@clearchain.com> <Benjamin.Close@clearchain.com>
Benjamin Tissoires <benjamin.tissoires@gmail.com> <tissoire@cena.fr>
Brian Paul <brianp@vmware.com> Brian <brian@i915.localnet.net>
Brian Paul <brianp@vmware.com> Brian <brian@yutani.localnet.net>
Brian Paul <brianp@vmware.com> <brian.paul@tungstengraphics.com>
Brice Goglin <bgoglin@debian.org> <brice.goglin@ens-lyon.org>
Carl Worth <cworth@cworth.org> <cworth@samich.home.cworth.org>
Carl Worth <cworth@cworth.org> <root@samich.home.cworth.org>
Chase Douglas <chase.douglas@canonical.com> <chase.douglas@ubuntu.com>
Chase Douglas <chase.douglas@canonical.com> <chasedouglas@gmail.com>
Christian König <christian.koenig@amd.com> <christian.koenig at amd.com>
Colin Guthrie <gmane@colin.guthr.ie> <cguthrie@mandriva.org>
Colin Harrison <colin@xming.myzen.co.uk> <colin.harrison-at-virgin.net>
Colin Harrison <colin@xming.myzen.co.uk> <colin.harrison@virgin.net>
Dan Nicholson <dbn.lists@gmail.com> <dan@conor.dwcab.com>
Daniel Drake <drake@endlessm.com> <d.drake@mmm.com>
Daniel Drake <drake@endlessm.com> <dsd@gentoo.org>
Daniel Drake <drake@endlessm.com> <dsd@laptop.org>
Daniel Martin <consume.noise@gmail.com> <daniel.martin@secunet.com>
Daniel Stone <daniels@collabora.com> <daniel.stone@nokia.com>
Daniel Stone <daniels@collabora.com> <daniel@fooishbar.org>
Dave Airlie <airlied@redhat.com> <airlied@clockmaker.usersys.redhat.com>
Dave Airlie <airlied@redhat.com> <airlied@gmail.com>
Dave Airlie <airlied@redhat.com> <airlied@linux.ie>
Dave Airlie <airlied@redhat.com> <airlied@panoply-rh.(none)>
Dave Airlie <airlied@redhat.com> <airlied@pegasus.(none)>
David Heidelberg <david@ixit.cz> David Heidelberger <david.heidelberger@ixit.cz>
David Miller <davem@davemloft.net>
David Nusinow <dnusinow@debian.org> <david@nee.(none)>
David Reveman <reveman@chromium.org> <c99drn@cs.umu.se>
David Reveman <reveman@chromium.org> <davidr@novell.com>
Demi Marie Obenour <demiobenour@gmail.com> <demi@invisiblethingslab.com>
Dodji Seketeli <dodji@seketeli.org> <dodji@openedhand.com>
Donnie Berkholz <dberkholz@gentoo.org> <donnie@supernova.(none)>
Donnie Berkholz <dberkholz@gentoo.org> <spyderous@gentoo.org>
Drew Parsons <dparsons@debian.org> <drew@emerall.com>
Drew Parsons <dparsons@debian.org> <drew@pug.localdomain>
Eamon Walsh <ewalsh@tycho.nsa.gov> <efw@eamonwalsh.com>
Eamon Walsh <ewalsh@tycho.nsa.gov> <ewalsh@epoch.ncsc.mil>
Eamon Walsh <ewalsh@tycho.nsa.gov> <ewalsh@moss-huskies.epoch.ncsc.mil>
Eamon Walsh <ewalsh@tycho.nsa.gov> <ewalsh@moss-uranus.epoch.ncsc.mil>
Egbert Eich <eich@suse.de> <eich@freedesktop.org>
Egbert Eich <eich@suse.de> <eich@ovid.suse.de>
Egbert Eich <eich@suse.de> <eich@pdx.freedesktop.org>
Emil Velikov <emil.l.velikov@gmail.com> <emil.velikov@collabora.com>
Emma Anholt <emma@anholt.net> <anholt@FreeBSD.org>
Emma Anholt <emma@anholt.net> <eric@anholt.net>
Eric Engestrom <eric@igalia.com> <eric@engestrom.ch>
Eric Engestrom <eric@igalia.com> <eric.engestrom@imgtec.com>
Éric Piel <eric.piel@trempin-utc.net>
Éric Piel <eric.piel@trempin-utc.net> <E.A.B.Piel@tudelft.nl>
Erik Andrén <erik.andren@gmail.com>
Faith Ekstrand <faith.ekstrand@collabora.com> <jason@jlekstrand.net>
Faith Ekstrand <faith.ekstrand@collabora.com> <jason.ekstrand@intel.com>
Faith Ekstrand <faith.ekstrand@collabora.com> <faith@gfxstrand.net>
Felix Kuehling <felix.kuehling@amd.com> <fxkuehl@gmx.de>
François Tigeot <ftigeot@wolfpond.org>
George Sapountzis <gsapountzis@gmail.com> <gsap7@yahoo.gr>
George Staplin <gstaplin@apple.com> <gps@Georges-Workstation.local>
George Staplin <gstaplin@apple.com> <georgestaplin@george-staplins-mac-pro.local>
Haihao Xiang <haihao.xiang@intel.com>
Hans de Goede <hdegoede@redhat.com>
Hans de Goede <hdegoede@redhat.com> <j.w.r.degoede@hhs.nl>
Henry Zhao <henry.zhao@oracle.com> <henryz@localhost.localdomain>
Ian Romanick <ian.d.romanick@intel.com> <idr@localhost.localdomain>
Ian Romanick <ian.d.romanick@intel.com> <idr@umwelt.(none)>
Ian Romanick <ian.d.romanick@intel.com> <idr@us.ibm.com>
Jan Beich <jbeich@freebsd.org> <jbeich@FreeBSD.org>
Jay Cotton <jay.cotton@oracle.com> <jay.cotton@sun.com>
Jeffrey Smith <whydoubt@gmail.com>
Jeffrey Smith <whydoubt@gmail.com> <whydoubt@yahoo.com>
Jeremy C. Reed <reed@glacier.reedmedia.net> <reed@reedmedia.net>
Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Jeremy Huddleston Sequoia <jeremyhu@apple.com> <jeremy@dhcp-38-248.EECS.Berkeley.EDU>
Jeremy Huddleston Sequoia <jeremyhu@apple.com> <jeremy@tifa-2.local>
Jeremy Huddleston Sequoia <jeremyhu@apple.com> <jeremy@tifa.local>
Jeremy Huddleston Sequoia <jeremyhu@apple.com> <jeremy@yuffie.local>
Jeremy Huddleston Sequoia <jeremyhu@apple.com> <jeremyhu@freedesktop.org>
Jeremy Uejio <jeremy.uejio@oracle.com> <jeremy.uejio@sun.com>
Jerome Glisse <jglisse@redhat.com> <glisse@freedesktop.org>
Jesse Adkins <jesserayadkins@gmail.com> <jesse_adkins7@yahoo.com>
Jesse Barnes <jesse.barnes@intel.com> <jbarnes@jbarnes-mobile.amr.corp.intel.com>
Jesse Barnes <jesse.barnes@intel.com> <jbarnes@jbarnes-t61.(none)>
Jesse Barnes <jesse.barnes@intel.com> <jbarnes@nietzche.virtuousgeek.org>
Jesse Barnes <jesse.barnes@intel.com> <jbarnes@virtuousgeek.org>
Joel Bosveld <joel.bosveld@gmail.com> <Joel.Bosveld@gmail.com>
John Tapsell <johnflux@gmail.com> <john.tapsell@john-desktop.(none)>
Jon Turney <jon.turney@dronecode.org.uk>
Julien Isorce <j.isorce@samsung.com> <julien.isorce@gmail.com>
Keith Packard <keithp@keithp.com> <keithp@dulcimer.keithp.com>
Keith Packard <keithp@keithp.com> <keithp@guitar.keithp.com>
Keith Packard <keithp@keithp.com> <keithp@koto.keithp.com>
Keith Packard <keithp@keithp.com> <keithp@mandolin.keithp.com>
Keith Packard <keithp@keithp.com> <keithp@neko.keithp.com>
Keith Packard <keithp@keithp.com> <keithp@ukulele.keithp.com>
Keith Packard <keithp@keithp.com> <keithp@viola.jf.intel.com>
Kevin E Martin <kem@redhat.com> <kem@freedesktop.org>
Kevin E Martin <kem@redhat.com> <kem@kem.org>
Kristian Høgsberg <krh@bitplanet.net>
Kristian Høgsberg <krh@bitplanet.net> <krh@redhat.com>
Kristian Høgsberg <krh@bitplanet.net> <krh@sasori.boston.redhat.com>
Kristian Høgsberg <krh@bitplanet.net> <krh@temari.boston.redhat.com>
Laércio de Sousa <laerciosousa@sme-mogidascruzes.sp.gov.br>
Laércio de Sousa <laerciosousa@sme-mogidascruzes.sp.gov.br> <lbsousajr@gmail.com>
Lina Versace <lina@kiwitree.net> <chad.versace@linux.intel.com>
Lucas Stach <dev@lynxeye.de> <l.stach@pengutronix.de>
Łukasz Spintzyk <lukasz.spintzyk@synaptics.com>
Łukasz Spintzyk <lukasz.spintzyk@synaptics.com> <lukasz.spintzyk@gmail.com>
Lyude Paul <lyude@redhat.com>
Lyude Paul <lyude@redhat.com> <cpaul@redhat.com>
Maarten Lankhorst <maarten.lankhorst@ubuntu.com> <dev@mblankhorst.nl>
Maarten Lankhorst <maarten.lankhorst@ubuntu.com> <maarten.lankhorst@canonical.com>
Marc Aurele La France <tsi@ualberta.ca> <tsi@ualberta.edu>
Mario Kleiner <mario.kleiner.de@gmail.com> <mario.kleiner@tuebingen.mpg.de>
Mark Kettenis <kettenis@openbsd.org> <mark.kettenis@xs4all.nl>
Matthew Allum <mallum@openedhand.com> <breakfast@10.am>
Matthew Allum <mallum@openedhand.com> <mallum@polystyrene.(none)>
Matthieu Herrb <matthieu@herrb.eu> <matthieu.herrb@laas.fr>
Matthieu Herrb <matthieu@herrb.eu> <matthieu@bluenote.herrb.com>
Matthieu Herrb <matthieu@herrb.eu> <matthieu@blues.laas.fr>
Matthieu Herrb <matthieu@herrb.eu> <matthieu@crux.(none)>
Matthieu Herrb <matthieu@herrb.eu> <matthieu@deville.herrb.com>
Matthieu Herrb <matthieu@herrb.eu> <matthieu@laas.fr>
Matthieu Herrb <matthieu@herrb.eu> <matthieu@roadrock.(none)>
Max Schwarz <Max@x-quadraht.de> <max.schwarz@online.de>
Maya Rashish <maya@NetBSD.org>
Maya Rashish <maya@NetBSD.org> <coypu@sdf.org>
Michal Srb <msrb@suse.com> <msrb@novell.com>
Michal Suchanek <hramrach@gmail.com> <hramrach@centrum.cz>
Michał Górny <gentoo@mgorny.alt.pl>
Michał Górny <gentoo@mgorny.alt.pl> <mgorny@gentoo.org>
Michael Vogt <mvo@ubuntu.com> <michael.vogt@ubuntu.com>
Michel Dänzer <michel@daenzer.net>
Michel Dänzer <michel@daenzer.net> <daenzer@debian.org>
Michel Dänzer <michel@daenzer.net> <daenzer@vmware.com>
Michel Dänzer <michel@daenzer.net> <mdaenzer@redhat.com>
Michel Dänzer <michel@daenzer.net> <michel.daenzer@amd.com>
Michel Dänzer <michel@daenzer.net> <michel@tungstengraphics.com>
Michele Baldessari <michele@redhat.com> <michele@acksyn.org>
Neil Roberts <nroberts@igalia.com> <neil@linux.intel.com>
nerdopolis <bluescreen_avenger@verizon.net> nerdopolis <rbos@rbos>
Nicolai Hähnle <nicolai.haehnle@amd.com>
Nicolai Hähnle <nicolai.haehnle@amd.com> <nhaehnle@gmail.com>
Niveditha Rau <niveditha.rau@oracle.com> <niveditha.rau@sun.com>
Oliver McFadden <oliver.mcfadden@linux.intel.com> <oliver.mcfadden@nokia.com>
Olivier Fourdan <ofourdan@redhat.com> <fourdan@xfce.org>
Owen W. Taylor <otaylor@fishsoup.net>
Owen W. Taylor <otaylor@fishsoup.net> <otaylor@huygens.home.fishsoup.net>
Owen W. Taylor <otaylor@fishsoup.net> <otaylor@redhat.com>
Pauli Nieminen <pauli.nieminen@linux.intel.com> <ext-pauli.nieminen@nokia.com>
Paulo Zanoni <paulo.r.zanoni@intel.com> Paulo Ricardo Zanoni <prz05@c3sl.ufpr.br>
Paulo Zanoni <paulo.r.zanoni@intel.com> Paulo Ricardo Zanoni <pzanoni@mandriva.com>
Pekka Paalanen <pekka.paalanen@collabora.co.uk> <pekka.paalanen@collabora.com>
Peter Harris <pharris2@rocketsoftware.com> <peter.harris@hummingbird.com>
Peter Harris <pharris2@rocketsoftware.com> <pharris@opentext.com>
Peter Hutterer <peter.hutterer@who-t.net> <peter.hutterer@redhat.com>
Peter Hutterer <peter.hutterer@who-t.net> <peter@cs.unisa.edu.au>
Peter Hutterer <peter.hutterer@who-t.net> <whot@potoroo.wearablelab.ml.unisa.edu.au>
Peter Hutterer <peter.hutterer@who-t.net> rpm-build <rpm-build>
Pierre Willenbrock <pierre@pirsoft.de> <pierre@pirsoft.dnsalias.org>
Qiang Yu <yuq825@gmail.com> <Qiang.Yu@amd.com>
Rami Ylimaki <rami.ylimaki@vincit.fi>
Rami Ylimaki <rami.ylimaki@vincit.fi> <ext-rami.ylimaki@nokia.com>
Rémi Cardona <remi@gentoo.org>
Rémi Cardona <remi@gentoo.org> <remi.cardona@lri.fr>
Rob Clark <robclark@freedesktop.org> <robdclark@gmail.com>
Roland Bär <roland@verifysoft.de>
Roland Scheidegger <sroland@vmware.com> <rscheidegger_lists@hispeed.ch>
Roland Scheidegger <sroland@vmware.com> <sroland@tungstengraphics.com>
Roman Gilg <subdiff@gmail.com>
Roman Kapl <code@rkapl.cz>
Ross Burton <ross.burton@intel.com> <ross@burtonini.com>
Ross Burton <ross.burton@intel.com> <ross@linux.intel.com>
Sam Lau <sam.lau@oracle.com> <sam.lau@sun.com>
Simon Farnsworth <simon.farnsworth@onelan.com> <simon.farnsworth@onelan.co.uk>
Sjoerd Simons <sjoerd@collabora.com> <sjoerd.simons@collabora.co.uk>
Søren Sandmann Pedersen <sandmann@redhat.com>
Søren Sandmann Pedersen <sandmann@redhat.com> <soren.sandmann@gmail.com>
Søren Sandmann Pedersen <sandmann@redhat.com> <sandmann@daimi.au.dk>
Søren Sandmann Pedersen <sandmann@redhat.com> <ssp@l3000.localdomain>
Søren Sandmann Pedersen <sandmann@redhat.com> <ssp@redhat.com>
Søren Sandmann Pedersen <sandmann@redhat.com> <ssp@dhcp83-218.boston.redhat.com>
Stuart Kreitman <stuart.kreitman@oracle.com> <stuart.kreitman@sun.com>
Thierry Reding <treding@nvidia.com> <thierry.reding@avionic-design.de>
Thierry Reding <treding@nvidia.com> <thierry.reding@gmail.com>
Thomas Hellstrom <thellstrom@vmware.com> <thomas-at-tungstengraphics-dot-com>
Thomas Hellstrom <thellstrom@vmware.com> <thomas-at-tungstengraphics.com>
Thomas Hellstrom <thellstrom@vmware.com> <unichrome@shipmail.org>
Thomas Jaeger <thjaeger@gmail.com> <ThJaeger@gmail.com>
Tiago Vignatti <tiago.vignatti@nokia.com>
Tiago Vignatti <tiago.vignatti@nokia.com> <tiago.vignatti@Nokia.com>
Tiago Vignatti <tiago.vignatti@nokia.com> <tiagov@balalaika.(none)>
Tiago Vignatti <tiago.vignatti@nokia.com> <tv02@c3sl.ufpr.br>
Tiago Vignatti <tiago.vignatti@nokia.com> <vignatti@c3sl.ufpr.br>
Timo Aaltonen <tjaalton@debian.org> <tjaalton@cc.hut.fi>
Timo Aaltonen <tjaalton@debian.org> <tjaalton@ubuntu.com>
Tomas Carnecky <tomas.carnecky@gmail.com> <tom@dbservice.com>
Tormod Volden <debian.tormod@gmail.com> <lists.tormod@gmail.com>
Tormod Volden <debian.tormod@gmail.com> <bugzi06.fdo.tormod@xoxy.net>
Ville Syrjälä <ville.syrjala@linux.intel.com>
Ville Syrjälä <ville.syrjala@linux.intel.com> <syrjala@sci.fi>
Ville Syrjälä <ville.syrjala@linux.intel.com> <ville.syrjala@nokia.com>
Yuriy Vasilev <uuvasiliev@yandex.ru>
Zack Rusin <zackr@vmware.com> <zack@kde.org>
Zack Rusin <zackr@vmware.com> <zack@tungstengraphics.com>
Zephaniah E. Hull <warp@aehallh.com> <warp@agamemnon.b5>
Zhenyu Wang <zhenyuw@linux.intel.com> <zhenyu.z.wang@intel.com>
Zhigang Gong <zhigang.gong@intel.com> <zhigang.gong@gmail.com>
Zhigang Gong <zhigang.gong@intel.com> <zhigang.gong@linux.intel.com>
Zoltán Böszörményi <zboszor@gmail.com>
Zoltán Böszörményi <zboszor@gmail.com> <zboszor@pr.hu>

View file

@ -1,27 +0,0 @@
language: c
cache:
ccache: true
directories:
- $HOME/Library/Caches/Homebrew
branches:
except:
- /appveyor.*/
os: osx
osx_image: xcode9.2
matrix:
include:
- env: TOOL=meson
- env: TOOL=autotools
install:
- brew update
- HOMEBREW_NO_AUTO_UPDATE=1 brew install ccache meson
script:
- ./test/scripts/build-travis-osx.sh $TOOL
- ccache -s
before_cache:
- brew cleanup

27
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
@ -16,12 +15,11 @@ Copyright © 2006 Nokia Corporation
Copyright © 2006-2008 Peter Hutterer
Copyright © 2006 Adam Jackson
Copyright © 2009-2010 NVIDIA Corporation
Copyright © 1987, 2003-2006, 2008-2010, 2025 Oracle and/or its affiliates.
Copyright © 1987, 2003-2006, 2008-2010 Oracle and/or its affiliates.
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.

104
Makefile.am Normal file
View file

@ -0,0 +1,104 @@
AUTOMAKE_OPTIONS=nostdinc
ACLOCAL_AMFLAGS = -I m4
if COMPOSITE
COMPOSITE_DIR=composite
endif
if GLX
GLX_DIR=glx
endif
if DBE
DBE_DIR=dbe
endif
if RECORD
RECORD_DIR=record
endif
SUBDIRS = \
doc \
man \
include \
dix \
fb \
mi \
Xext \
miext \
os \
randr \
render \
Xi \
xkb \
$(DBE_DIR) \
$(RECORD_DIR) \
xfixes \
damageext \
$(COMPOSITE_DIR) \
$(GLX_DIR) \
exa \
config \
hw \
test
if XORG
aclocaldir = $(datadir)/aclocal
aclocal_DATA = xorg-server.m4
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = xorg-server.pc
endif
EXTRA_DIST = xorg-server.pc.in xorg-server.m4 autogen.sh
DISTCHECK_CONFIGURE_FLAGS=\
--with-xkb-path=$(XKB_BASE_DIRECTORY) \
--with-xkb-bin-directory=$(XKB_BIN_DIRECTORY) \
--with-xkb-output='$${datadir}/X11/xkb/compiled'
.PHONY: ChangeLog INSTALL
INSTALL:
$(INSTALL_CMD)
ChangeLog:
$(CHANGELOG_CMD)
dist-hook: ChangeLog INSTALL
DIST_SUBDIRS = \
doc \
man \
include \
dix \
fb \
mi \
Xext \
miext \
os \
randr \
render \
Xi \
xkb \
dbe \
record \
xfixes \
damageext \
composite \
glx \
exa \
config \
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

38
README Normal file
View file

@ -0,0 +1,38 @@
X Server
The X server accepts requests from client applications to create windows,
which are (normally rectangular) "virtual screens" that the client program
can draw into.
Windows are then composed on the actual screen by the X server
(or by a separate composite manager) as directed by the window manager,
which usually communicates with the user via graphical controls such as buttons
and draggable titlebars and borders.
For a comprehensive overview of X Server and X Window System, consult the
following article:
http://en.wikipedia.org/wiki/X_server
All questions regarding this software should be directed at the
Xorg mailing list:
http://lists.freedesktop.org/mailman/listinfo/xorg
Please submit bug reports to the Xorg bugzilla:
https://bugs.freedesktop.org/enter_bug.cgi?product=xorg
The master development code repository can be found at:
git://anongit.freedesktop.org/git/xorg/xserver
http://cgit.freedesktop.org/xorg/xserver
For patch submission instructions, see:
http://www.x.org/wiki/Development/Documentation/SubmittingPatches
For more information on the git code manager, see:
http://wiki.x.org/wiki/GitPage

View file

@ -1,41 +0,0 @@
************************************************************************
* This is the now defunct 'master' branch of the xserver repository. *
* Ongoing development has moved to the 'main' branch instead. *
************************************************************************
X Server
--------
The X server accepts requests from client applications to create windows,
which are (normally rectangular) "virtual screens" that the client program
can draw into.
Windows are then composed on the actual screen by the X server
(or by a separate composite manager) as directed by the window manager,
which usually communicates with the user via graphical controls such as buttons
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
All questions regarding this software should be directed at the
Xorg mailing list:
https://lists.freedesktop.org/mailman/listinfo/xorg
The primary development code repository can be found at:
https://gitlab.freedesktop.org/xorg/xserver
For patch submission instructions, see:
https://www.x.org/wiki/Development/Documentation/SubmittingPatches
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,50 +0,0 @@
# Reporting Security Issues
Please notify us of any security issues by sending mail to
<xorg-security@lists.x.org>.
See https://www.x.org/wiki/Development/Security/Organization/
for more information about the X.Org security team.
# Learning about Security Fixes
X.Org announces security bugs and bug fix releases on the xorg-announce
mailing list. See the archives at https://lists.x.org/archives/xorg-announce/
and see https://lists.x.org/mailman/listinfo/xorg-announce to subscribe.
Security advisories are also listed on our wiki at
https://www.x.org/wiki/Development/Security/ and mailed to the
https://oss-security.openwall.org/wiki/mailing-lists/oss-security mailing list.
# Security model and trust boundaries
Only the Xorg server is expected to run with elevated privileges.
(Some distros may run Xorg with a wrapper to only grant these privileges when
necessary.) The Xorg server usually requires root access to hardware devices
and I/O registers when using a UMS (Userspace Mode Setting) driver, and not
when using a KMS (Kernel Mode Setting) driver, or drivers which do not require
actual hardware access (such as xf86-video-dummy).
All other X servers (Xephyr, Xnest, Xvfb, etc.) are expected to run with only
the privileges of the user who started the server. They should not require
direct access to any devices.
The Xorg server uses configuration files to control various aspects of its
operation (see the xorg.conf(5) man page), including specifying loadable
object modules to run code from with the full privileges of the X server.
There is no attempt to sandbox these modules - they are considered to be fully
trusted, and thus anyone who can edit a config file is considered to be fully
trusted - a module being able to control or crash the X server is not considered
a security vulnerability (though a crash would be a non-security bug in the
module). The configuration file loading mechanism takes steps to verify that
config files are owned by trusted users before reading them, and failure to do
so would be considered a security vulnerability.
Access control for which clients can connect to the X server is provided by
a number of mechanisms, see the Xsecurity(7) man page for details. Once a
client is authenticated via those mechanisms and has an active connection,
we do not consider it a security vulnerability for them to be able to take
any actions described in the X11 protocol or extension specifications, such
as changing monitor configurations or killing other clients, though we will
accept non-security bug reports for clients doing so in a manner or via
requests not documented in the protocol specs as doing those operations.

111
Xext/Makefile.am Normal file
View file

@ -0,0 +1,111 @@
noinst_LTLIBRARIES = libXext.la
AM_CFLAGS = $(DIX_CFLAGS)
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
BUILTIN_SRCS = \
bigreq.c \
geext.c \
shape.c \
sleepuntil.c \
sleepuntil.h \
sync.c \
syncsdk.h \
syncsrv.h \
xcmisc.c \
xtest.c
BUILTIN_LIBS =
# Optional sources included if extension enabled by configure.ac rules
# MIT Shared Memory extension
MITSHM_SRCS = shm.c shmint.h
if MITSHM
BUILTIN_SRCS += $(MITSHM_SRCS)
endif
# XVideo extension
XV_SRCS = xvmain.c xvdisp.c xvmc.c xvdix.h xvmcext.h xvdisp.h
if XV
BUILTIN_SRCS += $(XV_SRCS)
endif
# XResource extension: lets clients get data about per-client resource usage
RES_SRCS = hashtable.c hashtable.h xres.c
if RES
BUILTIN_SRCS += $(RES_SRCS)
endif
# MIT ScreenSaver extension
SCREENSAVER_SRCS = saver.c
if SCREENSAVER
BUILTIN_SRCS += $(SCREENSAVER_SRCS)
endif
# Xinerama extension: making multiple video devices act as one virtual screen
XINERAMA_SRCS = panoramiX.c panoramiX.h panoramiXh.h panoramiXsrv.h panoramiXprocs.c panoramiXSwap.c
if XINERAMA
BUILTIN_SRCS += $(XINERAMA_SRCS)
if XORG
sdk_HEADERS += panoramiXsrv.h panoramiX.h
endif
endif
# X-ACE extension: provides hooks for building security policy extensions
# like XC-Security, X-SELinux & XTSol
XACE_SRCS = xace.c xace.h xacestr.h
if XACE
BUILTIN_SRCS += $(XACE_SRCS)
if XORG
sdk_HEADERS += xace.h xacestr.h
endif
endif
# SELinux extension: provides SELinux policy support for X objects
# 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)
endif
# Security extension: multi-level security to protect clients from each other
XCSECURITY_SRCS = security.c securitysrv.h
if XCSECURITY
BUILTIN_SRCS += $(XCSECURITY_SRCS)
endif
# XF86 Big Font extension
BIGFONT_SRCS = xf86bigfont.c xf86bigfontsrv.h
if XF86BIGFONT
BUILTIN_SRCS += $(BIGFONT_SRCS)
endif
# DPMS extension
DPMS_SRCS = dpms.c dpmsproc.h
if DPMSExtension
BUILTIN_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)
EXTRA_DIST = \
$(MITSHM_SRCS) \
$(XV_SRCS) \
$(RES_SRCS) \
$(SCREENSAVER_SRCS) \
$(XACE_SRCS) \
$(XCSECURITY_SRCS) \
$(XSELINUX_SRCS) \
$(XINERAMA_SRCS) \
$(BIGFONT_SRCS) \
$(DPMS_SRCS) \
$(GE_SRCS)

View file

@ -26,18 +26,19 @@ from The Open Group.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#include <X11/Xproto.h>
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "dix_priv.h"
#include "extnsionst.h"
#include <X11/extensions/bigreqsproto.h>
#include "opaque.h"
#include "extinit_priv.h"
#include "extinit.h"
static int
ProcBigReqDispatch(ClientPtr client)
@ -45,6 +46,9 @@ ProcBigReqDispatch(ClientPtr client)
REQUEST(xBigReqEnableReq);
xBigReqEnableReply rep;
if (client->swapped) {
swaps(&stuff->length);
}
if (stuff->brReqType != X_BigReqEnable)
return BadRequest;
REQUEST_SIZE_MATCH(xBigReqEnableReq);

View file

@ -14,26 +14,24 @@ 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.
******************************************************************/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#include <X11/Xproto.h>
#include "os/screensaver.h"
#include "Xext/geext.h"
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
@ -41,255 +39,7 @@ Equipment Corporation.
#include "opaque.h"
#include <X11/extensions/dpmsproto.h>
#include "dpmsproc.h"
#include "extinit_priv.h"
#include "scrnintstr.h"
#include "windowstr.h"
#include "protocol-versions.h"
CARD16 DPMSPowerLevel = 0;
Bool DPMSDisabledSwitch = FALSE;
CARD32 DPMSStandbyTime = -1;
CARD32 DPMSSuspendTime = -1;
CARD32 DPMSOffTime = -1;
Bool DPMSEnabled;
static int DPMSReqCode = 0;
static RESTYPE ClientType, DPMSEventType; /* resource types for event masks */
static XID eventResource;
typedef struct _DPMSEvent *DPMSEventPtr;
typedef struct _DPMSEvent {
DPMSEventPtr next;
ClientPtr client;
XID clientResource;
unsigned int mask;
} DPMSEventRec;
/*ARGSUSED*/ static int
DPMSFreeClient(void *data, XID id)
{
DPMSEventPtr pEvent;
DPMSEventPtr *pHead, pCur, pPrev;
pEvent = (DPMSEventPtr) data;
dixLookupResourceByType((void *) &pHead, eventResource, DPMSEventType,
NullClient, DixUnknownAccess);
if (pHead) {
pPrev = 0;
for (pCur = *pHead; pCur && pCur != pEvent; pCur = pCur->next)
pPrev = pCur;
if (pCur) {
if (pPrev)
pPrev->next = pEvent->next;
else
*pHead = pEvent->next;
}
}
free((void *) pEvent);
return 1;
}
/*ARGSUSED*/ static int
DPMSFreeEvents(void *data, XID id)
{
DPMSEventPtr *pHead, pCur, pNext;
pHead = (DPMSEventPtr *) data;
for (pCur = *pHead; pCur; pCur = pNext) {
pNext = pCur->next;
FreeResource(pCur->clientResource, ClientType);
free((void *) pCur);
}
free((void *) pHead);
return 1;
}
static void
SDPMSInfoNotifyEvent(xGenericEvent * from,
xGenericEvent * to)
{
*to = *from;
swaps(&to->sequenceNumber);
swapl(&to->length);
swaps(&to->evtype);
if (from->evtype == DPMSInfoNotify) {
xDPMSInfoNotifyEvent *c = (xDPMSInfoNotifyEvent *) to;
swapl(&c->timestamp);
swaps(&c->power_level);
}
}
static int
ProcDPMSSelectInput(register ClientPtr client)
{
REQUEST(xDPMSSelectInputReq);
DPMSEventPtr pEvent, pNewEvent, *pHead;
XID clientResource;
int i;
REQUEST_SIZE_MATCH(xDPMSSelectInputReq);
i = dixLookupResourceByType((void **)&pHead, eventResource, DPMSEventType,
client,
DixWriteAccess);
if (stuff->eventMask == DPMSInfoNotifyMask) {
if (i == Success && pHead) {
/* check for existing entry. */
for (pEvent = *pHead; pEvent; pEvent = pEvent->next) {
if (pEvent->client == client) {
pEvent->mask = stuff->eventMask;
return Success;
}
}
}
/* build the entry */
pNewEvent = (DPMSEventPtr)malloc(sizeof(DPMSEventRec));
if (!pNewEvent)
return BadAlloc;
pNewEvent->next = 0;
pNewEvent->client = client;
pNewEvent->mask = stuff->eventMask;
/*
* add a resource that will be deleted when
* the client goes away
*/
clientResource = FakeClientID(client->index);
pNewEvent->clientResource = clientResource;
if (!AddResource(clientResource, ClientType, (void *)pNewEvent))
return BadAlloc;
/*
* create a resource to contain a pointer to the list
* of clients selecting input
*/
if (i != Success || !pHead) {
pHead = (DPMSEventPtr *)malloc(sizeof(DPMSEventPtr));
if (!pHead ||
!AddResource(eventResource, DPMSEventType, (void *)pHead)) {
FreeResource(clientResource, X11_RESTYPE_NONE);
return BadAlloc;
}
*pHead = 0;
}
pNewEvent->next = *pHead;
*pHead = pNewEvent;
}
else if (stuff->eventMask == 0) {
/* delete the interest */
if (i == Success && pHead) {
pNewEvent = 0;
for (pEvent = *pHead; pEvent; pEvent = pEvent->next) {
if (pEvent->client == client)
break;
pNewEvent = pEvent;
}
if (pEvent) {
FreeResource(pEvent->clientResource, ClientType);
if (pNewEvent)
pNewEvent->next = pEvent->next;
else
*pHead = pEvent->next;
free(pEvent);
}
}
}
else {
client->errorValue = stuff->eventMask;
return BadValue;
}
return Success;
}
static void
SendDPMSInfoNotify(void)
{
DPMSEventPtr *pHead, pEvent;
xDPMSInfoNotifyEvent se;
int i;
i = dixLookupResourceByType((void **)&pHead, eventResource, DPMSEventType,
serverClient,
DixReadAccess);
if (i != Success || !pHead)
return;
for (pEvent = *pHead; pEvent; pEvent = pEvent->next) {
if ((pEvent->mask & DPMSInfoNotifyMask) == 0)
continue;
se.type = GenericEvent;
se.extension = DPMSReqCode;
se.length = (sizeof(xDPMSInfoNotifyEvent) - 32) >> 2;
se.evtype = DPMSInfoNotify;
se.timestamp = currentTime.milliseconds;
se.power_level = DPMSPowerLevel;
se.state = DPMSEnabled;
WriteEventsToClient(pEvent->client, 1, (xEvent *)&se);
}
}
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;
int old_level = DPMSPowerLevel;
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);
if (DPMSPowerLevel != old_level)
SendDPMSInfoNotify();
return Success;
}
#include "extinit.h"
static int
ProcDPMSGetVersion(ClientPtr client)
@ -299,8 +49,8 @@ ProcDPMSGetVersion(ClientPtr client)
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.majorVersion = SERVER_DPMS_MAJOR_VERSION,
.minorVersion = SERVER_DPMS_MINOR_VERSION
.majorVersion = DPMSMajorVersion,
.minorVersion = DPMSMinorVersion
};
REQUEST_SIZE_MATCH(xDPMSGetVersionReq);
@ -322,7 +72,7 @@ ProcDPMSCapable(ClientPtr client)
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.capable = TRUE
.capable = DPMSCapableFlag
};
REQUEST_SIZE_MATCH(xDPMSCapableReq);
@ -390,10 +140,10 @@ ProcDPMSEnable(ClientPtr client)
REQUEST_SIZE_MATCH(xDPMSEnableReq);
DPMSEnabled = TRUE;
if (!was_enabled) {
SetScreenSaverTimer();
SendDPMSInfoNotify();
if (DPMSCapableFlag) {
DPMSEnabled = TRUE;
if (!was_enabled)
SetScreenSaverTimer();
}
return Success;
@ -402,8 +152,6 @@ ProcDPMSEnable(ClientPtr client)
static int
ProcDPMSDisable(ClientPtr client)
{
Bool was_enabled = DPMSEnabled;
/* REQUEST(xDPMSDisableReq); */
REQUEST_SIZE_MATCH(xDPMSDisableReq);
@ -411,8 +159,6 @@ ProcDPMSDisable(ClientPtr client)
DPMSSet(client, DPMSModeOn);
DPMSEnabled = FALSE;
if (was_enabled)
SendDPMSInfoNotify();
return Success;
}
@ -483,27 +229,51 @@ ProcDPMSDispatch(ClientPtr client)
return ProcDPMSForceLevel(client);
case X_DPMSInfo:
return ProcDPMSInfo(client);
case X_DPMSSelectInput:
return ProcDPMSSelectInput(client);
default:
return BadRequest;
}
}
static int _X_COLD
static int
SProcDPMSGetVersion(ClientPtr client)
{
REQUEST(xDPMSGetVersionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSGetVersionReq);
swaps(&stuff->majorVersion);
swaps(&stuff->minorVersion);
return ProcDPMSGetVersion(client);
}
static int _X_COLD
static int
SProcDPMSCapable(ClientPtr client)
{
REQUEST(xDPMSCapableReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSCapableReq);
return ProcDPMSCapable(client);
}
static int
SProcDPMSGetTimeouts(ClientPtr client)
{
REQUEST(xDPMSGetTimeoutsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSGetTimeoutsReq);
return ProcDPMSGetTimeouts(client);
}
static int
SProcDPMSSetTimeouts(ClientPtr client)
{
REQUEST(xDPMSSetTimeoutsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSSetTimeoutsReq);
swaps(&stuff->standby);
@ -512,10 +282,34 @@ SProcDPMSSetTimeouts(ClientPtr client)
return ProcDPMSSetTimeouts(client);
}
static int _X_COLD
static int
SProcDPMSEnable(ClientPtr client)
{
REQUEST(xDPMSEnableReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSEnableReq);
return ProcDPMSEnable(client);
}
static int
SProcDPMSDisable(ClientPtr client)
{
REQUEST(xDPMSDisableReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSDisableReq);
return ProcDPMSDisable(client);
}
static int
SProcDPMSForceLevel(ClientPtr client)
{
REQUEST(xDPMSForceLevelReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSForceLevelReq);
swaps(&stuff->level);
@ -523,18 +317,18 @@ SProcDPMSForceLevel(ClientPtr client)
return ProcDPMSForceLevel(client);
}
static int _X_COLD
SProcDPMSSelectInput(ClientPtr client)
static int
SProcDPMSInfo(ClientPtr client)
{
REQUEST(xDPMSSelectInputReq);
REQUEST_SIZE_MATCH(xDPMSSelectInputReq);
swapl(&stuff->eventMask);
return ProcDPMSSelectInput(client);
REQUEST(xDPMSInfoReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSInfoReq);
return ProcDPMSInfo(client);
}
static int _X_COLD
static int
SProcDPMSDispatch(ClientPtr client)
{
REQUEST(xReq);
@ -542,58 +336,28 @@ SProcDPMSDispatch(ClientPtr client)
case X_DPMSGetVersion:
return SProcDPMSGetVersion(client);
case X_DPMSCapable:
return ProcDPMSCapable(client);
return SProcDPMSCapable(client);
case X_DPMSGetTimeouts:
return ProcDPMSGetTimeouts(client);
return SProcDPMSGetTimeouts(client);
case X_DPMSSetTimeouts:
return SProcDPMSSetTimeouts(client);
case X_DPMSEnable:
return ProcDPMSEnable(client);
return SProcDPMSEnable(client);
case X_DPMSDisable:
return ProcDPMSDisable(client);
return SProcDPMSDisable(client);
case X_DPMSForceLevel:
return SProcDPMSForceLevel(client);
case X_DPMSInfo:
return ProcDPMSInfo(client);
case X_DPMSSelectInput:
return SProcDPMSSelectInput(client);
return SProcDPMSInfo(client);
default:
return BadRequest;
}
}
static void
DPMSCloseDownExtension(ExtensionEntry *e)
{
DPMSSet(serverClient, DPMSModeOn);
}
void
DPMSExtensionInit(void)
{
ExtensionEntry *extEntry;
#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();
ClientType = CreateNewResourceType(DPMSFreeClient, "DPMSClient");
DPMSEventType = CreateNewResourceType(DPMSFreeEvents, "DPMSEvent");
eventResource = FakeClientID(0);
if (DPMSEnabled && ClientType && DPMSEventType &&
(extEntry = AddExtension(DPMSExtensionName, 0, 0,
ProcDPMSDispatch, SProcDPMSDispatch,
DPMSCloseDownExtension, StandardMinorOpcode))) {
DPMSReqCode = extEntry->base;
GERegisterExtension(DPMSReqCode, SDPMSInfoNotifyEvent);
}
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

47
Xext/dpmsstubs.c Normal file
View file

@ -0,0 +1,47 @@
/*****************************************************************
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

@ -23,36 +23,31 @@
* Author: Peter Hutterer, University of South Australia, NICTA
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "windowstr.h"
#include <X11/extensions/ge.h>
#include "geint.h"
#include "geext.h"
#include "protocol-versions.h"
#include "extinit_priv.h"
#include "extinit.h"
DevPrivateKeyRec GEClientPrivateKeyRec;
#define GEClientPrivateKey (&GEClientPrivateKeyRec)
GEExtension GEExtensions[MAXEXTENSIONS];
/** Struct to keep information about registered extensions */
typedef struct _GEExtension {
/** Event swapping routine */
void (*evswap) (xGenericEvent *from, xGenericEvent *to);
} GEExtension, *GEExtensionPtr;
static GEExtension GEExtensions[MAXEXTENSIONS];
typedef struct _GEClientInfo {
CARD32 major_version;
CARD32 minor_version;
} GEClientInfoRec, *GEClientInfoPtr;
#define GEGetClient(pClient) ((GEClientInfoPtr)(dixLookupPrivate(&((pClient)->devPrivates), GEClientPrivateKey)))
/* 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 */
};
/* Forward declarations */
static void SGEGenericEvent(xEvent *from, xEvent *to);
#define NUM_VERSION_REQUESTS (sizeof (version_requests) / sizeof (version_requests[0]))
#define EXT_MASK(ext) ((ext) & 0x7F)
/************************************************************/
@ -95,19 +90,29 @@ ProcGEQueryVersion(ClientPtr client)
return Success;
}
int (*ProcGEVector[GENumberRequests]) (ClientPtr) = {
/* Version 1.0 */
ProcGEQueryVersion};
/************************************************************/
/* swapped request handlers */
/************************************************************/
static int _X_COLD
static int
SProcGEQueryVersion(ClientPtr client)
{
REQUEST(xGEQueryVersionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xGEQueryVersionReq);
swaps(&stuff->majorVersion);
swaps(&stuff->minorVersion);
return ProcGEQueryVersion(client);
return (*ProcGEVector[stuff->ReqType]) (client);
}
int (*SProcGEVector[GENumberRequests]) (ClientPtr) = {
/* Version 1.0 */
SProcGEQueryVersion};
/************************************************************/
/* callbacks */
/************************************************************/
@ -116,35 +121,50 @@ SProcGEQueryVersion(ClientPtr client)
static int
ProcGEDispatch(ClientPtr client)
{
REQUEST(xReq);
GEClientInfoPtr pGEClient = GEGetClient(client);
switch (stuff->data) {
case X_GEQueryVersion:
return ProcGEQueryVersion(client);
default:
REQUEST(xGEReq);
if (pGEClient->major_version >= NUM_VERSION_REQUESTS)
return BadRequest;
}
if (stuff->ReqType > version_requests[pGEClient->major_version])
return BadRequest;
return (ProcGEVector[stuff->ReqType]) (client);
}
/* dispatch swapped requests */
static int _X_COLD
static int
SProcGEDispatch(ClientPtr client)
{
REQUEST(xReq);
swaps(&stuff->length);
switch (stuff->data) {
case X_GEQueryVersion:
return SProcGEQueryVersion(client);
default:
REQUEST(xGEReq);
if (stuff->ReqType >= GENumberRequests)
return BadRequest;
}
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)
{
DeleteCallback(&ClientStateCallback, GEClientCallback, 0);
EventSwapVector[GenericEvent] = NotImplemented;
}
@ -155,7 +175,7 @@ GEResetProc(ExtensionEntry * extEntry)
* written on the wire, this one calls the registered swap function to do the
* work.
*/
static void _X_COLD
static void
SGEGenericEvent(xEvent *from, xEvent *to)
{
xGenericEvent *gefrom = (xGenericEvent *) from;
@ -177,16 +197,28 @@ SGEGenericEvent(xEvent *from, xEvent *to)
void
GEExtensionInit(void)
{
ExtensionEntry *extEntry;
if (!dixRegisterPrivateKey
(&GEClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(GEClientInfoRec)))
FatalError("GEExtensionInit: GE private request failed.\n");
if (!AddExtension(GE_NAME, 0, GENumberErrors, ProcGEDispatch, SProcGEDispatch,
GEResetProc, StandardMinorOpcode))
FatalError("GEInit: AddExtensions failed.\n");
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 {
FatalError("GEInit: AddExtensions failed.\n");
}
memset(GEExtensions, 0, sizeof(GEExtensions));
EventSwapVector[GenericEvent] = (EventSwapPtr) SGEGenericEvent;
}
/************************************************************/

View file

@ -25,12 +25,50 @@ other dealings in this Software without prior written authorization
from the author.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef _GEEXT_H_
#define _GEEXT_H_
#include <X11/Xfuncproto.h>
#include <X11/extensions/geproto.h>
/** Struct to keep information about registered extensions */
typedef struct _GEExtension {
/** Event swapping routine */
void (*evswap) (xGenericEvent *from, xGenericEvent *to);
} GEExtension, *GEExtensionPtr;
/* All registered extensions and their handling functions. */
extern _X_EXPORT GEExtension GEExtensions[MAXEXTENSIONS];
/* Typecast to generic event */
#define GEV(ev) ((xGenericEvent*)(ev))
/* Returns the extension offset from the event */
#define GEEXT(ev) (GEV(ev)->extension)
/* Return zero-based extension offset (offset - 128). Only for use in arrays */
#define GEEXTIDX(ev) (GEEXT(ev) & 0x7F)
/* True if mask is set for extension on window */
#define GEMaskIsSet(pWin, extension, mask) \
((pWin)->optional && \
(pWin)->optional->geMasks && \
((pWin)->optional->geMasks->eventMasks[(extension) & 0x7F] & (mask)))
/* Returns first client */
#define GECLIENT(pWin) \
(((pWin)->optional) ? (pWin)->optional->geMasks->geClients : NULL)
/* Returns the event_fill for the given event */
#define GEEventFill(ev) \
GEExtensions[GEEXTIDX(ev)].evfill
#define GEIsType(ev, ext, ev_type) \
((GEV(ev)->type == GenericEvent) && \
GEEXT(ev) == (ext) && \
GEV(ev)->evtype == (ev_type))
/* Interface for other extensions */
extern _X_EXPORT void GERegisterExtension(int extension,
void (*ev_dispatch) (xGenericEvent

View file

@ -1,5 +1,5 @@
/*
* Copyright © 2019 Red Hat, Inc.
* Copyright 2007-2008 Peter Hutterer
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@ -20,18 +20,35 @@
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Authors:
* Adam Jackson <ajax@redhat.com>
* Author: Peter Hutterer, University of South Australia, NICTA
*/
#ifndef XWAYLAND_GLX_H
#define XWAYLAND_GLX_H
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#ifdef GLXEXT
#include "glx_extinit.h"
extern _X_EXPORT __GLXprovider glamor_provider;
#endif
#endif /* XWAYLAND_GLX_H */
#ifndef _GEINT_H_
#define _GEINT_H_
#include <X11/X.h>
#include <X11/Xproto.h>
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "extnsionst.h"
#include <X11/extensions/geproto.h>
extern _X_EXPORT DevPrivateKeyRec GEClientPrivateKeyRec;
#define GEClientPrivateKey (&GEClientPrivateKeyRec)
typedef struct _GEClientInfo {
CARD32 major_version;
CARD32 minor_version;
} GEClientInfoRec, *GEClientInfoPtr;
#define GEGetClient(pClient) ((GEClientInfoPtr)(dixLookupPrivate(&((pClient)->devPrivates), GEClientPrivateKey)))
extern _X_EXPORT int (*ProcGEVector[ /*GENumRequests */ ]) (ClientPtr);
extern _X_EXPORT int (*SProcGEVector[ /*GENumRequests */ ]) (ClientPtr);
#endif /* _GEINT_H_ */

View file

@ -1,4 +1,6 @@
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <stdlib.h>
#include "misc.h"
@ -21,7 +23,7 @@ struct HashTableRec {
HashFunc hash;
HashCompareFunc compare;
void *cdata;
pointer cdata;
};
typedef struct {
@ -35,7 +37,7 @@ ht_create(int keySize,
int dataSize,
HashFunc hash,
HashCompareFunc compare,
void *cdata)
pointer cdata)
{
int c;
int numBuckets;
@ -52,7 +54,7 @@ ht_create(int keySize,
ht->elements = 0;
ht->bucketBits = INITHASHSIZE;
numBuckets = 1 << ht->bucketBits;
ht->buckets = xallocarray(numBuckets, sizeof(*ht->buckets));
ht->buckets = malloc(numBuckets * sizeof(*ht->buckets));
ht->cdata = cdata;
if (ht->buckets) {
@ -75,13 +77,10 @@ ht_destroy(HashTable ht)
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
@ -93,7 +92,7 @@ double_size(HashTable ht)
int newNumBuckets = 1 << newBucketBits;
int c;
newBuckets = xallocarray(newNumBuckets, sizeof(*ht->buckets));
newBuckets = malloc(newNumBuckets * sizeof(*ht->buckets));
if (newBuckets) {
for (c = 0; c < newNumBuckets; ++c) {
xorg_list_init(&newBuckets[c]);
@ -118,8 +117,8 @@ double_size(HashTable ht)
}
}
void *
ht_add(HashTable ht, const void *key)
pointer
ht_add(HashTable ht, pointer key)
{
unsigned index = ht->hash(ht->cdata, key, ht->bucketBits);
struct xorg_list *bucket = &ht->buckets[index];
@ -165,7 +164,7 @@ ht_add(HashTable ht, const void *key)
}
void
ht_remove(HashTable ht, const void *key)
ht_remove(HashTable ht, pointer key)
{
unsigned index = ht->hash(ht->cdata, key, ht->bucketBits);
struct xorg_list *bucket = &ht->buckets[index];
@ -183,8 +182,8 @@ ht_remove(HashTable ht, const void *key)
}
}
void *
ht_find(HashTable ht, const void *key)
pointer
ht_find(HashTable ht, pointer key)
{
unsigned index = ht->hash(ht->cdata, key, ht->bucketBits);
struct xorg_list *bucket = &ht->buckets[index];
@ -238,7 +237,7 @@ unsigned
ht_generic_hash(void *cdata, const void *ptr, int numBits)
{
HtGenericHashSetupPtr setup = cdata;
return one_at_a_time_hash(ptr, setup->keySize) & ~((~0U) << numBits);
return one_at_a_time_hash(ptr, setup->keySize) & ~((~0) << numBits);
}
int

View file

@ -40,7 +40,7 @@ typedef struct {
int keySize;
} HtGenericHashSetupRec, *HtGenericHashSetupPtr;
/** @brief ht_create initializes a hash table for a certain hash table
/** @brief ht_create initalizes a hash table for a certain hash table
configuration
@param[out] ht The hash table structure to initialize
@ -55,7 +55,7 @@ extern _X_EXPORT HashTable ht_create(int keySize,
int dataSize,
HashFunc hash,
HashCompareFunc compare,
void *cdata);
pointer cdata);
/** @brief HtDestruct deinitializes the structure. It does not free the
memory allocated to HashTableRec
*/
@ -75,12 +75,12 @@ extern _X_EXPORT void ht_destroy(HashTable ht);
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);
extern _X_EXPORT pointer ht_add(HashTable ht, pointer 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);
extern _X_EXPORT void ht_remove(HashTable ht, pointer key);
/** @brief Finds the associated data of a key from the hash table.
@ -93,7 +93,7 @@ extern _X_EXPORT void ht_remove(HashTable ht, const void *key);
use HtMember instead to determine if a key has been
inserted.
*/
extern _X_EXPORT void *ht_find(HashTable ht, const void *key);
extern _X_EXPORT pointer ht_find(HashTable ht, pointer key);
/** @brief A generic hash function */
extern _X_EXPORT unsigned ht_generic_hash(void *cdata,

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',
'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'
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,
)
if build_xorg
install_data(hdrs_xext, install_dir: xorgsdkdir)
endif

View file

@ -23,16 +23,18 @@ dealings in this Software without prior written authorization from Digital
Equipment Corporation.
******************************************************************/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifdef HAVE_DMX_CONFIG_H
#include <dmx-config.h>
#endif
#include <stdio.h>
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/Xarch.h>
#include <X11/extensions/panoramiXproto.h>
#include "dix/dix_priv.h"
#include "misc.h"
#include "cursor.h"
#include "cursorstr.h"
@ -45,17 +47,19 @@ Equipment Corporation.
#include "windowstr.h"
#include "pixmapstr.h"
#include "panoramiX.h"
#include <X11/extensions/panoramiXproto.h>
#include "panoramiXsrv.h"
#include "globals.h"
#include "servermd.h"
#include "resource.h"
#include "picturestr_priv.h"
#include "picturestr.h"
#ifdef XFIXES
#include "xfixesint.h"
#include "damageextint.h"
#endif
#ifdef COMPOSITE
#include "compint.h"
#endif
#include "extinit_priv.h"
#include "extinit.h"
#include "protocol-versions.h"
#ifdef GLXPROXY
@ -71,7 +75,7 @@ int PanoramiXPixWidth = 0;
int PanoramiXPixHeight = 0;
int PanoramiXNumScreens = 0;
_X_EXPORT RegionRec PanoramiXScreenRegion = { {0, 0, 0, 0}, NULL };
static RegionRec PanoramiXScreenRegion = { {0, 0, 0, 0}, NULL };
static int PanoramiXNumDepths;
static DepthPtr PanoramiXDepths;
@ -115,7 +119,7 @@ static DevPrivateKeyRec PanoramiXScreenKeyRec;
typedef struct {
DDXPointRec clipOrg;
DDXPointRec patOrg;
const GCFuncs *wrapFuncs;
GCFuncs *wrapFuncs;
} PanoramiXGCRec, *PanoramiXGCPtr;
typedef struct {
@ -127,11 +131,11 @@ static void XineramaValidateGC(GCPtr, unsigned long, DrawablePtr);
static void XineramaChangeGC(GCPtr, unsigned long);
static void XineramaCopyGC(GCPtr, unsigned long, GCPtr);
static void XineramaDestroyGC(GCPtr);
static void XineramaChangeClip(GCPtr, int, void *, int);
static void XineramaChangeClip(GCPtr, int, pointer, int);
static void XineramaDestroyClip(GCPtr);
static void XineramaCopyClip(GCPtr, GCPtr);
static const GCFuncs XineramaGCFuncs = {
static GCFuncs XineramaGCFuncs = {
XineramaValidateGC, XineramaChangeGC, XineramaCopyGC, XineramaDestroyGC,
XineramaChangeClip, XineramaDestroyClip, XineramaCopyClip
};
@ -157,7 +161,7 @@ XineramaCloseScreen(ScreenPtr pScreen)
if (pScreen->myNum == 0)
RegionUninit(&PanoramiXScreenRegion);
free(pScreenPriv);
free((pointer) pScreenPriv);
return (*pScreen->CloseScreen) (pScreen);
}
@ -291,7 +295,7 @@ XineramaCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst)
}
static void
XineramaChangeClip(GCPtr pGC, int type, void *pvalue, int nrects)
XineramaChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
{
Xinerama_GC_FUNC_PROLOGUE(pGC);
(*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
@ -315,7 +319,7 @@ XineramaDestroyClip(GCPtr pGC)
}
int
XineramaDeleteResource(void *data, XID id)
XineramaDeleteResource(pointer data, XID id)
{
free(data);
return 1;
@ -327,7 +331,7 @@ typedef struct {
} PanoramiXSearchData;
static Bool
XineramaFindIDByScrnum(void *resource, XID id, void *privdata)
XineramaFindIDByScrnum(pointer resource, XID id, pointer privdata)
{
PanoramiXRes *res = (PanoramiXRes *) resource;
PanoramiXSearchData *data = (PanoramiXSearchData *) privdata;
@ -339,7 +343,7 @@ PanoramiXRes *
PanoramiXFindIDByScrnum(RESTYPE type, XID id, int screen)
{
PanoramiXSearchData data;
void *val;
pointer val;
if (!screen) {
dixLookupResourceByType(&val, id, type, serverClient, DixReadAccess);
@ -424,7 +428,7 @@ XineramaReinitData(void)
/*
* PanoramiXExtensionInit():
* Called from InitExtensions in main().
* Called from InitExtensions in main().
* Register PanoramiXeen Extension
* Initialize global variables.
*/
@ -579,19 +583,22 @@ PanoramiXExtensionInit(void)
ProcVector[X_StoreNamedColor] = PanoramiXStoreNamedColor;
PanoramiXRenderInit();
#ifdef XFIXES
PanoramiXFixesInit();
PanoramiXDamageInit();
#endif
#ifdef COMPOSITE
PanoramiXCompositeInit();
#endif
}
extern Bool CreateConnectionBlock(void);
Bool
PanoramiXCreateConnectionBlock(void)
{
int i, j, length;
Bool disable_backing_store = FALSE;
Bool disableBackingStore = FALSE;
int old_width, old_height;
float width_mult, height_mult;
xWindowRoot *root;
@ -617,10 +624,10 @@ PanoramiXCreateConnectionBlock(void)
}
if (pScreen->backingStoreSupport !=
screenInfo.screens[0]->backingStoreSupport)
disable_backing_store = TRUE;
disableBackingStore = TRUE;
}
if (disable_backing_store) {
if (disableBackingStore) {
for (i = 0; i < screenInfo.numScreens; i++) {
pScreen = screenInfo.screens[i];
pScreen->backingStoreSupport = NotUseful;
@ -688,9 +695,9 @@ PanoramiXCreateConnectionBlock(void)
root->mmHeight *= height_mult;
while (ConnectionCallbackList) {
void *tmp;
pointer tmp;
tmp = (void *) ConnectionCallbackList;
tmp = (pointer) ConnectionCallbackList;
(*ConnectionCallbackList->func) ();
ConnectionCallbackList = ConnectionCallbackList->next;
free(tmp);
@ -744,11 +751,15 @@ PanoramiXMaybeAddDepth(DepthPtr pDepth)
j = PanoramiXNumDepths;
PanoramiXNumDepths++;
PanoramiXDepths = XNFreallocarray(PanoramiXDepths,
PanoramiXNumDepths, sizeof(DepthRec));
PanoramiXDepths = realloc(PanoramiXDepths,
PanoramiXNumDepths * sizeof(DepthRec));
PanoramiXDepths[j].depth = pDepth->depth;
PanoramiXDepths[j].numVids = 0;
PanoramiXDepths[j].vids = NULL;
/* XXX suboptimal, should grow these dynamically */
if (pDepth->numVids)
PanoramiXDepths[j].vids = malloc(sizeof(VisualID) * pDepth->numVids);
else
PanoramiXDepths[j].vids = NULL;
}
static void
@ -782,16 +793,13 @@ PanoramiXMaybeAddVisual(VisualPtr pVisual)
/* found a matching visual on all screens, add it to the subset list */
j = PanoramiXNumVisuals;
PanoramiXNumVisuals++;
PanoramiXVisuals = reallocarray(PanoramiXVisuals,
PanoramiXNumVisuals, sizeof(VisualRec));
PanoramiXVisuals = realloc(PanoramiXVisuals,
PanoramiXNumVisuals * sizeof(VisualRec));
memcpy(&PanoramiXVisuals[j], pVisual, sizeof(VisualRec));
for (k = 0; k < PanoramiXNumDepths; k++) {
if (PanoramiXDepths[k].depth == pVisual->nplanes) {
PanoramiXDepths[k].vids = reallocarray(PanoramiXDepths[k].vids,
PanoramiXDepths[k].numVids + 1,
sizeof(VisualID));
PanoramiXDepths[k].vids[PanoramiXDepths[k].numVids] = pVisual->vid;
PanoramiXDepths[k].numVids++;
break;
@ -817,23 +825,23 @@ PanoramiXConsolidate(void)
for (i = 0; i < pScreen->numVisuals; i++)
PanoramiXMaybeAddVisual(pVisual++);
root = XNFcallocarray(1, sizeof(PanoramiXRes));
root = malloc(sizeof(PanoramiXRes));
root->type = XRT_WINDOW;
defmap = XNFcallocarray(1, sizeof(PanoramiXRes));
defmap = malloc(sizeof(PanoramiXRes));
defmap->type = XRT_COLORMAP;
saver = XNFcallocarray(1, sizeof(PanoramiXRes));
saver = malloc(sizeof(PanoramiXRes));
saver->type = XRT_WINDOW;
FOR_NSCREENS(i) {
ScreenPtr scr = screenInfo.screens[i];
ScreenPtr pScreen = screenInfo.screens[i];
root->info[i].id = scr->root->drawable.id;
root->info[i].id = pScreen->root->drawable.id;
root->u.win.class = InputOutput;
root->u.win.root = TRUE;
saver->info[i].id = scr->screensaver.wid;
saver->info[i].id = pScreen->screensaver.wid;
saver->u.win.class = InputOutput;
saver->u.win.root = TRUE;
defmap->info[i].id = scr->defColormap;
defmap->info[i].id = pScreen->defColormap;
}
AddResource(root->info[0].id, XRT_WINDOW, root);
@ -884,8 +892,9 @@ PanoramiXResetProc(ExtensionEntry * extEntry)
int i;
PanoramiXRenderReset();
#ifdef XFIXES
PanoramiXFixesReset();
PanoramiXDamageReset();
#endif
#ifdef COMPOSITE
PanoramiXCompositeReset ();
#endif
@ -984,11 +993,10 @@ ProcPanoramiXGetScreenSize(ClientPtr client)
xPanoramiXGetScreenSizeReply rep;
int rc;
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
if (stuff->screen >= PanoramiXNumScreens)
return BadMatch;
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
return rc;

View file

@ -28,7 +28,7 @@ Equipment Corporation.
/* THIS IS NOT AN X PROJECT TEAM SPECIFICATION */
/*
/*
* PanoramiX definitions
*/
@ -39,8 +39,9 @@ Equipment Corporation.
#ifndef _PANORAMIX_H_
#define _PANORAMIX_H_
#define _PANORAMIX_SERVER
#include <X11/extensions/panoramiXproto.h>
#undef _PANORAMIX_SERVER
#include "gcstruct.h"
#include "dixstruct.h"

View file

@ -23,7 +23,9 @@ dealings in this Software without prior written authorization from Digital
Equipment Corporation.
******************************************************************/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <stdio.h>
#include <X11/X.h>
@ -45,41 +47,77 @@ Equipment Corporation.
#include "globals.h"
#include "panoramiXh.h"
static int _X_COLD
static int
SProcPanoramiXQueryVersion(ClientPtr client)
{
REQUEST(xPanoramiXQueryVersionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq);
return ProcPanoramiXQueryVersion(client);
}
static int
SProcPanoramiXGetState(ClientPtr client)
{
REQUEST(xPanoramiXGetStateReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
swapl(&stuff->window);
return ProcPanoramiXGetState(client);
}
static int _X_COLD
static int
SProcPanoramiXGetScreenCount(ClientPtr client)
{
REQUEST(xPanoramiXGetScreenCountReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
swapl(&stuff->window);
return ProcPanoramiXGetScreenCount(client);
}
static int _X_COLD
static int
SProcPanoramiXGetScreenSize(ClientPtr client)
{
REQUEST(xPanoramiXGetScreenSizeReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
swapl(&stuff->window);
swapl(&stuff->screen);
return ProcPanoramiXGetScreenSize(client);
}
int _X_COLD
static int
SProcXineramaIsActive(ClientPtr client)
{
REQUEST(xXineramaIsActiveReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
return ProcXineramaIsActive(client);
}
static int
SProcXineramaQueryScreens(ClientPtr client)
{
REQUEST(xXineramaQueryScreensReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
return ProcXineramaQueryScreens(client);
}
int
SProcPanoramiXDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
case X_PanoramiXQueryVersion:
return ProcPanoramiXQueryVersion(client);
return SProcPanoramiXQueryVersion(client);
case X_PanoramiXGetState:
return SProcPanoramiXGetState(client);
case X_PanoramiXGetScreenCount:
@ -87,9 +125,9 @@ SProcPanoramiXDispatch(ClientPtr client)
case X_PanoramiXGetScreenSize:
return SProcPanoramiXGetScreenSize(client);
case X_XineramaIsActive:
return ProcXineramaIsActive(client);
return SProcXineramaIsActive(client);
case X_XineramaQueryScreens:
return ProcXineramaQueryScreens(client);
return SProcXineramaQueryScreens(client);
}
return BadRequest;
}

View file

@ -25,15 +25,13 @@ Equipment Corporation.
/* Massively rewritten by Mark Vojkovich <markv@valinux.com> */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <stdio.h>
#include <X11/X.h>
#include <X11/Xproto.h>
#include "dix/dix_priv.h"
#include "os/osdep.h"
#include "windowstr.h"
#include "dixfontstr.h"
#include "gcstruct.h"
@ -74,7 +72,7 @@ PanoramiXCreateWindow(ClientPtr client)
if (Ones(stuff->mask) != len)
return BadLength;
result = dixLookupResourceByType((void **) &parent, stuff->parent,
result = dixLookupResourceByType((pointer *) &parent, stuff->parent,
XRT_WINDOW, client, DixWriteAccess);
if (result != Success)
return result;
@ -89,7 +87,7 @@ PanoramiXCreateWindow(ClientPtr client)
pback_offset = Ones((Mask) stuff->mask & (CWBackPixmap - 1));
tmp = *((CARD32 *) &stuff[1] + pback_offset);
if ((tmp != None) && (tmp != ParentRelative)) {
result = dixLookupResourceByType((void **) &backPix, tmp,
result = dixLookupResourceByType((pointer *) &backPix, tmp,
XRT_PIXMAP, client, DixReadAccess);
if (result != Success)
return result;
@ -99,7 +97,7 @@ PanoramiXCreateWindow(ClientPtr client)
pbord_offset = Ones((Mask) stuff->mask & (CWBorderPixmap - 1));
tmp = *((CARD32 *) &stuff[1] + pbord_offset);
if (tmp != CopyFromParent) {
result = dixLookupResourceByType((void **) &bordPix, tmp,
result = dixLookupResourceByType((pointer *) &bordPix, tmp,
XRT_PIXMAP, client, DixReadAccess);
if (result != Success)
return result;
@ -108,8 +106,8 @@ PanoramiXCreateWindow(ClientPtr client)
if ((Mask) stuff->mask & CWColormap) {
cmap_offset = Ones((Mask) stuff->mask & (CWColormap - 1));
tmp = *((CARD32 *) &stuff[1] + cmap_offset);
if (tmp != CopyFromParent) {
result = dixLookupResourceByType((void **) &cmap, tmp,
if ((tmp != CopyFromParent) && (tmp != None)) {
result = dixLookupResourceByType((pointer *) &cmap, tmp,
XRT_COLORMAP, client,
DixReadAccess);
if (result != Success)
@ -180,7 +178,7 @@ PanoramiXChangeWindowAttributes(ClientPtr client)
if (Ones(stuff->valueMask) != len)
return BadLength;
result = dixLookupResourceByType((void **) &win, stuff->window,
result = dixLookupResourceByType((pointer *) &win, stuff->window,
XRT_WINDOW, client, DixWriteAccess);
if (result != Success)
return result;
@ -193,7 +191,7 @@ PanoramiXChangeWindowAttributes(ClientPtr client)
pback_offset = Ones((Mask) stuff->valueMask & (CWBackPixmap - 1));
tmp = *((CARD32 *) &stuff[1] + pback_offset);
if ((tmp != None) && (tmp != ParentRelative)) {
result = dixLookupResourceByType((void **) &backPix, tmp,
result = dixLookupResourceByType((pointer *) &backPix, tmp,
XRT_PIXMAP, client, DixReadAccess);
if (result != Success)
return result;
@ -203,7 +201,7 @@ PanoramiXChangeWindowAttributes(ClientPtr client)
pbord_offset = Ones((Mask) stuff->valueMask & (CWBorderPixmap - 1));
tmp = *((CARD32 *) &stuff[1] + pbord_offset);
if (tmp != CopyFromParent) {
result = dixLookupResourceByType((void **) &bordPix, tmp,
result = dixLookupResourceByType((pointer *) &bordPix, tmp,
XRT_PIXMAP, client, DixReadAccess);
if (result != Success)
return result;
@ -212,8 +210,8 @@ PanoramiXChangeWindowAttributes(ClientPtr client)
if ((Mask) stuff->valueMask & CWColormap) {
cmap_offset = Ones((Mask) stuff->valueMask & (CWColormap - 1));
tmp = *((CARD32 *) &stuff[1] + cmap_offset);
if (tmp != CopyFromParent) {
result = dixLookupResourceByType((void **) &cmap, tmp,
if ((tmp != CopyFromParent) && (tmp != None)) {
result = dixLookupResourceByType((pointer *) &cmap, tmp,
XRT_COLORMAP, client,
DixReadAccess);
if (result != Success)
@ -245,7 +243,7 @@ PanoramiXDestroyWindow(ClientPtr client)
REQUEST_SIZE_MATCH(xResourceReq);
result = dixLookupResourceByType((void **) &win, stuff->id, XRT_WINDOW,
result = dixLookupResourceByType((pointer *) &win, stuff->id, XRT_WINDOW,
client, DixDestroyAccess);
if (result != Success)
return result;
@ -273,7 +271,7 @@ PanoramiXDestroySubwindows(ClientPtr client)
REQUEST_SIZE_MATCH(xResourceReq);
result = dixLookupResourceByType((void **) &win, stuff->id, XRT_WINDOW,
result = dixLookupResourceByType((pointer *) &win, stuff->id, XRT_WINDOW,
client, DixDestroyAccess);
if (result != Success)
return result;
@ -301,7 +299,7 @@ PanoramiXChangeSaveSet(ClientPtr client)
REQUEST_SIZE_MATCH(xChangeSaveSetReq);
result = dixLookupResourceByType((void **) &win, stuff->window,
result = dixLookupResourceByType((pointer *) &win, stuff->window,
XRT_WINDOW, client, DixReadAccess);
if (result != Success)
return result;
@ -328,12 +326,12 @@ PanoramiXReparentWindow(ClientPtr client)
REQUEST_SIZE_MATCH(xReparentWindowReq);
result = dixLookupResourceByType((void **) &win, stuff->window,
result = dixLookupResourceByType((pointer *) &win, stuff->window,
XRT_WINDOW, client, DixWriteAccess);
if (result != Success)
return result;
result = dixLookupResourceByType((void **) &parent, stuff->parent,
result = dixLookupResourceByType((pointer *) &parent, stuff->parent,
XRT_WINDOW, client, DixWriteAccess);
if (result != Success)
return result;
@ -367,7 +365,7 @@ PanoramiXMapWindow(ClientPtr client)
REQUEST_SIZE_MATCH(xResourceReq);
result = dixLookupResourceByType((void **) &win, stuff->id,
result = dixLookupResourceByType((pointer *) &win, stuff->id,
XRT_WINDOW, client, DixReadAccess);
if (result != Success)
return result;
@ -392,7 +390,7 @@ PanoramiXMapSubwindows(ClientPtr client)
REQUEST_SIZE_MATCH(xResourceReq);
result = dixLookupResourceByType((void **) &win, stuff->id,
result = dixLookupResourceByType((pointer *) &win, stuff->id,
XRT_WINDOW, client, DixReadAccess);
if (result != Success)
return result;
@ -417,7 +415,7 @@ PanoramiXUnmapWindow(ClientPtr client)
REQUEST_SIZE_MATCH(xResourceReq);
result = dixLookupResourceByType((void **) &win, stuff->id,
result = dixLookupResourceByType((pointer *) &win, stuff->id,
XRT_WINDOW, client, DixReadAccess);
if (result != Success)
return result;
@ -442,7 +440,7 @@ PanoramiXUnmapSubwindows(ClientPtr client)
REQUEST_SIZE_MATCH(xResourceReq);
result = dixLookupResourceByType((void **) &win, stuff->id,
result = dixLookupResourceByType((pointer *) &win, stuff->id,
XRT_WINDOW, client, DixReadAccess);
if (result != Success)
return result;
@ -476,12 +474,12 @@ PanoramiXConfigureWindow(ClientPtr client)
return BadLength;
/* because we need the parent */
result = dixLookupResourceByType((void **) &pWin, stuff->window,
X11_RESTYPE_WINDOW, client, DixWriteAccess);
result = dixLookupResourceByType((pointer *) &pWin, stuff->window,
RT_WINDOW, client, DixWriteAccess);
if (result != Success)
return result;
result = dixLookupResourceByType((void **) &win, stuff->window,
result = dixLookupResourceByType((pointer *) &win, stuff->window,
XRT_WINDOW, client, DixWriteAccess);
if (result != Success)
return result;
@ -491,7 +489,7 @@ PanoramiXConfigureWindow(ClientPtr client)
sib_offset = Ones((Mask) stuff->mask & (CWSibling - 1));
if ((tmp = *((CARD32 *) &stuff[1] + sib_offset))) {
result = dixLookupResourceByType((void **) &sib, tmp, XRT_WINDOW,
result = dixLookupResourceByType((pointer *) &sib, tmp, XRT_WINDOW,
client, DixReadAccess);
if (result != Success)
return result;
@ -511,7 +509,7 @@ PanoramiXConfigureWindow(ClientPtr client)
}
}
/* have to go forward or you get expose events before
/* have to go forward or you get expose events before
ConfigureNotify events */
FOR_NSCREENS_FORWARD(j) {
stuff->window = win->info[j].id;
@ -539,7 +537,7 @@ PanoramiXCirculateWindow(ClientPtr client)
REQUEST_SIZE_MATCH(xCirculateWindowReq);
result = dixLookupResourceByType((void **) &win, stuff->window,
result = dixLookupResourceByType((pointer *) &win, stuff->window,
XRT_WINDOW, client, DixWriteAccess);
if (result != Success)
return result;
@ -689,7 +687,7 @@ PanoramiXCreatePixmap(ClientPtr client)
REQUEST_SIZE_MATCH(xCreatePixmapReq);
client->errorValue = stuff->pid;
result = dixLookupResourceByClass((void **) &refDraw, stuff->drawable,
result = dixLookupResourceByClass((pointer *) &refDraw, stuff->drawable,
XRC_DRAWABLE, client, DixReadAccess);
if (result != Success)
return (result == BadValue) ? BadDrawable : result;
@ -729,7 +727,7 @@ PanoramiXFreePixmap(ClientPtr client)
client->errorValue = stuff->id;
result = dixLookupResourceByType((void **) &pix, stuff->id, XRT_PIXMAP,
result = dixLookupResourceByType((pointer *) &pix, stuff->id, XRT_PIXMAP,
client, DixDestroyAccess);
if (result != Success)
return result;
@ -768,7 +766,7 @@ PanoramiXCreateGC(ClientPtr client)
if (Ones(stuff->mask) != len)
return BadLength;
result = dixLookupResourceByClass((void **) &refDraw, stuff->drawable,
result = dixLookupResourceByClass((pointer *) &refDraw, stuff->drawable,
XRC_DRAWABLE, client, DixReadAccess);
if (result != Success)
return (result == BadValue) ? BadDrawable : result;
@ -776,7 +774,7 @@ PanoramiXCreateGC(ClientPtr client)
if ((Mask) stuff->mask & GCTile) {
tile_offset = Ones((Mask) stuff->mask & (GCTile - 1));
if ((tmp = *((CARD32 *) &stuff[1] + tile_offset))) {
result = dixLookupResourceByType((void **) &tile, tmp, XRT_PIXMAP,
result = dixLookupResourceByType((pointer *) &tile, tmp, XRT_PIXMAP,
client, DixReadAccess);
if (result != Success)
return result;
@ -785,7 +783,7 @@ PanoramiXCreateGC(ClientPtr client)
if ((Mask) stuff->mask & GCStipple) {
stip_offset = Ones((Mask) stuff->mask & (GCStipple - 1));
if ((tmp = *((CARD32 *) &stuff[1] + stip_offset))) {
result = dixLookupResourceByType((void **) &stip, tmp, XRT_PIXMAP,
result = dixLookupResourceByType((pointer *) &stip, tmp, XRT_PIXMAP,
client, DixReadAccess);
if (result != Success)
return result;
@ -794,7 +792,7 @@ PanoramiXCreateGC(ClientPtr client)
if ((Mask) stuff->mask & GCClipMask) {
clip_offset = Ones((Mask) stuff->mask & (GCClipMask - 1));
if ((tmp = *((CARD32 *) &stuff[1] + clip_offset))) {
result = dixLookupResourceByType((void **) &clip, tmp, XRT_PIXMAP,
result = dixLookupResourceByType((pointer *) &clip, tmp, XRT_PIXMAP,
client, DixReadAccess);
if (result != Success)
return result;
@ -848,7 +846,7 @@ PanoramiXChangeGC(ClientPtr client)
if (Ones(stuff->mask) != len)
return BadLength;
result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
client, DixReadAccess);
if (result != Success)
return result;
@ -856,7 +854,7 @@ PanoramiXChangeGC(ClientPtr client)
if ((Mask) stuff->mask & GCTile) {
tile_offset = Ones((Mask) stuff->mask & (GCTile - 1));
if ((tmp = *((CARD32 *) &stuff[1] + tile_offset))) {
result = dixLookupResourceByType((void **) &tile, tmp, XRT_PIXMAP,
result = dixLookupResourceByType((pointer *) &tile, tmp, XRT_PIXMAP,
client, DixReadAccess);
if (result != Success)
return result;
@ -865,7 +863,7 @@ PanoramiXChangeGC(ClientPtr client)
if ((Mask) stuff->mask & GCStipple) {
stip_offset = Ones((Mask) stuff->mask & (GCStipple - 1));
if ((tmp = *((CARD32 *) &stuff[1] + stip_offset))) {
result = dixLookupResourceByType((void **) &stip, tmp, XRT_PIXMAP,
result = dixLookupResourceByType((pointer *) &stip, tmp, XRT_PIXMAP,
client, DixReadAccess);
if (result != Success)
return result;
@ -874,7 +872,7 @@ PanoramiXChangeGC(ClientPtr client)
if ((Mask) stuff->mask & GCClipMask) {
clip_offset = Ones((Mask) stuff->mask & (GCClipMask - 1));
if ((tmp = *((CARD32 *) &stuff[1] + clip_offset))) {
result = dixLookupResourceByType((void **) &clip, tmp, XRT_PIXMAP,
result = dixLookupResourceByType((pointer *) &clip, tmp, XRT_PIXMAP,
client, DixReadAccess);
if (result != Success)
return result;
@ -907,12 +905,12 @@ PanoramiXCopyGC(ClientPtr client)
REQUEST_SIZE_MATCH(xCopyGCReq);
result = dixLookupResourceByType((void **) &srcGC, stuff->srcGC, XRT_GC,
result = dixLookupResourceByType((pointer *) &srcGC, stuff->srcGC, XRT_GC,
client, DixReadAccess);
if (result != Success)
return result;
result = dixLookupResourceByType((void **) &dstGC, stuff->dstGC, XRT_GC,
result = dixLookupResourceByType((pointer *) &dstGC, stuff->dstGC, XRT_GC,
client, DixWriteAccess);
if (result != Success)
return result;
@ -938,7 +936,7 @@ PanoramiXSetDashes(ClientPtr client)
REQUEST_FIXED_SIZE(xSetDashesReq, stuff->nDashes);
result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
client, DixWriteAccess);
if (result != Success)
return result;
@ -963,7 +961,7 @@ PanoramiXSetClipRectangles(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xSetClipRectanglesReq);
result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
client, DixWriteAccess);
if (result != Success)
return result;
@ -988,7 +986,7 @@ PanoramiXFreeGC(ClientPtr client)
REQUEST_SIZE_MATCH(xResourceReq);
result = dixLookupResourceByType((void **) &gc, stuff->id, XRT_GC,
result = dixLookupResourceByType((pointer *) &gc, stuff->id, XRT_GC,
client, DixDestroyAccess);
if (result != Success)
return result;
@ -1017,7 +1015,7 @@ PanoramiXClearToBackground(ClientPtr client)
REQUEST_SIZE_MATCH(xClearAreaReq);
result = dixLookupResourceByType((void **) &win, stuff->window,
result = dixLookupResourceByType((pointer *) &win, stuff->window,
XRT_WINDOW, client, DixWriteAccess);
if (result != Success)
return result;
@ -1039,7 +1037,7 @@ PanoramiXClearToBackground(ClientPtr client)
return result;
}
/*
/*
For Window to Pixmap copies you're screwed since each screen's
pixmap will look like what it sees on its screen. Unless the
screens overlap and the window lies on each, the two copies
@ -1052,7 +1050,7 @@ PanoramiXClearToBackground(ClientPtr client)
int
PanoramiXCopyArea(ClientPtr client)
{
int j, result, srcx, srcy, dstx, dsty, width, height;
int j, result, srcx, srcy, dstx, dsty;
PanoramiXRes *gc, *src, *dst;
Bool srcIsRoot = FALSE;
Bool dstIsRoot = FALSE;
@ -1062,14 +1060,14 @@ PanoramiXCopyArea(ClientPtr client)
REQUEST_SIZE_MATCH(xCopyAreaReq);
result = dixLookupResourceByClass((void **) &src, stuff->srcDrawable,
result = dixLookupResourceByClass((pointer *) &src, stuff->srcDrawable,
XRC_DRAWABLE, client, DixReadAccess);
if (result != Success)
return (result == BadValue) ? BadDrawable : result;
srcShared = IS_SHARED_PIXMAP(src);
result = dixLookupResourceByClass((void **) &dst, stuff->dstDrawable,
result = dixLookupResourceByClass((pointer *) &dst, stuff->dstDrawable,
XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
return (result == BadValue) ? BadDrawable : result;
@ -1079,7 +1077,7 @@ PanoramiXCopyArea(ClientPtr client)
if (dstShared && srcShared)
return (*SavedProcVector[X_CopyArea]) (client);
result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
client, DixReadAccess);
if (result != Success)
return result;
@ -1093,8 +1091,6 @@ PanoramiXCopyArea(ClientPtr client)
srcy = stuff->srcY;
dstx = stuff->dstX;
dsty = stuff->dstY;
width = stuff->width;
height = stuff->height;
if ((dst->type == XRT_PIXMAP) && (src->type == XRT_WINDOW)) {
DrawablePtr drawables[MAXSCREENS];
DrawablePtr pDst;
@ -1107,18 +1103,15 @@ PanoramiXCopyArea(ClientPtr client)
DixGetAttrAccess);
if (rc != Success)
return rc;
drawables[j]->pScreen->SourceValidate(drawables[j], 0, 0,
drawables[j]->width,
drawables[j]->height,
IncludeInferiors);
}
pitch = PixmapBytePad(width, drawables[0]->depth);
if (!(data = calloc(height, pitch)))
pitch = PixmapBytePad(stuff->width, drawables[0]->depth);
if (!(data = calloc(1, stuff->height * pitch)))
return BadAlloc;
XineramaGetImageData(drawables, srcx, srcy, width, height, ZPixmap, ~0,
data, pitch, srcIsRoot);
XineramaGetImageData(drawables, srcx, srcy,
stuff->width, stuff->height, ZPixmap, ~0, data,
pitch, srcIsRoot);
FOR_NSCREENS_BACKWARD(j) {
stuff->gc = gc->info[j].id;
@ -1130,63 +1123,14 @@ PanoramiXCopyArea(ClientPtr client)
}
(*pGC->ops->PutImage) (pDst, pGC, pDst->depth, dstx, dsty,
width, height, 0, ZPixmap, data);
stuff->width, stuff->height,
0, ZPixmap, data);
if (dstShared)
break;
}
free(data);
if (pGC->graphicsExposures) {
RegionRec rgn;
int dx, dy;
BoxRec sourceBox;
dx = drawables[0]->x;
dy = drawables[0]->y;
if (srcIsRoot) {
dx += screenInfo.screens[0]->x;
dy += screenInfo.screens[0]->y;
}
sourceBox.x1 = min(srcx + dx, 0);
sourceBox.y1 = min(srcy + dy, 0);
sourceBox.x2 = max(sourceBox.x1 + width, 32767);
sourceBox.y2 = max(sourceBox.y1 + height, 32767);
RegionInit(&rgn, &sourceBox, 1);
/* subtract the (screen-space) clips of the source drawables */
FOR_NSCREENS(j) {
ScreenPtr screen = screenInfo.screens[j];
RegionPtr sd;
if (pGC->subWindowMode == IncludeInferiors)
sd = NotClippedByChildren((WindowPtr)drawables[j]);
else
sd = &((WindowPtr)drawables[j])->clipList;
if (srcIsRoot)
RegionTranslate(&rgn, -screen->x, -screen->y);
RegionSubtract(&rgn, &rgn, sd);
if (srcIsRoot)
RegionTranslate(&rgn, screen->x, screen->y);
if (pGC->subWindowMode == IncludeInferiors)
RegionDestroy(sd);
}
/* -dx/-dy to get back to dest-relative, plus request offsets */
RegionTranslate(&rgn, -dx + dstx, -dy + dsty);
/* intersect with gc clip; just one screen is fine because pixmap */
RegionIntersect(&rgn, &rgn, pGC->pCompositeClip);
/* and expose */
SendGraphicsExpose(client, &rgn, dst->info[0].id, X_CopyArea, 0);
RegionUninit(&rgn);
}
}
else {
DrawablePtr pDst = NULL, pSrc = NULL;
@ -1249,8 +1193,9 @@ PanoramiXCopyArea(ClientPtr client)
Bool overlap;
RegionValidate(&totalReg, &overlap);
SendGraphicsExpose(client, &totalReg, stuff->dstDrawable,
X_CopyArea, 0);
(*pDst->pScreen->SendGraphicsExpose) (client, &totalReg,
stuff->dstDrawable,
X_CopyArea, 0);
RegionUninit(&totalReg);
}
}
@ -1274,14 +1219,14 @@ PanoramiXCopyPlane(ClientPtr client)
REQUEST_SIZE_MATCH(xCopyPlaneReq);
rc = dixLookupResourceByClass((void **) &src, stuff->srcDrawable,
rc = dixLookupResourceByClass((pointer *) &src, stuff->srcDrawable,
XRC_DRAWABLE, client, DixReadAccess);
if (rc != Success)
return (rc == BadValue) ? BadDrawable : rc;
srcShared = IS_SHARED_PIXMAP(src);
rc = dixLookupResourceByClass((void **) &dst, stuff->dstDrawable,
rc = dixLookupResourceByClass((pointer *) &dst, stuff->dstDrawable,
XRC_DRAWABLE, client, DixWriteAccess);
if (rc != Success)
return (rc == BadValue) ? BadDrawable : rc;
@ -1291,7 +1236,7 @@ PanoramiXCopyPlane(ClientPtr client)
if (dstShared && srcShared)
return (*SavedProcVector[X_CopyPlane]) (client);
rc = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
rc = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
client, DixReadAccess);
if (rc != Success)
return rc;
@ -1361,8 +1306,9 @@ PanoramiXCopyPlane(ClientPtr client)
Bool overlap;
RegionValidate(&totalReg, &overlap);
SendGraphicsExpose(client, &totalReg, stuff->dstDrawable,
X_CopyPlane, 0);
(*pdstDraw->pScreen->SendGraphicsExpose) (client, &totalReg,
stuff->dstDrawable,
X_CopyPlane, 0);
RegionUninit(&totalReg);
}
@ -1381,7 +1327,7 @@ PanoramiXPolyPoint(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xPolyPointReq);
result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
return (result == BadValue) ? BadDrawable : result;
@ -1389,7 +1335,7 @@ PanoramiXPolyPoint(ClientPtr client)
if (IS_SHARED_PIXMAP(draw))
return (*SavedProcVector[X_PolyPoint]) (client);
result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
client, DixReadAccess);
if (result != Success)
return result;
@ -1397,7 +1343,7 @@ PanoramiXPolyPoint(ClientPtr client)
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyPointReq));
if (npoint > 0) {
origPts = xallocarray(npoint, sizeof(xPoint));
origPts = malloc(npoint * sizeof(xPoint));
memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
FOR_NSCREENS_FORWARD(j) {
@ -1446,7 +1392,7 @@ PanoramiXPolyLine(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xPolyLineReq);
result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
return (result == BadValue) ? BadDrawable : result;
@ -1454,7 +1400,7 @@ PanoramiXPolyLine(ClientPtr client)
if (IS_SHARED_PIXMAP(draw))
return (*SavedProcVector[X_PolyLine]) (client);
result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
client, DixReadAccess);
if (result != Success)
return result;
@ -1462,7 +1408,7 @@ PanoramiXPolyLine(ClientPtr client)
isRoot = IS_ROOT_DRAWABLE(draw);
npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyLineReq));
if (npoint > 0) {
origPts = xallocarray(npoint, sizeof(xPoint));
origPts = malloc(npoint * sizeof(xPoint));
memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
FOR_NSCREENS_FORWARD(j) {
@ -1511,7 +1457,7 @@ PanoramiXPolySegment(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xPolySegmentReq);
result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
return (result == BadValue) ? BadDrawable : result;
@ -1519,7 +1465,7 @@ PanoramiXPolySegment(ClientPtr client)
if (IS_SHARED_PIXMAP(draw))
return (*SavedProcVector[X_PolySegment]) (client);
result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
client, DixReadAccess);
if (result != Success)
return result;
@ -1531,7 +1477,7 @@ PanoramiXPolySegment(ClientPtr client)
return BadLength;
nsegs >>= 3;
if (nsegs > 0) {
origSegs = xallocarray(nsegs, sizeof(xSegment));
origSegs = malloc(nsegs * sizeof(xSegment));
memcpy((char *) origSegs, (char *) &stuff[1], nsegs * sizeof(xSegment));
FOR_NSCREENS_FORWARD(j) {
@ -1579,7 +1525,7 @@ PanoramiXPolyRectangle(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xPolyRectangleReq);
result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
return (result == BadValue) ? BadDrawable : result;
@ -1587,7 +1533,7 @@ PanoramiXPolyRectangle(ClientPtr client)
if (IS_SHARED_PIXMAP(draw))
return (*SavedProcVector[X_PolyRectangle]) (client);
result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
client, DixReadAccess);
if (result != Success)
return result;
@ -1599,7 +1545,7 @@ PanoramiXPolyRectangle(ClientPtr client)
return BadLength;
nrects >>= 3;
if (nrects > 0) {
origRecs = xallocarray(nrects, sizeof(xRectangle));
origRecs = malloc(nrects * sizeof(xRectangle));
memcpy((char *) origRecs, (char *) &stuff[1],
nrects * sizeof(xRectangle));
FOR_NSCREENS_FORWARD(j) {
@ -1646,7 +1592,7 @@ PanoramiXPolyArc(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xPolyArcReq);
result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
return (result == BadValue) ? BadDrawable : result;
@ -1654,7 +1600,7 @@ PanoramiXPolyArc(ClientPtr client)
if (IS_SHARED_PIXMAP(draw))
return (*SavedProcVector[X_PolyArc]) (client);
result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
client, DixReadAccess);
if (result != Success)
return result;
@ -1666,7 +1612,7 @@ PanoramiXPolyArc(ClientPtr client)
return BadLength;
narcs /= sizeof(xArc);
if (narcs > 0) {
origArcs = xallocarray(narcs, sizeof(xArc));
origArcs = malloc(narcs * sizeof(xArc));
memcpy((char *) origArcs, (char *) &stuff[1], narcs * sizeof(xArc));
FOR_NSCREENS_FORWARD(j) {
@ -1711,7 +1657,7 @@ PanoramiXFillPoly(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xFillPolyReq);
result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
return (result == BadValue) ? BadDrawable : result;
@ -1719,7 +1665,7 @@ PanoramiXFillPoly(ClientPtr client)
if (IS_SHARED_PIXMAP(draw))
return (*SavedProcVector[X_FillPoly]) (client);
result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
client, DixReadAccess);
if (result != Success)
return result;
@ -1728,7 +1674,7 @@ PanoramiXFillPoly(ClientPtr client)
count = bytes_to_int32((client->req_len << 2) - sizeof(xFillPolyReq));
if (count > 0) {
locPts = xallocarray(count, sizeof(DDXPointRec));
locPts = malloc(count * sizeof(DDXPointRec));
memcpy((char *) locPts, (char *) &stuff[1],
count * sizeof(DDXPointRec));
FOR_NSCREENS_FORWARD(j) {
@ -1777,7 +1723,7 @@ PanoramiXPolyFillRectangle(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xPolyFillRectangleReq);
result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
return (result == BadValue) ? BadDrawable : result;
@ -1785,7 +1731,7 @@ PanoramiXPolyFillRectangle(ClientPtr client)
if (IS_SHARED_PIXMAP(draw))
return (*SavedProcVector[X_PolyFillRectangle]) (client);
result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
client, DixReadAccess);
if (result != Success)
return result;
@ -1797,7 +1743,7 @@ PanoramiXPolyFillRectangle(ClientPtr client)
return BadLength;
things >>= 3;
if (things > 0) {
origRects = xallocarray(things, sizeof(xRectangle));
origRects = malloc(things * sizeof(xRectangle));
memcpy((char *) origRects, (char *) &stuff[1],
things * sizeof(xRectangle));
FOR_NSCREENS_FORWARD(j) {
@ -1844,7 +1790,7 @@ PanoramiXPolyFillArc(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xPolyFillArcReq);
result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
return (result == BadValue) ? BadDrawable : result;
@ -1852,7 +1798,7 @@ PanoramiXPolyFillArc(ClientPtr client)
if (IS_SHARED_PIXMAP(draw))
return (*SavedProcVector[X_PolyFillArc]) (client);
result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
client, DixReadAccess);
if (result != Success)
return result;
@ -1864,7 +1810,7 @@ PanoramiXPolyFillArc(ClientPtr client)
return BadLength;
narcs /= sizeof(xArc);
if (narcs > 0) {
origArcs = xallocarray(narcs, sizeof(xArc));
origArcs = malloc(narcs * sizeof(xArc));
memcpy((char *) origArcs, (char *) &stuff[1], narcs * sizeof(xArc));
FOR_NSCREENS_FORWARD(j) {
@ -1909,7 +1855,7 @@ PanoramiXPutImage(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xPutImageReq);
result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
return (result == BadValue) ? BadDrawable : result;
@ -1917,7 +1863,7 @@ PanoramiXPutImage(ClientPtr client)
if (IS_SHARED_PIXMAP(draw))
return (*SavedProcVector[X_PutImage]) (client);
result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
client, DixReadAccess);
if (result != Success)
return result;
@ -1963,8 +1909,8 @@ PanoramiXGetImage(ClientPtr client)
return BadValue;
}
rc = dixLookupResourceByClass((void **) &draw, stuff->drawable,
XRC_DRAWABLE, client, DixReadAccess);
rc = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
XRC_DRAWABLE, client, DixWriteAccess);
if (rc != Success)
return (rc == BadValue) ? BadDrawable : rc;
@ -2013,12 +1959,6 @@ PanoramiXGetImage(ClientPtr client)
if (rc != Success)
return rc;
}
FOR_NSCREENS_FORWARD(i) {
drawables[i]->pScreen->SourceValidate(drawables[i], 0, 0,
drawables[i]->width,
drawables[i]->height,
IncludeInferiors);
}
xgi = (xGetImageReply) {
.type = X_Reply,
@ -2050,7 +1990,8 @@ PanoramiXGetImage(ClientPtr client)
if (linesPerBuf > h)
linesPerBuf = h;
}
if (!(pBuf = xallocarray(linesPerBuf, widthBytesLine)))
length = linesPerBuf * widthBytesLine;
if (!(pBuf = malloc(length)))
return BadAlloc;
WriteReplyToClient(client, sizeof(xGetImageReply), &xgi);
@ -2114,7 +2055,7 @@ PanoramiXPolyText8(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xPolyTextReq);
result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
return (result == BadValue) ? BadDrawable : result;
@ -2122,7 +2063,7 @@ PanoramiXPolyText8(ClientPtr client)
if (IS_SHARED_PIXMAP(draw))
return (*SavedProcVector[X_PolyText8]) (client);
result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
client, DixReadAccess);
if (result != Success)
return result;
@ -2157,7 +2098,7 @@ PanoramiXPolyText16(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xPolyTextReq);
result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
return (result == BadValue) ? BadDrawable : result;
@ -2165,7 +2106,7 @@ PanoramiXPolyText16(ClientPtr client)
if (IS_SHARED_PIXMAP(draw))
return (*SavedProcVector[X_PolyText16]) (client);
result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
client, DixReadAccess);
if (result != Success)
return result;
@ -2200,7 +2141,7 @@ PanoramiXImageText8(ClientPtr client)
REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars);
result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
return (result == BadValue) ? BadDrawable : result;
@ -2208,7 +2149,7 @@ PanoramiXImageText8(ClientPtr client)
if (IS_SHARED_PIXMAP(draw))
return (*SavedProcVector[X_ImageText8]) (client);
result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
client, DixReadAccess);
if (result != Success)
return result;
@ -2243,7 +2184,7 @@ PanoramiXImageText16(ClientPtr client)
REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars << 1);
result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
return (result == BadValue) ? BadDrawable : result;
@ -2251,7 +2192,7 @@ PanoramiXImageText16(ClientPtr client)
if (IS_SHARED_PIXMAP(draw))
return (*SavedProcVector[X_ImageText16]) (client);
result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
client, DixReadAccess);
if (result != Success)
return result;
@ -2284,7 +2225,7 @@ PanoramiXCreateColormap(ClientPtr client)
REQUEST_SIZE_MATCH(xCreateColormapReq);
result = dixLookupResourceByType((void **) &win, stuff->window,
result = dixLookupResourceByType((pointer *) &win, stuff->window,
XRT_WINDOW, client, DixReadAccess);
if (result != Success)
return result;
@ -2325,7 +2266,7 @@ PanoramiXFreeColormap(ClientPtr client)
client->errorValue = stuff->id;
result = dixLookupResourceByType((void **) &cmap, stuff->id, XRT_COLORMAP,
result = dixLookupResourceByType((pointer *) &cmap, stuff->id, XRT_COLORMAP,
client, DixDestroyAccess);
if (result != Success)
return result;
@ -2355,7 +2296,7 @@ PanoramiXCopyColormapAndFree(ClientPtr client)
client->errorValue = stuff->srcCmap;
result = dixLookupResourceByType((void **) &cmap, stuff->srcCmap,
result = dixLookupResourceByType((pointer *) &cmap, stuff->srcCmap,
XRT_COLORMAP, client,
DixReadAccess | DixWriteAccess);
if (result != Success)
@ -2394,7 +2335,7 @@ PanoramiXInstallColormap(ClientPtr client)
client->errorValue = stuff->id;
result = dixLookupResourceByType((void **) &cmap, stuff->id, XRT_COLORMAP,
result = dixLookupResourceByType((pointer *) &cmap, stuff->id, XRT_COLORMAP,
client, DixReadAccess);
if (result != Success)
return result;
@ -2419,7 +2360,7 @@ PanoramiXUninstallColormap(ClientPtr client)
client->errorValue = stuff->id;
result = dixLookupResourceByType((void **) &cmap, stuff->id, XRT_COLORMAP,
result = dixLookupResourceByType((pointer *) &cmap, stuff->id, XRT_COLORMAP,
client, DixReadAccess);
if (result != Success)
return result;
@ -2445,7 +2386,7 @@ PanoramiXAllocColor(ClientPtr client)
client->errorValue = stuff->cmap;
result = dixLookupResourceByType((void **) &cmap, stuff->cmap,
result = dixLookupResourceByType((pointer *) &cmap, stuff->cmap,
XRT_COLORMAP, client, DixWriteAccess);
if (result != Success)
return result;
@ -2471,7 +2412,7 @@ PanoramiXAllocNamedColor(ClientPtr client)
client->errorValue = stuff->cmap;
result = dixLookupResourceByType((void **) &cmap, stuff->cmap,
result = dixLookupResourceByType((pointer *) &cmap, stuff->cmap,
XRT_COLORMAP, client, DixWriteAccess);
if (result != Success)
return result;
@ -2497,7 +2438,7 @@ PanoramiXAllocColorCells(ClientPtr client)
client->errorValue = stuff->cmap;
result = dixLookupResourceByType((void **) &cmap, stuff->cmap,
result = dixLookupResourceByType((pointer *) &cmap, stuff->cmap,
XRT_COLORMAP, client, DixWriteAccess);
if (result != Success)
return result;
@ -2523,7 +2464,7 @@ PanoramiXAllocColorPlanes(ClientPtr client)
client->errorValue = stuff->cmap;
result = dixLookupResourceByType((void **) &cmap, stuff->cmap,
result = dixLookupResourceByType((pointer *) &cmap, stuff->cmap,
XRT_COLORMAP, client, DixWriteAccess);
if (result != Success)
return result;
@ -2549,7 +2490,7 @@ PanoramiXFreeColors(ClientPtr client)
client->errorValue = stuff->cmap;
result = dixLookupResourceByType((void **) &cmap, stuff->cmap,
result = dixLookupResourceByType((pointer *) &cmap, stuff->cmap,
XRT_COLORMAP, client, DixWriteAccess);
if (result != Success)
return result;
@ -2573,7 +2514,7 @@ PanoramiXStoreColors(ClientPtr client)
client->errorValue = stuff->cmap;
result = dixLookupResourceByType((void **) &cmap, stuff->cmap,
result = dixLookupResourceByType((pointer *) &cmap, stuff->cmap,
XRT_COLORMAP, client, DixWriteAccess);
if (result != Success)
return result;
@ -2599,7 +2540,7 @@ PanoramiXStoreNamedColor(ClientPtr client)
client->errorValue = stuff->cmap;
result = dixLookupResourceByType((void **) &cmap, stuff->cmap,
result = dixLookupResourceByType((pointer *) &cmap, stuff->cmap,
XRT_COLORMAP, client, DixWriteAccess);
if (result != Success)
return result;

View file

@ -11,7 +11,6 @@
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);
@ -19,7 +18,7 @@ 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 int XineramaDeleteResource(pointer, XID);
extern _X_EXPORT void XineramaReinitData(void);

View file

@ -26,18 +26,12 @@ in this Software without prior written authorization from the X Consortium.
* Author: Keith Packard, MIT X Consortium
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <stdio.h>
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/extensions/saverproto.h>
#include "dix/colormap_priv.h"
#include "dix/dix_priv.h"
#include "os/osdep.h"
#include "os/screensaver.h"
#include "misc.h"
#include "os.h"
#include "windowstr.h"
@ -47,35 +41,51 @@ in this Software without prior written authorization from the X Consortium.
#include "dixstruct.h"
#include "resource.h"
#include "opaque.h"
#include <X11/extensions/saverproto.h>
#include "gcstruct.h"
#include "cursorstr.h"
#include "colormapst.h"
#include "xace.h"
#include "inputstr.h"
#ifdef XINERAMA
#ifdef PANORAMIX
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif /* XINERAMA */
#endif
#ifdef DPMSExtension
#include <X11/extensions/dpmsconst.h>
#include "dpmsproc.h"
#endif
#include "protocol-versions.h"
#include "extinit_priv.h"
// temporary workaround for win32/mingw32 name clash
// see: https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1355
#undef CreateWindow
#include <stdio.h>
#include "extinit.h"
static int ScreenSaverEventBase = 0;
static Bool ScreenSaverHandle(ScreenPtr pScreen, int xstate, Bool force);
static Bool CreateSaverWindow(ScreenPtr pScreen);
static Bool DestroySaverWindow(ScreenPtr pScreen);
static void UninstallSaverColormap(ScreenPtr pScreen);
static void CheckScreenPrivate(ScreenPtr pScreen);
static void SScreenSaverNotifyEvent(xScreenSaverNotifyEvent *from,
xScreenSaverNotifyEvent *to);
static Bool ScreenSaverHandle(ScreenPtr /* pScreen */ ,
int /* xstate */ ,
Bool /* force */
);
static Bool
CreateSaverWindow(ScreenPtr /* pScreen */
);
static Bool
DestroySaverWindow(ScreenPtr /* pScreen */
);
static void
UninstallSaverColormap(ScreenPtr /* pScreen */
);
static void
CheckScreenPrivate(ScreenPtr /* pScreen */
);
static void SScreenSaverNotifyEvent(xScreenSaverNotifyEvent * /* from */ ,
xScreenSaverNotifyEvent * /* to */
);
static RESTYPE SuspendType; /* resource type for suspension records */
@ -97,7 +107,9 @@ typedef struct _ScreenSaverSuspension {
int count;
} ScreenSaverSuspensionRec;
static int ScreenSaverFreeSuspend(void *value, XID id);
static int ScreenSaverFreeSuspend(pointer /*value */ ,
XID /* id */
);
/*
* each screen has a list of clients requesting
@ -119,14 +131,18 @@ typedef struct _ScreenSaverEvent {
CARD32 mask;
} ScreenSaverEventRec;
static int ScreenSaverFreeEvents(void * value, XID id);
static int ScreenSaverFreeEvents(pointer /* value */ ,
XID /* id */
);
static Bool setEventMask(ScreenPtr pScreen,
ClientPtr client,
unsigned long mask);
static Bool setEventMask(ScreenPtr /* pScreen */ ,
ClientPtr /* client */ ,
unsigned long /* mask */
);
static unsigned long getEventMask(ScreenPtr pScreen,
ClientPtr client);
static unsigned long getEventMask(ScreenPtr /* pScreen */ ,
ClientPtr /* client */
);
/*
* when a client sets the screen saver attributes, a resource is
@ -152,16 +168,21 @@ typedef struct _ScreenSaverAttr {
unsigned long *values;
} ScreenSaverAttrRec, *ScreenSaverAttrPtr;
static int ScreenSaverFreeAttr(void *value, XID id);
static int ScreenSaverFreeAttr(pointer /* value */ ,
XID /* id */
);
static void FreeAttrs(ScreenSaverAttrPtr pAttr);
static void FreeAttrs(ScreenSaverAttrPtr /* pAttr */
);
static void FreeScreenAttr(ScreenSaverAttrPtr pAttr);
static void FreeScreenAttr(ScreenSaverAttrPtr /* pAttr */
);
static void
SendScreenSaverNotify(ScreenPtr pScreen,
int state,
Bool forced);
SendScreenSaverNotify(ScreenPtr /* pScreen */ ,
int /* state */ ,
Bool /* forced */
);
typedef struct _ScreenSaverScreenPrivate {
ScreenSaverEventPtr events;
@ -170,7 +191,8 @@ typedef struct _ScreenSaverScreenPrivate {
Colormap installedMap;
} ScreenSaverScreenPrivateRec, *ScreenSaverScreenPrivatePtr;
static ScreenSaverScreenPrivatePtr MakeScreenPrivate(ScreenPtr pScreen);
static ScreenSaverScreenPrivatePtr MakeScreenPrivate(ScreenPtr /* pScreen */
);
static DevPrivateKeyRec ScreenPrivateKeyRec;
@ -182,6 +204,8 @@ static DevPrivateKeyRec ScreenPrivateKeyRec;
dixSetPrivate(&(s)->devPrivates, ScreenPrivateKey, v);
#define SetupScreen(s) ScreenSaverScreenPrivatePtr pPriv = (s ? GetScreenPrivate(s) : NULL)
#define New(t) (malloc(sizeof (t)))
static void
CheckScreenPrivate(ScreenPtr pScreen)
{
@ -204,7 +228,7 @@ MakeScreenPrivate(ScreenPtr pScreen)
if (pPriv)
return pPriv;
pPriv = calloc(1, sizeof(ScreenSaverScreenPrivateRec));
pPriv = New(ScreenSaverScreenPrivateRec);
if (!pPriv)
return 0;
pPriv->events = 0;
@ -254,7 +278,7 @@ setEventMask(ScreenPtr pScreen, ClientPtr client, unsigned long mask)
}
else {
if (!pEv) {
pEv = calloc(1, sizeof(ScreenSaverEventRec));
pEv = New(ScreenSaverEventRec);
if (!pEv) {
CheckScreenPrivate(pScreen);
return FALSE;
@ -264,7 +288,7 @@ setEventMask(ScreenPtr pScreen, ClientPtr client, unsigned long mask)
pEv->client = client;
pEv->screen = pScreen;
pEv->resource = FakeClientID(client->index);
if (!AddResource(pEv->resource, SaverEventType, (void *) pEv))
if (!AddResource(pEv->resource, SaverEventType, (pointer) pEv))
return FALSE;
}
pEv->mask = mask;
@ -295,7 +319,7 @@ FreeScreenAttr(ScreenSaverAttrPtr pAttr)
}
static int
ScreenSaverFreeEvents(void *value, XID id)
ScreenSaverFreeEvents(pointer value, XID id)
{
ScreenSaverEventPtr pOld = (ScreenSaverEventPtr) value;
ScreenPtr pScreen = pOld->screen;
@ -317,7 +341,7 @@ ScreenSaverFreeEvents(void *value, XID id)
}
static int
ScreenSaverFreeAttr(void *value, XID id)
ScreenSaverFreeAttr(pointer value, XID id)
{
ScreenSaverAttrPtr pOldAttr = (ScreenSaverAttrPtr) value;
ScreenPtr pScreen = pOldAttr->screen;
@ -339,7 +363,7 @@ ScreenSaverFreeAttr(void *value, XID id)
}
static int
ScreenSaverFreeSuspend(void *value, XID id)
ScreenSaverFreeSuspend(pointer value, XID id)
{
ScreenSaverSuspensionPtr data = (ScreenSaverSuspensionPtr) value;
ScreenSaverSuspensionPtr *prev, this;
@ -353,7 +377,7 @@ ScreenSaverFreeSuspend(void *value, XID id)
}
}
/* Re-enable the screensaver if this was the last client suspending it. */
/* Reenable the screensaver if this was the last client suspending it. */
if (screenSaverSuspended && suspendingClients == NULL) {
screenSaverSuspended = FALSE;
@ -368,7 +392,9 @@ ScreenSaverFreeSuspend(void *value, XID id)
DeviceIntPtr dev;
UpdateCurrentTimeIf();
nt_list_for_each_entry(dev, inputInfo.devices, next)
NoticeTime(dev, currentTime);
lastDeviceEventTime[dev->id] = currentTime;
lastDeviceEventTime[XIAllDevices] = currentTime;
lastDeviceEventTime[XIAllMasterDevices] = currentTime;
SetScreenSaverTimer();
}
}
@ -414,7 +440,7 @@ SendScreenSaverNotify(ScreenPtr pScreen, int state, Bool forced)
}
}
static void _X_COLD
static void
SScreenSaverNotifyEvent(xScreenSaverNotifyEvent * from,
xScreenSaverNotifyEvent * to)
{
@ -436,8 +462,8 @@ UninstallSaverColormap(ScreenPtr pScreen)
int rc;
if (pPriv && pPriv->installedMap != None) {
rc = dixLookupResourceByType((void **) &pCmap, pPriv->installedMap,
X11_RESTYPE_COLORMAP, serverClient,
rc = dixLookupResourceByType((pointer *) &pCmap, pPriv->installedMap,
RT_COLORMAP, serverClient,
DixUninstallAccess);
if (rc == Success)
(*pCmap->pScreen->UninstallColormap) (pCmap);
@ -455,13 +481,16 @@ CreateSaverWindow(ScreenPtr pScreen)
WindowPtr pWin;
int result;
unsigned long mask;
Colormap *installedMaps;
int numInstalled;
int i;
Colormap wantMap;
ColormapPtr pCmap;
pSaver = &pScreen->screensaver;
if (pSaver->pWindow) {
pSaver->pWindow = NullWindow;
FreeResource(pSaver->wid, X11_RESTYPE_NONE);
FreeResource(pSaver->wid, RT_NONE);
if (pPriv) {
UninstallSaverColormap(pScreen);
pPriv->hasWindow = FALSE;
@ -485,7 +514,7 @@ CreateSaverWindow(ScreenPtr pScreen)
if (!pWin)
return FALSE;
if (!AddResource(pWin->drawable.id, X11_RESTYPE_WINDOW, pWin))
if (!AddResource(pWin->drawable.id, RT_WINDOW, pWin))
return FALSE;
mask = 0;
@ -502,16 +531,15 @@ CreateSaverWindow(ScreenPtr pScreen)
mask |= CWBorderPixmap;
}
if (pAttr->pCursor) {
CursorPtr cursor;
if (!pWin->optional)
if (!MakeWindowOptional(pWin)) {
FreeResource(pWin->drawable.id, X11_RESTYPE_NONE);
FreeResource(pWin->drawable.id, RT_NONE);
return FALSE;
}
cursor = RefCursor(pAttr->pCursor);
pAttr->pCursor->refcnt++;
if (pWin->optional->cursor)
FreeCursor(pWin->optional->cursor, (Cursor) 0);
pWin->optional->cursor = cursor;
pWin->optional->cursor = pAttr->pCursor;
pWin->cursorIsNone = FALSE;
CheckWindowOptionalNeed(pWin);
mask |= CWCursor;
@ -530,10 +558,21 @@ CreateSaverWindow(ScreenPtr pScreen)
/* check and install our own colormap if it isn't installed now */
wantMap = wColormap(pWin);
if (wantMap == None || IsMapInstalled(wantMap, pWin))
if (wantMap == None)
return TRUE;
installedMaps = malloc(pScreen->maxInstalledCmaps * sizeof(Colormap));
numInstalled = (*pWin->drawable.pScreen->ListInstalledColormaps)
(pScreen, installedMaps);
for (i = 0; i < numInstalled; i++)
if (installedMaps[i] == wantMap)
break;
free((char *) installedMaps);
if (i < numInstalled)
return TRUE;
result = dixLookupResourceByType((void **) &pCmap, wantMap, X11_RESTYPE_COLORMAP,
result = dixLookupResourceByType((pointer *) &pCmap, wantMap, RT_COLORMAP,
serverClient, DixInstallAccess);
if (result != Success)
return TRUE;
@ -557,7 +596,7 @@ DestroySaverWindow(ScreenPtr pScreen)
pSaver = &pScreen->screensaver;
if (pSaver->pWindow) {
pSaver->pWindow = NullWindow;
FreeResource(pSaver->wid, X11_RESTYPE_NONE);
FreeResource(pSaver->wid, RT_NONE);
}
pPriv->hasWindow = FALSE;
CheckScreenPrivate(pScreen);
@ -588,9 +627,9 @@ ScreenSaverHandle(ScreenPtr pScreen, int xstate, Bool force)
ret = TRUE;
}
#ifdef XINERAMA
#ifdef PANORAMIX
if (noPanoramiXExtension || !pScreen->myNum)
#endif /* XINERAMA */
#endif
SendScreenSaverNotify(pScreen, state, force);
return ret;
}
@ -611,8 +650,6 @@ ProcScreenSaverQueryVersion(ClientPtr client)
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.majorVersion);
swaps(&rep.minorVersion);
}
WriteToClient(client, sizeof(xScreenSaverQueryVersionReply), &rep);
return Success;
@ -634,7 +671,8 @@ ProcScreenSaverQueryInfo(ClientPtr client)
DixGetAttrAccess);
if (rc != Success)
return rc;
rc = XaceHookScreensaverAccess(client, pDraw->pScreen, DixGetAttrAccess);
rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, pDraw->pScreen,
DixGetAttrAccess);
if (rc != Success)
return rc;
@ -642,7 +680,7 @@ ProcScreenSaverQueryInfo(ClientPtr client)
pPriv = GetScreenPrivate(pDraw->pScreen);
UpdateCurrentTime();
lastInput = GetTimeInMillis() - LastEventTime(XIAllDevices).milliseconds;
lastInput = GetTimeInMillis() - lastDeviceEventTime[XIAllDevices].milliseconds;
rep = (xScreenSaverQueryInfoReply) {
.type = X_Reply,
@ -703,7 +741,8 @@ ProcScreenSaverSelectInput(ClientPtr client)
if (rc != Success)
return rc;
rc = XaceHookScreensaverAccess(client, pDraw->pScreen, DixSetAttrAccess);
rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, pDraw->pScreen,
DixSetAttrAccess);
if (rc != Success)
return rc;
@ -713,8 +752,9 @@ ProcScreenSaverSelectInput(ClientPtr client)
}
static int
ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
ScreenSaverSetAttributes(ClientPtr client)
{
REQUEST(xScreenSaverSetAttributesReq);
DrawablePtr pDraw;
WindowPtr pParent;
ScreenPtr pScreen;
@ -737,6 +777,7 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
Colormap cmap;
ColormapPtr pCmap;
REQUEST_AT_LEAST_SIZE(xScreenSaverSetAttributesReq);
ret = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
DixGetAttrAccess);
if (ret != Success)
@ -744,11 +785,11 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
pScreen = pDraw->pScreen;
pParent = pScreen->root;
ret = XaceHookScreensaverAccess(client, pScreen, DixSetAttrAccess);
ret = XaceHook(XACE_SCREENSAVER_ACCESS, client, pScreen, DixSetAttrAccess);
if (ret != Success)
return ret;
len = client->req_len - bytes_to_int32(sizeof(xScreenSaverSetAttributesReq));
len = stuff->length - bytes_to_int32(sizeof(xScreenSaverSetAttributesReq));
if (Ones(stuff->mask) != len)
return BadLength;
if (!stuff->width || !stuff->height) {
@ -796,7 +837,7 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
if ((visual != ancwopt->visual) || (depth != pParent->drawable.depth)) {
fOK = FALSE;
for (idepth = 0; idepth < pScreen->numDepths; idepth++) {
pDepth = (DepthPtr) &pScreen->allowedDepths[idepth];
pDepth = (DepthPtr) & pScreen->allowedDepths[idepth];
if ((depth == pDepth->depth) || (depth == 0)) {
for (ivisual = 0; ivisual < pDepth->numVids; ivisual++) {
if (visual == pDepth->vids[ivisual]) {
@ -833,13 +874,13 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
if (!pPriv)
return FALSE;
}
pAttr = calloc(1, sizeof(ScreenSaverAttrRec));
pAttr = New(ScreenSaverAttrRec);
if (!pAttr) {
ret = BadAlloc;
goto bail;
}
/* over allocate for override redirect */
pAttr->values = values = xallocarray(len + 1, sizeof(unsigned long));
pAttr->values = values = malloc((len + 1) * sizeof(unsigned long));
if (!values) {
ret = BadAlloc;
goto bail;
@ -883,8 +924,8 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
}
else {
ret =
dixLookupResourceByType((void **) &pPixmap, pixID,
X11_RESTYPE_PIXMAP, client, DixReadAccess);
dixLookupResourceByType((pointer *) &pPixmap, pixID,
RT_PIXMAP, client, DixReadAccess);
if (ret == Success) {
if ((pPixmap->drawable.depth != depth) ||
(pPixmap->drawable.pScreen != pScreen)) {
@ -915,8 +956,8 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
}
else {
ret =
dixLookupResourceByType((void **) &pPixmap, pixID,
X11_RESTYPE_PIXMAP, client, DixReadAccess);
dixLookupResourceByType((pointer *) &pPixmap, pixID,
RT_PIXMAP, client, DixReadAccess);
if (ret == Success) {
if ((pPixmap->drawable.depth != depth) ||
(pPixmap->drawable.pScreen != pScreen)) {
@ -999,7 +1040,7 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
break;
case CWColormap:
cmap = (Colormap) * pVlist;
ret = dixLookupResourceByType((void **) &pCmap, cmap, X11_RESTYPE_COLORMAP,
ret = dixLookupResourceByType((pointer *) &pCmap, cmap, RT_COLORMAP,
client, DixUseAccess);
if (ret != Success) {
client->errorValue = cmap;
@ -1018,13 +1059,14 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
*values++ = None;
}
else {
ret = dixLookupResourceByType((void **) &pCursor, cursorID,
X11_RESTYPE_CURSOR, client, DixUseAccess);
ret = dixLookupResourceByType((pointer *) &pCursor, cursorID,
RT_CURSOR, client, DixUseAccess);
if (ret != Success) {
client->errorValue = cursorID;
goto PatchUp;
}
pAttr->pCursor = RefCursor(pCursor);
pCursor->refcnt++;
pAttr->pCursor = pCursor;
pAttr->mask &= ~CWCursor;
}
break;
@ -1036,10 +1078,10 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
pVlist++;
}
if (pPriv->attr)
FreeResource(pPriv->attr->resource, AttrType);
FreeScreenAttr(pPriv->attr);
pPriv->attr = pAttr;
pAttr->resource = FakeClientID(client->index);
if (!AddResource(pAttr->resource, AttrType, (void *) pAttr))
if (!AddResource(pAttr->resource, AttrType, (pointer) pAttr))
return BadAlloc;
return Success;
PatchUp:
@ -1053,13 +1095,16 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
}
static int
ScreenSaverUnsetAttributes(ClientPtr client, Drawable drawable)
ScreenSaverUnsetAttributes(ClientPtr client)
{
REQUEST(xScreenSaverSetAttributesReq);
DrawablePtr pDraw;
ScreenSaverScreenPrivatePtr pPriv;
int rc;
rc = dixLookupDrawable(&pDraw, drawable, client, 0, DixGetAttrAccess);
REQUEST_SIZE_MATCH(xScreenSaverUnsetAttributesReq);
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
DixGetAttrAccess);
if (rc != Success)
return rc;
pPriv = GetScreenPrivate(pDraw->pScreen);
@ -1075,11 +1120,9 @@ ScreenSaverUnsetAttributes(ClientPtr client, Drawable drawable)
static int
ProcScreenSaverSetAttributes(ClientPtr client)
{
REQUEST(xScreenSaverSetAttributesReq);
REQUEST_AT_LEAST_SIZE(xScreenSaverSetAttributesReq);
#ifdef XINERAMA
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
REQUEST(xScreenSaverSetAttributesReq);
PanoramiXRes *draw;
PanoramiXRes *backPix = NULL;
PanoramiXRes *bordPix = NULL;
@ -1088,13 +1131,15 @@ ProcScreenSaverSetAttributes(ClientPtr client)
int pback_offset = 0, pbord_offset = 0, cmap_offset = 0;
XID orig_visual, tmp;
status = dixLookupResourceByClass((void **) &draw, stuff->drawable,
REQUEST_AT_LEAST_SIZE(xScreenSaverSetAttributesReq);
status = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
XRC_DRAWABLE, client, DixWriteAccess);
if (status != Success)
return (status == BadValue) ? BadDrawable : status;
len =
client->req_len -
stuff->length -
bytes_to_int32(sizeof(xScreenSaverSetAttributesReq));
if (Ones(stuff->mask) != len)
return BadLength;
@ -1103,7 +1148,7 @@ ProcScreenSaverSetAttributes(ClientPtr client)
pback_offset = Ones((Mask) stuff->mask & (CWBackPixmap - 1));
tmp = *((CARD32 *) &stuff[1] + pback_offset);
if ((tmp != None) && (tmp != ParentRelative)) {
status = dixLookupResourceByType((void **) &backPix, tmp,
status = dixLookupResourceByType((pointer *) &backPix, tmp,
XRT_PIXMAP, client,
DixReadAccess);
if (status != Success)
@ -1115,7 +1160,7 @@ ProcScreenSaverSetAttributes(ClientPtr client)
pbord_offset = Ones((Mask) stuff->mask & (CWBorderPixmap - 1));
tmp = *((CARD32 *) &stuff[1] + pbord_offset);
if (tmp != CopyFromParent) {
status = dixLookupResourceByType((void **) &bordPix, tmp,
status = dixLookupResourceByType((pointer *) &bordPix, tmp,
XRT_PIXMAP, client,
DixReadAccess);
if (status != Success)
@ -1126,8 +1171,8 @@ ProcScreenSaverSetAttributes(ClientPtr client)
if ((Mask) stuff->mask & CWColormap) {
cmap_offset = Ones((Mask) stuff->mask & (CWColormap - 1));
tmp = *((CARD32 *) &stuff[1] + cmap_offset);
if (tmp != CopyFromParent) {
status = dixLookupResourceByType((void **) &cmap, tmp,
if ((tmp != CopyFromParent) && (tmp != None)) {
status = dixLookupResourceByType((pointer *) &cmap, tmp,
XRT_COLORMAP, client,
DixReadAccess);
if (status != Success)
@ -1149,83 +1194,72 @@ ProcScreenSaverSetAttributes(ClientPtr client)
if (orig_visual != CopyFromParent)
stuff->visualID = PanoramiXTranslateVisualID(i, orig_visual);
status = ScreenSaverSetAttributes(client, stuff);
status = ScreenSaverSetAttributes(client);
}
return status;
}
#endif /* XINERAMA */
#endif
return ScreenSaverSetAttributes(client, stuff);
return ScreenSaverSetAttributes(client);
}
static int
ProcScreenSaverUnsetAttributes(ClientPtr client)
{
REQUEST(xScreenSaverUnsetAttributesReq);
REQUEST_SIZE_MATCH(xScreenSaverUnsetAttributesReq);
#ifdef XINERAMA
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
REQUEST(xScreenSaverUnsetAttributesReq);
PanoramiXRes *draw;
int rc, i;
rc = dixLookupResourceByClass((void **) &draw, stuff->drawable,
rc = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
XRC_DRAWABLE, client, DixWriteAccess);
if (rc != Success)
return (rc == BadValue) ? BadDrawable : rc;
for (i = PanoramiXNumScreens - 1; i > 0; i--) {
ScreenSaverUnsetAttributes(client, draw->info[i].id);
stuff->drawable = draw->info[i].id;
ScreenSaverUnsetAttributes(client);
}
stuff->drawable = draw->info[0].id;
}
#endif /* XINERAMA */
#endif
return ScreenSaverUnsetAttributes(client, stuff->drawable);
return ScreenSaverUnsetAttributes(client);
}
static int
ProcScreenSaverSuspend(ClientPtr client)
{
ScreenSaverSuspensionPtr *prev, this;
BOOL suspend;
REQUEST(xScreenSaverSuspendReq);
REQUEST_SIZE_MATCH(xScreenSaverSuspendReq);
/*
* Old versions of XCB encode suspend as 1 byte followed by three
* pad bytes (which are always cleared), instead of a 4 byte
* value. Be compatible by just checking for a non-zero value in
* all 32-bits.
*/
suspend = stuff->suspend != 0;
/* Check if this client is suspending the screensaver */
for (prev = &suspendingClients; (this = *prev); prev = &this->next)
if (this->pClient == client)
break;
if (this) {
if (suspend == TRUE)
if (stuff->suspend == TRUE)
this->count++;
else if (--this->count == 0)
FreeResource(this->clientResource, X11_RESTYPE_NONE);
FreeResource(this->clientResource, RT_NONE);
return Success;
}
/* If we get to this point, this client isn't suspending the screensaver */
if (suspend == FALSE)
if (stuff->suspend == FALSE)
return Success;
/*
* Allocate a suspension record for the client, and stop the screensaver
* if it isn't already suspended by another client. We attach a resource ID
* to the record, so the screensaver will be re-enabled and the record freed
* to the record, so the screensaver will be reenabled and the record freed
* if the client disconnects without reenabling it first.
*/
this = malloc(sizeof(ScreenSaverSuspensionRec));
@ -1238,7 +1272,7 @@ ProcScreenSaverSuspend(ClientPtr client)
this->count = 1;
this->clientResource = FakeClientID(client->index);
if (!AddResource(this->clientResource, SuspendType, (void *) this)) {
if (!AddResource(this->clientResource, SuspendType, (pointer) this)) {
free(this);
return BadAlloc;
}
@ -1253,47 +1287,59 @@ ProcScreenSaverSuspend(ClientPtr client)
}
static int (*NormalVector[]) (ClientPtr /* client */ ) = {
ProcScreenSaverQueryVersion,
ProcScreenSaverQueryVersion,
ProcScreenSaverQueryInfo,
ProcScreenSaverSelectInput,
ProcScreenSaverSetAttributes,
ProcScreenSaverUnsetAttributes,
ProcScreenSaverSuspend,
};
ProcScreenSaverUnsetAttributes, ProcScreenSaverSuspend,};
#define NUM_REQUESTS ((sizeof NormalVector) / (sizeof NormalVector[0]))
static int
ProcScreenSaverDispatch(ClientPtr client)
{
REQUEST(xReq);
if (stuff->data < ARRAY_SIZE(NormalVector))
if (stuff->data < NUM_REQUESTS)
return (*NormalVector[stuff->data]) (client);
return BadRequest;
}
static int _X_COLD
static int
SProcScreenSaverQueryVersion(ClientPtr client)
{
REQUEST(xScreenSaverQueryVersionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xScreenSaverQueryVersionReq);
return ProcScreenSaverQueryVersion(client);
}
static int
SProcScreenSaverQueryInfo(ClientPtr client)
{
REQUEST(xScreenSaverQueryInfoReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xScreenSaverQueryInfoReq);
swapl(&stuff->drawable);
return ProcScreenSaverQueryInfo(client);
}
static int _X_COLD
static int
SProcScreenSaverSelectInput(ClientPtr client)
{
REQUEST(xScreenSaverSelectInputReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xScreenSaverSelectInputReq);
swapl(&stuff->drawable);
swapl(&stuff->eventMask);
return ProcScreenSaverSelectInput(client);
}
static int _X_COLD
static int
SProcScreenSaverSetAttributes(ClientPtr client)
{
REQUEST(xScreenSaverSetAttributesReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xScreenSaverSetAttributesReq);
swapl(&stuff->drawable);
swaps(&stuff->x);
@ -1307,39 +1353,39 @@ SProcScreenSaverSetAttributes(ClientPtr client)
return ProcScreenSaverSetAttributes(client);
}
static int _X_COLD
static int
SProcScreenSaverUnsetAttributes(ClientPtr client)
{
REQUEST(xScreenSaverUnsetAttributesReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xScreenSaverUnsetAttributesReq);
swapl(&stuff->drawable);
return ProcScreenSaverUnsetAttributes(client);
}
static int _X_COLD
static int
SProcScreenSaverSuspend(ClientPtr client)
{
REQUEST(xScreenSaverSuspendReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xScreenSaverSuspendReq);
swapl(&stuff->suspend);
return ProcScreenSaverSuspend(client);
}
static int (*SwappedVector[]) (ClientPtr /* client */ ) = {
ProcScreenSaverQueryVersion,
SProcScreenSaverQueryVersion,
SProcScreenSaverQueryInfo,
SProcScreenSaverSelectInput,
SProcScreenSaverSetAttributes,
SProcScreenSaverUnsetAttributes,
SProcScreenSaverSuspend,
};
SProcScreenSaverUnsetAttributes, SProcScreenSaverSuspend,};
static int _X_COLD
static int
SProcScreenSaverDispatch(ClientPtr client)
{
REQUEST(xReq);
if (stuff->data < ARRAY_SIZE(NormalVector))
if (stuff->data < NUM_REQUESTS)
return (*SwappedVector[stuff->data]) (client);
return BadRequest;
}

View file

@ -24,19 +24,9 @@ in this Software without prior written authorization from The Open Group.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#include <X11/Xmd.h>
#include <X11/extensions/securproto.h>
#include <X11/Xfuncproto.h>
#include "dix/dix_priv.h"
#include "dix/registry_priv.h"
#include "include/extinit_priv.h"
#include "os/audit.h"
#include "os/auth.h"
#include "os/client_priv.h"
#include "os/osdep.h"
#endif
#include "scrnintstr.h"
#include "inputstr.h"
@ -44,8 +34,10 @@ in this Software without prior written authorization from The Open Group.
#include "propertyst.h"
#include "colormapst.h"
#include "privates.h"
#include "registry.h"
#include "xacestr.h"
#include "securitysrv.h"
#include <X11/extensions/securproto.h>
#include "extinit.h"
#include "protocol-versions.h"
@ -65,16 +57,16 @@ static DevPrivateKeyRec stateKeyRec;
/* This is what we store as client security state */
typedef struct {
unsigned int haveState :1;
unsigned int live :1;
unsigned int trustLevel :2;
int haveState;
unsigned int trustLevel;
XID authId;
} SecurityStateRec;
/* The only extensions that untrusted clients have access to */
/* Extensions that untrusted clients shouldn't have access to */
static const char *SecurityTrustedExtensions[] = {
"XC-MISC",
"BIG-REQUESTS",
"XpExtension",
NULL
};
@ -149,13 +141,12 @@ SecurityLabelInitial(void)
state = dixLookupPrivate(&serverClient->devPrivates, stateKey);
state->trustLevel = XSecurityClientTrusted;
state->haveState = TRUE;
state->live = FALSE;
}
/*
* Looks up a request name
*/
static inline const char *
static _X_INLINE const char *
SecurityLookupRequestName(ClientPtr client)
{
return LookupRequestName(client->majorOp, client->minorOp);
@ -174,7 +165,7 @@ SecurityLookupRequestName(ClientPtr client)
*/
static int
SecurityDeleteAuthorization(void *value, XID id)
SecurityDeleteAuthorization(pointer value, XID id)
{
SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr) value;
unsigned short name_len, data_len;
@ -206,7 +197,7 @@ SecurityDeleteAuthorization(void *value, XID id)
.authId = pAuth->id
};
WriteEventsToClient(rClient(pEventClient), 1, (xEvent *) &are);
FreeResource(pEventClient->resource, X11_RESTYPE_NONE);
FreeResource(pEventClient->resource, RT_NONE);
}
/* kill all clients using this auth */
@ -220,7 +211,7 @@ SecurityDeleteAuthorization(void *value, XID id)
CloseDownClient(clients[i]);
}
SecurityAudit("revoked authorization ID %lu\n", (unsigned long)pAuth->id);
SecurityAudit("revoked authorization ID %d\n", pAuth->id);
free(pAuth);
return Success;
@ -228,7 +219,7 @@ SecurityDeleteAuthorization(void *value, XID id)
/* resource delete function for RTEventClient */
static int
SecurityDeleteAuthorizationEventClient(void *value, XID id)
SecurityDeleteAuthorizationEventClient(pointer value, XID id)
{
OtherClientsPtr pEventClient, prev = NULL;
SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr) value;
@ -301,7 +292,7 @@ SecurityComputeAuthorizationTimeout(SecurityAuthorizationPtr pAuth,
*/
static CARD32
SecurityAuthorizationExpired(OsTimerPtr timer, CARD32 time, void *pval)
SecurityAuthorizationExpired(OsTimerPtr timer, CARD32 time, pointer pval)
{
SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr) pval;
@ -312,7 +303,7 @@ SecurityAuthorizationExpired(OsTimerPtr timer, CARD32 time, void *pval)
pAuth->secondsRemaining);
}
else {
FreeResource(pAuth->id, X11_RESTYPE_NONE);
FreeResource(pAuth->id, RT_NONE);
return 0;
}
} /* SecurityAuthorizationExpired */
@ -376,7 +367,7 @@ SecurityEventSelectForAuthorization(SecurityAuthorizationPtr pAuth,
pEventClient; pEventClient = pEventClient->next) {
if (SameClient(pEventClient, client)) {
if (mask == 0)
FreeResource(pEventClient->resource, X11_RESTYPE_NONE);
FreeResource(pEventClient->resource, RT_NONE);
else
pEventClient->mask = mask;
return Success;
@ -389,7 +380,7 @@ SecurityEventSelectForAuthorization(SecurityAuthorizationPtr pAuth,
pEventClient->mask = mask;
pEventClient->resource = FakeClientID(client->index);
pEventClient->next = pAuth->eventClients;
if (!AddResource(pEventClient->resource, RTEventClient, (void *) pAuth)) {
if (!AddResource(pEventClient->resource, RTEventClient, (pointer) pAuth)) {
free(pEventClient);
return BadAlloc;
}
@ -461,7 +452,7 @@ ProcSecurityGenerateAuthorization(ClientPtr client)
vgi.group = group;
vgi.valid = FALSE;
CallCallbacks(&SecurityValidateGroupCallback, (void *) &vgi);
CallCallbacks(&SecurityValidateGroupCallback, (pointer) &vgi);
/* if nobody said they recognized it, it's an error */
@ -557,9 +548,9 @@ ProcSecurityGenerateAuthorization(ClientPtr client)
WriteToClient(client, authdata_len, pAuthdata);
SecurityAudit
("client %d generated authorization %lu trust %d timeout %lu group %lu events %lu\n",
client->index, (unsigned long)pAuth->id, pAuth->trustLevel, (unsigned long)pAuth->timeout,
(unsigned long)pAuth->group, (unsigned long)eventMask);
("client %d generated authorization %d trust %d timeout %d group %d events %d\n",
client->index, pAuth->id, pAuth->trustLevel, pAuth->timeout,
pAuth->group, eventMask);
/* the request succeeded; don't call RemoveAuthorization or free pAuth */
return Success;
@ -582,13 +573,13 @@ ProcSecurityRevokeAuthorization(ClientPtr client)
REQUEST_SIZE_MATCH(xSecurityRevokeAuthorizationReq);
rc = dixLookupResourceByType((void **) &pAuth, stuff->authId,
rc = dixLookupResourceByType((pointer *) &pAuth, stuff->authId,
SecurityAuthorizationResType, client,
DixDestroyAccess);
if (rc != Success)
return rc;
FreeResource(stuff->authId, X11_RESTYPE_NONE);
FreeResource(stuff->authId, RT_NONE);
return Success;
} /* ProcSecurityRevokeAuthorization */
@ -609,23 +600,27 @@ ProcSecurityDispatch(ClientPtr client)
}
} /* ProcSecurityDispatch */
static int _X_COLD
static int
SProcSecurityQueryVersion(ClientPtr client)
{
REQUEST(xSecurityQueryVersionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSecurityQueryVersionReq);
swaps(&stuff->majorVersion);
swaps(&stuff->minorVersion);
return ProcSecurityQueryVersion(client);
} /* SProcSecurityQueryVersion */
static int _X_COLD
static int
SProcSecurityGenerateAuthorization(ClientPtr client)
{
REQUEST(xSecurityGenerateAuthorizationReq);
CARD32 *values;
unsigned long nvalues;
int values_offset;
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xSecurityGenerateAuthorizationReq);
swaps(&stuff->nbytesAuthProto);
swaps(&stuff->nbytesAuthData);
@ -633,24 +628,26 @@ SProcSecurityGenerateAuthorization(ClientPtr client)
values_offset = bytes_to_int32(stuff->nbytesAuthProto) +
bytes_to_int32(stuff->nbytesAuthData);
if (values_offset >
client->req_len - bytes_to_int32(sz_xSecurityGenerateAuthorizationReq))
stuff->length - bytes_to_int32(sz_xSecurityGenerateAuthorizationReq))
return BadLength;
values = (CARD32 *) (&stuff[1]) + values_offset;
nvalues = (((CARD32 *) stuff) + client->req_len) - values;
nvalues = (((CARD32 *) stuff) + stuff->length) - values;
SwapLongs(values, nvalues);
return ProcSecurityGenerateAuthorization(client);
} /* SProcSecurityGenerateAuthorization */
static int _X_COLD
static int
SProcSecurityRevokeAuthorization(ClientPtr client)
{
REQUEST(xSecurityRevokeAuthorizationReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSecurityRevokeAuthorizationReq);
swapl(&stuff->authId);
return ProcSecurityRevokeAuthorization(client);
} /* SProcSecurityRevokeAuthorization */
static int _X_COLD
static int
SProcSecurityDispatch(ClientPtr client)
{
REQUEST(xReq);
@ -667,7 +664,7 @@ SProcSecurityDispatch(ClientPtr client)
}
} /* SProcSecurityDispatch */
static void _X_COLD
static void
SwapSecurityAuthorizationRevokedEvent(xSecurityAuthorizationRevokedEvent * from,
xSecurityAuthorizationRevokedEvent * to)
{
@ -694,7 +691,7 @@ SwapSecurityAuthorizationRevokedEvent(xSecurityAuthorizationRevokedEvent * from,
*/
static void
SecurityDevice(CallbackListPtr *pcbl, void *unused, void *calldata)
SecurityDevice(CallbackListPtr *pcbl, pointer unused, pointer calldata)
{
XaceDeviceAccessRec *rec = calldata;
SecurityStateRec *subj, *obj;
@ -738,7 +735,7 @@ SecurityDevice(CallbackListPtr *pcbl, void *unused, void *calldata)
*/
static void
SecurityResource(CallbackListPtr *pcbl, void *unused, void *calldata)
SecurityResource(CallbackListPtr *pcbl, pointer unused, pointer calldata)
{
XaceResourceAccessRec *rec = calldata;
SecurityStateRec *subj, *obj;
@ -749,12 +746,12 @@ SecurityResource(CallbackListPtr *pcbl, void *unused, void *calldata)
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
/* disable background None for untrusted windows */
if ((requested & DixCreateAccess) && (rec->rtype == X11_RESTYPE_WINDOW))
if ((requested & DixCreateAccess) && (rec->rtype == RT_WINDOW))
if (subj->haveState && subj->trustLevel != XSecurityClientTrusted)
((WindowPtr) rec->res)->forcedBG = TRUE;
/* additional permissions for specific resource types */
if (rec->rtype == X11_RESTYPE_WINDOW)
if (rec->rtype == RT_WINDOW)
allowed |= SecurityWindowExtraMask;
/* special checks for server-owned resources */
@ -763,7 +760,7 @@ SecurityResource(CallbackListPtr *pcbl, void *unused, void *calldata)
/* additional operations allowed on root windows */
allowed |= SecurityRootWindowExtraMask;
else if (rec->rtype == X11_RESTYPE_COLORMAP)
else if (rec->rtype == RT_COLORMAP)
/* allow access to default colormaps */
allowed = requested;
@ -778,15 +775,15 @@ SecurityResource(CallbackListPtr *pcbl, void *unused, void *calldata)
return;
}
SecurityAudit("Security: denied client %d access %lx to resource 0x%lx "
SecurityAudit("Security: denied client %d access %x to resource 0x%x "
"of client %d on request %s\n", rec->client->index,
(unsigned long)requested, (unsigned long)rec->id, cid,
requested, rec->id, cid,
SecurityLookupRequestName(rec->client));
rec->status = BadAccess; /* deny access */
}
static void
SecurityExtension(CallbackListPtr *pcbl, void *unused, void *calldata)
SecurityExtension(CallbackListPtr *pcbl, pointer unused, pointer calldata)
{
XaceExtAccessRec *rec = calldata;
SecurityStateRec *subj;
@ -809,7 +806,7 @@ SecurityExtension(CallbackListPtr *pcbl, void *unused, void *calldata)
}
static void
SecurityServer(CallbackListPtr *pcbl, void *unused, void *calldata)
SecurityServer(CallbackListPtr *pcbl, pointer unused, pointer calldata)
{
XaceServerAccessRec *rec = calldata;
SecurityStateRec *subj, *obj;
@ -828,7 +825,7 @@ SecurityServer(CallbackListPtr *pcbl, void *unused, void *calldata)
}
static void
SecurityClient(CallbackListPtr *pcbl, void *unused, void *calldata)
SecurityClient(CallbackListPtr *pcbl, pointer unused, pointer calldata)
{
XaceClientAccessRec *rec = calldata;
SecurityStateRec *subj, *obj;
@ -847,7 +844,7 @@ SecurityClient(CallbackListPtr *pcbl, void *unused, void *calldata)
}
static void
SecurityProperty(CallbackListPtr *pcbl, void *unused, void *calldata)
SecurityProperty(CallbackListPtr *pcbl, pointer unused, pointer calldata)
{
XacePropertyAccessRec *rec = calldata;
SecurityStateRec *subj, *obj;
@ -860,16 +857,16 @@ SecurityProperty(CallbackListPtr *pcbl, void *unused, void *calldata)
if (SecurityDoCheck(subj, obj, requested, allowed) != Success) {
SecurityAudit("Security: denied client %d access to property %s "
"(atom 0x%x) window 0x%lx of client %d on request %s\n",
"(atom 0x%x) window 0x%x of client %d on request %s\n",
rec->client->index, NameForAtom(name), name,
(unsigned long)rec->pWin->drawable.id, wClient(rec->pWin)->index,
rec->pWin->drawable.id, wClient(rec->pWin)->index,
SecurityLookupRequestName(rec->client));
rec->status = BadAccess;
}
}
static void
SecuritySend(CallbackListPtr *pcbl, void *unused, void *calldata)
SecuritySend(CallbackListPtr *pcbl, pointer unused, pointer calldata)
{
XaceSendAccessRec *rec = calldata;
SecurityStateRec *subj, *obj;
@ -889,10 +886,10 @@ SecuritySend(CallbackListPtr *pcbl, void *unused, void *calldata)
rec->events[i].u.u.type != ClientMessage) {
SecurityAudit("Security: denied client %d from sending event "
"of type %s to window 0x%lx of client %d\n",
"of type %s to window 0x%x of client %d\n",
rec->client->index,
LookupEventName(rec->events[i].u.u.type),
(unsigned long)rec->pWin->drawable.id,
rec->pWin->drawable.id,
wClient(rec->pWin)->index);
rec->status = BadAccess;
return;
@ -901,7 +898,7 @@ SecuritySend(CallbackListPtr *pcbl, void *unused, void *calldata)
}
static void
SecurityReceive(CallbackListPtr *pcbl, void *unused, void *calldata)
SecurityReceive(CallbackListPtr *pcbl, pointer unused, pointer calldata)
{
XaceReceiveAccessRec *rec = calldata;
SecurityStateRec *subj, *obj;
@ -913,8 +910,8 @@ SecurityReceive(CallbackListPtr *pcbl, void *unused, void *calldata)
return;
SecurityAudit("Security: denied client %d from receiving an event "
"sent to window 0x%lx of client %d\n",
rec->client->index, (unsigned long)rec->pWin->drawable.id,
"sent to window 0x%x of client %d\n",
rec->client->index, rec->pWin->drawable.id,
wClient(rec->pWin)->index);
rec->status = BadAccess;
}
@ -930,19 +927,19 @@ SecurityReceive(CallbackListPtr *pcbl, void *unused, void *calldata)
* Returns: nothing.
*
* Side Effects:
*
*
* If a new client is connecting, its authorization ID is copied to
* client->authID. If this is a generated authorization, its reference
* count is bumped, its timer is cancelled if it was running, and its
* trustlevel is copied to TRUSTLEVEL(client).
*
*
* If a client is disconnecting and the client was using a generated
* authorization, the authorization's reference count is decremented, and
* if it is now zero, the timer for this authorization is started.
*/
static void
SecurityClientState(CallbackListPtr *pcbl, void *unused, void *calldata)
SecurityClientState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
{
NewClientInfoRec *pci = calldata;
SecurityStateRec *state;
@ -956,18 +953,16 @@ SecurityClientState(CallbackListPtr *pcbl, void *unused, void *calldata)
state->trustLevel = XSecurityClientTrusted;
state->authId = None;
state->haveState = TRUE;
state->live = FALSE;
break;
case ClientStateRunning:
state->authId = AuthorizationIDOfClient(pci->client);
rc = dixLookupResourceByType((void **) &pAuth, state->authId,
rc = dixLookupResourceByType((pointer *) &pAuth, state->authId,
SecurityAuthorizationResType, serverClient,
DixGetAttrAccess);
if (rc == Success) {
/* it is a generated authorization */
pAuth->refcnt++;
state->live = TRUE;
if (pAuth->refcnt == 1 && pAuth->timer)
TimerCancel(pAuth->timer);
@ -977,13 +972,12 @@ SecurityClientState(CallbackListPtr *pcbl, void *unused, void *calldata)
case ClientStateGone:
case ClientStateRetained:
rc = dixLookupResourceByType((void **) &pAuth, state->authId,
rc = dixLookupResourceByType((pointer *) &pAuth, state->authId,
SecurityAuthorizationResType, serverClient,
DixGetAttrAccess);
if (rc == Success && state->live) {
if (rc == Success) {
/* it is a generated authorization */
pAuth->refcnt--;
state->live = FALSE;
if (pAuth->refcnt == 0)
SecurityStartAuthorizationTimer(pAuth);
}

View file

@ -30,8 +30,27 @@ from The Open Group.
#ifndef _SECURITY_SRV_H
#define _SECURITY_SRV_H
/* Allow client side portions of <X11/extensions/security.h> to compile */
#ifndef Status
#define Status int
#define NEED_UNDEF_Status
#endif
#ifndef Display
#define Display void
#define NEED_UNDEF_Display
#endif
#include <X11/extensions/secur.h>
#ifdef NEED_UNDEF_Status
#undef Status
#undef NEED_UNDEF_Status
#endif
#ifdef 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 */

View file

@ -24,16 +24,14 @@ in this Software without prior written authorization from The Open Group.
********************************************************/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <stdlib.h>
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/extensions/shapeproto.h>
#include "dix/dix_priv.h"
#include "dix/gc_priv.h"
#include "misc.h"
#include "os.h"
#include "windowstr.h"
@ -43,19 +41,20 @@ in this Software without prior written authorization from The Open Group.
#include "dixstruct.h"
#include "resource.h"
#include "opaque.h"
#include <X11/extensions/shapeproto.h>
#include "regionstr.h"
#include "gcstruct.h"
#include "extinit_priv.h"
#include "extinit.h"
#include "protocol-versions.h"
typedef RegionPtr (*CreateDftPtr) (WindowPtr /* pWin */
);
static int ShapeFreeClient(void * /* data */ ,
XID /* id */
static int ShapeFreeClient(pointer /* data */ ,
XID /* id */
);
static int ShapeFreeEvents(void * /* data */ ,
XID /* id */
static int ShapeFreeEvents(pointer /* data */ ,
XID /* id */
);
static void SShapeNotifyEvent(xShapeNotifyEvent * /* from */ ,
xShapeNotifyEvent * /* to */
@ -65,10 +64,10 @@ static void SShapeNotifyEvent(xShapeNotifyEvent * /* from */ ,
* externally by the Xfixes extension and are now defined in window.h
*/
#ifdef XINERAMA
#ifdef PANORAMIX
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif /* XINERAMA */
#endif
static int ShapeEventBase = 0;
static RESTYPE ClientType, ShapeEventType; /* resource types for event masks */
@ -266,7 +265,7 @@ ProcShapeRectangles(ClientPtr client)
client->errorValue = stuff->ordering;
return BadValue;
}
nrects = ((client->req_len << 2) - sizeof(xShapeRectanglesReq));
nrects = ((stuff->length << 2) - sizeof(xShapeRectanglesReq));
if (nrects & 4)
return BadLength;
nrects >>= 3;
@ -297,7 +296,7 @@ ProcShapeRectangles(ClientPtr client)
stuff->xOff, stuff->yOff, createDefault);
}
#ifdef XINERAMA
#ifdef PANORAMIX
static int
ProcPanoramiXShapeRectangles(ClientPtr client)
{
@ -307,7 +306,7 @@ ProcPanoramiXShapeRectangles(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xShapeRectanglesReq);
result = dixLookupResourceByType((void **) &win, stuff->dest, XRT_WINDOW,
result = dixLookupResourceByType((pointer *) &win, stuff->dest, XRT_WINDOW,
client, DixWriteAccess);
if (result != Success)
return result;
@ -320,7 +319,7 @@ ProcPanoramiXShapeRectangles(ClientPtr client)
}
return result;
}
#endif /* XINERAMA */
#endif
/**************
* ProcShapeMask
@ -362,8 +361,8 @@ ProcShapeMask(ClientPtr client)
if (stuff->src == None)
srcRgn = 0;
else {
rc = dixLookupResourceByType((void **) &pPixmap, stuff->src,
X11_RESTYPE_PIXMAP, client, DixReadAccess);
rc = dixLookupResourceByType((pointer *) &pPixmap, stuff->src,
RT_PIXMAP, client, DixReadAccess);
if (rc != Success)
return rc;
if (pPixmap->drawable.pScreen != pScreen ||
@ -395,7 +394,7 @@ ProcShapeMask(ClientPtr client)
stuff->xOff, stuff->yOff, createDefault);
}
#ifdef XINERAMA
#ifdef PANORAMIX
static int
ProcPanoramiXShapeMask(ClientPtr client)
{
@ -405,13 +404,13 @@ ProcPanoramiXShapeMask(ClientPtr client)
REQUEST_SIZE_MATCH(xShapeMaskReq);
result = dixLookupResourceByType((void **) &win, stuff->dest, XRT_WINDOW,
result = dixLookupResourceByType((pointer *) &win, stuff->dest, XRT_WINDOW,
client, DixWriteAccess);
if (result != Success)
return result;
if (stuff->src != None) {
result = dixLookupResourceByType((void **) &pmap, stuff->src,
result = dixLookupResourceByType((pointer *) &pmap, stuff->src,
XRT_PIXMAP, client, DixReadAccess);
if (result != Success)
return result;
@ -429,7 +428,7 @@ ProcPanoramiXShapeMask(ClientPtr client)
}
return result;
}
#endif /* XINERAMA */
#endif
/************
* ProcShapeCombine
@ -523,7 +522,7 @@ ProcShapeCombine(ClientPtr client)
stuff->xOff, stuff->yOff, createDefault);
}
#ifdef XINERAMA
#ifdef PANORAMIX
static int
ProcPanoramiXShapeCombine(ClientPtr client)
{
@ -533,12 +532,12 @@ ProcPanoramiXShapeCombine(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xShapeCombineReq);
result = dixLookupResourceByType((void **) &win, stuff->dest, XRT_WINDOW,
result = dixLookupResourceByType((pointer *) &win, stuff->dest, XRT_WINDOW,
client, DixWriteAccess);
if (result != Success)
return result;
result = dixLookupResourceByType((void **) &win2, stuff->src, XRT_WINDOW,
result = dixLookupResourceByType((pointer *) &win2, stuff->src, XRT_WINDOW,
client, DixReadAccess);
if (result != Success)
return result;
@ -552,7 +551,7 @@ ProcPanoramiXShapeCombine(ClientPtr client)
}
return result;
}
#endif /* XINERAMA */
#endif
/*************
* ProcShapeOffset
@ -594,7 +593,7 @@ ProcShapeOffset(ClientPtr client)
return Success;
}
#ifdef XINERAMA
#ifdef PANORAMIX
static int
ProcPanoramiXShapeOffset(ClientPtr client)
{
@ -604,7 +603,7 @@ ProcPanoramiXShapeOffset(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xShapeOffsetReq);
result = dixLookupResourceByType((void **) &win, stuff->dest, XRT_WINDOW,
result = dixLookupResourceByType((pointer *) &win, stuff->dest, XRT_WINDOW,
client, DixWriteAccess);
if (result != Success)
return result;
@ -617,7 +616,7 @@ ProcPanoramiXShapeOffset(ClientPtr client)
}
return result;
}
#endif /* XINERAMA */
#endif
static int
ProcShapeQueryExtents(ClientPtr client)
@ -687,7 +686,7 @@ ProcShapeQueryExtents(ClientPtr client)
}
/*ARGSUSED*/ static int
ShapeFreeClient(void *data, XID id)
ShapeFreeClient(pointer data, XID id)
{
ShapeEventPtr pShapeEvent;
WindowPtr pWin;
@ -696,7 +695,7 @@ ShapeFreeClient(void *data, XID id)
pShapeEvent = (ShapeEventPtr) data;
pWin = pShapeEvent->window;
rc = dixLookupResourceByType((void **) &pHead, pWin->drawable.id,
rc = dixLookupResourceByType((pointer *) &pHead, pWin->drawable.id,
ShapeEventType, serverClient, DixReadAccess);
if (rc == Success) {
pPrev = 0;
@ -709,12 +708,12 @@ ShapeFreeClient(void *data, XID id)
*pHead = pShapeEvent->next;
}
}
free((void *) pShapeEvent);
free((pointer) pShapeEvent);
return 1;
}
/*ARGSUSED*/ static int
ShapeFreeEvents(void *data, XID id)
ShapeFreeEvents(pointer data, XID id)
{
ShapeEventPtr *pHead, pCur, pNext;
@ -722,9 +721,9 @@ ShapeFreeEvents(void *data, XID id)
for (pCur = *pHead; pCur; pCur = pNext) {
pNext = pCur->next;
FreeResource(pCur->clientResource, ClientType);
free((void *) pCur);
free((pointer) pCur);
}
free((void *) pHead);
free((pointer) pHead);
return 1;
}
@ -741,7 +740,7 @@ ProcShapeSelectInput(ClientPtr client)
rc = dixLookupWindow(&pWin, stuff->window, client, DixReceiveAccess);
if (rc != Success)
return rc;
rc = dixLookupResourceByType((void **) &pHead, pWin->drawable.id,
rc = dixLookupResourceByType((pointer *) &pHead, pWin->drawable.id,
ShapeEventType, client, DixWriteAccess);
if (rc != Success && rc != BadValue)
return rc;
@ -771,10 +770,10 @@ ProcShapeSelectInput(ClientPtr client)
*/
clientResource = FakeClientID(client->index);
pNewShapeEvent->clientResource = clientResource;
if (!AddResource(clientResource, ClientType, (void *) pNewShapeEvent))
if (!AddResource(clientResource, ClientType, (pointer) pNewShapeEvent))
return BadAlloc;
/*
* create a resource to contain a void *to the list
* create a resource to contain a pointer to the list
* of clients selecting input. This must be indirect as
* the list may be arbitrarily rearranged which cannot be
* done through the resource database.
@ -783,8 +782,8 @@ ProcShapeSelectInput(ClientPtr client)
pHead = malloc(sizeof(ShapeEventPtr));
if (!pHead ||
!AddResource(pWin->drawable.id, ShapeEventType,
(void *) pHead)) {
FreeResource(clientResource, X11_RESTYPE_NONE);
(pointer) pHead)) {
FreeResource(clientResource, RT_NONE);
return BadAlloc;
}
*pHead = 0;
@ -832,7 +831,7 @@ SendShapeNotify(WindowPtr pWin, int which)
BYTE shaped;
int rc;
rc = dixLookupResourceByType((void **) &pHead, pWin->drawable.id,
rc = dixLookupResourceByType((pointer *) &pHead, pWin->drawable.id,
ShapeEventType, serverClient, DixReadAccess);
if (rc != Success)
return;
@ -882,7 +881,6 @@ SendShapeNotify(WindowPtr pWin, int which)
default:
return;
}
UpdateCurrentTimeIf();
for (pShapeEvent = *pHead; pShapeEvent; pShapeEvent = pShapeEvent->next) {
xShapeNotifyEvent se = {
.type = ShapeNotify + ShapeEventBase,
@ -912,7 +910,7 @@ ProcShapeInputSelected(ClientPtr client)
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
return rc;
rc = dixLookupResourceByType((void **) &pHead, pWin->drawable.id,
rc = dixLookupResourceByType((pointer *) &pHead, pWin->drawable.id,
ShapeEventType, client, DixReadAccess);
if (rc != Success && rc != BadValue)
return rc;
@ -998,7 +996,7 @@ ProcShapeGetRectangles(ClientPtr client)
nrects = RegionNumRects(region);
box = RegionRects(region);
rects = xallocarray(nrects, sizeof(xRectangle));
rects = malloc(nrects * sizeof(xRectangle));
if (!rects && nrects)
return BadAlloc;
for (i = 0; i < nrects; i++, box++) {
@ -1035,32 +1033,32 @@ ProcShapeDispatch(ClientPtr client)
case X_ShapeQueryVersion:
return ProcShapeQueryVersion(client);
case X_ShapeRectangles:
#ifdef XINERAMA
#ifdef PANORAMIX
if (!noPanoramiXExtension)
return ProcPanoramiXShapeRectangles(client);
else
#endif /* XINERAMA */
#endif
return ProcShapeRectangles(client);
case X_ShapeMask:
#ifdef XINERAMA
#ifdef PANORAMIX
if (!noPanoramiXExtension)
return ProcPanoramiXShapeMask(client);
else
#endif /* XINERAMA */
#endif
return ProcShapeMask(client);
case X_ShapeCombine:
#ifdef XINERAMA
#ifdef PANORAMIX
if (!noPanoramiXExtension)
return ProcPanoramiXShapeCombine(client);
else
#endif /* XINERAMA */
#endif
return ProcShapeCombine(client);
case X_ShapeOffset:
#ifdef XINERAMA
#ifdef PANORAMIX
if (!noPanoramiXExtension)
return ProcPanoramiXShapeOffset(client);
else
#endif /* XINERAMA */
#endif
return ProcShapeOffset(client);
case X_ShapeQueryExtents:
return ProcShapeQueryExtents(client);
@ -1075,7 +1073,7 @@ ProcShapeDispatch(ClientPtr client)
}
}
static void _X_COLD
static void
SShapeNotifyEvent(xShapeNotifyEvent * from, xShapeNotifyEvent * to)
{
to->type = from->type;
@ -1090,10 +1088,21 @@ SShapeNotifyEvent(xShapeNotifyEvent * from, xShapeNotifyEvent * to)
to->shaped = from->shaped;
}
static int _X_COLD
static int
SProcShapeQueryVersion(ClientPtr client)
{
REQUEST(xShapeQueryVersionReq);
swaps(&stuff->length);
return ProcShapeQueryVersion(client);
}
static int
SProcShapeRectangles(ClientPtr client)
{
REQUEST(xShapeRectanglesReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xShapeRectanglesReq);
swapl(&stuff->dest);
swaps(&stuff->xOff);
@ -1102,10 +1111,12 @@ SProcShapeRectangles(ClientPtr client)
return ProcShapeRectangles(client);
}
static int _X_COLD
static int
SProcShapeMask(ClientPtr client)
{
REQUEST(xShapeMaskReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShapeMaskReq);
swapl(&stuff->dest);
swaps(&stuff->xOff);
@ -1114,10 +1125,12 @@ SProcShapeMask(ClientPtr client)
return ProcShapeMask(client);
}
static int _X_COLD
static int
SProcShapeCombine(ClientPtr client)
{
REQUEST(xShapeCombineReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShapeCombineReq);
swapl(&stuff->dest);
swaps(&stuff->xOff);
@ -1126,10 +1139,12 @@ SProcShapeCombine(ClientPtr client)
return ProcShapeCombine(client);
}
static int _X_COLD
static int
SProcShapeOffset(ClientPtr client)
{
REQUEST(xShapeOffsetReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShapeOffsetReq);
swapl(&stuff->dest);
swaps(&stuff->xOff);
@ -1137,49 +1152,56 @@ SProcShapeOffset(ClientPtr client)
return ProcShapeOffset(client);
}
static int _X_COLD
static int
SProcShapeQueryExtents(ClientPtr client)
{
REQUEST(xShapeQueryExtentsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShapeQueryExtentsReq);
swapl(&stuff->window);
return ProcShapeQueryExtents(client);
}
static int _X_COLD
static int
SProcShapeSelectInput(ClientPtr client)
{
REQUEST(xShapeSelectInputReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShapeSelectInputReq);
swapl(&stuff->window);
return ProcShapeSelectInput(client);
}
static int _X_COLD
static int
SProcShapeInputSelected(ClientPtr client)
{
REQUEST(xShapeInputSelectedReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShapeInputSelectedReq);
swapl(&stuff->window);
return ProcShapeInputSelected(client);
}
static int _X_COLD
static int
SProcShapeGetRectangles(ClientPtr client)
{
REQUEST(xShapeGetRectanglesReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShapeGetRectanglesReq);
swapl(&stuff->window);
return ProcShapeGetRectangles(client);
}
static int _X_COLD
static int
SProcShapeDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
case X_ShapeQueryVersion:
return ProcShapeQueryVersion(client);
return SProcShapeQueryVersion(client);
case X_ShapeRectangles:
return SProcShapeRectangles(client);
case X_ShapeMask:

View file

@ -28,29 +28,20 @@ in this Software without prior written authorization from The Open Group.
#define SHM
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/mman.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/extensions/shmproto.h>
#include <X11/Xfuncproto.h>
#include "dix/dix_priv.h"
#include "os/auth.h"
#include "os/busfault.h"
#include "os/client_priv.h"
#include "os/osdep.h"
#include "misc.h"
#include "os.h"
#include "dixstruct_priv.h"
#include "dixstruct.h"
#include "resource.h"
#include "scrnintstr.h"
#include "windowstr.h"
@ -60,7 +51,8 @@ in this Software without prior written authorization from The Open Group.
#include "servermd.h"
#include "shmint.h"
#include "xace.h"
#include "extinit_priv.h"
#include <X11/extensions/shmproto.h>
#include <X11/Xfuncproto.h>
#include "protocol-versions.h"
/* Needed for Solaris cross-zone shared memory extension */
@ -90,10 +82,21 @@ in this Software without prior written authorization from The Open Group.
#define SHMPERM_MODE(p) p->mode
#endif
#ifdef XINERAMA
#ifdef PANORAMIX
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif /* XINERAMA */
#endif
#include "extinit.h"
typedef struct _ShmDesc {
struct _ShmDesc *next;
int shmid;
int refcnt;
char *addr;
Bool writable;
unsigned long size;
} ShmDescRec, *ShmDescPtr;
typedef struct _ShmScrPrivateRec {
CloseScreenProcPtr CloseScreen;
@ -102,10 +105,14 @@ typedef struct _ShmScrPrivateRec {
} ShmScrPrivateRec;
static PixmapPtr fbShmCreatePixmap(XSHM_CREATE_PIXMAP_ARGS);
static int ShmDetachSegment(void *value, XID shmseg);
static void ShmResetProc(ExtensionEntry *extEntry);
static void SShmCompletionEvent(xShmCompletionEvent *from,
xShmCompletionEvent *to);
static int ShmDetachSegment(pointer /* value */ ,
XID /* shmseg */
);
static void ShmResetProc(ExtensionEntry * /* extEntry */
);
static void SShmCompletionEvent(xShmCompletionEvent * /* from */ ,
xShmCompletionEvent * /* to */
);
static Bool ShmDestroyPixmap(PixmapPtr pPixmap);
@ -128,11 +135,11 @@ static ShmFuncs fbFuncs = { fbShmCreatePixmap, NULL };
#define VERIFY_SHMSEG(shmseg,shmdesc,client) \
{ \
int tmprc; \
tmprc = dixLookupResourceByType((void **)&(shmdesc), shmseg, ShmSegType, \
client, DixReadAccess); \
if (tmprc != Success) \
return tmprc; \
int rc; \
rc = dixLookupResourceByType((pointer *)&(shmdesc), shmseg, ShmSegType, \
client, DixReadAccess); \
if (rc != Success) \
return rc; \
}
#define VERIFY_SHMPTR(shmseg,offset,needwrite,shmdesc,client) \
@ -156,6 +163,7 @@ static ShmFuncs fbFuncs = { fbShmCreatePixmap, NULL };
}
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__) || defined(__DragonFly__)
#include <sys/signal.h>
static Bool badSysCall = FALSE;
@ -172,7 +180,7 @@ CheckForShmSyscall(void)
int shmid = -1;
/* If no SHM support in the kernel, the bad syscall will generate SIGSYS */
oldHandler = OsSignal(SIGSYS, SigSysHandler);
oldHandler = signal(SIGSYS, SigSysHandler);
badSysCall = FALSE;
shmid = shmget(IPC_PRIVATE, 4096, IPC_CREAT);
@ -185,7 +193,7 @@ CheckForShmSyscall(void)
/* Allocation failed */
badSysCall = TRUE;
}
OsSignal(SIGSYS, oldHandler);
signal(SIGSYS, oldHandler);
return !badSysCall;
}
@ -210,7 +218,7 @@ ShmInitScreenPriv(ScreenPtr pScreen)
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
if (!screen_priv) {
screen_priv = XNFcallocarray(1, sizeof(ShmScrPrivateRec));
screen_priv = calloc(1, sizeof(ShmScrPrivateRec));
screen_priv->CloseScreen = pScreen->CloseScreen;
dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, screen_priv);
pScreen->CloseScreen = ShmCloseScreen;
@ -250,21 +258,21 @@ ShmDestroyPixmap(PixmapPtr pPixmap)
{
ScreenPtr pScreen = pPixmap->drawable.pScreen;
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
void *shmdesc = NULL;
Bool ret = TRUE;
Bool ret;
if (pPixmap->refcnt == 1)
shmdesc = dixLookupPrivate(&pPixmap->devPrivates, shmPixmapPrivateKey);
if (pPixmap->refcnt == 1) {
ShmDescPtr shmdesc;
shmdesc = (ShmDescPtr) dixLookupPrivate(&pPixmap->devPrivates,
shmPixmapPrivateKey);
if (shmdesc)
ShmDetachSegment((pointer) shmdesc, pPixmap->drawable.id);
}
pScreen->DestroyPixmap = screen_priv->destroyPixmap;
if (pScreen->DestroyPixmap)
ret = pScreen->DestroyPixmap(pPixmap);
ret = (*pScreen->DestroyPixmap) (pPixmap);
screen_priv->destroyPixmap = pScreen->DestroyPixmap;
pScreen->DestroyPixmap = ShmDestroyPixmap;
if (shmdesc)
ShmDetachSegment(shmdesc, 0);
return ret;
}
@ -304,8 +312,8 @@ ProcShmQueryVersion(ClientPtr client)
}
/*
* Simulate the access() system call for a shared memory segment,
* using the credentials from the client if available.
* Simulate the access() system call for a shared memory segement,
* using the credentials from the client if available
*/
static int
shm_access(ClientPtr client, SHMPERM_TYPE * perm, int readonly)
@ -383,10 +391,8 @@ ProcShmAttach(ClientPtr client)
client->errorValue = stuff->readOnly;
return BadValue;
}
for (shmdesc = Shmsegs; shmdesc; shmdesc = shmdesc->next) {
if (!SHMDESC_IS_FD(shmdesc) && shmdesc->shmid == stuff->shmid)
break;
}
for (shmdesc = Shmsegs;
shmdesc && (shmdesc->shmid != stuff->shmid); shmdesc = shmdesc->next);
if (shmdesc) {
if (!stuff->readOnly && !shmdesc->writable)
return BadAccess;
@ -396,9 +402,6 @@ ProcShmAttach(ClientPtr client)
shmdesc = malloc(sizeof(ShmDescRec));
if (!shmdesc)
return BadAlloc;
#ifdef SHM_FD_PASSING
shmdesc->is_fd = FALSE;
#endif
shmdesc->addr = shmat(stuff->shmid, 0,
stuff->readOnly ? SHM_RDONLY : 0);
if ((shmdesc->addr == ((char *) -1)) || SHMSTAT(stuff->shmid, &buf)) {
@ -407,7 +410,7 @@ ProcShmAttach(ClientPtr client)
}
/* The attach was performed with root privs. We must
* do manual checking of access rights for the credentials
* do manual checking of access rights for the credentials
* of the client */
if (shm_access(client, &(SHM_PERM(buf)), stuff->readOnly) == -1) {
@ -423,28 +426,21 @@ ProcShmAttach(ClientPtr client)
shmdesc->next = Shmsegs;
Shmsegs = shmdesc;
}
if (!AddResource(stuff->shmseg, ShmSegType, (void *) shmdesc))
if (!AddResource(stuff->shmseg, ShmSegType, (pointer) shmdesc))
return BadAlloc;
return Success;
}
/*ARGSUSED*/ static int
ShmDetachSegment(void *value, /* must conform to DeleteType */
XID unused)
ShmDetachSegment(pointer value, /* must conform to DeleteType */
XID shmseg)
{
ShmDescPtr shmdesc = (ShmDescPtr) value;
ShmDescPtr *prev;
if (--shmdesc->refcnt)
return TRUE;
#if SHM_FD_PASSING
if (shmdesc->is_fd) {
if (shmdesc->busfault)
busfault_unregister(shmdesc->busfault);
munmap(shmdesc->addr, shmdesc->size);
} else
#endif
shmdt(shmdesc->addr);
shmdt(shmdesc->addr);
for (prev = &Shmsegs; *prev != shmdesc; prev = &(*prev)->next);
*prev = shmdesc->next;
free(shmdesc);
@ -460,7 +456,7 @@ ProcShmDetach(ClientPtr client)
REQUEST_SIZE_MATCH(xShmDetachReq);
VERIFY_SHMSEG(stuff->shmseg, shmdesc, client);
FreeResource(stuff->shmseg, X11_RESTYPE_NONE);
FreeResource(stuff->shmseg, RT_NONE);
return Success;
}
@ -482,8 +478,8 @@ doShmPutImage(DrawablePtr dst, GCPtr pGC,
PixmapBytePad(w, depth), data);
if (!pPixmap)
return;
(void) pGC->ops->CopyArea((DrawablePtr) pPixmap, dst, pGC,
sx, sy, sw, sh, dx, dy);
pGC->ops->CopyArea((DrawablePtr) pPixmap, dst, pGC, sx, sy, sw, sh, dx,
dy);
FreeScratchPixmapHeader(pPixmap);
}
else {
@ -622,7 +618,6 @@ ProcShmGetImage(ClientPtr client)
xShmGetImageReply xgi;
ShmDescPtr shmdesc;
VisualID visual = None;
RegionPtr pVisibleRegion = NULL;
int rc;
REQUEST(xShmGetImageReq);
@ -654,11 +649,6 @@ ProcShmGetImage(ClientPtr client)
wBorderWidth((WindowPtr) pDraw) + (int) pDraw->height)
return BadMatch;
visual = wVisual(((WindowPtr) pDraw));
if (pDraw->type == DRAWABLE_WINDOW)
pVisibleRegion = &((WindowPtr) pDraw)->borderClip;
pDraw->pScreen->SourceValidate(pDraw, stuff->x, stuff->y,
stuff->width, stuff->height,
IncludeInferiors);
}
else {
if (stuff->x < 0 ||
@ -695,11 +685,6 @@ ProcShmGetImage(ClientPtr client)
stuff->width, stuff->height,
stuff->format, stuff->planeMask,
shmdesc->addr + stuff->offset);
if (pVisibleRegion)
XaceCensorImage(client, pVisibleRegion,
PixmapBytePad(stuff->width, pDraw->depth), pDraw,
stuff->x, stuff->y, stuff->width, stuff->height,
stuff->format, shmdesc->addr + stuff->offset);
}
else {
@ -711,11 +696,6 @@ ProcShmGetImage(ClientPtr client)
stuff->width, stuff->height,
stuff->format, plane,
shmdesc->addr + length);
if (pVisibleRegion)
XaceCensorImage(client, pVisibleRegion,
BitmapBytePad(stuff->width), pDraw,
stuff->x, stuff->y, stuff->width, stuff->height,
stuff->format, shmdesc->addr + length);
length += lenPer;
}
}
@ -732,7 +712,7 @@ ProcShmGetImage(ClientPtr client)
return Success;
}
#ifdef XINERAMA
#ifdef PANORAMIX
static int
ProcPanoramiXShmPutImage(ClientPtr client)
{
@ -743,12 +723,12 @@ ProcPanoramiXShmPutImage(ClientPtr client)
REQUEST(xShmPutImageReq);
REQUEST_SIZE_MATCH(xShmPutImageReq);
result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
return (result == BadValue) ? BadDrawable : result;
result = dixLookupResourceByType((void **) &gc, stuff->gc,
result = dixLookupResourceByType((pointer *) &gc, stuff->gc,
XRT_GC, client, DixReadAccess);
if (result != Success)
return result;
@ -797,7 +777,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
return BadValue;
}
rc = dixLookupResourceByClass((void **) &draw, stuff->drawable,
rc = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
XRC_DRAWABLE, client, DixWriteAccess);
if (rc != Success)
return (rc == BadValue) ? BadDrawable : rc;
@ -841,19 +821,6 @@ ProcPanoramiXShmGetImage(ClientPtr client)
return BadMatch;
}
if (format == ZPixmap) {
widthBytesLine = PixmapBytePad(w, pDraw->depth);
length = widthBytesLine * h;
}
else {
widthBytesLine = PixmapBytePad(w, 1);
lenPer = widthBytesLine * h;
plane = ((Mask) 1) << (pDraw->depth - 1);
length = lenPer * Ones(planemask & (plane | (plane - 1)));
}
VERIFY_SHMSIZE(shmdesc, stuff->offset, length, client);
drawables = calloc(PanoramiXNumScreens, sizeof(DrawablePtr));
if (!drawables)
return BadAlloc;
@ -867,12 +834,6 @@ ProcPanoramiXShmGetImage(ClientPtr client)
return rc;
}
}
FOR_NSCREENS_FORWARD(i) {
drawables[i]->pScreen->SourceValidate(drawables[i], 0, 0,
drawables[i]->width,
drawables[i]->height,
IncludeInferiors);
}
xgi = (xShmGetImageReply) {
.type = X_Reply,
@ -882,6 +843,18 @@ ProcPanoramiXShmGetImage(ClientPtr client)
.depth = pDraw->depth
};
if (format == ZPixmap) {
widthBytesLine = PixmapBytePad(w, pDraw->depth);
length = widthBytesLine * h;
}
else {
widthBytesLine = PixmapBytePad(w, 1);
lenPer = widthBytesLine * h;
plane = ((Mask) 1) << (pDraw->depth - 1);
length = lenPer * Ones(planemask & (plane | (plane - 1)));
}
VERIFY_SHMSIZE(shmdesc, stuff->offset, length, client);
xgi.size = length;
if (length == 0) { /* nothing to do */
@ -997,17 +970,11 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
stuff->offset);
if (pMap) {
result = XaceHookResourceAccess(client, stuff->pid,
X11_RESTYPE_PIXMAP, pMap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
if (result != Success) {
pDraw->pScreen->DestroyPixmap(pMap);
break;
}
dixSetPrivate(&pMap->devPrivates, shmPixmapPrivateKey, shmdesc);
shmdesc->refcnt++;
pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
pMap->drawable.id = newPix->info[j].id;
if (!AddResource(newPix->info[j].id, X11_RESTYPE_PIXMAP, (void *) pMap)) {
if (!AddResource(newPix->info[j].id, RT_PIXMAP, (pointer) pMap)) {
result = BadAlloc;
break;
}
@ -1018,9 +985,9 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
}
}
if (result != Success) {
if (result == BadAlloc) {
while (j--)
FreeResource(newPix->info[j].id, X11_RESTYPE_NONE);
FreeResource(newPix->info[j].id, RT_NONE);
free(newPix);
}
else
@ -1028,7 +995,7 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
return result;
}
#endif /* XINERAMA */
#endif
static PixmapPtr
fbShmCreatePixmap(ScreenPtr pScreen,
@ -1043,7 +1010,7 @@ fbShmCreatePixmap(ScreenPtr pScreen,
if (!(*pScreen->ModifyPixmapHeader) (pPixmap, width, height, depth,
BitsPerPixel(depth),
PixmapBytePad(width, depth),
(void *) addr)) {
(pointer) addr)) {
(*pScreen->DestroyPixmap) (pPixmap);
return NullPixmap;
}
@ -1112,8 +1079,8 @@ ProcShmCreatePixmap(ClientPtr client)
shmdesc->addr +
stuff->offset);
if (pMap) {
rc = XaceHookResourceAccess(client, stuff->pid, X11_RESTYPE_PIXMAP,
pMap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, RT_PIXMAP,
pMap, RT_NONE, NULL, DixCreateAccess);
if (rc != Success) {
pDraw->pScreen->DestroyPixmap(pMap);
return rc;
@ -1122,261 +1089,48 @@ ProcShmCreatePixmap(ClientPtr client)
shmdesc->refcnt++;
pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
pMap->drawable.id = stuff->pid;
if (AddResource(stuff->pid, X11_RESTYPE_PIXMAP, (void *) pMap)) {
if (AddResource(stuff->pid, RT_PIXMAP, (pointer) pMap)) {
return Success;
}
}
return BadAlloc;
}
#ifdef SHM_FD_PASSING
static void
ShmBusfaultNotify(void *context)
{
ShmDescPtr shmdesc = context;
ErrorF("shared memory 0x%x truncated by client\n",
(unsigned int) shmdesc->resource);
busfault_unregister(shmdesc->busfault);
shmdesc->busfault = NULL;
FreeResource (shmdesc->resource, X11_RESTYPE_NONE);
}
static int
ProcShmAttachFd(ClientPtr client)
{
int fd;
ShmDescPtr shmdesc;
REQUEST(xShmAttachFdReq);
struct stat statb;
SetReqFds(client, 1);
REQUEST_SIZE_MATCH(xShmAttachFdReq);
LEGAL_NEW_RESOURCE(stuff->shmseg, client);
if ((stuff->readOnly != xTrue) && (stuff->readOnly != xFalse)) {
client->errorValue = stuff->readOnly;
return BadValue;
}
fd = ReadFdFromClient(client);
if (fd < 0)
return BadMatch;
if (fstat(fd, &statb) < 0 || statb.st_size == 0) {
close(fd);
return BadMatch;
}
shmdesc = malloc(sizeof(ShmDescRec));
if (!shmdesc) {
close(fd);
return BadAlloc;
}
shmdesc->is_fd = TRUE;
shmdesc->addr = mmap(NULL, statb.st_size,
stuff->readOnly ? PROT_READ : PROT_READ|PROT_WRITE,
MAP_SHARED,
fd, 0);
close(fd);
if (shmdesc->addr == ((char *) -1)) {
free(shmdesc);
return BadAccess;
}
shmdesc->refcnt = 1;
shmdesc->writable = !stuff->readOnly;
shmdesc->size = statb.st_size;
shmdesc->resource = stuff->shmseg;
shmdesc->busfault = busfault_register_mmap(shmdesc->addr, shmdesc->size, ShmBusfaultNotify, shmdesc);
if (!shmdesc->busfault) {
munmap(shmdesc->addr, shmdesc->size);
free(shmdesc);
return BadAlloc;
}
shmdesc->next = Shmsegs;
Shmsegs = shmdesc;
if (!AddResource(stuff->shmseg, ShmSegType, (void *) shmdesc))
return BadAlloc;
return Success;
}
static int
shm_tmpfile(void)
{
const char *shmdirs[] = {
"/run/shm",
"/var/tmp",
"/tmp",
};
int fd;
#ifdef HAVE_MEMFD_CREATE
fd = memfd_create("xorg", MFD_CLOEXEC|MFD_ALLOW_SEALING);
if (fd != -1) {
fcntl(fd, F_ADD_SEALS, F_SEAL_SHRINK);
DebugF ("Using memfd_create\n");
return fd;
}
#endif
#ifdef O_TMPFILE
for (int i = 0; i < ARRAY_SIZE(shmdirs); i++) {
fd = open(shmdirs[i], O_TMPFILE|O_RDWR|O_CLOEXEC|O_EXCL, 0666);
if (fd >= 0) {
DebugF ("Using O_TMPFILE\n");
return fd;
}
}
ErrorF ("Not using O_TMPFILE\n");
#endif
for (int i = 0; i < ARRAY_SIZE(shmdirs); i++) {
char template[PATH_MAX];
snprintf(template, ARRAY_SIZE(template), "%s/shmfd-XXXXXX", shmdirs[i]);
#ifdef HAVE_MKOSTEMP
fd = mkostemp(template, O_CLOEXEC);
#else
fd = mkstemp(template);
#endif
if (fd < 0)
continue;
unlink(template);
#ifndef HAVE_MKOSTEMP
int flags = fcntl(fd, F_GETFD);
if (flags != -1) {
flags |= FD_CLOEXEC;
(void) fcntl(fd, F_SETFD, flags);
}
#endif
return fd;
}
return -1;
}
static int
ProcShmCreateSegment(ClientPtr client)
{
int fd;
ShmDescPtr shmdesc;
REQUEST(xShmCreateSegmentReq);
xShmCreateSegmentReply rep = {
.type = X_Reply,
.nfd = 1,
.sequenceNumber = client->sequence,
.length = 0,
};
REQUEST_SIZE_MATCH(xShmCreateSegmentReq);
LEGAL_NEW_RESOURCE(stuff->shmseg, client);
if ((stuff->readOnly != xTrue) && (stuff->readOnly != xFalse)) {
client->errorValue = stuff->readOnly;
return BadValue;
}
fd = shm_tmpfile();
if (fd < 0)
return BadAlloc;
if (ftruncate(fd, stuff->size) < 0) {
close(fd);
return BadAlloc;
}
shmdesc = malloc(sizeof(ShmDescRec));
if (!shmdesc) {
close(fd);
return BadAlloc;
}
shmdesc->is_fd = TRUE;
shmdesc->addr = mmap(NULL, stuff->size,
stuff->readOnly ? PROT_READ : PROT_READ|PROT_WRITE,
MAP_SHARED,
fd, 0);
if (shmdesc->addr == ((char *) -1)) {
close(fd);
free(shmdesc);
return BadAccess;
}
shmdesc->refcnt = 1;
shmdesc->writable = !stuff->readOnly;
shmdesc->size = stuff->size;
shmdesc->busfault = busfault_register_mmap(shmdesc->addr, shmdesc->size, ShmBusfaultNotify, shmdesc);
if (!shmdesc->busfault) {
close(fd);
munmap(shmdesc->addr, shmdesc->size);
free(shmdesc);
return BadAlloc;
}
shmdesc->next = Shmsegs;
Shmsegs = shmdesc;
if (!AddResource(stuff->shmseg, ShmSegType, (void *) shmdesc)) {
close(fd);
return BadAlloc;
}
if (WriteFdToClient(client, fd, TRUE) < 0) {
FreeResource(stuff->shmseg, X11_RESTYPE_NONE);
close(fd);
return BadAlloc;
}
WriteToClient(client, sizeof (xShmCreateSegmentReply), &rep);
return Success;
}
#endif /* SHM_FD_PASSING */
static int
ProcShmDispatch(ClientPtr client)
{
REQUEST(xReq);
if (stuff->data == X_ShmQueryVersion)
return ProcShmQueryVersion(client);
if (!client->local)
return BadRequest;
switch (stuff->data) {
case X_ShmQueryVersion:
return ProcShmQueryVersion(client);
case X_ShmAttach:
return ProcShmAttach(client);
case X_ShmDetach:
return ProcShmDetach(client);
case X_ShmPutImage:
#ifdef XINERAMA
#ifdef PANORAMIX
if (!noPanoramiXExtension)
return ProcPanoramiXShmPutImage(client);
#endif /* XINERAMA */
#endif
return ProcShmPutImage(client);
case X_ShmGetImage:
#ifdef XINERAMA
#ifdef PANORAMIX
if (!noPanoramiXExtension)
return ProcPanoramiXShmGetImage(client);
#endif /* XINERAMA */
#endif
return ProcShmGetImage(client);
case X_ShmCreatePixmap:
#ifdef XINERAMA
#ifdef PANORAMIX
if (!noPanoramiXExtension)
return ProcPanoramiXShmCreatePixmap(client);
#endif /* XINERAMA */
return ProcShmCreatePixmap(client);
#ifdef SHM_FD_PASSING
case X_ShmAttachFd:
return ProcShmAttachFd(client);
case X_ShmCreateSegment:
return ProcShmCreateSegment(client);
#endif
return ProcShmCreatePixmap(client);
default:
return BadRequest;
}
}
static void _X_COLD
static void
SShmCompletionEvent(xShmCompletionEvent * from, xShmCompletionEvent * to)
{
to->type = from->type;
@ -1388,29 +1142,41 @@ SShmCompletionEvent(xShmCompletionEvent * from, xShmCompletionEvent * to)
cpswapl(from->offset, to->offset);
}
static int _X_COLD
static int
SProcShmQueryVersion(ClientPtr client)
{
REQUEST(xShmQueryVersionReq);
swaps(&stuff->length);
return ProcShmQueryVersion(client);
}
static int
SProcShmAttach(ClientPtr client)
{
REQUEST(xShmAttachReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShmAttachReq);
swapl(&stuff->shmseg);
swapl(&stuff->shmid);
return ProcShmAttach(client);
}
static int _X_COLD
static int
SProcShmDetach(ClientPtr client)
{
REQUEST(xShmDetachReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShmDetachReq);
swapl(&stuff->shmseg);
return ProcShmDetach(client);
}
static int _X_COLD
static int
SProcShmPutImage(ClientPtr client)
{
REQUEST(xShmPutImageReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShmPutImageReq);
swapl(&stuff->drawable);
swapl(&stuff->gc);
@ -1427,10 +1193,11 @@ SProcShmPutImage(ClientPtr client)
return ProcShmPutImage(client);
}
static int _X_COLD
static int
SProcShmGetImage(ClientPtr client)
{
REQUEST(xShmGetImageReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShmGetImageReq);
swapl(&stuff->drawable);
swaps(&stuff->x);
@ -1443,10 +1210,11 @@ SProcShmGetImage(ClientPtr client)
return ProcShmGetImage(client);
}
static int _X_COLD
static int
SProcShmCreatePixmap(ClientPtr client)
{
REQUEST(xShmCreatePixmapReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShmCreatePixmapReq);
swapl(&stuff->pid);
swapl(&stuff->drawable);
@ -1457,40 +1225,13 @@ SProcShmCreatePixmap(ClientPtr client)
return ProcShmCreatePixmap(client);
}
#ifdef SHM_FD_PASSING
static int _X_COLD
SProcShmAttachFd(ClientPtr client)
{
REQUEST(xShmAttachFdReq);
SetReqFds(client, 1);
REQUEST_SIZE_MATCH(xShmAttachFdReq);
swapl(&stuff->shmseg);
return ProcShmAttachFd(client);
}
static int _X_COLD
SProcShmCreateSegment(ClientPtr client)
{
REQUEST(xShmCreateSegmentReq);
REQUEST_SIZE_MATCH(xShmCreateSegmentReq);
swapl(&stuff->shmseg);
swapl(&stuff->size);
return ProcShmCreateSegment(client);
}
#endif /* SHM_FD_PASSING */
static int _X_COLD
static int
SProcShmDispatch(ClientPtr client)
{
REQUEST(xReq);
if (stuff->data == X_ShmQueryVersion)
return ProcShmQueryVersion(client);
if (!client->local)
return BadRequest;
switch (stuff->data) {
case X_ShmQueryVersion:
return SProcShmQueryVersion(client);
case X_ShmAttach:
return SProcShmAttach(client);
case X_ShmDetach:
@ -1501,12 +1242,6 @@ SProcShmDispatch(ClientPtr client)
return SProcShmGetImage(client);
case X_ShmCreatePixmap:
return SProcShmCreatePixmap(client);
#ifdef SHM_FD_PASSING
case X_ShmAttachFd:
return SProcShmAttachFd(client);
case X_ShmCreateSegment:
return SProcShmCreateSegment(client);
#endif
default:
return BadRequest;
}

View file

@ -56,30 +56,6 @@ typedef struct _ShmFuncs {
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);

View file

@ -27,7 +27,9 @@ in this Software without prior written authorization from The Open Group.
/* dixsleep.c - implement millisecond timeouts for X clients */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "sleepuntil.h"
#include <X11/X.h>
@ -44,10 +46,10 @@ typedef struct _Sertafied {
ClientPtr pClient;
XID id;
void (*notifyFunc) (ClientPtr /* client */ ,
void * /* closure */
pointer /* closure */
);
void *closure;
pointer closure;
} SertafiedRec, *SertafiedPtr;
static SertafiedPtr pPending;
@ -56,21 +58,24 @@ static Bool BlockHandlerRegistered;
static int SertafiedGeneration;
static void ClientAwaken(ClientPtr /* client */ ,
void * /* closure */
pointer /* closure */
);
static int SertafiedDelete(void * /* value */ ,
XID /* id */
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 */
);
static void SertafiedBlockHandler(void *data,
void *timeout);
static void SertafiedWakeupHandler(void *data,
int i);
int
ClientSleepUntil(ClientPtr client,
TimeStamp *revive,
void (*notifyFunc) (ClientPtr, void *), void *closure)
void (*notifyFunc) (ClientPtr, pointer), pointer closure)
{
SertafiedPtr pRequest, pReq, pPrev;
@ -92,14 +97,14 @@ ClientSleepUntil(ClientPtr client,
if (!BlockHandlerRegistered) {
if (!RegisterBlockAndWakeupHandlers(SertafiedBlockHandler,
SertafiedWakeupHandler,
(void *) 0)) {
(pointer) 0)) {
free(pRequest);
return FALSE;
}
BlockHandlerRegistered = TRUE;
}
pRequest->notifyFunc = 0;
if (!AddResource(pRequest->id, SertafiedResType, (void *) pRequest))
if (!AddResource(pRequest->id, SertafiedResType, (pointer) pRequest))
return FALSE;
if (!notifyFunc)
notifyFunc = ClientAwaken;
@ -121,13 +126,14 @@ ClientSleepUntil(ClientPtr client,
}
static void
ClientAwaken(ClientPtr client, void *closure)
ClientAwaken(ClientPtr client, pointer closure)
{
AttendClient(client);
if (!client->clientGone)
AttendClient(client);
}
static int
SertafiedDelete(void *value, XID id)
SertafiedDelete(pointer value, XID id)
{
SertafiedPtr pRequest = (SertafiedPtr) value;
SertafiedPtr pReq, pPrev;
@ -148,7 +154,7 @@ SertafiedDelete(void *value, XID id)
}
static void
SertafiedBlockHandler(void *data, void *wt)
SertafiedBlockHandler(pointer data, OSTimePtr wt, pointer LastSelectMask)
{
SertafiedPtr pReq, pNext;
unsigned long delay;
@ -164,7 +170,7 @@ SertafiedBlockHandler(void *data, void *wt)
pNext = pReq->next;
if (CompareTimeStamps(pReq->revive, now) == LATER)
break;
FreeResource(pReq->id, X11_RESTYPE_NONE);
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
@ -180,7 +186,7 @@ SertafiedBlockHandler(void *data, void *wt)
}
static void
SertafiedWakeupHandler(void *data, int i)
SertafiedWakeupHandler(pointer data, int i, pointer LastSelectMask)
{
SertafiedPtr pReq, pNext;
TimeStamp now;
@ -193,11 +199,11 @@ SertafiedWakeupHandler(void *data, int i)
pNext = pReq->next;
if (CompareTimeStamps(pReq->revive, now) == LATER)
break;
FreeResource(pReq->id, X11_RESTYPE_NONE);
FreeResource(pReq->id, RT_NONE);
}
if (!pPending) {
RemoveBlockAndWakeupHandlers(SertafiedBlockHandler,
SertafiedWakeupHandler, (void *) 0);
SertafiedWakeupHandler, (pointer) 0);
BlockHandlerRegistered = FALSE;
}
}

View file

@ -36,7 +36,7 @@
extern int ClientSleepUntil(ClientPtr client,
TimeStamp *revive,
void (*notifyFunc) (ClientPtr /* client */ ,
void * /* closure */
), void *Closure);
pointer /* closure */
), pointer Closure);
#endif

File diff suppressed because it is too large Load diff

View file

@ -29,9 +29,6 @@
extern _X_EXPORT int
SyncVerifyFence(SyncFence ** ppFence, XID fid, ClientPtr client, Mask mode);
extern _X_EXPORT SyncObject*
SyncCreate(ClientPtr client, XID id, unsigned char type);
#define VERIFY_SYNC_FENCE(pFence, fid, client, mode) \
do { \
int rc; \

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
@ -66,20 +66,20 @@ typedef enum {
XSyncCounterUnrestricted
} SyncCounterType;
typedef void (*SyncSystemCounterQueryValue)(void *counter,
int64_t *value_return
typedef void (*SyncSystemCounterQueryValue)(pointer counter,
CARD64 *value_return
);
typedef void (*SyncSystemCounterBracketValues)(void *counter,
int64_t *pbracket_less,
int64_t *pbracket_greater
typedef void (*SyncSystemCounterBracketValues)(pointer counter,
CARD64 *pbracket_less,
CARD64 *pbracket_greater
);
typedef struct _SysCounterInfo {
SyncCounter *pCounter;
char *name;
int64_t resolution;
int64_t bracket_greater;
int64_t bracket_less;
CARD64 resolution;
CARD64 bracket_greater;
CARD64 bracket_less;
SyncCounterType counterType; /* how can this counter change */
SyncSystemCounterQueryValue QueryValue;
SyncSystemCounterBracketValues BracketValues;
@ -97,7 +97,7 @@ typedef struct _SyncAlarm {
SyncTrigger trigger;
ClientPtr client;
XSyncAlarm alarm_id;
int64_t delta;
CARD64 delta;
int events;
int state;
SyncAlarmClientList *pEventClients;
@ -111,7 +111,7 @@ typedef struct {
typedef struct {
SyncTrigger trigger;
int64_t event_threshold;
CARD64 event_threshold;
SyncAwaitHeader *pHeader;
} SyncAwait;
@ -121,31 +121,19 @@ typedef union {
} SyncAwaitUnion;
extern SyncCounter* SyncCreateSystemCounter(const char *name,
int64_t initial_value,
int64_t resolution,
CARD64 initial_value,
CARD64 resolution,
SyncCounterType counterType,
SyncSystemCounterQueryValue QueryValue,
SyncSystemCounterBracketValues BracketValues
);
extern void SyncChangeCounter(SyncCounter *pCounter,
int64_t new_value);
CARD64 new_value
);
extern void SyncDestroySystemCounter(void *pCounter);
extern void SyncDestroySystemCounter(pointer pCounter);
extern SyncCounter *SyncInitDeviceIdleTime(DeviceIntPtr dev);
extern void SyncRemoveDeviceIdleTime(SyncCounter *counter);
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_ */

View file

@ -17,12 +17,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
********************************************************/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <stdarg.h>
#include "os/client_priv.h"
#include "scrnintstr.h"
#include "extnsionst.h"
#include "pixmapstr.h"
@ -30,20 +29,37 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "gcstruct.h"
#include "xacestr.h"
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.
*/
int
XaceHookDispatch0(ClientPtr client, int major)
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
@ -63,100 +79,138 @@ XaceHookSelectionAccess(ClientPtr client, Selection ** ppSel, Mask access_mode)
return rec.status;
}
int XaceHookResourceAccess(ClientPtr client, XID id, RESTYPE rtype, void *res,
RESTYPE ptype, void *parent, Mask access_mode)
void
XaceHookAuditEnd(ClientPtr ptr, int result)
{
XaceResourceAccessRec rec = { client, id, rtype, res, ptype, parent,
access_mode, Success };
CallCallbacks(&XaceHooks[XACE_RESOURCE_ACCESS], &rec);
return rec.status;
XaceAuditRec rec = { ptr, result };
/* call callbacks, there is no return value. */
CallCallbacks(&XaceHooks[XACE_AUDIT_END], &rec);
}
int XaceHookDeviceAccess(ClientPtr client, DeviceIntPtr dev, Mask access_mode)
{
XaceDeviceAccessRec rec = { client, dev, access_mode, Success };
CallCallbacks(&XaceHooks[XACE_DEVICE_ACCESS], &rec);
return rec.status;
}
int XaceHookSendAccess(ClientPtr client, DeviceIntPtr dev, WindowPtr win,
xEventPtr ev, int count)
{
XaceSendAccessRec rec = { client, dev, win, ev, count, Success };
CallCallbacks(&XaceHooks[XACE_SEND_ACCESS], &rec);
return rec.status;
}
int XaceHookReceiveAccess(ClientPtr client, WindowPtr win,
xEventPtr ev, int count)
{
XaceReceiveAccessRec rec = { client, win, ev, count, Success };
CallCallbacks(&XaceHooks[XACE_RECEIVE_ACCESS], &rec);
return rec.status;
}
int XaceHookClientAccess(ClientPtr client, ClientPtr target, Mask access_mode)
{
XaceClientAccessRec rec = { client, target, access_mode, Success };
CallCallbacks(&XaceHooks[XACE_CLIENT_ACCESS], &rec);
return rec.status;
}
int XaceHookExtAccess(ClientPtr client, ExtensionEntry *ext)
{
XaceExtAccessRec rec = { client, ext, DixGetAttrAccess, Success };
CallCallbacks(&XaceHooks[XACE_EXT_ACCESS], &rec);
return rec.status;
}
int XaceHookServerAccess(ClientPtr client, Mask access_mode)
{
XaceServerAccessRec rec = { client, access_mode, Success };
CallCallbacks(&XaceHooks[XACE_SERVER_ACCESS], &rec);
return rec.status;
}
int XaceHookScreenAccess(ClientPtr client, ScreenPtr screen, Mask access_mode)
{
XaceScreenAccessRec rec = { client, screen, access_mode, Success };
CallCallbacks(&XaceHooks[XACE_SCREEN_ACCESS], &rec);
return rec.status;
}
int XaceHookScreensaverAccess(ClientPtr client, ScreenPtr screen, Mask access_mode)
{
XaceScreenAccessRec rec = { client, screen, access_mode, Success };
CallCallbacks(&XaceHooks[XACE_SCREENSAVER_ACCESS], &rec);
return rec.status;
}
int XaceHookAuthAvail(ClientPtr client, XID authId)
{
XaceAuthAvailRec rec = { client, authId };
CallCallbacks(&XaceHooks[XACE_AUTH_AVAIL], &rec);
return Success;
}
int XaceHookKeyAvail(xEventPtr ev, DeviceIntPtr dev, int count)
{
XaceKeyAvailRec rec = { ev, dev, count };
CallCallbacks(&XaceHooks[XACE_KEY_AVAIL], &rec);
return 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.
/* Entry point for hook functions. Called by Xserver.
*/
int
XaceHookIsSet(int hook)
XaceHook(int hook, ...)
{
if (hook < 0 || hook >= XACE_NUM_HOOKS)
return 0;
return XaceHooks[hook] != NULL;
union {
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 */
if (!XaceHooks[hook])
return Success;
va_start(ap, hook);
/* Marshal arguments for passing to callback.
* Each callback has its own case, which sets up a structure to hold
* 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, 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;
}
/* XaceCensorImage
@ -191,10 +245,10 @@ XaceCensorImage(ClientPtr client,
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);
@ -219,7 +273,7 @@ XaceCensorImage(ClientPtr client,
goto failSafe;
}
for (pBox = RegionRects(&censorRegion), i = 0; i < nRects; i++, pBox++) {
pRects[i].x = pBox->x1 - imageBox.x1;
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;
@ -234,7 +288,7 @@ XaceCensorImage(ClientPtr client,
pPix = GetScratchPixmapHeader(pDraw->pScreen, w, h,
depth, bitsPerPixel,
widthBytesLine, (void *) pBuf);
widthBytesLine, (pointer) pBuf);
if (!pPix) {
failed = TRUE;
goto failSafe;
@ -273,11 +327,15 @@ XaceCensorImage(ClientPtr client,
int
XaceGetConnectionNumber(ClientPtr client)
{
return GetClientFd(client);
XtransConnInfo ci = ((OsCommPtr) client->osPrivate)->trans_conn;
return _XSERVTransGetConnectionNumber(ci);
}
int
XaceIsLocal(ClientPtr client)
{
return ClientIsLocal(client);
XtransConnInfo ci = ((OsCommPtr) client->osPrivate)->trans_conn;
return _XSERVTransIsLocal(ci);
}

View file

@ -25,7 +25,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define XACE_MAJOR_VERSION 2
#define XACE_MINOR_VERSION 0
#include "extnsionst.h"
#include "pixmap.h"
#include "region.h"
#include "window.h"
@ -53,7 +52,9 @@ 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];
@ -64,40 +65,15 @@ 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);
/* Special-cased hook functions
*/
int XaceHookDispatch0(ClientPtr client, int major);
#define XaceHookDispatch(c, m) \
((XaceHooks[XACE_EXT_DISPATCH] && (m) >= EXTENSION_BASE) ? \
XaceHookDispatch0((c), (m)) : \
Success)
extern _X_EXPORT int XaceHookDispatch(ClientPtr ptr, int major);
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);
/* needs to be exported for in-tree modsetting, but not part of public API */
_X_EXPORT int XaceHookResourceAccess(ClientPtr client, XID id, RESTYPE rtype, void *res,
RESTYPE ptype, void *parent, Mask access_mode);
int XaceHookDeviceAccess(ClientPtr client, DeviceIntPtr dev, Mask access_mode);
int XaceHookSendAccess(ClientPtr client, DeviceIntPtr dev, WindowPtr win,
xEventPtr ev, int count);
int XaceHookReceiveAccess(ClientPtr client, WindowPtr win, xEventPtr ev, int count);
int XaceHookClientAccess(ClientPtr client, ClientPtr target, Mask access_mode);
int XaceHookExtAccess(ClientPtr client, ExtensionEntry *ext);
int XaceHookServerAccess(ClientPtr client, Mask access_mode);
int XaceHookScreenAccess(ClientPtr client, ScreenPtr screen, Mask access_mode);
int XaceHookScreensaverAccess(ClientPtr client, ScreenPtr screen, Mask access_mode);
int XaceHookAuthAvail(ClientPtr client, XID authId);
int XaceHookKeyAvail(xEventPtr ev, DeviceIntPtr dev, int count);
extern _X_EXPORT void XaceHookAuditEnd(ClientPtr ptr, int result);
/* Register a callback for a given hook.
*/
@ -132,38 +108,18 @@ extern _X_EXPORT void XaceCensorImage(ClientPtr client,
/* Define calls away when XACE is not being built. */
#ifdef __GNUC__
#define XaceHookIsSet(args...) 0
#define XaceHook(args...) Success
#define XaceHookDispatch(args...) Success
#define XaceHookPropertyAccess(args...) Success
#define XaceHookSelectionAccess(args...) Success
#define XaceHookResourceAccess(args...) Success
#define XaceHookDeviceAccess(args...) Success
#define XaceHookSendAccess(args...) Success
#define XaceHookReceiveAccess(args...) Success
#define XaceHookClientAccess(args...) Success
#define XaceHookExtAccess(args...) Success
#define XaceHookServerAccess(args...) Success
#define XaceHookScreenAccess(args...) Success
#define XaceHookScreensaverAccess(args...) Success
#define XaceHookAuthAvail(args...) Success
#define XaceHookKeyAvail(args...) Success
#define XaceHookAuditEnd(args...) { ; }
#define XaceCensorImage(args...) { ; }
#else
#define XaceHookIsSet(...) 0
#define XaceHook(...) Success
#define XaceHookDispatch(...) Success
#define XaceHookPropertyAccess(...) Success
#define XaceHookSelectionAccess(...) Success
#define XaceHookResourceAccess(...) Success
#define XaceHookDeviceAccess(...) Success
#define XaceHookSendAccess(...) Success
#define XaceHookReceiveAccess(...) Success
#define XaceHookClientAccess(...) Success
#define XaceHookExtAccess(...) Success
#define XaceHookServerAccess(...) Success
#define XaceHookScreenAccess(...) Success
#define XaceHookScreensaverAccess(...) Success
#define XaceHookAuthAvail(...) Success
#define XaceHookKeyAvail(...) Success
#define XaceHookAuditEnd(...) { ; }
#define XaceCensorImage(...) { ; }
#endif

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;

View file

@ -26,7 +26,9 @@ from The Open Group.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#include <X11/Xproto.h>
@ -36,7 +38,7 @@ from The Open Group.
#include "extnsionst.h"
#include "swaprep.h"
#include <X11/extensions/xcmiscproto.h>
#include "extinit_priv.h"
#include "extinit.h"
#include <stdint.h>
@ -99,7 +101,7 @@ ProcXCMiscGetXIDList(ClientPtr client)
if (stuff->count > UINT32_MAX / sizeof(XID))
return BadAlloc;
pids = xallocarray(stuff->count, sizeof(XID));
pids = (XID *) malloc(stuff->count * sizeof(XID));
if (!pids) {
return BadAlloc;
}
@ -140,27 +142,38 @@ ProcXCMiscDispatch(ClientPtr client)
}
}
static int _X_COLD
static int
SProcXCMiscGetVersion(ClientPtr client)
{
REQUEST(xXCMiscGetVersionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXCMiscGetVersionReq);
swaps(&stuff->majorVersion);
swaps(&stuff->minorVersion);
return ProcXCMiscGetVersion(client);
}
static int _X_COLD
static int
SProcXCMiscGetXIDRange(ClientPtr client)
{
REQUEST(xReq);
swaps(&stuff->length);
return ProcXCMiscGetXIDRange(client);
}
static int
SProcXCMiscGetXIDList(ClientPtr client)
{
REQUEST(xXCMiscGetXIDListReq);
REQUEST_SIZE_MATCH(xXCMiscGetXIDListReq);
swaps(&stuff->length);
swapl(&stuff->count);
return ProcXCMiscGetXIDList(client);
}
static int _X_COLD
static int
SProcXCMiscDispatch(ClientPtr client)
{
REQUEST(xReq);
@ -168,7 +181,7 @@ SProcXCMiscDispatch(ClientPtr client)
case X_XCMiscGetVersion:
return SProcXCMiscGetVersion(client);
case X_XCMiscGetXIDRange:
return ProcXCMiscGetXIDRange(client);
return SProcXCMiscGetXIDRange(client);
case X_XCMiscGetXIDList:
return SProcXCMiscGetXIDList(client);
default:

View file

@ -34,10 +34,19 @@
* XLoadQueryFont).
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <sys/types.h>
#ifdef MITSHM
#ifdef HAS_SHM
#if defined(linux) && (!defined(__GNU_LIBRARY__) || __GNU_LIBRARY__ < 2)
/* libc4 does not define __GNU_LIBRARY__, libc5 defines __GNU_LIBRARY__ as 1 */
/* Linux libc4 and libc5 only (because glibc doesn't include kernel headers):
Linux 2.0.x and 2.2.x define SHMLBA as PAGE_SIZE, but forget to define
PAGE_SIZE. It is defined in <asm/page.h>. */
#include <asm/page.h>
#endif
#ifdef SVR4
#include <sys/sysmacros.h>
#endif
@ -56,24 +65,22 @@
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/extensions/xf86bigfproto.h>
#include <X11/fonts/fontstruct.h>
#include <X11/fonts/libxfont2.h>
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "gcstruct.h"
#include "dixfontstr.h"
#include "extnsionst.h"
#include "extinit_priv.h"
#include "extinit.h"
#include "protocol-versions.h"
#include <X11/extensions/xf86bigfproto.h>
#include "xf86bigfontsrv.h"
static void XF86BigfontResetProc(ExtensionEntry *extEntry );
static void XF86BigfontResetProc(ExtensionEntry * /* extEntry */
);
#ifdef MITSHM
#ifdef HAS_SHM
/* A random signature, transmitted to the clients so they can verify that the
shared memory segment they are attaching to was really established by the
@ -89,6 +96,8 @@ static Bool badSysCall = FALSE;
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__) || defined(__DragonFly__)
#include <sys/signal.h>
static void
SigSysHandler(int signo)
{
@ -102,7 +111,7 @@ CheckForShmSyscall(void)
int shmid = -1;
/* If no SHM support in the kernel, the bad syscall will generate SIGSYS */
oldHandler = OsSignal(SIGSYS, SigSysHandler);
oldHandler = signal(SIGSYS, SigSysHandler);
badSysCall = FALSE;
shmid = shmget(IPC_PRIVATE, 4096, IPC_CREAT);
@ -114,7 +123,7 @@ CheckForShmSyscall(void)
/* Allocation failed */
badSysCall = TRUE;
}
OsSignal(SIGSYS, oldHandler);
signal(SIGSYS, oldHandler);
return !badSysCall;
}
@ -126,7 +135,7 @@ CheckForShmSyscall(void)
/* ========== Management of shared memory segments ========== */
#ifdef MITSHM
#ifdef HAS_SHM
#ifdef __linux__
/* On Linux, shared memory marked as "removed" can still be attached.
@ -221,7 +230,7 @@ shmdealloc(ShmDescPtr pDesc)
void
XF86BigfontFreeFontShm(FontPtr pFont)
{
#ifdef MITSHM
#ifdef HAS_SHM
ShmDescPtr pDesc;
/* If during shutdown of the server, XF86BigfontCleanup() has already
@ -240,7 +249,7 @@ XF86BigfontFreeFontShm(FontPtr pFont)
void
XF86BigfontCleanup(void)
{
#ifdef MITSHM
#ifdef HAS_SHM
while (ShmList)
shmdealloc(ShmList);
#endif
@ -277,9 +286,9 @@ ProcXF86BigfontQueryVersion(ClientPtr client)
.minorVersion = SERVER_XF86BIGFONT_MINOR_VERSION,
.uid = geteuid(),
.gid = getegid(),
#ifdef MITSHM
#ifdef HAS_SHM
.signature = signature,
.capabilities = (client->local && !client->swapped)
.capabilities = (LocalClient(client) && !client->swapped)
? XF86Bigfont_CAP_LocalShm : 0
#else
.signature = 0,
@ -287,6 +296,8 @@ ProcXF86BigfontQueryVersion(ClientPtr client)
#endif
};
if (client->swapped) {
char tmp;
swaps(&reply.sequenceNumber);
swapl(&reply.length);
swaps(&reply.majorVersion);
@ -302,6 +313,8 @@ ProcXF86BigfontQueryVersion(ClientPtr client)
static void
swapCharInfo(xCharInfo * pCI)
{
char tmp;
swaps(&pCI->leftSideBearing);
swaps(&pCI->rightSideBearing);
swaps(&pCI->characterWidth);
@ -329,7 +342,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
int nCharInfos;
int shmid;
#ifdef MITSHM
#ifdef HAS_SHM
ShmDescPtr pDesc = NULL;
#else
#define pDesc 0
@ -339,10 +352,12 @@ ProcXF86BigfontQueryFont(ClientPtr client)
CARD16 *pUniqIndex2Index;
CARD32 nUniqCharInfos;
/* protocol version is decided based on request packet size */
#if 0
REQUEST_SIZE_MATCH(xXF86BigfontQueryFontReq);
#else
switch (client->req_len) {
case 2: /* client with version 1.0 libX11 */
stuff_flags = (client->local &&
stuff_flags = (LocalClient(client) &&
!client->swapped ? XF86Bigfont_FLAGS_Shm : 0);
break;
case 3: /* client with version 1.1 libX11 */
@ -351,7 +366,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
default:
return BadLength;
}
#endif
if (dixLookupFontable(&pFont, stuff->id, client, DixGetAttrAccess) !=
Success)
return BadFont; /* procotol spec says only error is BadFont */
@ -372,7 +387,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
nUniqCharInfos = 0;
if (nCharInfos > 0) {
#ifdef MITSHM
#ifdef HAS_SHM
if (!badSysCall)
pDesc = (ShmDescPtr) FontGetPrivate(pFont, FontShmdescIndex);
if (pDesc) {
@ -390,10 +405,10 @@ ProcXF86BigfontQueryFont(ClientPtr client)
}
else {
#endif
pCI = xallocarray(nCharInfos, sizeof(xCharInfo));
pCI = malloc(nCharInfos * sizeof(xCharInfo));
if (!pCI)
return BadAlloc;
#ifdef MITSHM
#ifdef HAS_SHM
}
#endif
/* Fill nCharInfos starting at pCI. */
@ -425,10 +440,10 @@ ProcXF86BigfontQueryFont(ClientPtr client)
}
}
}
#ifdef MITSHM
#ifdef HAS_SHM
if (pDesc && !badSysCall) {
*(CARD32 *) (pCI + nCharInfos) = signature;
if (!xfont2_font_set_private(pFont, FontShmdescIndex, pDesc)) {
if (!FontSetPrivate(pFont, FontShmdescIndex, pDesc)) {
shmdealloc(pDesc);
return BadAlloc;
}
@ -452,7 +467,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
if (hashModulus > nCharInfos + 1)
hashModulus = nCharInfos + 1;
tmp = xallocarray(4 * nCharInfos + 1, sizeof(CARD16));
tmp = malloc((4 * nCharInfos + 1) * sizeof(CARD16));
if (!tmp) {
if (!pDesc)
free(pCI);
@ -570,6 +585,8 @@ ProcXF86BigfontQueryFont(ClientPtr client)
reply->shmid = shmid;
reply->shmsegoffset = 0;
if (client->swapped) {
char tmp;
swaps(&reply->sequenceNumber);
swapl(&reply->length);
swapCharInfo(&reply->minBounds);
@ -596,6 +613,8 @@ ProcXF86BigfontQueryFont(ClientPtr client)
prFP->name = pFP->name;
prFP->value = pFP->value;
if (client->swapped) {
char tmp;
swapl(&prFP->name);
swapl(&prFP->value);
}
@ -617,6 +636,8 @@ ProcXF86BigfontQueryFont(ClientPtr client)
for (j = 0; j < nCharInfos; j++, ps++) {
*ps = pIndex2UniqIndex[j];
if (client->swapped) {
char tmp;
swaps(ps);
}
}
@ -648,23 +669,29 @@ ProcXF86BigfontDispatch(ClientPtr client)
}
}
static int _X_COLD
static int
SProcXF86BigfontQueryVersion(ClientPtr client)
{
/* REQUEST(xXF86BigfontQueryVersionReq); */
REQUEST(xXF86BigfontQueryVersionReq);
char tmp;
swaps(&stuff->length);
return ProcXF86BigfontQueryVersion(client);
}
static int _X_COLD
static int
SProcXF86BigfontQueryFont(ClientPtr client)
{
REQUEST(xXF86BigfontQueryFontReq);
char tmp;
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86BigfontQueryFontReq);
swapl(&stuff->id);
return ProcXF86BigfontQueryFont(client);
}
static int _X_COLD
static int
SProcXF86BigfontDispatch(ClientPtr client)
{
REQUEST(xReq);
@ -688,7 +715,7 @@ XFree86BigfontExtensionInit(void)
ProcXF86BigfontDispatch,
SProcXF86BigfontDispatch,
XF86BigfontResetProc, StandardMinorOpcode)) {
#ifdef MITSHM
#ifdef HAS_SHM
#ifdef MUST_CHECK_FOR_SHM_SYSCALL
/*
* Note: Local-clients will not be optimized without shared memory
@ -708,7 +735,7 @@ XFree86BigfontExtensionInit(void)
+ (unsigned int) (65536.0 / (RAND_MAX + 1.0) * rand());
/* fprintf(stderr, "signature = 0x%08X\n", signature); */
FontShmdescIndex = xfont2_allocate_font_private_index();
FontShmdescIndex = AllocateFontPrivateIndex();
#if !defined(CSRG_BASED) && !defined(__CYGWIN__)
pagesize = SHMLBA;

View file

@ -2,28 +2,28 @@
Copyright (c) 2002 XFree86 Inc
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/extensions/XResproto.h>
#include "dix/registry_priv.h"
#include "os/client_priv.h"
#include <assert.h>
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "extnsionst.h"
#include "swaprep.h"
#include "registry.h"
#include <X11/extensions/XResproto.h>
#include "pixmapstr.h"
#include "windowstr.h"
#include "gcstruct.h"
#include "extinit_priv.h"
#include "extinit.h"
#include "protocol-versions.h"
#include "client.h"
#include "list.h"
#include "misc.h"
#include <string.h>
@ -72,7 +72,7 @@ typedef struct {
HashTable visitedResources;
/* Used by AddSubResourceSizeSpec when AddResourceSizeValue is
handling cross-references */
handling crossreferences */
HashTable visitedSubResources;
/* used when ConstructResourceBytesCtx is passed to
@ -190,9 +190,12 @@ DestroyConstructResourceBytesCtx(ConstructResourceBytesCtx *ctx)
ht_destroy(ctx->visitedResources);
}
extern void ResExtensionInit(void);
static int
ProcXResQueryVersion(ClientPtr client)
{
REQUEST(xXResQueryVersionReq);
xXResQueryVersionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
@ -223,9 +226,7 @@ ProcXResQueryClients(ClientPtr client)
REQUEST_SIZE_MATCH(xXResQueryClientsReq);
current_clients = xallocarray(currentMaxClients, sizeof(int));
if (current_clients == NULL)
return BadAlloc;
current_clients = malloc(currentMaxClients * sizeof(int));
num_clients = 0;
for (i = 0; i < currentMaxClients; i++) {
@ -269,31 +270,13 @@ ProcXResQueryClients(ClientPtr client)
}
static void
ResFindAllRes(void *value, XID id, RESTYPE type, void *cdata)
ResFindAllRes(pointer value, XID id, RESTYPE type, pointer cdata)
{
int *counts = (int *) cdata;
counts[(type & TypeMask) - 1]++;
}
static CARD32
resourceTypeAtom(int i)
{
CARD32 ret;
const char *name = LookupResourceName(i);
if (strcmp(name, XREGISTRY_UNKNOWN))
ret = MakeAtom(name, strlen(name), TRUE);
else {
char buf[40];
snprintf(buf, sizeof(buf), "Unregistered resource %i", i + 1);
ret = MakeAtom(buf, strlen(buf), TRUE);
}
return ret;
}
static int
ProcXResQueryClientResources(ClientPtr client)
{
@ -338,12 +321,22 @@ ProcXResQueryClientResources(ClientPtr client)
if (num_types) {
xXResType scratch;
const char *name;
for (i = 0; i < lastResourceType; i++) {
if (!counts[i])
continue;
scratch.resource_type = resourceTypeAtom(i + 1);
name = LookupResourceName(i + 1);
if (strcmp(name, XREGISTRY_UNKNOWN))
scratch.resource_type = MakeAtom(name, strlen(name), TRUE);
else {
char buf[40];
snprintf(buf, sizeof(buf), "Unregistered resource %i", i + 1);
scratch.resource_type = MakeAtom(buf, strlen(buf), TRUE);
}
scratch.count = counts[i];
if (client->swapped) {
@ -359,8 +352,23 @@ ProcXResQueryClientResources(ClientPtr client)
return Success;
}
static unsigned long
ResGetApproxPixmapBytes(PixmapPtr pix)
{
unsigned long nPixels;
int bytesPerPixel;
bytesPerPixel = pix->drawable.bitsPerPixel >> 3;
nPixels = pix->drawable.width * pix->drawable.height;
/* Divide by refcnt as pixmap could be shared between clients,
* so total pixmap mem is shared between these.
*/
return (nPixels * bytesPerPixel) / pix->refcnt;
}
static void
ResFindResourcePixmaps(void *value, XID id, RESTYPE type, void *cdata)
ResFindResourcePixmaps(pointer value, XID id, RESTYPE type, pointer cdata)
{
SizeType sizeFunc = GetResourceTypeSizeFunc(type);
ResourceSizeRec size = { 0, 0, 0 };
@ -370,6 +378,57 @@ ResFindResourcePixmaps(void *value, XID id, RESTYPE type, void *cdata)
*bytes += size.pixmapRefSize;
}
static void
ResFindPixmaps(pointer value, XID id, pointer cdata)
{
unsigned long *bytes = (unsigned long *) cdata;
PixmapPtr pix = (PixmapPtr) value;
*bytes += ResGetApproxPixmapBytes(pix);
}
static void
ResFindWindowPixmaps(pointer value, XID id, pointer cdata)
{
unsigned long *bytes = (unsigned long *) cdata;
WindowPtr pWin = (WindowPtr) value;
if (pWin->backgroundState == BackgroundPixmap)
*bytes += ResGetApproxPixmapBytes(pWin->background.pixmap);
if (pWin->border.pixmap != NULL && !pWin->borderIsPixel)
*bytes += ResGetApproxPixmapBytes(pWin->border.pixmap);
}
static void
ResFindGCPixmaps(pointer value, XID id, pointer cdata)
{
unsigned long *bytes = (unsigned long *) cdata;
GCPtr pGC = (GCPtr) value;
if (pGC->stipple != NULL)
*bytes += ResGetApproxPixmapBytes(pGC->stipple);
if (pGC->tile.pixmap != NULL && !pGC->tileIsPixel)
*bytes += ResGetApproxPixmapBytes(pGC->tile.pixmap);
}
static void
ResFindPicturePixmaps(pointer value, XID id, pointer cdata)
{
#ifdef RENDER
ResFindResourcePixmaps(value, id, PictureType, cdata);
#endif
}
static void
ResFindCompositeClientWindowPixmaps (pointer value, XID id, pointer cdata)
{
#ifdef COMPOSITE
ResFindResourcePixmaps(value, id, CompositeClientWindowType, cdata);
#endif
}
static int
ProcXResQueryClientPixmapBytes(ClientPtr client)
{
@ -389,8 +448,34 @@ ProcXResQueryClientPixmapBytes(ClientPtr client)
bytes = 0;
FindAllClientResources(clients[clientID], ResFindResourcePixmaps,
(void *) (&bytes));
FindClientResourcesByType(clients[clientID], RT_PIXMAP, ResFindPixmaps,
(pointer) (&bytes));
/*
* Make sure win background pixmaps also held to account.
*/
FindClientResourcesByType(clients[clientID], RT_WINDOW,
ResFindWindowPixmaps, (pointer) (&bytes));
/*
* GC Tile & Stipple pixmaps too.
*/
FindClientResourcesByType(clients[clientID], RT_GC,
ResFindGCPixmaps, (pointer) (&bytes));
#ifdef RENDER
/* Render extension picture pixmaps. */
FindClientResourcesByType(clients[clientID], PictureType,
ResFindPicturePixmaps,
(pointer)(&bytes));
#endif
#ifdef COMPOSITE
/* Composite extension client window pixmaps. */
FindClientResourcesByType(clients[clientID], CompositeClientWindowType,
ResFindCompositeClientWindowPixmaps,
(pointer)(&bytes));
#endif
rep = (xXResQueryClientPixmapBytesReply) {
.type = X_Reply,
@ -444,7 +529,7 @@ WillConstructMask(ClientPtr client, CARD32 mask,
client id spec
@param sendClient Which client wishes to receive this answer. Used for
byte endianness.
byte endianess.
@param client Which client are we considering.
@param mask The client id spec mask indicating which information
we want about this client.
@ -611,7 +696,7 @@ ProcXResQueryClientIds (ClientPtr client)
return rc;
}
/** @brief Swaps xXResResourceIdSpec endianness */
/** @brief Swaps xXResResourceIdSpec endianess */
static void
SwapXResResourceIdSpec(xXResResourceIdSpec *spec)
{
@ -619,7 +704,7 @@ SwapXResResourceIdSpec(xXResResourceIdSpec *spec)
swapl(&spec->type);
}
/** @brief Swaps xXResResourceSizeSpec endianness */
/** @brief Swaps xXResResourceSizeSpec endianess */
static void
SwapXResResourceSizeSpec(xXResResourceSizeSpec *size)
{
@ -629,7 +714,7 @@ SwapXResResourceSizeSpec(xXResResourceSizeSpec *size)
swapl(&size->useCount);
}
/** @brief Swaps xXResResourceSizeValue endianness */
/** @brief Swaps xXResResourceSizeValue endianess */
static void
SwapXResResourceSizeValue(xXResResourceSizeValue *rep)
{
@ -671,10 +756,10 @@ SwapXResQueryResourceBytes(struct xorg_list *response)
FindRes
*/
static void
AddSubResourceSizeSpec(void *value,
AddSubResourceSizeSpec(pointer value,
XID id,
RESTYPE type,
void *cdata)
pointer cdata)
{
ConstructResourceBytesCtx *ctx = cdata;
@ -703,7 +788,7 @@ AddSubResourceSizeSpec(void *value,
sizeFunc(value, id, &size);
crossRef->spec.resource = id;
crossRef->spec.type = resourceTypeAtom(type);
crossRef->spec.type = type;
crossRef->bytes = size.resourceSize;
crossRef->refCount = size.refCnt;
crossRef->useCount = 1;
@ -736,7 +821,7 @@ AddSubResourceSizeSpec(void *value,
FindRes
*/
static void
AddResourceSizeValue(void *ptr, XID id, RESTYPE type, void *cdata)
AddResourceSizeValue(pointer ptr, XID id, RESTYPE type, pointer cdata)
{
ConstructResourceBytesCtx *ctx = cdata;
if (ctx->status == Success &&
@ -776,7 +861,7 @@ AddResourceSizeValue(void *ptr, XID id, RESTYPE type, void *cdata)
sizeFunc(ptr, id, &size);
value->size.spec.resource = id;
value->size.spec.type = resourceTypeAtom(type);
value->size.spec.type = type;
value->size.bytes = size.resourceSize;
value->size.refCount = size.refCnt;
value->size.useCount = 1;
@ -806,7 +891,7 @@ AddResourceSizeValue(void *ptr, XID id, RESTYPE type, void *cdata)
@param[in/out] cdata The context object that contains the resource type
*/
static void
AddResourceSizeValueWithResType(void *ptr, XID id, void *cdata)
AddResourceSizeValueWithResType(pointer ptr, XID id, pointer cdata)
{
ConstructResourceBytesCtx *ctx = cdata;
AddResourceSizeValue(ptr, id, ctx->resType, cdata);
@ -824,7 +909,7 @@ AddResourceSizeValueWithResType(void *ptr, XID id, void *cdata)
type FindAllRes
*/
static void
AddResourceSizeValueByResource(void *ptr, XID id, RESTYPE type, void *cdata)
AddResourceSizeValueByResource(pointer ptr, XID id, RESTYPE type, pointer cdata)
{
ConstructResourceBytesCtx *ctx = cdata;
xXResResourceIdSpec *spec = ctx->curSpec;
@ -957,8 +1042,6 @@ ProcXResQueryResourceBytes (ClientPtr client)
ConstructResourceBytesCtx ctx;
REQUEST_AT_LEAST_SIZE(xXResQueryResourceBytesReq);
if (stuff->numSpecs > UINT32_MAX / sizeof(ctx.specs[0]))
return BadLength;
REQUEST_FIXED_SIZE(xXResQueryResourceBytesReq,
stuff->numSpecs * sizeof(ctx.specs[0]));
@ -1019,14 +1102,15 @@ ProcResDispatch(ClientPtr client)
return BadRequest;
}
static int _X_COLD
static int
SProcXResQueryVersion(ClientPtr client)
{
REQUEST(xXResQueryVersionReq);
REQUEST_SIZE_MATCH(xXResQueryVersionReq);
return ProcXResQueryVersion(client);
}
static int _X_COLD
static int
SProcXResQueryClientResources(ClientPtr client)
{
REQUEST(xXResQueryClientResourcesReq);
@ -1035,7 +1119,7 @@ SProcXResQueryClientResources(ClientPtr client)
return ProcXResQueryClientResources(client);
}
static int _X_COLD
static int
SProcXResQueryClientPixmapBytes(ClientPtr client)
{
REQUEST(xXResQueryClientPixmapBytesReq);
@ -1044,7 +1128,7 @@ SProcXResQueryClientPixmapBytes(ClientPtr client)
return ProcXResQueryClientPixmapBytes(client);
}
static int _X_COLD
static int
SProcXResQueryClientIds (ClientPtr client)
{
REQUEST(xXResQueryClientIdsReq);
@ -1057,15 +1141,15 @@ SProcXResQueryClientIds (ClientPtr client)
/** @brief Implements the XResQueryResourceBytes of XResProto v1.2.
This variant byteswaps request contents before issuing the
rest of the work to ProcXResQueryResourceBytes */
static int _X_COLD
static int
SProcXResQueryResourceBytes (ClientPtr client)
{
REQUEST(xXResQueryResourceBytesReq);
int c;
xXResResourceIdSpec *specs = (void*) ((char*) stuff + sizeof(*stuff));
REQUEST_AT_LEAST_SIZE(xXResQueryResourceBytesReq);
swapl(&stuff->numSpecs);
REQUEST_AT_LEAST_SIZE(xXResQueryResourceBytesReq);
REQUEST_FIXED_SIZE(xXResQueryResourceBytesReq,
stuff->numSpecs * sizeof(specs[0]));
@ -1076,10 +1160,11 @@ SProcXResQueryResourceBytes (ClientPtr client)
return ProcXResQueryResourceBytes(client);
}
static int _X_COLD
static int
SProcResDispatch (ClientPtr client)
{
REQUEST(xReq);
swaps(&stuff->length);
switch (stuff->data) {
case X_XResQueryVersion:

View file

@ -136,12 +136,4 @@ typedef struct {
CARD32 pad6;
} SELinuxListItemsReply;
#ifdef XSELINUX
#define SELINUX_MODE_DEFAULT 0
#define SELINUX_MODE_DISABLED 1
#define SELINUX_MODE_PERMISSIVE 2
#define SELINUX_MODE_ENFORCING 3
extern int selinuxEnforcingState;
#endif
#endif /* _XSELINUX_H */

View file

@ -17,16 +17,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
********************************************************/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#include "dix/dix_priv.h"
#endif
#include "selection.h"
#include "inputstr.h"
#include "windowstr.h"
#include "propertyst.h"
#include "extnsionst.h"
#include "extinit_priv.h"
#include "extinit.h"
#include "xselinuxint.h"
#define CTX_DEV offsetof(SELinuxSubjectRec, dev_create_sid)
@ -37,24 +37,21 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define USE_SEL offsetof(SELinuxSubjectRec, sel_use_sid)
typedef struct {
char *octx;
char *dctx;
security_context_t octx;
security_context_t dctx;
CARD32 octx_len;
CARD32 dctx_len;
CARD32 id;
} SELinuxListItemRec;
Bool noSELinuxExtension = FALSE;
int selinuxEnforcingState = SELINUX_MODE_DEFAULT;
/*
* Extension Dispatch
*/
static char *
static security_context_t
SELinuxCopyContext(char *ptr, unsigned len)
{
char *copy = malloc(len + 1);
security_context_t copy = malloc(len + 1);
if (!copy)
return NULL;
@ -69,6 +66,7 @@ ProcSELinuxQueryVersion(ClientPtr client)
SELinuxQueryVersionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.server_major = SELINUX_MAJOR_VERSION,
.server_minor = SELINUX_MINOR_VERSION
};
@ -85,7 +83,8 @@ ProcSELinuxQueryVersion(ClientPtr client)
static int
SELinuxSendContextReply(ClientPtr client, security_id_t sid)
{
char *ctx = NULL;
SELinuxGetContextReply rep;
security_context_t ctx = NULL;
int len = 0;
if (sid) {
@ -94,7 +93,7 @@ SELinuxSendContextReply(ClientPtr client, security_id_t sid)
len = strlen(ctx) + 1;
}
SELinuxGetContextReply rep = {
rep = (SELinuxGetContextReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = bytes_to_int32(len),
@ -118,7 +117,7 @@ ProcSELinuxSetCreateContext(ClientPtr client, unsigned offset)
{
PrivateRec **privPtr = &client->devPrivates;
security_id_t *pSid;
char *ctx = NULL;
security_context_t ctx = NULL;
char *ptr;
int rc;
@ -166,7 +165,7 @@ ProcSELinuxGetCreateContext(ClientPtr client, unsigned offset)
static int
ProcSELinuxSetDeviceContext(ClientPtr client)
{
char *ctx;
security_context_t ctx;
security_id_t sid;
DeviceIntPtr dev;
SELinuxSubjectRec *subj;
@ -246,7 +245,7 @@ ProcSELinuxGetDrawableContext(ClientPtr client)
}
static int
ProcSELinuxGetPropertyContext(ClientPtr client, void *privKey)
ProcSELinuxGetPropertyContext(ClientPtr client, pointer privKey)
{
WindowPtr pWin;
PropertyPtr pProp;
@ -270,7 +269,7 @@ ProcSELinuxGetPropertyContext(ClientPtr client, void *privKey)
}
static int
ProcSELinuxGetSelectionContext(ClientPtr client, void *privKey)
ProcSELinuxGetSelectionContext(ClientPtr client, pointer privKey)
{
Selection *pSel;
SELinuxObjectRec *obj;
@ -341,9 +340,13 @@ static int
SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec * items,
int size, int count)
{
int rc = BadAlloc, k, pos = 0;
CARD32 *buf = calloc(size, sizeof(CARD32));
int rc, k, pos = 0;
SELinuxListItemsReply rep;
CARD32 *buf;
buf = calloc(size, sizeof(CARD32));
if (size && !buf) {
rc = BadAlloc;
goto out;
}
@ -371,7 +374,7 @@ SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec * items,
}
/* Send reply to client */
SELinuxListItemsReply rep = {
rep = (SELinuxListItemsReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = size,
@ -449,10 +452,8 @@ ProcSELinuxListSelections(ClientPtr client)
count = 0;
for (pSel = CurrentSelections; pSel; pSel = pSel->next)
count++;
if (count == 0)
return SELinuxSendItemsToClient(client, NULL, 0, 0);
items = calloc(count, sizeof(SELinuxListItemRec));
if (!items)
if (count && !items)
return BadAlloc;
/* Fill in the items and calculate size */
@ -527,13 +528,13 @@ ProcSELinuxDispatch(ClientPtr client)
}
}
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);
@ -543,7 +544,7 @@ SProcSELinuxSetCreateContext(ClientPtr client, unsigned offset)
return ProcSELinuxSetCreateContext(client, offset);
}
static int _X_COLD
static int
SProcSELinuxSetDeviceContext(ClientPtr client)
{
REQUEST(SELinuxSetContextReq);
@ -554,7 +555,7 @@ SProcSELinuxSetDeviceContext(ClientPtr client)
return ProcSELinuxSetDeviceContext(client);
}
static int _X_COLD
static int
SProcSELinuxGetDeviceContext(ClientPtr client)
{
REQUEST(SELinuxGetContextReq);
@ -564,7 +565,7 @@ SProcSELinuxGetDeviceContext(ClientPtr client)
return ProcSELinuxGetDeviceContext(client);
}
static int _X_COLD
static int
SProcSELinuxGetDrawableContext(ClientPtr client)
{
REQUEST(SELinuxGetContextReq);
@ -574,8 +575,8 @@ SProcSELinuxGetDrawableContext(ClientPtr client)
return ProcSELinuxGetDrawableContext(client);
}
static int _X_COLD
SProcSELinuxGetPropertyContext(ClientPtr client, void *privKey)
static int
SProcSELinuxGetPropertyContext(ClientPtr client, pointer privKey)
{
REQUEST(SELinuxGetPropertyContextReq);
@ -585,8 +586,8 @@ SProcSELinuxGetPropertyContext(ClientPtr client, void *privKey)
return ProcSELinuxGetPropertyContext(client, privKey);
}
static int _X_COLD
SProcSELinuxGetSelectionContext(ClientPtr client, void *privKey)
static int
SProcSELinuxGetSelectionContext(ClientPtr client, pointer privKey)
{
REQUEST(SELinuxGetContextReq);
@ -595,7 +596,7 @@ SProcSELinuxGetSelectionContext(ClientPtr client, void *privKey)
return ProcSELinuxGetSelectionContext(client, privKey);
}
static int _X_COLD
static int
SProcSELinuxListProperties(ClientPtr client)
{
REQUEST(SELinuxGetContextReq);
@ -605,7 +606,7 @@ SProcSELinuxListProperties(ClientPtr client)
return ProcSELinuxListProperties(client);
}
static int _X_COLD
static int
SProcSELinuxGetClientContext(ClientPtr client)
{
REQUEST(SELinuxGetContextReq);
@ -615,11 +616,13 @@ SProcSELinuxGetClientContext(ClientPtr client)
return ProcSELinuxGetClientContext(client);
}
static int _X_COLD
static int
SProcSELinuxDispatch(ClientPtr client)
{
REQUEST(xReq);
swaps(&stuff->length);
switch (stuff->data) {
case X_SELinuxQueryVersion:
return SProcSELinuxQueryVersion(client);
@ -686,6 +689,8 @@ SELinuxResetProc(ExtensionEntry * extEntry)
void
SELinuxExtensionInit(void)
{
ExtensionEntry *extEntry;
/* Check SELinux mode on system, configuration file, and boolean */
if (!is_selinux_enabled()) {
LogMessage(X_INFO, "SELinux: Disabled on system\n");
@ -705,7 +710,10 @@ SELinuxExtensionInit(void)
SELinuxFlaskInit();
/* Add extension to server */
AddExtension(SELINUX_EXTENSION_NAME, SELinuxNumberEvents,
SELinuxNumberErrors, ProcSELinuxDispatch,
SProcSELinuxDispatch, SELinuxResetProc, StandardMinorOpcode);
extEntry = AddExtension(SELINUX_EXTENSION_NAME,
SELinuxNumberEvents, SELinuxNumberErrors,
ProcSELinuxDispatch, SProcSELinuxDispatch,
SELinuxResetProc, StandardMinorOpcode);
AddExtensionAlias("Flask", extEntry);
}

View file

@ -22,19 +22,17 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* All rights reserved.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <errno.h>
#include <sys/socket.h>
#include <stdio.h>
#include <stdarg.h>
#include <libaudit.h>
#include <X11/Xatom.h>
#include <X11/Xfuncproto.h>
#include "dix/registry_priv.h"
#include "os/client_priv.h"
#include "selection.h"
#include "inputstr.h"
#include "scrnintstr.h"
@ -42,6 +40,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "propertyst.h"
#include "extnsionst.h"
#include "xacestr.h"
#include "client.h"
#include "../os/osdep.h"
#define _XSELINUX_NEED_FLASK_MAP
#include "xselinuxint.h"
@ -74,10 +74,10 @@ static Atom atom_client_ctx;
static security_id_t unlabeled_sid;
/* forward declarations */
static void SELinuxScreen(CallbackListPtr *, void *, void *);
static void SELinuxScreen(CallbackListPtr *, pointer, pointer);
/* "true" pointer value for use as callback data */
static void *truep = (void *) 1;
static pointer truep = (pointer) 1;
/*
* Performs an SELinux permission check.
@ -115,7 +115,7 @@ SELinuxLabelClient(ClientPtr client)
int fd = XaceGetConnectionNumber(client);
SELinuxSubjectRec *subj;
SELinuxObjectRec *obj;
char *ctx;
security_context_t ctx;
subj = dixLookupPrivate(&client->devPrivates, subjectKey);
obj = dixLookupPrivate(&client->devPrivates, objectKey);
@ -170,8 +170,8 @@ SELinuxLabelInitial(void)
XaceScreenAccessRec srec;
SELinuxSubjectRec *subj;
SELinuxObjectRec *obj;
char *ctx;
void *unused;
security_context_t ctx;
pointer unused;
/* Do the serverClient */
subj = dixLookupPrivate(&serverClient->devPrivates, subjectKey);
@ -200,7 +200,7 @@ SELinuxLabelInitial(void)
/* Do the default colormap */
dixLookupResourceByType(&unused, screenInfo.screens[i]->defColormap,
X11_RESTYPE_COLORMAP, serverClient, DixCreateAccess);
RT_COLORMAP, serverClient, DixCreateAccess);
}
}
@ -294,9 +294,6 @@ SELinuxAudit(void *auditdata,
audit->extension ? audit->extension : "");
}
static int
SELinuxLog(int type, const char *fmt, ...) _X_ATTRIBUTE_PRINTF(2, 3);
static int
SELinuxLog(int type, const char *fmt, ...)
{
@ -319,7 +316,6 @@ SELinuxLog(int type, const char *fmt, ...)
va_start(ap, fmt);
vsnprintf(buf, MAX_AUDIT_MESSAGE_LENGTH, fmt, ap);
rc = audit_log_user_avc_message(audit_fd, aut, buf, NULL, NULL, NULL, 0);
(void) rc;
va_end(ap);
LogMessageVerb(X_WARNING, 0, "%s", buf);
return 0;
@ -330,7 +326,7 @@ SELinuxLog(int type, const char *fmt, ...)
*/
static void
SELinuxDevice(CallbackListPtr *pcbl, void *unused, void *calldata)
SELinuxDevice(CallbackListPtr *pcbl, pointer unused, pointer calldata)
{
XaceDeviceAccessRec *rec = calldata;
SELinuxSubjectRec *subj;
@ -367,7 +363,7 @@ SELinuxDevice(CallbackListPtr *pcbl, void *unused, void *calldata)
}
static void
SELinuxSend(CallbackListPtr *pcbl, void *unused, void *calldata)
SELinuxSend(CallbackListPtr *pcbl, pointer unused, pointer calldata)
{
XaceSendAccessRec *rec = calldata;
SELinuxSubjectRec *subj;
@ -409,7 +405,7 @@ SELinuxSend(CallbackListPtr *pcbl, void *unused, void *calldata)
}
static void
SELinuxReceive(CallbackListPtr *pcbl, void *unused, void *calldata)
SELinuxReceive(CallbackListPtr *pcbl, pointer unused, pointer calldata)
{
XaceReceiveAccessRec *rec = calldata;
SELinuxSubjectRec *subj;
@ -447,7 +443,7 @@ SELinuxReceive(CallbackListPtr *pcbl, void *unused, void *calldata)
}
static void
SELinuxExtension(CallbackListPtr *pcbl, void *unused, void *calldata)
SELinuxExtension(CallbackListPtr *pcbl, pointer unused, pointer calldata)
{
XaceExtAccessRec *rec = calldata;
SELinuxSubjectRec *subj, *serv;
@ -480,7 +476,7 @@ SELinuxExtension(CallbackListPtr *pcbl, void *unused, void *calldata)
}
/* Perform the security check */
auditdata.extension = (char *) rec->ext->name;
auditdata.extension = rec->ext->name;
rc = SELinuxDoCheck(subj, obj, SECCLASS_X_EXTENSION, rec->access_mode,
&auditdata);
if (rc != Success)
@ -488,7 +484,7 @@ SELinuxExtension(CallbackListPtr *pcbl, void *unused, void *calldata)
}
static void
SELinuxSelection(CallbackListPtr *pcbl, void *unused, void *calldata)
SELinuxSelection(CallbackListPtr *pcbl, pointer unused, pointer calldata)
{
XaceSelectionAccessRec *rec = calldata;
SELinuxSubjectRec *subj;
@ -548,7 +544,7 @@ SELinuxSelection(CallbackListPtr *pcbl, void *unused, void *calldata)
}
static void
SELinuxProperty(CallbackListPtr *pcbl, void *unused, void *calldata)
SELinuxProperty(CallbackListPtr *pcbl, pointer unused, pointer calldata)
{
XacePropertyAccessRec *rec = calldata;
SELinuxSubjectRec *subj;
@ -612,7 +608,7 @@ SELinuxProperty(CallbackListPtr *pcbl, void *unused, void *calldata)
}
static void
SELinuxResource(CallbackListPtr *pcbl, void *unused, void *calldata)
SELinuxResource(CallbackListPtr *pcbl, pointer unused, pointer calldata)
{
XaceResourceAccessRec *rec = calldata;
SELinuxSubjectRec *subj;
@ -663,7 +659,7 @@ SELinuxResource(CallbackListPtr *pcbl, void *unused, void *calldata)
rec->status = rc;
/* Perform the background none check on windows */
if (access_mode & DixCreateAccess && rec->rtype == X11_RESTYPE_WINDOW) {
if (access_mode & DixCreateAccess && rec->rtype == RT_WINDOW) {
rc = SELinuxDoCheck(subj, obj, class, DixBlendAccess, &auditdata);
if (rc != Success)
((WindowPtr) rec->res)->forcedBG = TRUE;
@ -671,7 +667,7 @@ SELinuxResource(CallbackListPtr *pcbl, void *unused, void *calldata)
}
static void
SELinuxScreen(CallbackListPtr *pcbl, void *is_saver, void *calldata)
SELinuxScreen(CallbackListPtr *pcbl, pointer is_saver, pointer calldata)
{
XaceScreenAccessRec *rec = calldata;
SELinuxSubjectRec *subj;
@ -703,7 +699,7 @@ SELinuxScreen(CallbackListPtr *pcbl, void *is_saver, void *calldata)
}
static void
SELinuxClient(CallbackListPtr *pcbl, void *unused, void *calldata)
SELinuxClient(CallbackListPtr *pcbl, pointer unused, pointer calldata)
{
XaceClientAccessRec *rec = calldata;
SELinuxSubjectRec *subj;
@ -721,7 +717,7 @@ SELinuxClient(CallbackListPtr *pcbl, void *unused, void *calldata)
}
static void
SELinuxServer(CallbackListPtr *pcbl, void *unused, void *calldata)
SELinuxServer(CallbackListPtr *pcbl, pointer unused, pointer calldata)
{
XaceServerAccessRec *rec = calldata;
SELinuxSubjectRec *subj;
@ -743,7 +739,7 @@ SELinuxServer(CallbackListPtr *pcbl, void *unused, void *calldata)
*/
static void
SELinuxClientState(CallbackListPtr *pcbl, void *unused, void *calldata)
SELinuxClientState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
{
NewClientInfoRec *pci = calldata;
@ -758,14 +754,14 @@ SELinuxClientState(CallbackListPtr *pcbl, void *unused, void *calldata)
}
static void
SELinuxResourceState(CallbackListPtr *pcbl, void *unused, void *calldata)
SELinuxResourceState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
{
ResourceStateInfoRec *rec = calldata;
SELinuxSubjectRec *subj;
SELinuxObjectRec *obj;
WindowPtr pWin;
if (rec->type != X11_RESTYPE_WINDOW)
if (rec->type != RT_WINDOW)
return;
if (rec->state != ResourceStateAdding)
return;
@ -774,7 +770,7 @@ SELinuxResourceState(CallbackListPtr *pcbl, void *unused, void *calldata)
subj = dixLookupPrivate(&wClient(pWin)->devPrivates, subjectKey);
if (subj->sid) {
char *ctx;
security_context_t ctx;
int rc = avc_sid_to_context_raw(subj->sid, &ctx);
if (rc < 0)
@ -792,7 +788,7 @@ SELinuxResourceState(CallbackListPtr *pcbl, void *unused, void *calldata)
obj = dixLookupPrivate(&pWin->devPrivates, objectKey);
if (obj->sid) {
char *ctx;
security_context_t ctx;
int rc = avc_sid_to_context_raw(obj->sid, &ctx);
if (rc < 0)
@ -811,9 +807,15 @@ SELinuxResourceState(CallbackListPtr *pcbl, void *unused, void *calldata)
static int netlink_fd;
static void
SELinuxNetlinkNotify(int fd, int ready, void *data)
SELinuxBlockHandler(void *data, struct timeval **tv, void *read_mask)
{
avc_netlink_check_nb();
}
static void
SELinuxWakeupHandler(void *data, int err, void *read_mask)
{
if (FD_ISSET(netlink_fd, (fd_set *) read_mask))
avc_netlink_check_nb();
}
void
@ -839,7 +841,9 @@ SELinuxFlaskReset(void)
/* Tear down SELinux stuff */
audit_close(audit_fd);
avc_netlink_release_fd();
RemoveNotifyFd(netlink_fd);
RemoveBlockAndWakeupHandlers(SELinuxBlockHandler, SELinuxWakeupHandler,
NULL);
RemoveGeneralSocket(netlink_fd);
avc_destroy();
}
@ -848,7 +852,7 @@ void
SELinuxFlaskInit(void)
{
struct selinux_opt avc_option = { AVC_OPT_SETENFORCE, (char *) 0 };
char *ctx;
security_context_t ctx;
int ret = TRUE;
switch (selinuxEnforcingState) {
@ -911,7 +915,9 @@ SELinuxFlaskInit(void)
FatalError("SELinux: Failed to create atom\n");
netlink_fd = avc_netlink_acquire_fd();
SetNotifyFd(netlink_fd, SELinuxNetlinkNotify, X_NOTIFY_READ, NULL);
AddGeneralSocket(netlink_fd);
RegisterBlockAndWakeupHandlers(SELinuxBlockHandler, SELinuxWakeupHandler,
NULL);
/* Register callbacks */
ret &= AddCallback(&ClientStateCallback, SELinuxClientState, NULL);

View file

@ -17,12 +17,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
********************************************************/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <selinux/label.h>
#include "dix/registry_priv.h"
#include "registry.h"
#include "xselinuxint.h"
/* selection and property atom cache */
@ -63,7 +64,7 @@ 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));
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));
@ -96,7 +97,7 @@ static int
SELinuxAtomToSIDLookup(Atom atom, SELinuxObjectRec * obj, int map, int polymap)
{
const char *name = NameForAtom(atom);
char *ctx;
security_context_t ctx;
int rc = Success;
obj->poly = 1;
@ -137,12 +138,8 @@ SELinuxAtomToSID(Atom atom, int prop, SELinuxObjectRec ** obj_rtn)
rec = SELinuxArrayGet(&arr_atoms, atom);
if (!rec) {
rec = calloc(1, sizeof(SELinuxAtomRec));
if (!rec)
if (!rec || !SELinuxArraySet(&arr_atoms, atom, rec))
return BadAlloc;
if (!SELinuxArraySet(&arr_atoms, atom, rec)) {
free(rec);
return BadAlloc;
}
}
if (prop) {
@ -258,7 +255,7 @@ SELinuxEventToSID(unsigned type, security_id_t sid_of_window,
{
const char *name = LookupEventName(type);
security_id_t sid;
char *ctx;
security_context_t ctx;
type &= 127;
@ -294,7 +291,7 @@ SELinuxEventToSID(unsigned type, security_id_t sid_of_window,
int
SELinuxExtensionToSID(const char *name, security_id_t * sid_rtn)
{
char *ctx;
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) {
@ -325,13 +322,13 @@ SELinuxTypeToClass(RESTYPE type)
if (type & RC_DRAWABLE)
class = SECCLASS_X_DRAWABLE;
else if (type == X11_RESTYPE_GC)
else if (type == RT_GC)
class = SECCLASS_X_GC;
else if (type == X11_RESTYPE_FONT)
else if (type == RT_FONT)
class = SECCLASS_X_FONT;
else if (type == X11_RESTYPE_CURSOR)
else if (type == RT_CURSOR)
class = SECCLASS_X_CURSOR;
else if (type == X11_RESTYPE_COLORMAP)
else if (type == RT_COLORMAP)
class = SECCLASS_X_COLORMAP;
else {
/* Need to do a string lookup */
@ -350,10 +347,10 @@ SELinuxTypeToClass(RESTYPE type)
return (security_class_t) (unsigned long) tmp;
}
char *
security_context_t
SELinuxDefaultClientLabel(void)
{
char *ctx;
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");

View file

@ -28,6 +28,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "dixstruct.h"
#include "privates.h"
#include "resource.h"
#include "registry.h"
#include "inputstr.h"
#include "xselinux.h"
@ -98,7 +99,7 @@ int
security_class_t SELinuxTypeToClass(RESTYPE type);
char *SELinuxDefaultClientLabel(void);
security_context_t SELinuxDefaultClientLabel(void);
void
SELinuxLabelInit(void);

View file

@ -26,22 +26,13 @@
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/Xatom.h>
#include <X11/extensions/xtestproto.h>
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/input_priv.h"
#include "dix/dix_priv.h"
#include "dix/exevents_priv.h"
#include "mi/mipointer_priv.h"
#include "os/client_priv.h"
#include "os/osdep.h"
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
@ -54,17 +45,23 @@
#include "mi.h"
#include "xkbsrv.h"
#include "xkbstr.h"
#include <X11/extensions/xtestproto.h>
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exglobals.h"
#include "mipointer.h"
#include "xserver-properties.h"
#include "exevents.h"
#include "eventstr.h"
#include "inpututils.h"
#include "extinit_priv.h"
/* XTest events are sent during request processing and may be interrupted by
#include "extinit.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.
*/
* other's memory */
static InternalEvent *xtest_evlist;
/**
@ -79,10 +76,10 @@ static InternalEvent *xtest_evlist;
*/
DeviceIntPtr xtestpointer, xtestkeyboard;
#ifdef XINERAMA
#ifdef PANORAMIX
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif /* XINERAMA */
#endif
static int XTestSwapFakeInput(ClientPtr /* client */ ,
xReq * /* req */
@ -132,8 +129,8 @@ ProcXTestCompareCursor(ClientPtr client)
else if (stuff->cursor == XTestCurrentCursor)
pCursor = GetSpriteCursor(ptr);
else {
rc = dixLookupResourceByType((void **) &pCursor, stuff->cursor,
X11_RESTYPE_CURSOR, client, DixReadAccess);
rc = dixLookupResourceByType((pointer *) &pCursor, stuff->cursor,
RT_CURSOR, client, DixReadAccess);
if (rc != Success) {
client->errorValue = stuff->cursor;
return rc;
@ -152,35 +149,6 @@ ProcXTestCompareCursor(ClientPtr client)
return Success;
}
void
XTestDeviceSendEvents(DeviceIntPtr dev,
int type,
int detail,
int flags,
const ValuatorMask *mask)
{
int nevents = 0;
int i;
switch (type) {
case MotionNotify:
nevents = GetPointerEvents(xtest_evlist, dev, type, 0, flags, mask);
break;
case ButtonPress:
case ButtonRelease:
nevents = GetPointerEvents(xtest_evlist, dev, type, detail, flags, mask);
break;
case KeyPress:
case KeyRelease:
nevents =
GetKeyboardEvents(xtest_evlist, dev, type, detail);
break;
}
for (i = 0; i < nevents; i++)
mieqProcessDeviceEvent(dev, &xtest_evlist[i], miPointerGetScreen(inputInfo.pointer));
}
static int
ProcXTestFakeInput(ClientPtr client)
{
@ -190,15 +158,18 @@ ProcXTestFakeInput(ClientPtr client)
DeviceIntPtr dev = NULL;
WindowPtr root;
Bool extension = FALSE;
deviceValuator *dv = NULL;
ValuatorMask mask;
int valuators[MAX_VALUATORS] = { 0 };
int numValuators = 0;
int firstValuator = 0;
int nevents = 0;
int i;
int base = 0;
int flags = 0;
int need_ptr_update = 1;
nev = (client->req_len << 2) - sizeof(xReq);
nev = (stuff->length << 2) - sizeof(xReq);
if ((nev % sizeof(xEvent)) || !nev)
return BadLength;
nev /= sizeof(xEvent);
@ -272,14 +243,14 @@ ProcXTestFakeInput(ClientPtr client)
}
if (nev > 1 && !dev->valuator) {
client->errorValue = firstValuator;
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);
dv = (deviceValuator *) (ev + n);
if (dv->type != DeviceValuator) {
client->errorValue = dv->type;
return BadValue;
@ -337,7 +308,7 @@ ProcXTestFakeInput(ClientPtr client)
numValuators = 2;
firstValuator = 0;
if (ev->u.u.detail == xFalse)
flags = POINTER_ABSOLUTE | POINTER_DESKTOP;
flags = POINTER_ABSOLUTE | POINTER_SCREEN;
break;
default:
client->errorValue = ev->u.u.type;
@ -350,10 +321,6 @@ ProcXTestFakeInput(ClientPtr client)
return BadAccess;
dev = GetXTestDevice(dev);
/* This can only happen if we passed a slave to GetXTestDevice() */
if (!dev)
return BadAccess;
}
@ -378,6 +345,7 @@ ProcXTestFakeInput(ClientPtr client)
/* swap the request back so we can simply re-execute it */
if (client->swapped) {
(void) XTestSwapFakeInput(client, (xReq *) stuff);
swaps(&stuff->length);
}
ResetCurrentRequest(client);
client->sequence--;
@ -411,14 +379,6 @@ ProcXTestFakeInput(ClientPtr client)
client->errorValue = ev->u.keyButtonPointer.root;
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 + numValuators > 1)
valuators[1 - firstValuator] += root->drawable.pScreen->y;
}
}
if (ev->u.u.detail != xTrue && ev->u.u.detail != xFalse) {
client->errorValue = ev->u.u.detail;
@ -442,10 +402,26 @@ ProcXTestFakeInput(ClientPtr client)
if (screenIsSaved == SCREEN_SAVER_ON)
dixSaveScreens(serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);
valuator_mask_set_range(&mask, firstValuator, numValuators, valuators);
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;
}
if (dev->sendEventsProc)
(*dev->sendEventsProc) (dev, type, ev->u.u.detail, flags, &mask);
for (i = 0; i < nevents; i++)
mieqProcessDeviceEvent(dev, &xtest_evlist[i], NULL);
if (need_ptr_update)
miPointerUpdateSprite(dev);
@ -487,26 +463,30 @@ ProcXTestDispatch(ClientPtr client)
}
}
static int _X_COLD
static int
SProcXTestGetVersion(ClientPtr client)
{
REQUEST(xXTestGetVersionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXTestGetVersionReq);
swaps(&stuff->minorVersion);
return ProcXTestGetVersion(client);
}
static int _X_COLD
static int
SProcXTestCompareCursor(ClientPtr client)
{
REQUEST(xXTestCompareCursorReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXTestCompareCursorReq);
swapl(&stuff->window);
swapl(&stuff->cursor);
return ProcXTestCompareCursor(client);
}
static int _X_COLD
static int
XTestSwapFakeInput(ClientPtr client, xReq * req)
{
int nev;
@ -514,13 +494,12 @@ XTestSwapFakeInput(ClientPtr client, xReq * req)
xEvent sev;
EventSwapPtr proc;
nev = ((client->req_len << 2) - sizeof(xReq)) / sizeof(xEvent);
nev = ((req->length << 2) - sizeof(xReq)) / sizeof(xEvent);
for (ev = (xEvent *) &req[1]; --nev >= 0; ev++) {
int evtype = ev->u.u.type & 0177;
/* Swap event */
proc = EventSwapVector[evtype];
proc = EventSwapVector[ev->u.u.type & 0177];
/* no swapping proc; invalid event type? */
if (!proc || proc == NotImplemented || evtype == GenericEvent) {
if (!proc || proc == NotImplemented) {
client->errorValue = ev->u.u.type;
return BadValue;
}
@ -530,20 +509,31 @@ XTestSwapFakeInput(ClientPtr client, xReq * req)
return Success;
}
static int _X_COLD
static int
SProcXTestFakeInput(ClientPtr client)
{
int n;
REQUEST(xReq);
swaps(&stuff->length);
n = XTestSwapFakeInput(client, stuff);
if (n != Success)
return n;
return ProcXTestFakeInput(client);
}
static int _X_COLD
static int
SProcXTestGrabControl(ClientPtr client)
{
REQUEST(xXTestGrabControlReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXTestGrabControlReq);
return ProcXTestGrabControl(client);
}
static int
SProcXTestDispatch(ClientPtr client)
{
REQUEST(xReq);
@ -555,7 +545,7 @@ SProcXTestDispatch(ClientPtr client)
case X_XTestFakeInput:
return SProcXTestFakeInput(client);
case X_XTestGrabControl:
return ProcXTestGrabControl(client);
return SProcXTestGrabControl(client);
default:
return BadRequest;
}

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
@ -21,18 +21,14 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <string.h>
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/extensions/Xv.h>
#include <X11/extensions/Xvproto.h>
#include "dix/dix_priv.h"
#include "Xext/xvdix_priv.h"
#include "misc.h"
#include "scrnintstr.h"
#include "windowstr.h"
@ -41,19 +37,22 @@ SOFTWARE.
#include "dixstruct.h"
#include "resource.h"
#include "opaque.h"
#include <X11/extensions/Xv.h>
#include <X11/extensions/Xvproto.h>
#include "xvdix.h"
#ifdef MITSHM
#include <X11/extensions/shmproto.h>
#include "shmint.h"
#endif
#include "xvdisp.h"
#ifdef XINERAMA
#ifdef PANORAMIX
#include "panoramiX.h"
#include "panoramiXsrv.h"
unsigned long XvXRTPort;
#endif /* XINERAMA */
#endif
static int
SWriteQueryExtensionReply(ClientPtr client, xvQueryExtensionReply * rep)
@ -297,6 +296,9 @@ SWriteListImageFormatsReply(ClientPtr client, xvListImageFormatsReply * rep)
if ((_c)->swapped) SWriteImageFormatInfo(_c, _d); \
else WriteToClient(_c, sz_xvImageFormatInfo, _d)
#define _AllocatePort(_i,_p) \
((_p)->id != _i) ? (* (_p)->pAdaptor->ddAllocatePort)(_i,_p,&_p) : Success
static int
ProcXvQueryExtension(ClientPtr client)
{
@ -353,6 +355,8 @@ ProcXvQueryAdaptors(ClientPtr client)
return Success;
}
(*pxvs->ddQueryAdaptors) (pScreen, &pxvs->pAdaptors, &pxvs->nAdaptors);
rep = (xvQueryAdaptorsReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
@ -417,12 +421,18 @@ ProcXvQueryEncodings(ClientPtr client)
XvPortPtr pPort;
int ne;
XvEncodingPtr pe;
int status;
REQUEST(xvQueryEncodingsReq);
REQUEST_SIZE_MATCH(xvQueryEncodingsReq);
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
client->errorValue = stuff->port;
return status;
}
rep = (xvQueryEncodingsReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
@ -474,6 +484,11 @@ ProcXvPutVideo(ClientPtr client)
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
client->errorValue = stuff->port;
return status;
}
if (!(pPort->pAdaptor->type & XvInputMask) ||
!(pPort->pAdaptor->type & XvVideoMask)) {
client->errorValue = stuff->port;
@ -504,6 +519,11 @@ ProcXvPutStill(ClientPtr client)
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
client->errorValue = stuff->port;
return status;
}
if (!(pPort->pAdaptor->type & XvInputMask) ||
!(pPort->pAdaptor->type & XvStillMask)) {
client->errorValue = stuff->port;
@ -534,6 +554,11 @@ ProcXvGetVideo(ClientPtr client)
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixReadAccess);
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
client->errorValue = stuff->port;
return status;
}
if (!(pPort->pAdaptor->type & XvOutputMask) ||
!(pPort->pAdaptor->type & XvVideoMask)) {
client->errorValue = stuff->port;
@ -564,6 +589,11 @@ ProcXvGetStill(ClientPtr client)
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixReadAccess);
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
client->errorValue = stuff->port;
return status;
}
if (!(pPort->pAdaptor->type & XvOutputMask) ||
!(pPort->pAdaptor->type & XvStillMask)) {
client->errorValue = stuff->port;
@ -600,6 +630,7 @@ ProcXvSelectVideoNotify(ClientPtr client)
static int
ProcXvSelectPortNotify(ClientPtr client)
{
int status;
XvPortPtr pPort;
REQUEST(xvSelectPortNotifyReq);
@ -607,6 +638,11 @@ ProcXvSelectPortNotify(ClientPtr client)
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
client->errorValue = stuff->port;
return status;
}
return XvdiSelectPortNotify(client, pPort, stuff->onoff);
}
@ -622,6 +658,11 @@ ProcXvGrabPort(ClientPtr client)
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
client->errorValue = stuff->port;
return status;
}
status = XvdiGrabPort(client, pPort, stuff->time, &result);
if (status != Success) {
@ -642,6 +683,7 @@ ProcXvGrabPort(ClientPtr client)
static int
ProcXvUngrabPort(ClientPtr client)
{
int status;
XvPortPtr pPort;
REQUEST(xvGrabPortReq);
@ -649,13 +691,18 @@ ProcXvUngrabPort(ClientPtr client)
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
client->errorValue = stuff->port;
return status;
}
return XvdiUngrabPort(client, pPort, stuff->time);
}
static int
ProcXvStopVideo(ClientPtr client)
{
int ret;
int status, rc;
DrawablePtr pDraw;
XvPortPtr pPort;
@ -664,9 +711,14 @@ ProcXvStopVideo(ClientPtr client)
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
ret = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixWriteAccess);
if (ret != Success)
return ret;
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
client->errorValue = stuff->port;
return status;
}
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixWriteAccess);
if (rc != Success)
return rc;
return XvdiStopVideo(client, pPort, pDraw);
}
@ -682,6 +734,11 @@ ProcXvSetPortAttribute(ClientPtr client)
VALIDATE_XV_PORT(stuff->port, pPort, DixSetAttrAccess);
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
client->errorValue = stuff->port;
return status;
}
if (!ValidAtom(stuff->attribute)) {
client->errorValue = stuff->attribute;
return BadAtom;
@ -711,6 +768,11 @@ ProcXvGetPortAttribute(ClientPtr client)
VALIDATE_XV_PORT(stuff->port, pPort, DixGetAttrAccess);
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
client->errorValue = stuff->port;
return status;
}
if (!ValidAtom(stuff->attribute)) {
client->errorValue = stuff->attribute;
return BadAtom;
@ -737,6 +799,7 @@ ProcXvGetPortAttribute(ClientPtr client)
static int
ProcXvQueryBestSize(ClientPtr client)
{
int status;
unsigned int actual_width, actual_height;
XvPortPtr pPort;
xvQueryBestSizeReply rep;
@ -746,7 +809,12 @@ ProcXvQueryBestSize(ClientPtr client)
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
(*pPort->pAdaptor->ddQueryBestSize) (pPort, stuff->motion,
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
client->errorValue = stuff->port;
return status;
}
(*pPort->pAdaptor->ddQueryBestSize) (client, pPort, stuff->motion,
stuff->vid_w, stuff->vid_h,
stuff->drw_w, stuff->drw_h,
&actual_width, &actual_height);
@ -767,7 +835,7 @@ ProcXvQueryBestSize(ClientPtr client)
static int
ProcXvQueryPortAttributes(ClientPtr client)
{
int size, i;
int status, size, i;
XvPortPtr pPort;
XvAttributePtr pAtt;
xvQueryPortAttributesReply rep;
@ -778,6 +846,11 @@ ProcXvQueryPortAttributes(ClientPtr client)
VALIDATE_XV_PORT(stuff->port, pPort, DixGetAttrAccess);
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
client->errorValue = stuff->port;
return status;
}
rep = (xvQueryPortAttributesReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
@ -828,6 +901,11 @@ ProcXvPutImage(ClientPtr client)
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
client->errorValue = stuff->port;
return status;
}
if (!(pPort->pAdaptor->type & XvImageMask) ||
!(pPort->pAdaptor->type & XvInputMask)) {
client->errorValue = stuff->port;
@ -851,7 +929,8 @@ ProcXvPutImage(ClientPtr client)
width = stuff->width;
height = stuff->height;
size = (*pPort->pAdaptor->ddQueryImageAttributes) (pPort, pImage, &width,
size = (*pPort->pAdaptor->ddQueryImageAttributes) (client,
pPort, pImage, &width,
&height, NULL, NULL);
size += sizeof(xvPutImageReq);
size = bytes_to_int32(size);
@ -870,6 +949,18 @@ ProcXvPutImage(ClientPtr client)
}
#ifdef MITSHM
/* redefined here since it's not in any header file */
typedef struct _ShmDesc {
struct _ShmDesc *next;
int shmid;
int refcnt;
char *addr;
Bool writable;
unsigned long size;
} ShmDescRec, *ShmDescPtr;
extern RESTYPE ShmSegType;
extern int ShmCompletionCode;
static int
ProcXvShmPutImage(ClientPtr client)
@ -888,6 +979,11 @@ ProcXvShmPutImage(ClientPtr client)
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
client->errorValue = stuff->port;
return status;
}
if (!(pPort->pAdaptor->type & XvImageMask) ||
!(pPort->pAdaptor->type & XvInputMask)) {
client->errorValue = stuff->port;
@ -909,14 +1005,15 @@ ProcXvShmPutImage(ClientPtr client)
if (!pImage)
return BadMatch;
status = dixLookupResourceByType((void **) &shmdesc, stuff->shmseg,
status = dixLookupResourceByType((pointer *) &shmdesc, stuff->shmseg,
ShmSegType, serverClient, DixReadAccess);
if (status != Success)
return status;
width = stuff->width;
height = stuff->height;
size_needed = (*pPort->pAdaptor->ddQueryImageAttributes) (pPort, pImage,
size_needed = (*pPort->pAdaptor->ddQueryImageAttributes) (client,
pPort, pImage,
&width, &height,
NULL, NULL);
if ((size_needed + stuff->offset) > shmdesc->size)
@ -949,6 +1046,7 @@ ProcXvShmPutImage(ClientPtr client)
static int
ProcXvShmPutImage(ClientPtr client)
{
SendErrorToClient(client, XvReqCode, xv_ShmPutImage, 0, BadImplementation);
return BadImplementation;
}
#endif
@ -999,7 +1097,7 @@ ProcXvQueryImageAttributes(ClientPtr client)
width = stuff->width;
height = stuff->height;
size = (*pPort->pAdaptor->ddQueryImageAttributes) (pPort, pImage,
size = (*pPort->pAdaptor->ddQueryImageAttributes) (client, pPort, pImage,
&width, &height, offsets,
pitches);
@ -1107,6 +1205,7 @@ ProcXvDispatch(ClientPtr client)
UpdateCurrentTime();
if (stuff->data >= xvNumRequests) {
SendErrorToClient(client, XvReqCode, stuff->data, 0, BadRequest);
return BadRequest;
}
@ -1115,49 +1214,57 @@ ProcXvDispatch(ClientPtr client)
/* Swapped Procs */
static int _X_COLD
static int
SProcXvQueryExtension(ClientPtr client)
{
REQUEST(xvQueryExtensionReq);
swaps(&stuff->length);
return XvProcVector[xv_QueryExtension] (client);
}
static int
SProcXvQueryAdaptors(ClientPtr client)
{
REQUEST(xvQueryAdaptorsReq);
REQUEST_SIZE_MATCH(xvQueryAdaptorsReq);
swaps(&stuff->length);
swapl(&stuff->window);
return XvProcVector[xv_QueryAdaptors] (client);
}
static int _X_COLD
static int
SProcXvQueryEncodings(ClientPtr client)
{
REQUEST(xvQueryEncodingsReq);
REQUEST_SIZE_MATCH(xvQueryEncodingsReq);
swaps(&stuff->length);
swapl(&stuff->port);
return XvProcVector[xv_QueryEncodings] (client);
}
static int _X_COLD
static int
SProcXvGrabPort(ClientPtr client)
{
REQUEST(xvGrabPortReq);
REQUEST_SIZE_MATCH(xvGrabPortReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->time);
return XvProcVector[xv_GrabPort] (client);
}
static int _X_COLD
static int
SProcXvUngrabPort(ClientPtr client)
{
REQUEST(xvUngrabPortReq);
REQUEST_SIZE_MATCH(xvUngrabPortReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->time);
return XvProcVector[xv_UngrabPort] (client);
}
static int _X_COLD
static int
SProcXvPutVideo(ClientPtr client)
{
REQUEST(xvPutVideoReq);
REQUEST_SIZE_MATCH(xvPutVideoReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->drawable);
swapl(&stuff->gc);
@ -1172,11 +1279,11 @@ SProcXvPutVideo(ClientPtr client)
return XvProcVector[xv_PutVideo] (client);
}
static int _X_COLD
static int
SProcXvPutStill(ClientPtr client)
{
REQUEST(xvPutStillReq);
REQUEST_SIZE_MATCH(xvPutStillReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->drawable);
swapl(&stuff->gc);
@ -1191,11 +1298,11 @@ SProcXvPutStill(ClientPtr client)
return XvProcVector[xv_PutStill] (client);
}
static int _X_COLD
static int
SProcXvGetVideo(ClientPtr client)
{
REQUEST(xvGetVideoReq);
REQUEST_SIZE_MATCH(xvGetVideoReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->drawable);
swapl(&stuff->gc);
@ -1210,11 +1317,11 @@ SProcXvGetVideo(ClientPtr client)
return XvProcVector[xv_GetVideo] (client);
}
static int _X_COLD
static int
SProcXvGetStill(ClientPtr client)
{
REQUEST(xvGetStillReq);
REQUEST_SIZE_MATCH(xvGetStillReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->drawable);
swapl(&stuff->gc);
@ -1229,11 +1336,11 @@ SProcXvGetStill(ClientPtr client)
return XvProcVector[xv_GetStill] (client);
}
static int _X_COLD
static int
SProcXvPutImage(ClientPtr client)
{
REQUEST(xvPutImageReq);
REQUEST_AT_LEAST_SIZE(xvPutImageReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->drawable);
swapl(&stuff->gc);
@ -1252,11 +1359,11 @@ SProcXvPutImage(ClientPtr client)
}
#ifdef MITSHM
static int _X_COLD
static int
SProcXvShmPutImage(ClientPtr client)
{
REQUEST(xvShmPutImageReq);
REQUEST_SIZE_MATCH(xvShmPutImageReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->drawable);
swapl(&stuff->gc);
@ -1279,60 +1386,60 @@ SProcXvShmPutImage(ClientPtr client)
#define SProcXvShmPutImage ProcXvShmPutImage
#endif
static int _X_COLD
static int
SProcXvSelectVideoNotify(ClientPtr client)
{
REQUEST(xvSelectVideoNotifyReq);
REQUEST_SIZE_MATCH(xvSelectVideoNotifyReq);
swaps(&stuff->length);
swapl(&stuff->drawable);
return XvProcVector[xv_SelectVideoNotify] (client);
}
static int _X_COLD
static int
SProcXvSelectPortNotify(ClientPtr client)
{
REQUEST(xvSelectPortNotifyReq);
REQUEST_SIZE_MATCH(xvSelectPortNotifyReq);
swaps(&stuff->length);
swapl(&stuff->port);
return XvProcVector[xv_SelectPortNotify] (client);
}
static int _X_COLD
static int
SProcXvStopVideo(ClientPtr client)
{
REQUEST(xvStopVideoReq);
REQUEST_SIZE_MATCH(xvStopVideoReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->drawable);
return XvProcVector[xv_StopVideo] (client);
}
static int _X_COLD
static int
SProcXvSetPortAttribute(ClientPtr client)
{
REQUEST(xvSetPortAttributeReq);
REQUEST_SIZE_MATCH(xvSetPortAttributeReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->attribute);
swapl(&stuff->value);
return XvProcVector[xv_SetPortAttribute] (client);
}
static int _X_COLD
static int
SProcXvGetPortAttribute(ClientPtr client)
{
REQUEST(xvGetPortAttributeReq);
REQUEST_SIZE_MATCH(xvGetPortAttributeReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->attribute);
return XvProcVector[xv_GetPortAttribute] (client);
}
static int _X_COLD
static int
SProcXvQueryBestSize(ClientPtr client)
{
REQUEST(xvQueryBestSizeReq);
REQUEST_SIZE_MATCH(xvQueryBestSizeReq);
swaps(&stuff->length);
swapl(&stuff->port);
swaps(&stuff->vid_w);
swaps(&stuff->vid_h);
@ -1341,20 +1448,20 @@ SProcXvQueryBestSize(ClientPtr client)
return XvProcVector[xv_QueryBestSize] (client);
}
static int _X_COLD
static int
SProcXvQueryPortAttributes(ClientPtr client)
{
REQUEST(xvQueryPortAttributesReq);
REQUEST_SIZE_MATCH(xvQueryPortAttributesReq);
swaps(&stuff->length);
swapl(&stuff->port);
return XvProcVector[xv_QueryPortAttributes] (client);
}
static int _X_COLD
static int
SProcXvQueryImageAttributes(ClientPtr client)
{
REQUEST(xvQueryImageAttributesReq);
REQUEST_SIZE_MATCH(xvQueryImageAttributesReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->id);
swaps(&stuff->width);
@ -1362,17 +1469,17 @@ SProcXvQueryImageAttributes(ClientPtr client)
return XvProcVector[xv_QueryImageAttributes] (client);
}
static int _X_COLD
static int
SProcXvListImageFormats(ClientPtr client)
{
REQUEST(xvListImageFormatsReq);
REQUEST_SIZE_MATCH(xvListImageFormatsReq);
swaps(&stuff->length);
swapl(&stuff->port);
return XvProcVector[xv_ListImageFormats] (client);
}
static int (*SXvProcVector[xvNumRequests]) (ClientPtr) = {
ProcXvQueryExtension,
SProcXvQueryExtension,
SProcXvQueryAdaptors,
SProcXvQueryEncodings,
SProcXvGrabPort,
@ -1391,7 +1498,7 @@ static int (*SXvProcVector[xvNumRequests]) (ClientPtr) = {
SProcXvListImageFormats,
SProcXvQueryImageAttributes, SProcXvPutImage, SProcXvShmPutImage,};
int _X_COLD
int
SProcXvDispatch(ClientPtr client)
{
REQUEST(xReq);
@ -1399,13 +1506,14 @@ SProcXvDispatch(ClientPtr client)
UpdateCurrentTime();
if (stuff->data >= xvNumRequests) {
SendErrorToClient(client, XvReqCode, stuff->data, 0, BadRequest);
return BadRequest;
}
return SXvProcVector[stuff->data] (client);
}
#ifdef XINERAMA
#ifdef PANORAMIX
static int
XineramaXvStopVideo(ClientPtr client)
{
@ -1415,12 +1523,12 @@ XineramaXvStopVideo(ClientPtr client)
REQUEST(xvStopVideoReq);
REQUEST_SIZE_MATCH(xvStopVideoReq);
result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
return (result == BadValue) ? BadDrawable : result;
result = dixLookupResourceByType((void **) &port, stuff->port,
result = dixLookupResourceByType((pointer *) &port, stuff->port,
XvXRTPort, client, DixReadAccess);
if (result != Success)
return result;
@ -1445,7 +1553,7 @@ XineramaXvSetPortAttribute(ClientPtr client)
REQUEST_SIZE_MATCH(xvSetPortAttributeReq);
result = dixLookupResourceByType((void **) &port, stuff->port,
result = dixLookupResourceByType((pointer *) &port, stuff->port,
XvXRTPort, client, DixReadAccess);
if (result != Success)
return result;
@ -1465,25 +1573,23 @@ XineramaXvShmPutImage(ClientPtr client)
{
REQUEST(xvShmPutImageReq);
PanoramiXRes *draw, *gc, *port;
Bool send_event;
Bool send_event = stuff->send_event;
Bool isRoot;
int result, i, x, y;
REQUEST_SIZE_MATCH(xvShmPutImageReq);
send_event = stuff->send_event;
result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
return (result == BadValue) ? BadDrawable : result;
result = dixLookupResourceByType((void **) &gc, stuff->gc,
result = dixLookupResourceByType((pointer *) &gc, stuff->gc,
XRT_GC, client, DixReadAccess);
if (result != Success)
return result;
result = dixLookupResourceByType((void **) &port, stuff->port,
result = dixLookupResourceByType((pointer *) &port, stuff->port,
XvXRTPort, client, DixReadAccess);
if (result != Success)
return result;
@ -1513,7 +1619,7 @@ XineramaXvShmPutImage(ClientPtr client)
}
#else
#define XineramaXvShmPutImage ProcXvShmPutImage
#endif /* MITSHM */
#endif
static int
XineramaXvPutImage(ClientPtr client)
@ -1525,17 +1631,17 @@ XineramaXvPutImage(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xvPutImageReq);
result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
return (result == BadValue) ? BadDrawable : result;
result = dixLookupResourceByType((void **) &gc, stuff->gc,
result = dixLookupResourceByType((pointer *) &gc, stuff->gc,
XRT_GC, client, DixReadAccess);
if (result != Success)
return result;
result = dixLookupResourceByType((void **) &port, stuff->port,
result = dixLookupResourceByType((pointer *) &port, stuff->port,
XvXRTPort, client, DixReadAccess);
if (result != Success)
return result;
@ -1573,17 +1679,17 @@ XineramaXvPutVideo(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xvPutVideoReq);
result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
return (result == BadValue) ? BadDrawable : result;
result = dixLookupResourceByType((void **) &gc, stuff->gc,
result = dixLookupResourceByType((pointer *) &gc, stuff->gc,
XRT_GC, client, DixReadAccess);
if (result != Success)
return result;
result = dixLookupResourceByType((void **) &port, stuff->port,
result = dixLookupResourceByType((pointer *) &port, stuff->port,
XvXRTPort, client, DixReadAccess);
if (result != Success)
return result;
@ -1621,17 +1727,17 @@ XineramaXvPutStill(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xvPutImageReq);
result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
return (result == BadValue) ? BadDrawable : result;
result = dixLookupResourceByType((void **) &gc, stuff->gc,
result = dixLookupResourceByType((pointer *) &gc, stuff->gc,
XRT_GC, client, DixReadAccess);
if (result != Success)
return result;
result = dixLookupResourceByType((void **) &port, stuff->port,
result = dixLookupResourceByType((pointer *) &port, stuff->port,
XvXRTPort, client, DixReadAccess);
if (result != Success)
return result;
@ -1768,17 +1874,17 @@ XineramifyXv(void)
XvProcVector[xv_PutImage] = XineramaXvPutImage;
XvProcVector[xv_ShmPutImage] = XineramaXvShmPutImage;
}
#endif /* XINERAMA */
#endif /* PANORAMIX */
void
XvResetProcVector(void)
{
#ifdef XINERAMA
#ifdef PANORAMIX
XvProcVector[xv_PutVideo] = ProcXvPutVideo;
XvProcVector[xv_PutStill] = ProcXvPutStill;
XvProcVector[xv_StopVideo] = ProcXvStopVideo;
XvProcVector[xv_SetPortAttribute] = ProcXvSetPortAttribute;
XvProcVector[xv_PutImage] = ProcXvPutImage;
XvProcVector[xv_ShmPutImage] = ProcXvShmPutImage;
#endif /* XINERAMA */
#endif
}

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,21 @@ SOFTWARE.
#include "scrnintstr.h"
#include <X11/extensions/Xvproto.h>
extern _X_EXPORT unsigned long XvExtensionGeneration;
extern _X_EXPORT unsigned long XvScreenGeneration;
extern _X_EXPORT unsigned long XvResourceGeneration;
extern _X_EXPORT int XvReqCode;
extern _X_EXPORT int XvEventBase;
extern _X_EXPORT int XvErrorBase;
extern _X_EXPORT RESTYPE XvRTPort;
extern _X_EXPORT RESTYPE XvRTEncoding;
extern _X_EXPORT RESTYPE XvRTGrab;
extern _X_EXPORT RESTYPE XvRTVideoNotify;
extern _X_EXPORT RESTYPE XvRTVideoNotifyList;
extern _X_EXPORT RESTYPE XvRTPortNotify;
typedef struct {
int numerator;
int denominator;
@ -70,7 +85,18 @@ typedef struct {
ClientPtr client;
} XvGrabRec, *XvGrabPtr;
typedef struct _XvPortNotifyRec *XvPortNotifyPtr;
typedef struct _XvVideoNotifyRec {
struct _XvVideoNotifyRec *next;
ClientPtr client;
unsigned long id;
unsigned long mask;
} XvVideoNotifyRec, *XvVideoNotifyPtr;
typedef struct _XvPortNotifyRec {
struct _XvPortNotifyRec *next;
ClientPtr client;
unsigned long id;
} XvPortNotifyRec, *XvPortNotifyPtr;
typedef struct {
int id;
@ -131,29 +157,32 @@ typedef struct {
int nPorts;
struct _XvPortRec *pPorts;
ScreenPtr pScreen;
int (*ddPutVideo) (DrawablePtr, struct _XvPortRec *, GCPtr,
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) (DrawablePtr, struct _XvPortRec *, GCPtr,
int (*ddPutStill) (ClientPtr, DrawablePtr, struct _XvPortRec *, GCPtr,
INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16);
int (*ddGetVideo) (DrawablePtr, struct _XvPortRec *, GCPtr,
int (*ddGetVideo) (ClientPtr, DrawablePtr, struct _XvPortRec *, GCPtr,
INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16);
int (*ddGetStill) (DrawablePtr, struct _XvPortRec *, GCPtr,
int (*ddGetStill) (ClientPtr, 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,
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) (DrawablePtr, struct _XvPortRec *, GCPtr,
int (*ddPutImage) (ClientPtr, DrawablePtr, struct _XvPortRec *, GCPtr,
INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16,
XvImagePtr, unsigned char *, Bool, CARD16, CARD16);
int (*ddQueryImageAttributes) (struct _XvPortRec *, XvImagePtr,
int (*ddQueryImageAttributes) (ClientPtr, struct _XvPortRec *, XvImagePtr,
CARD16 *, CARD16 *, int *, int *);
DevUnion devPriv;
} XvAdaptorRec, *XvAdaptorPtr;
@ -169,6 +198,14 @@ typedef struct _XvPortRec {
DevUnion devPriv;
} XvPortRec, *XvPortPtr;
#define VALIDATE_XV_PORT(portID, pPort, mode)\
{\
int rc = dixLookupResourceByType((pointer *)&(pPort), portID,\
XvRTPort, client, mode);\
if (rc != Success)\
return rc;\
}
typedef struct {
int version, revision;
int nAdaptors;
@ -176,10 +213,55 @@ typedef struct {
DestroyWindowProcPtr DestroyWindow;
DestroyPixmapProcPtr DestroyPixmap;
CloseScreenProcPtr CloseScreen;
Bool (*ddCloseScreen) (ScreenPtr);
int (*ddQueryAdaptors) (ScreenPtr, XvAdaptorPtr *, int *);
DevUnion devPriv;
} XvScreenRec, *XvScreenPtr;
#define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = ((XvScreenPtr) \
dixLookupPrivate(&(pScreen)->devPrivates, XvScreenKey))->field)
#define SCREEN_EPILOGUE(pScreen, field, wrapper)\
((pScreen)->field = wrapper)
/* Errors */
#define _XvBadPort (XvBadPort+XvErrorBase)
#define _XvBadEncoding (XvBadEncoding+XvErrorBase)
extern _X_EXPORT int ProcXvDispatch(ClientPtr);
extern _X_EXPORT int SProcXvDispatch(ClientPtr);
extern _X_EXPORT int XvScreenInit(ScreenPtr);
extern _X_EXPORT DevPrivateKey XvGetScreenKey(void);
extern _X_EXPORT unsigned long XvGetRTPort(void);
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);
extern _X_EXPORT int XvdiPutStill(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
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);
extern _X_EXPORT int XvdiGetStill(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
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);
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 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 */

View file

@ -1,84 +0,0 @@
/* SPDX-License-Identifier: MIT OR X11
*
* Copyright © 2024 Enrico Weigelt, metux IT consult <info@metux.net>
*/
#ifndef _XORG_XVDIX_PRIV_H
#include <X11/Xdefs.h>
#include "include/pixmap.h"
#include "include/regionstr.h"
#include "Xext/xvdix.h"
#define VALIDATE_XV_PORT(portID, pPort, mode)\
{\
int rc = dixLookupResourceByType((void **)&(pPort), portID,\
XvRTPort, client, mode);\
if (rc != Success)\
return rc;\
}
/* Errors */
#define _XvBadPort (XvBadPort+XvErrorBase)
typedef struct _XvPortNotifyRec {
struct _XvPortNotifyRec *next;
ClientPtr client;
unsigned long id;
} XvPortNotifyRec, *XvPortNotifyPtr;
extern int XvReqCode;
extern int XvErrorBase;
extern RESTYPE XvRTPort;
/* dispatch functions */
int ProcXvDispatch(ClientPtr);
int SProcXvDispatch(ClientPtr);
void XvFreeAdaptor(XvAdaptorPtr pAdaptor);
void XvFillColorKey(DrawablePtr pDraw, CARD32 key, RegionPtr region);
int XvdiSelectVideoNotify(ClientPtr client, DrawablePtr pDraw, BOOL onoff);
int XvdiSelectPortNotify(ClientPtr client, XvPortPtr pPort, BOOL onoff);
int XvdiPutVideo(ClientPtr client, DrawablePtr pDraw, XvPortPtr pPort,
GCPtr pGC, INT16 vid_x, INT16 vid_y, CARD16 vid_w,
CARD16 wid_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w,
CARD16 drw_h);
int XvdiPutStill(ClientPtr client, DrawablePtr pDraw, XvPortPtr pPort,
GCPtr pGC, INT16 vid_x, INT16 vid_y, CARD16 vid_w,
CARD16 vid_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w,
CARD16 drw_h);
int XvdiPutImage(ClientPtr client, DrawablePtr pDraw, XvPortPtr pPort,
GCPtr pGC, INT16 src_x, INT16 src_y, CARD16 src_w,
CARD16 src_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w,
CARD16 drw_h, XvImagePtr image, unsigned char *data,
Bool sync, CARD16 width, CARD16 height);
int XvdiGetVideo(ClientPtr client, DrawablePtr pDraw, XvPortPtr pPort,
GCPtr pGC, INT16 vid_x, INT16 vid_y, CARD16 vid_w,
CARD16 vid_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w,
CARD16 drw_h);
int XvdiGetStill(ClientPtr client, DrawablePtr pDraw, XvPortPtr pPort,
GCPtr pGC, INT16 vid_x, INT16 vid_y, CARD16 vid_w,
CARD16 vid_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w,
CARD16 drw_h);
int XvdiSetPortAttribute(ClientPtr client, XvPortPtr pPort, Atom attribute,
INT32 value);
int XvdiGetPortAttribute(ClientPtr client, XvPortPtr pPort, Atom attribute,
INT32 *p_value);
int XvdiStopVideo(ClientPtr client, XvPortPtr pPort, DrawablePtr pDraw);
int XvdiMatchPort(XvPortPtr pPort, DrawablePtr pDraw);
int XvdiGrabPort(ClientPtr client, XvPortPtr pPort, Time ctime, int *p_result);
int XvdiUngrabPort(ClientPtr client, XvPortPtr pPort, Time ctime);
XvImagePtr XvMCFindXvImage(XvPortPtr pPort, CARD32 id);
#endif /* _XORG_XVDIX_PRIV_H */

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
@ -23,11 +23,11 @@ SOFTWARE.
******************************************************************/
/*
** File:
** File:
**
** xvmain.c --- Xv server extension main device independent module.
**
** Author:
**
** Author:
**
** David Carver (Digital Workstation Engineering/Project Athena)
**
@ -58,7 +58,7 @@ SOFTWARE.
**
** 24.01.91 Carver
** - version 1.4 upgrade
**
**
** Notes:
**
** Port structures reference client structures in a two different
@ -73,67 +73,56 @@ SOFTWARE.
**
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <string.h>
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/extensions/Xv.h>
#include <X11/extensions/Xvproto.h>
#include "Xext/xvdix_priv.h"
#include "misc.h"
#include "os.h"
#include "scrnintstr.h"
#include "windowstr.h"
#include "pixmapstr.h"
#include "gcstruct.h"
#include "gc.h"
#include "extnsionst.h"
#include "extinit_priv.h"
#include "extinit.h"
#include "dixstruct.h"
#include "resource.h"
#include "opaque.h"
#include "input.h"
#ifdef XINERAMA
#define GLOBAL
#include <X11/extensions/Xv.h>
#include <X11/extensions/Xvproto.h>
#include "xvdix.h"
#ifdef PANORAMIX
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif /* XINERAMA */
#endif
#include "xvdisp.h"
#define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = ((XvScreenPtr) \
dixLookupPrivate(&(pScreen)->devPrivates, XvScreenKey))->field)
#define SCREEN_EPILOGUE(pScreen, field, wrapper)\
((pScreen)->field = wrapper)
typedef struct _XvVideoNotifyRec {
struct _XvVideoNotifyRec *next;
ClientPtr client;
unsigned long id;
unsigned long mask;
} XvVideoNotifyRec, *XvVideoNotifyPtr;
static DevPrivateKeyRec XvScreenKeyRec;
Bool noXvExtension = FALSE;
#define XvScreenKey (&XvScreenKeyRec)
static unsigned long XvExtensionGeneration = 0;
static unsigned long XvScreenGeneration = 0;
static unsigned long XvResourceGeneration = 0;
unsigned long XvExtensionGeneration = 0;
unsigned long XvScreenGeneration = 0;
unsigned long XvResourceGeneration = 0;
int XvReqCode;
static int XvEventBase;
int XvEventBase;
int XvErrorBase;
RESTYPE XvRTPort;
static RESTYPE XvRTEncoding;
static RESTYPE XvRTGrab;
static RESTYPE XvRTVideoNotify;
static RESTYPE XvRTVideoNotifyList;
static RESTYPE XvRTPortNotify;
RESTYPE XvRTEncoding;
RESTYPE XvRTGrab;
RESTYPE XvRTVideoNotify;
RESTYPE XvRTVideoNotifyList;
RESTYPE XvRTPortNotify;
/* EXTERNAL */
@ -145,12 +134,12 @@ static Bool XvCloseScreen(ScreenPtr);
static Bool XvDestroyPixmap(PixmapPtr);
static Bool XvDestroyWindow(WindowPtr);
static void XvResetProc(ExtensionEntry *);
static int XvdiDestroyGrab(void *, XID);
static int XvdiDestroyEncoding(void *, XID);
static int XvdiDestroyVideoNotify(void *, XID);
static int XvdiDestroyPortNotify(void *, XID);
static int XvdiDestroyVideoNotifyList(void *, XID);
static int XvdiDestroyPort(void *, XID);
static int XvdiDestroyGrab(pointer, XID);
static int XvdiDestroyEncoding(pointer, XID);
static int XvdiDestroyVideoNotify(pointer, XID);
static int XvdiDestroyPortNotify(pointer, XID);
static int XvdiDestroyVideoNotifyList(pointer, XID);
static int XvdiDestroyPort(pointer, XID);
static int XvdiSendVideoNotify(XvPortPtr, DrawablePtr, int);
/*
@ -167,16 +156,16 @@ XvExtensionInit(void)
if (!dixRegisterPrivateKey(&XvScreenKeyRec, PRIVATE_SCREEN, 0))
return;
/* Look to see if any screens were initialized; if not then
init global variables so the extension can function */
/* LOOK TO SEE IF ANY SCREENS WERE INITIALIZED; IF NOT THEN
INIT GLOBAL VARIABLES SO THE EXTENSION CAN FUNCTION */
if (XvScreenGeneration != serverGeneration) {
if (!CreateResourceTypes()) {
ErrorF("XvExtensionInit: Unable to allocate resource types\n");
return;
}
#ifdef XINERAMA
#ifdef PANORAMIX
XineramaRegisterConnectionBlockCallback(XineramifyXv);
#endif /* XINERAMA */
#endif
XvScreenGeneration = serverGeneration;
}
@ -267,9 +256,9 @@ XvScreenInit(ScreenPtr pScreen)
ErrorF("XvScreenInit: Unable to allocate resource types\n");
return BadAlloc;
}
#ifdef XINERAMA
#ifdef PANORAMIX
XineramaRegisterConnectionBlockCallback(XineramifyXv);
#endif /* XINERAMA */
#endif
XvScreenGeneration = serverGeneration;
}
@ -313,6 +302,8 @@ XvCloseScreen(ScreenPtr pScreen)
pScreen->DestroyWindow = pxvs->DestroyWindow;
pScreen->CloseScreen = pxvs->CloseScreen;
(*pxvs->ddCloseScreen) (pScreen);
free(pxvs);
dixSetPrivate(&pScreen->devPrivates, XvScreenKey, NULL);
@ -338,24 +329,36 @@ XvGetRTPort(void)
return XvRTPort;
}
static void
XvStopAdaptors(DrawablePtr pDrawable)
static Bool
XvDestroyPixmap(PixmapPtr pPix)
{
ScreenPtr pScreen = pDrawable->pScreen;
XvScreenPtr pxvs = dixLookupPrivate(&pScreen->devPrivates, XvScreenKey);
XvAdaptorPtr pa = pxvs->pAdaptors;
int na = pxvs->nAdaptors;
Bool status;
ScreenPtr pScreen;
XvScreenPtr pxvs;
XvAdaptorPtr pa;
int na;
XvPortPtr pp;
int np;
pScreen = pPix->drawable.pScreen;
SCREEN_PROLOGUE(pScreen, DestroyPixmap);
pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XvScreenKey);
/* CHECK TO SEE IF THIS PORT IS IN USE */
pa = pxvs->pAdaptors;
na = pxvs->nAdaptors;
while (na--) {
XvPortPtr pp = pa->pPorts;
int np = pa->nPorts;
np = pa->nPorts;
pp = pa->pPorts;
while (np--) {
if (pp->pDraw == pDrawable) {
XvdiSendVideoNotify(pp, pDrawable, XvPreempted);
if (pp->pDraw == (DrawablePtr) pPix) {
XvdiSendVideoNotify(pp, pp->pDraw, XvPreempted);
(void) (*pp->pAdaptor->ddStopVideo) (pp, pDrawable);
(void) (*pp->pAdaptor->ddStopVideo) (NULL, pp, pp->pDraw);
pp->pDraw = NULL;
pp->client = NULL;
@ -365,20 +368,9 @@ XvStopAdaptors(DrawablePtr pDrawable)
}
pa++;
}
}
static Bool
XvDestroyPixmap(PixmapPtr pPix)
{
ScreenPtr pScreen = pPix->drawable.pScreen;
Bool status = TRUE;
status = (*pScreen->DestroyPixmap) (pPix);
if (pPix->refcnt == 1)
XvStopAdaptors(&pPix->drawable);
SCREEN_PROLOGUE(pScreen, DestroyPixmap);
if (pScreen->DestroyPixmap)
status = pScreen->DestroyPixmap(pPix);
SCREEN_EPILOGUE(pScreen, DestroyPixmap, XvDestroyPixmap);
return status;
@ -388,34 +380,90 @@ XvDestroyPixmap(PixmapPtr pPix)
static Bool
XvDestroyWindow(WindowPtr pWin)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
Bool status;
ScreenPtr pScreen;
XvScreenPtr pxvs;
XvAdaptorPtr pa;
int na;
XvPortPtr pp;
int np;
XvStopAdaptors(&pWin->drawable);
pScreen = pWin->drawable.pScreen;
SCREEN_PROLOGUE(pScreen, DestroyWindow);
pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XvScreenKey);
/* CHECK TO SEE IF THIS PORT IS IN USE */
pa = pxvs->pAdaptors;
na = pxvs->nAdaptors;
while (na--) {
np = pa->nPorts;
pp = pa->pPorts;
while (np--) {
if (pp->pDraw == (DrawablePtr) pWin) {
XvdiSendVideoNotify(pp, pp->pDraw, XvPreempted);
(void) (*pp->pAdaptor->ddStopVideo) (NULL, pp, pp->pDraw);
pp->pDraw = NULL;
pp->client = NULL;
pp->time = currentTime;
}
pp++;
}
pa++;
}
status = (*pScreen->DestroyWindow) (pWin);
SCREEN_EPILOGUE(pScreen, DestroyWindow, XvDestroyWindow);
return status;
}
static int
XvdiDestroyPort(void *pPort, XID id)
/* The XvdiVideoStopped procedure is a hook for the device dependent layer.
It provides a way for the dd layer to inform the di layer that video has
stopped in a port for reasons that the di layer had no control over; note
that it doesn't call back into the dd layer */
int
XvdiVideoStopped(XvPortPtr pPort, int reason)
{
/* IF PORT ISN'T ACTIVE THEN WE'RE DONE */
if (!pPort->pDraw)
return Success;
XvdiSendVideoNotify(pPort, pPort->pDraw, reason);
pPort->pDraw = NULL;
pPort->client = NULL;
pPort->time = currentTime;
return Success;
}
static int
XvdiDestroyGrab(void *pGrab, XID id)
XvdiDestroyPort(pointer pPort, XID id)
{
return (*((XvPortPtr) pPort)->pAdaptor->ddFreePort) (pPort);
}
static int
XvdiDestroyGrab(pointer pGrab, XID id)
{
((XvGrabPtr) pGrab)->client = NULL;
return Success;
}
static int
XvdiDestroyVideoNotify(void *pn, XID id)
XvdiDestroyVideoNotify(pointer pn, XID id)
{
/* JUST CLEAR OUT THE client POINTER FIELD */
@ -424,7 +472,7 @@ XvdiDestroyVideoNotify(void *pn, XID id)
}
static int
XvdiDestroyPortNotify(void *pn, XID id)
XvdiDestroyPortNotify(pointer pn, XID id)
{
/* JUST CLEAR OUT THE client POINTER FIELD */
@ -433,11 +481,11 @@ XvdiDestroyPortNotify(void *pn, XID id)
}
static int
XvdiDestroyVideoNotifyList(void *pn, XID id)
XvdiDestroyVideoNotifyList(pointer pn, XID id)
{
XvVideoNotifyPtr npn, cpn;
/* ACTUALLY DESTROY THE NOTIFY LIST */
/* ACTUALLY DESTROY THE NOTITY LIST */
cpn = (XvVideoNotifyPtr) pn;
@ -452,7 +500,7 @@ XvdiDestroyVideoNotifyList(void *pn, XID id)
}
static int
XvdiDestroyEncoding(void *value, XID id)
XvdiDestroyEncoding(pointer value, XID id)
{
return Success;
}
@ -462,7 +510,7 @@ XvdiSendVideoNotify(XvPortPtr pPort, DrawablePtr pDraw, int reason)
{
XvVideoNotifyPtr pn;
dixLookupResourceByType((void **) &pn, pDraw->id, XvRTVideoNotifyList,
dixLookupResourceByType((pointer *) &pn, pDraw->id, XvRTVideoNotifyList,
serverClient, DixReadAccess);
while (pn) {
@ -481,7 +529,7 @@ XvdiSendVideoNotify(XvPortPtr pPort, DrawablePtr pDraw, int reason)
}
static int
int
XvdiSendPortNotify(XvPortPtr pPort, Atom attribute, INT32 value)
{
XvPortNotifyPtr pn;
@ -544,7 +592,7 @@ XvdiPutVideo(ClientPtr client,
XvdiSendVideoNotify(pPort, pPort->pDraw, XvPreempted);
}
(void) (*pPort->pAdaptor->ddPutVideo) (pDraw, pPort, pGC,
(void) (*pPort->pAdaptor->ddPutVideo) (client, pDraw, pPort, pGC,
vid_x, vid_y, vid_w, vid_h,
drw_x, drw_y, drw_w, drw_h);
@ -586,7 +634,7 @@ XvdiPutStill(ClientPtr client,
pPort->time = currentTime;
status = (*pPort->pAdaptor->ddPutStill) (pDraw, pPort, pGC,
status = (*pPort->pAdaptor->ddPutStill) (client, pDraw, pPort, pGC,
vid_x, vid_y, vid_w, vid_h,
drw_x, drw_y, drw_w, drw_h);
@ -622,7 +670,7 @@ XvdiPutImage(ClientPtr client,
pPort->time = currentTime;
return (*pPort->pAdaptor->ddPutImage) (pDraw, pPort, pGC,
return (*pPort->pAdaptor->ddPutImage) (client, pDraw, pPort, pGC,
src_x, src_y, src_w, src_h,
drw_x, drw_y, drw_w, drw_h,
image, data, sync, width, height);
@ -661,7 +709,7 @@ XvdiGetVideo(ClientPtr client,
XvdiSendVideoNotify(pPort, pPort->pDraw, XvPreempted);
}
(void) (*pPort->pAdaptor->ddGetVideo) (pDraw, pPort, pGC,
(void) (*pPort->pAdaptor->ddGetVideo) (client, pDraw, pPort, pGC,
vid_x, vid_y, vid_w, vid_h,
drw_x, drw_y, drw_w, drw_h);
@ -701,7 +749,7 @@ XvdiGetStill(ClientPtr client,
return Success;
}
status = (*pPort->pAdaptor->ddGetStill) (pDraw, pPort, pGC,
status = (*pPort->pAdaptor->ddGetStill) (client, pDraw, pPort, pGC,
vid_x, vid_y, vid_w, vid_h,
drw_x, drw_y, drw_w, drw_h);
@ -795,7 +843,7 @@ XvdiSelectVideoNotify(ClientPtr client, DrawablePtr pDraw, BOOL onoff)
/* FIND VideoNotify LIST */
rc = dixLookupResourceByType((void **) &pn, pDraw->id,
rc = dixLookupResourceByType((pointer *) &pn, pDraw->id,
XvRTVideoNotifyList, client, DixWriteAccess);
if (rc != Success && rc != BadValue)
return rc;
@ -812,9 +860,10 @@ XvdiSelectVideoNotify(ClientPtr client, DrawablePtr pDraw, BOOL onoff)
if (!(tpn = malloc(sizeof(XvVideoNotifyRec))))
return BadAlloc;
tpn->next = NULL;
tpn->client = NULL;
if (!AddResource(pDraw->id, XvRTVideoNotifyList, tpn))
if (!AddResource(pDraw->id, XvRTVideoNotifyList, tpn)) {
free(tpn);
return BadAlloc;
}
}
else {
/* LOOK TO SEE IF ENTRY ALREADY EXISTS */
@ -823,10 +872,8 @@ XvdiSelectVideoNotify(ClientPtr client, DrawablePtr pDraw, BOOL onoff)
tpn = pn;
while (tpn) {
if (tpn->client == client) {
if (!onoff) {
if (!onoff)
tpn->client = NULL;
FreeResource(tpn->id, XvRTVideoNotify);
}
return Success;
}
if (!tpn->client)
@ -834,7 +881,7 @@ XvdiSelectVideoNotify(ClientPtr client, DrawablePtr pDraw, BOOL onoff)
tpn = tpn->next;
}
/* IF TURNING OFF, THEN JUST RETURN */
/* IF TUNNING OFF, THEN JUST RETURN */
if (!onoff)
return Success;
@ -857,8 +904,7 @@ XvdiSelectVideoNotify(ClientPtr client, DrawablePtr pDraw, BOOL onoff)
tpn->client = NULL;
tpn->id = FakeClientID(client->index);
if (!AddResource(tpn->id, XvRTVideoNotify, tpn))
return BadAlloc;
AddResource(tpn->id, XvRTVideoNotify, tpn);
tpn->client = client;
return Success;
@ -895,7 +941,7 @@ XvdiSelectPortNotify(ClientPtr client, XvPortPtr pPort, BOOL onoff)
return Success;
}
/* DIDN'T FIND IT; SO REUSE LIST ELEMENT IF ONE IS FREE OTHERWISE
/* DIDN'T FIND IT; SO REUSE LIST ELEMENT IF ONE IS FREE OTHERWISE
CREATE A NEW ONE AND ADD IT TO THE BEGINNING OF THE LIST */
if (!tpn) {
@ -907,8 +953,7 @@ XvdiSelectPortNotify(ClientPtr client, XvPortPtr pPort, BOOL onoff)
tpn->client = client;
tpn->id = FakeClientID(client->index);
if (!AddResource(tpn->id, XvRTPortNotify, tpn))
return BadAlloc;
AddResource(tpn->id, XvRTPortNotify, tpn);
return Success;
@ -936,7 +981,29 @@ XvdiStopVideo(ClientPtr client, XvPortPtr pPort, DrawablePtr pDraw)
XvdiSendVideoNotify(pPort, pDraw, XvStopped);
status = (*pPort->pAdaptor->ddStopVideo) (pPort, pDraw);
status = (*pPort->pAdaptor->ddStopVideo) (client, pPort, pDraw);
pPort->pDraw = NULL;
pPort->client = (ClientPtr) client;
pPort->time = currentTime;
return status;
}
int
XvdiPreemptVideo(ClientPtr client, XvPortPtr pPort, DrawablePtr pDraw)
{
int status;
/* IF PORT ISN'T ACTIVE THEN WE'RE DONE */
if (!pPort->pDraw || (pPort->pDraw != pDraw))
return Success;
XvdiSendVideoNotify(pPort, pPort->pDraw, XvPreempted);
status = (*pPort->pAdaptor->ddStopVideo) (client, pPort, pPort->pDraw);
pPort->pDraw = NULL;
pPort->client = (ClientPtr) client;
@ -979,7 +1046,7 @@ XvdiSetPortAttribute(ClientPtr client,
int status;
status =
(*pPort->pAdaptor->ddSetPortAttribute) (pPort, attribute,
(*pPort->pAdaptor->ddSetPortAttribute) (client, pPort, attribute,
value);
if (status == Success)
XvdiSendPortNotify(pPort, attribute, value);
@ -993,12 +1060,12 @@ XvdiGetPortAttribute(ClientPtr client,
{
return
(*pPort->pAdaptor->ddGetPortAttribute) (pPort, attribute,
(*pPort->pAdaptor->ddGetPortAttribute) (client, pPort, attribute,
p_value);
}
static void _X_COLD
static void
WriteSwappedVideoNotifyEvent(xvEvent * from, xvEvent * to)
{
@ -1012,7 +1079,7 @@ WriteSwappedVideoNotifyEvent(xvEvent * from, xvEvent * to)
}
static void _X_COLD
static void
WriteSwappedPortNotifyEvent(xvEvent * from, xvEvent * to)
{
@ -1024,77 +1091,3 @@ WriteSwappedPortNotifyEvent(xvEvent * from, xvEvent * to)
cpswapl(from->u.portNotify.value, to->u.portNotify.value);
}
void
XvFreeAdaptor(XvAdaptorPtr pAdaptor)
{
int i;
free(pAdaptor->name);
pAdaptor->name = NULL;
if (pAdaptor->pEncodings) {
XvEncodingPtr pEncode = pAdaptor->pEncodings;
for (i = 0; i < pAdaptor->nEncodings; i++, pEncode++)
free(pEncode->name);
free(pAdaptor->pEncodings);
pAdaptor->pEncodings = NULL;
}
free(pAdaptor->pFormats);
pAdaptor->pFormats = NULL;
free(pAdaptor->pPorts);
pAdaptor->pPorts = NULL;
if (pAdaptor->pAttributes) {
XvAttributePtr pAttribute = pAdaptor->pAttributes;
for (i = 0; i < pAdaptor->nAttributes; i++, pAttribute++)
free(pAttribute->name);
free(pAdaptor->pAttributes);
pAdaptor->pAttributes = NULL;
}
free(pAdaptor->pImages);
pAdaptor->pImages = NULL;
free(pAdaptor->devPriv.ptr);
pAdaptor->devPriv.ptr = NULL;
}
void
XvFillColorKey(DrawablePtr pDraw, CARD32 key, RegionPtr region)
{
ScreenPtr pScreen = pDraw->pScreen;
ChangeGCVal pval[2];
BoxPtr pbox = RegionRects(region);
int i, nbox = RegionNumRects(region);
xRectangle *rects;
GCPtr gc;
gc = GetScratchGC(pDraw->depth, pScreen);
if (!gc)
return;
pval[0].val = key;
pval[1].val = IncludeInferiors;
(void) ChangeGC(NullClient, gc, GCForeground | GCSubwindowMode, pval);
ValidateGC(pDraw, gc);
rects = xallocarray(nbox, sizeof(xRectangle));
if (rects) {
for (i = 0; i < nbox; i++, pbox++) {
rects[i].x = pbox->x1 - pDraw->x;
rects[i].y = pbox->y1 - pDraw->y;
rects[i].width = pbox->x2 - pbox->x1;
rects[i].height = pbox->y2 - pbox->y1;
}
(*gc->ops->PolyFillRect) (pDraw, gc, nbox, rects);
free(rects);
}
FreeScratchGC(gc);
}

View file

@ -1,21 +1,22 @@
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <string.h>
#include <X11/X.h>
#include <X11/Xproto.h>
#include "Xext/xvdix_priv.h"
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "resource.h"
#include "scrnintstr.h"
#include "extnsionst.h"
#include "extinit_priv.h"
#include "extinit.h"
#include "servermd.h"
#include <X11/Xfuncproto.h>
#include "xvdix.h"
#include <X11/extensions/XvMC.h>
#include <X11/extensions/Xvproto.h>
#include <X11/extensions/XvMCproto.h>
@ -43,6 +44,8 @@ static RESTYPE XvMCRTContext;
static RESTYPE XvMCRTSurface;
static RESTYPE XvMCRTSubpicture;
int (*XvMCScreenInitProc)(ScreenPtr, int, XvMCAdaptorPtr) = NULL;
typedef struct {
int num_adaptors;
XvMCAdaptorPtr adaptors;
@ -58,7 +61,7 @@ typedef struct {
(XvMCScreenPtr)(dixLookupPrivate(&(pScreen)->devPrivates, XvMCScreenKey))
static int
XvMCDestroyContextRes(void *data, XID id)
XvMCDestroyContextRes(pointer data, XID id)
{
XvMCContextPtr pContext = (XvMCContextPtr) data;
@ -75,7 +78,7 @@ XvMCDestroyContextRes(void *data, XID id)
}
static int
XvMCDestroySurfaceRes(void *data, XID id)
XvMCDestroySurfaceRes(pointer data, XID id)
{
XvMCSurfacePtr pSurface = (XvMCSurfacePtr) data;
XvMCContextPtr pContext = pSurface->context;
@ -84,13 +87,13 @@ XvMCDestroySurfaceRes(void *data, XID id)
(*pScreenPriv->adaptors[pContext->adapt_num].DestroySurface) (pSurface);
free(pSurface);
XvMCDestroyContextRes((void *) pContext, pContext->context_id);
XvMCDestroyContextRes((pointer) pContext, pContext->context_id);
return Success;
}
static int
XvMCDestroySubpictureRes(void *data, XID id)
XvMCDestroySubpictureRes(pointer data, XID id)
{
XvMCSubpicturePtr pSubpict = (XvMCSubpicturePtr) data;
XvMCContextPtr pContext = pSubpict->context;
@ -99,7 +102,7 @@ XvMCDestroySubpictureRes(void *data, XID id)
(*pScreenPriv->adaptors[pContext->adapt_num].DestroySubpicture) (pSubpict);
free(pSubpict);
XvMCDestroyContextRes((void *) pContext, pContext->context_id);
XvMCDestroyContextRes((pointer) pContext, pContext->context_id);
return Success;
}
@ -250,10 +253,6 @@ ProcXvMCCreateContext(ClientPtr client)
free(pContext);
return result;
}
if (!AddResource(pContext->context_id, XvMCRTContext, pContext)) {
free(data);
return BadAlloc;
}
rep = (xvmcCreateContextReply) {
.type = X_Reply,
@ -267,6 +266,7 @@ ProcXvMCCreateContext(ClientPtr client)
WriteToClient(client, sizeof(xvmcCreateContextReply), &rep);
if (dwords)
WriteToClient(client, dwords << 2, data);
AddResource(pContext->context_id, XvMCRTContext, pContext);
free(data);
@ -276,7 +276,7 @@ ProcXvMCCreateContext(ClientPtr client)
static int
ProcXvMCDestroyContext(ClientPtr client)
{
void *val;
pointer val;
int rc;
REQUEST(xvmcDestroyContextReq);
@ -287,7 +287,7 @@ ProcXvMCDestroyContext(ClientPtr client)
if (rc != Success)
return rc;
FreeResource(stuff->context_id, X11_RESTYPE_NONE);
FreeResource(stuff->context_id, RT_NONE);
return Success;
}
@ -306,7 +306,7 @@ ProcXvMCCreateSurface(ClientPtr client)
REQUEST(xvmcCreateSurfaceReq);
REQUEST_SIZE_MATCH(xvmcCreateSurfaceReq);
result = dixLookupResourceByType((void **) &pContext, stuff->context_id,
result = dixLookupResourceByType((pointer *) &pContext, stuff->context_id,
XvMCRTContext, client, DixUseAccess);
if (result != Success)
return result;
@ -329,11 +329,6 @@ ProcXvMCCreateSurface(ClientPtr client)
free(pSurface);
return result;
}
if (!AddResource(pSurface->surface_id, XvMCRTSurface, pSurface)) {
free(data);
return BadAlloc;
}
rep = (xvmcCreateSurfaceReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
@ -343,6 +338,7 @@ ProcXvMCCreateSurface(ClientPtr client)
WriteToClient(client, sizeof(xvmcCreateSurfaceReply), &rep);
if (dwords)
WriteToClient(client, dwords << 2, data);
AddResource(pSurface->surface_id, XvMCRTSurface, pSurface);
free(data);
@ -354,7 +350,7 @@ ProcXvMCCreateSurface(ClientPtr client)
static int
ProcXvMCDestroySurface(ClientPtr client)
{
void *val;
pointer val;
int rc;
REQUEST(xvmcDestroySurfaceReq);
@ -365,7 +361,7 @@ ProcXvMCDestroySurface(ClientPtr client)
if (rc != Success)
return rc;
FreeResource(stuff->surface_id, X11_RESTYPE_NONE);
FreeResource(stuff->surface_id, RT_NONE);
return Success;
}
@ -386,7 +382,7 @@ ProcXvMCCreateSubpicture(ClientPtr client)
REQUEST(xvmcCreateSubpictureReq);
REQUEST_SIZE_MATCH(xvmcCreateSubpictureReq);
result = dixLookupResourceByType((void **) &pContext, stuff->context_id,
result = dixLookupResourceByType((pointer *) &pContext, stuff->context_id,
XvMCRTContext, client, DixUseAccess);
if (result != Success)
return result;
@ -449,11 +445,6 @@ ProcXvMCCreateSubpicture(ClientPtr client)
free(pSubpicture);
return result;
}
if (!AddResource(pSubpicture->subpicture_id, XvMCRTSubpicture, pSubpicture)) {
free(data);
return BadAlloc;
}
rep = (xvmcCreateSubpictureReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
@ -471,6 +462,7 @@ ProcXvMCCreateSubpicture(ClientPtr client)
WriteToClient(client, sizeof(xvmcCreateSubpictureReply), &rep);
if (dwords)
WriteToClient(client, dwords << 2, data);
AddResource(pSubpicture->subpicture_id, XvMCRTSubpicture, pSubpicture);
free(data);
@ -482,7 +474,7 @@ ProcXvMCCreateSubpicture(ClientPtr client)
static int
ProcXvMCDestroySubpicture(ClientPtr client)
{
void *val;
pointer val;
int rc;
REQUEST(xvmcDestroySubpictureReq);
@ -493,7 +485,7 @@ ProcXvMCDestroySubpicture(ClientPtr client)
if (rc != Success)
return rc;
FreeResource(stuff->subpicture_id, X11_RESTYPE_NONE);
FreeResource(stuff->subpicture_id, RT_NONE);
return Success;
}
@ -687,7 +679,7 @@ ProcXvMCDispatch(ClientPtr client)
return BadRequest;
}
static int _X_COLD
static int
SProcXvMCDispatch(ClientPtr client)
{
/* We only support local */
@ -808,8 +800,8 @@ XvMCFindXvImage(XvPortPtr pPort, CARD32 id)
}
int
xf86XvMCRegisterDRInfo(ScreenPtr pScreen, const char *name,
const char *busID, int major, int minor, int patchLevel)
xf86XvMCRegisterDRInfo(ScreenPtr pScreen, char *name,
char *busID, int major, int minor, int patchLevel)
{
XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pScreen);

View file

@ -31,15 +31,15 @@ typedef struct {
unsigned short height;
CARD32 flags;
int refcnt;
void *port_priv;
void *driver_priv;
pointer port_priv;
pointer driver_priv;
} XvMCContextRec, *XvMCContextPtr;
typedef struct {
XID surface_id;
int surface_type_id;
XvMCContextPtr context;
void *driver_priv;
pointer driver_priv;
} XvMCSurfaceRec, *XvMCSurfacePtr;
typedef struct {
@ -51,7 +51,7 @@ typedef struct {
int entry_bytes;
char component_order[4];
XvMCContextPtr context;
void *driver_priv;
pointer driver_priv;
} XvMCSubpictureRec, *XvMCSubpicturePtr;
typedef int (*XvMCCreateContextProcPtr) (XvPortPtr port,
@ -84,11 +84,15 @@ typedef struct {
XvMCDestroySubpictureProcPtr DestroySubpicture;
} XvMCAdaptorRec, *XvMCAdaptorPtr;
extern int (*XvMCScreenInitProc)(ScreenPtr, int, XvMCAdaptorPtr);
extern _X_EXPORT int XvMCScreenInit(ScreenPtr pScreen,
int num, XvMCAdaptorPtr adapt);
extern _X_EXPORT int xf86XvMCRegisterDRInfo(ScreenPtr pScreen, const char *name,
const char *busID, int major, int minor,
extern _X_EXPORT XvImagePtr XvMCFindXvImage(XvPortPtr pPort, CARD32 id);
extern _X_EXPORT int xf86XvMCRegisterDRInfo(ScreenPtr pScreen, char *name,
char *busID, int major, int minor,
int patchLevel);
#endif /* _XVMC_H */

108
Xi/Makefile.am Normal file
View file

@ -0,0 +1,108 @@
noinst_LTLIBRARIES = libXi.la
AM_CFLAGS = $(DIX_CFLAGS)
libXi_la_SOURCES = \
allowev.c \
allowev.h \
chgdctl.c \
chgdctl.h \
chgfctl.c \
chgfctl.h \
chgkbd.c \
chgkbd.h \
chgkmap.c \
chgkmap.h \
chgprop.c \
chgprop.h \
chgptr.c \
chgptr.h \
closedev.c \
closedev.h \
devbell.c \
devbell.h \
exevents.c \
exglobals.h \
extinit.c \
getbmap.c \
getbmap.h \
getdctl.c \
getdctl.h \
getfctl.c \
getfctl.h \
getfocus.c \
getfocus.h \
getkmap.c \
getkmap.h \
getmmap.c \
getmmap.h \
getprop.c \
getprop.h \
getselev.c \
getselev.h \
getvers.c \
getvers.h \
grabdev.c \
grabdev.h \
grabdevb.c \
grabdevb.h \
grabdevk.c \
grabdevk.h \
gtmotion.c \
gtmotion.h \
listdev.c \
listdev.h \
opendev.c \
opendev.h \
queryst.c \
queryst.h \
selectev.c \
selectev.h \
sendexev.c \
sendexev.h \
setbmap.c \
setbmap.h \
setdval.c \
setdval.h \
setfocus.c \
setfocus.h \
setmmap.c \
setmmap.h \
setmode.c \
setmode.h \
ungrdev.c \
ungrdev.h \
ungrdevb.c \
ungrdevb.h \
ungrdevk.c \
ungrdevk.h \
xiallowev.c \
xiallowev.h \
xichangecursor.c \
xichangecursor.h \
xichangehierarchy.c \
xichangehierarchy.h \
xigetclientpointer.c \
xigetclientpointer.h \
xigrabdev.c \
xigrabdev.h \
xipassivegrab.h \
xipassivegrab.c \
xiproperty.c \
xiproperty.h \
xiquerydevice.c \
xiquerydevice.h \
xiquerypointer.c \
xiquerypointer.h \
xiqueryversion.c \
xiqueryversion.h \
xiselectev.c \
xiselectev.h \
xisetclientpointer.c \
xisetclientpointer.h \
xisetdevfocus.c \
xisetdevfocus.h \
xiwarppointer.c \
xiwarppointer.h
EXTRA_DIST = stubs.c

View file

@ -50,15 +50,14 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/dix_priv.h"
#include "dix/input_priv.h"
#include "exglobals.h"
#include "allowev.h"
@ -70,10 +69,11 @@ SOFTWARE.
*
*/
int _X_COLD
int
SProcXAllowDeviceEvents(ClientPtr client)
{
REQUEST(xAllowDeviceEventsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xAllowDeviceEventsReq);
swapl(&stuff->time);
return (ProcXAllowDeviceEvents(client));
@ -102,22 +102,22 @@ ProcXAllowDeviceEvents(ClientPtr client)
switch (stuff->mode) {
case ReplayThisDevice:
AllowSome(client, time, thisdev, GRAB_STATE_NOT_GRABBED);
AllowSome(client, time, thisdev, NOT_GRABBED);
break;
case SyncThisDevice:
AllowSome(client, time, thisdev, GRAB_STATE_FREEZE_NEXT_EVENT);
AllowSome(client, time, thisdev, FREEZE_NEXT_EVENT);
break;
case AsyncThisDevice:
AllowSome(client, time, thisdev, GRAB_STATE_THAWED);
AllowSome(client, time, thisdev, THAWED);
break;
case AsyncOtherDevices:
AllowSome(client, time, thisdev, GRAB_STATE_THAW_OTHERS);
AllowSome(client, time, thisdev, THAW_OTHERS);
break;
case SyncAll:
AllowSome(client, time, thisdev, GRAB_STATE_FREEZE_BOTH_NEXT_EVENT);
AllowSome(client, time, thisdev, FREEZE_BOTH_NEXT_EVENT);
break;
case AsyncAll:
AllowSome(client, time, thisdev, GRAB_STATE_THAWED_BOTH);
AllowSome(client, time, thisdev, THAWED_BOTH);
break;
default:
client->errorValue = stuff->mode;

View file

@ -50,17 +50,18 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h> /* control constants */
#include "dix/exevents_priv.h"
#include "dix/input_priv.h"
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h> /* control constants */
#include "XIstubs.h"
#include "exglobals.h"
#include "exevents.h"
#include "chgdctl.h"
/***********************************************************************
@ -70,13 +71,14 @@ SOFTWARE.
*
*/
int _X_COLD
int
SProcXChangeDeviceControl(ClientPtr client)
{
xDeviceCtl *ctl;
REQUEST(xChangeDeviceControlReq);
REQUEST_AT_LEAST_EXTRA_SIZE(xChangeDeviceControlReq, sizeof(xDeviceCtl));
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xChangeDeviceControlReq);
swaps(&stuff->control);
ctl = (xDeviceCtl *) &stuff[1];
swaps(&ctl->control);
@ -113,25 +115,18 @@ ProcXChangeDeviceControl(ClientPtr client)
xDeviceEnableCtl *e;
REQUEST(xChangeDeviceControlReq);
REQUEST_AT_LEAST_EXTRA_SIZE(xChangeDeviceControlReq, sizeof(xDeviceCtl));
REQUEST_AT_LEAST_SIZE(xChangeDeviceControlReq);
len = client->req_len - bytes_to_int32(sizeof(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,
.length = 0
};
switch (stuff->control) {
@ -190,15 +185,8 @@ ProcXChangeDeviceControl(ClientPtr client)
break;
case DEVICE_ENABLE:
e = (xDeviceEnableCtl *) &stuff[1];
if ((len != bytes_to_int32(sizeof(xDeviceEnableCtl)))) {
ret = BadLength;
goto out;
}
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)
@ -245,7 +233,7 @@ ProcXChangeDeviceControl(ClientPtr client)
*
*/
void _X_COLD
void
SRepXChangeDeviceControl(ClientPtr client, int size,
xChangeDeviceControlReply * rep)
{

View file

@ -50,7 +50,9 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
@ -69,10 +71,11 @@ SOFTWARE.
*
*/
int _X_COLD
int
SProcXChangeFeedbackControl(ClientPtr client)
{
REQUEST(xChangeFeedbackControlReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xChangeFeedbackControlReq);
swapl(&stuff->mask);
return (ProcXChangeFeedbackControl(client));
@ -435,7 +438,7 @@ ProcXChangeFeedbackControl(ClientPtr client)
REQUEST(xChangeFeedbackControlReq);
REQUEST_AT_LEAST_SIZE(xChangeFeedbackControlReq);
len = client->req_len - bytes_to_int32(sizeof(xChangeFeedbackControlReq));
len = stuff->length - bytes_to_int32(sizeof(xChangeFeedbackControlReq));
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixManageAccess);
if (rc != Success)
return rc;
@ -461,14 +464,9 @@ ProcXChangeFeedbackControl(ClientPtr client)
break;
case StringFeedbackClass:
{
xStringFeedbackCtl *f;
xStringFeedbackCtl *f = ((xStringFeedbackCtl *) &stuff[1]);
REQUEST_AT_LEAST_EXTRA_SIZE(xChangeFeedbackControlReq,
sizeof(xStringFeedbackCtl));
f = ((xStringFeedbackCtl *) &stuff[1]);
if (client->swapped) {
if (len < bytes_to_int32(sizeof(xStringFeedbackCtl)))
return BadLength;
swaps(&f->num_keysyms);
}
if (len !=

View file

@ -50,7 +50,9 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
@ -69,6 +71,23 @@ SOFTWARE.
* This procedure changes the keyboard device.
*
*/
int
SProcXChangeKeyboardDevice(ClientPtr client)
{
REQUEST(xChangeKeyboardDeviceReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xChangeKeyboardDeviceReq);
return (ProcXChangeKeyboardDevice(client));
}
/***********************************************************************
*
* This procedure is invoked to swap the request bytes if the server and
* client have a different byte order.
*
*/
int
ProcXChangeKeyboardDevice(ClientPtr client)
{

View file

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

View file

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

View file

@ -50,18 +50,18 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/dix_priv.h"
#include "dix/exevents_priv.h"
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h"
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exevents.h"
#include "exglobals.h"
#include "chgprop.h"
#include "grabdev.h"
@ -71,10 +71,11 @@ SOFTWARE.
*
*/
int _X_COLD
int
SProcXChangeDeviceDontPropagateList(ClientPtr client)
{
REQUEST(xChangeDeviceDontPropagateListReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xChangeDeviceDontPropagateListReq);
swapl(&stuff->window);
swaps(&stuff->count);
@ -101,7 +102,7 @@ ProcXChangeDeviceDontPropagateList(ClientPtr client)
REQUEST(xChangeDeviceDontPropagateListReq);
REQUEST_AT_LEAST_SIZE(xChangeDeviceDontPropagateListReq);
if (client->req_len !=
if (stuff->length !=
bytes_to_int32(sizeof(xChangeDeviceDontPropagateListReq)) +
stuff->count)
return BadLength;

View file

@ -50,7 +50,9 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
@ -65,6 +67,22 @@ SOFTWARE.
#include "chgptr.h"
/***********************************************************************
*
* This procedure is invoked to swap the request bytes if the server and
* client have a different byte order.
*
*/
int
SProcXChangePointerDevice(ClientPtr client)
{
REQUEST(xChangePointerDeviceReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xChangePointerDeviceReq);
return (ProcXChangePointerDevice(client));
}
/***********************************************************************
*
* This procedure changes the device used as the X pointer.

View file

@ -30,6 +30,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef CHGPTR_H
#define CHGPTR_H 1
int SProcXChangePointerDevice(ClientPtr /* client */
);
int ProcXChangePointerDevice(ClientPtr /* client */
);

View file

@ -50,7 +50,9 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
@ -62,6 +64,21 @@ SOFTWARE.
#include "closedev.h"
/***********************************************************************
*
* This procedure closes an input device.
*
*/
int
SProcXCloseDevice(ClientPtr client)
{
REQUEST(xCloseDeviceReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xCloseDeviceReq);
return (ProcXCloseDevice(client));
}
/***********************************************************************
*
* Clear out event selections and passive grabs from a window for the
@ -85,13 +102,13 @@ DeleteDeviceEvents(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client)
next = grab->next;
if ((grab->device == dev) &&
(client->clientAsMask == CLIENT_BITS(grab->resource)))
FreeResource(grab->resource, X11_RESTYPE_NONE);
FreeResource(grab->resource, RT_NONE);
}
}
/***********************************************************************
*
* Walk through the window tree, deleting event selections for this client
* Walk througth the window tree, deleting event selections for this client
* from this device from all windows.
*
*/

View file

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

View file

@ -50,7 +50,9 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
@ -59,6 +61,21 @@ SOFTWARE.
#include "devbell.h"
/***********************************************************************
*
* This procedure is invoked to swap the request bytes if the server and
* client have a different byte order.
*
*/
int
SProcXDeviceBell(ClientPtr client)
{
REQUEST(xDeviceBellReq);
swaps(&stuff->length);
return (ProcXDeviceBell(client));
}
/***********************************************************************
*
* This procedure rings a bell on an extension device.
@ -74,7 +91,7 @@ ProcXDeviceBell(ClientPtr client)
int rc, base;
int newpercent;
CARD8 class;
void *ctrl;
pointer ctrl;
BellProcPtr proc;
REQUEST(xDeviceBellReq);
@ -100,7 +117,7 @@ ProcXDeviceBell(ClientPtr client)
}
base = k->ctrl.bell;
proc = k->BellProc;
ctrl = (void *) &(k->ctrl);
ctrl = (pointer) &(k->ctrl);
class = KbdFeedbackClass;
}
else if (stuff->feedbackclass == BellFeedbackClass) {
@ -113,7 +130,7 @@ ProcXDeviceBell(ClientPtr client)
}
base = b->ctrl.percent;
proc = b->BellProc;
ctrl = (void *) &(b->ctrl);
ctrl = (pointer) &(b->ctrl);
class = BellFeedbackClass;
}
else {
@ -125,8 +142,7 @@ ProcXDeviceBell(ClientPtr client)
newpercent = base + newpercent;
else
newpercent = base - newpercent + stuff->percent;
if (proc == NULL)
return BadValue;
(*proc) (newpercent, dev, ctrl, class);
return Success;
}

View file

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

File diff suppressed because it is too large Load diff

View file

@ -44,6 +44,7 @@ extern int DeviceBusy;
extern int BadClass;
/* Note: only the ones needed in files other than extinit.c are declared */
extern const Mask DevicePointerMotionMask;
extern const Mask DevicePointerMotionHintMask;
extern const Mask DeviceFocusChangeMask;
extern const Mask DeviceStateNotifyMask;
@ -55,6 +56,8 @@ extern const Mask DevicePresenceNotifyMask;
extern const Mask DevicePropertyNotifyMask;
extern const Mask XIAllMasks;
extern Mask PropagateMask[];
extern int DeviceValuator;
extern int DeviceKeyPress;
extern int DeviceKeyRelease;

View file

@ -51,7 +51,9 @@ SOFTWARE.
*/
#define NUMTYPES 15
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h"
#include "gcstruct.h" /* pointer for extnsionst.h */
@ -60,17 +62,11 @@ SOFTWARE.
#include <X11/extensions/XIproto.h>
#include <X11/extensions/XI2proto.h>
#include <X11/extensions/geproto.h>
#include "dix/dix_priv.h"
#include "dix/exevents_priv.h"
#include "inputstr.h"
#include "gcstruct.h" /* pointer for extnsionst.h */
#include "extnsionst.h" /* extension entry */
#include "geext.h" /* extension interfaces for ge */
#include "dixevents.h"
#include "extinit_priv.h"
#include "exevents.h"
#include "extinit.h"
#include "exglobals.h"
#include "swaprep.h"
#include "privates.h"
@ -126,15 +122,19 @@ SOFTWARE.
#include "xiqueryversion.h"
#include "xisetclientpointer.h"
#include "xiwarppointer.h"
#include "xibarriers.h"
/* Masks for XI events have to be aligned with core event (partially anyway).
* If DeviceButtonMotionMask is != ButtonMotionMask, event delivery
* breaks down. The device needs the dev->button->motionMask. If DBMM is
* the same as BMM, we can ensure that both core and device events can be
* delivered, without the need for extra structures in the DeviceIntRec. */
const Mask DeviceKeyPressMask = KeyPressMask;
const Mask DeviceKeyReleaseMask = KeyReleaseMask;
const Mask DeviceButtonPressMask = ButtonPressMask;
const Mask DeviceButtonReleaseMask = ButtonReleaseMask;
const Mask DeviceProximityMask = (1L << 4);
const Mask DeviceStateNotifyMask = (1L << 5);
const Mask DevicePointerMotionMask = PointerMotionMask;
const Mask DevicePointerMotionHintMask = PointerMotionHintMask;
const Mask DeviceButton1MotionMask = Button1MotionMask;
const Mask DeviceButton2MotionMask = Button2MotionMask;
@ -152,6 +152,7 @@ const Mask DevicePropertyNotifyMask = (1L << 19);
const Mask XIAllMasks = (1L << 20) - 1;
int ExtEventIndex;
Mask ExtExclusiveMasks[EMASKSIZE];
static struct dev_type {
Atom type;
@ -250,25 +251,24 @@ static int (*ProcIVector[]) (ClientPtr) = {
ProcXIChangeProperty, /* 57 */
ProcXIDeleteProperty, /* 58 */
ProcXIGetProperty, /* 59 */
ProcXIGetSelectedEvents, /* 60 */
ProcXIBarrierReleasePointer /* 61 */
ProcXIGetSelectedEvents /* 60 */
};
/* For swapped clients */
static int (*SProcIVector[]) (ClientPtr) = {
NULL, /* 0 */
NULL, /* 0 */
SProcXGetExtensionVersion, /* 1 */
ProcXListInputDevices, /* 2 */
ProcXOpenDevice, /* 3 */
ProcXCloseDevice, /* 4 */
ProcXSetDeviceMode, /* 5 */
SProcXListInputDevices, /* 2 */
SProcXOpenDevice, /* 3 */
SProcXCloseDevice, /* 4 */
SProcXSetDeviceMode, /* 5 */
SProcXSelectExtensionEvent, /* 6 */
SProcXGetSelectedExtensionEvents, /* 7 */
SProcXChangeDeviceDontPropagateList, /* 8 */
SProcXGetDeviceDontPropagateList, /* 9 */
SProcXGetDeviceMotionEvents, /* 10 */
ProcXChangeKeyboardDevice, /* 11 */
ProcXChangePointerDevice, /* 12 */
SProcXChangeKeyboardDevice, /* 11 */
SProcXChangePointerDevice, /* 12 */
SProcXGrabDevice, /* 13 */
SProcXUngrabDevice, /* 14 */
SProcXGrabDeviceKey, /* 15 */
@ -276,30 +276,30 @@ static int (*SProcIVector[]) (ClientPtr) = {
SProcXGrabDeviceButton, /* 17 */
SProcXUngrabDeviceButton, /* 18 */
SProcXAllowDeviceEvents, /* 19 */
ProcXGetDeviceFocus, /* 20 */
SProcXGetDeviceFocus, /* 20 */
SProcXSetDeviceFocus, /* 21 */
ProcXGetFeedbackControl, /* 22 */
SProcXGetFeedbackControl, /* 22 */
SProcXChangeFeedbackControl, /* 23 */
ProcXGetDeviceKeyMapping, /* 24 */
SProcXGetDeviceKeyMapping, /* 24 */
SProcXChangeDeviceKeyMapping, /* 25 */
ProcXGetDeviceModifierMapping, /* 26 */
ProcXSetDeviceModifierMapping, /* 27 */
ProcXGetDeviceButtonMapping, /* 28 */
ProcXSetDeviceButtonMapping, /* 29 */
ProcXQueryDeviceState, /* 30 */
SProcXGetDeviceModifierMapping, /* 26 */
SProcXSetDeviceModifierMapping, /* 27 */
SProcXGetDeviceButtonMapping, /* 28 */
SProcXSetDeviceButtonMapping, /* 29 */
SProcXQueryDeviceState, /* 30 */
SProcXSendExtensionEvent, /* 31 */
ProcXDeviceBell, /* 32 */
ProcXSetDeviceValuators, /* 33 */
SProcXDeviceBell, /* 32 */
SProcXSetDeviceValuators, /* 33 */
SProcXGetDeviceControl, /* 34 */
SProcXChangeDeviceControl, /* 35 */
ProcXListDeviceProperties, /* 36 */
SProcXListDeviceProperties, /* 36 */
SProcXChangeDeviceProperty, /* 37 */
SProcXDeleteDeviceProperty, /* 38 */
SProcXGetDeviceProperty, /* 39 */
SProcXIQueryPointer, /* 40 */
SProcXIWarpPointer, /* 41 */
SProcXIChangeCursor, /* 42 */
ProcXIChangeHierarchy, /* 43 */
SProcXIChangeHierarchy, /* 43 */
SProcXISetClientPointer, /* 44 */
SProcXIGetClientPointer, /* 45 */
SProcXISelectEvents, /* 46 */
@ -316,8 +316,7 @@ static int (*SProcIVector[]) (ClientPtr) = {
SProcXIChangeProperty, /* 57 */
SProcXIDeleteProperty, /* 58 */
SProcXIGetProperty, /* 59 */
SProcXIGetSelectedEvents, /* 60 */
SProcXIBarrierReleasePointer /* 61 */
SProcXIGetSelectedEvents /* 60 */
};
/*****************************************************************
@ -362,6 +361,8 @@ RESTYPE RT_INPUTCLIENT;
extern XExtensionVersion XIVersion;
Mask PropagateMask[EMASKSIZE];
/*****************************************************************
*
* Versioning support
@ -376,6 +377,18 @@ DevPrivateKeyRec XIClientPrivateKeyRec;
*
*/
static void
XIClientCallback(CallbackListPtr *list, pointer closure, pointer data)
{
NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
ClientPtr pClient = clientinfo->client;
XIClientPtr pXIClient;
pXIClient = dixLookupPrivate(&pClient->devPrivates, XIClientPrivateKey);
pXIClient->major_version = 0;
pXIClient->minor_version = 0;
}
/*************************************************************************
*
* ProcIDispatch - main dispatch routine for requests to this extension.
@ -390,7 +403,6 @@ ProcIDispatch(ClientPtr client)
if (stuff->data >= ARRAY_SIZE(ProcIVector) || !ProcIVector[stuff->data])
return BadRequest;
UpdateCurrentTimeIf();
return (*ProcIVector[stuff->data]) (client);
}
@ -403,14 +415,13 @@ ProcIDispatch(ClientPtr client)
*
*/
static int _X_COLD
static int
SProcIDispatch(ClientPtr client)
{
REQUEST(xReq);
if (stuff->data >= ARRAY_SIZE(SProcIVector) || !SProcIVector[stuff->data])
return BadRequest;
UpdateCurrentTimeIf();
return (*SProcIVector[stuff->data]) (client);
}
@ -421,7 +432,7 @@ SProcIDispatch(ClientPtr client)
*
*/
static void _X_COLD
static void
SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep)
{
/* All we look at is the type field */
@ -516,7 +527,7 @@ static void
SEventDeviceValuator(deviceValuator * from, deviceValuator * to)
{
int i;
INT32 *ip;
INT32 *ip B32;
*to = *from;
swaps(&to->sequenceNumber);
@ -540,7 +551,7 @@ static void
SDeviceStateNotifyEvent(deviceStateNotify * from, deviceStateNotify * to)
{
int i;
INT32 *ip;
INT32 *ip B32;
*to = *from;
swaps(&to->sequenceNumber);
@ -635,7 +646,7 @@ SDeviceChangedEvent(xXIDeviceChangedEvent * from, xXIDeviceChangedEvent * to)
*to = *from;
memcpy(&to[1], &from[1], from->length * 4);
any = (xXIAnyInfo *) &to[1];
any = (xXIAnyInfo *) & to[1];
for (i = 0; i < to->num_classes; i++) {
int length = any->length;
@ -643,7 +654,7 @@ SDeviceChangedEvent(xXIDeviceChangedEvent * from, xXIDeviceChangedEvent * to)
case KeyClass:
{
xXIKeyInfo *ki = (xXIKeyInfo *) any;
uint32_t *key = (uint32_t *) &ki[1];
uint32_t *key = (uint32_t *) & ki[1];
for (j = 0; j < ki->num_keycodes; j++, key++)
swapl(key);
@ -754,7 +765,7 @@ SDeviceHierarchyEvent(xXIHierarchyEvent * from, xXIHierarchyEvent * to)
swapl(&to->flags);
swaps(&to->num_info);
info = (xXIHierarchyInfo *) &to[1];
info = (xXIHierarchyInfo *) & to[1];
for (i = 0; i < from->num_info; i++) {
swaps(&info->deviceid);
swaps(&info->attachment);
@ -828,102 +839,8 @@ STouchOwnershipEvent(xXITouchOwnershipEvent * from, xXITouchOwnershipEvent * to)
swapl(&to->child);
}
static void
SBarrierEvent(xXIBarrierEvent * from,
xXIBarrierEvent * to) {
*to = *from;
swaps(&to->sequenceNumber);
swapl(&to->length);
swaps(&to->evtype);
swapl(&to->time);
swaps(&to->deviceid);
swaps(&to->sourceid);
swapl(&to->event);
swapl(&to->root);
swapl(&to->root_x);
swapl(&to->root_y);
swapl(&to->dx.integral);
swapl(&to->dx.frac);
swapl(&to->dy.integral);
swapl(&to->dy.frac);
swapl(&to->dtime);
swapl(&to->barrier);
swapl(&to->eventid);
}
static void
SGesturePinchEvent(xXIGesturePinchEvent* from,
xXIGesturePinchEvent* to)
{
*to = *from;
swaps(&to->sequenceNumber);
swapl(&to->length);
swaps(&to->evtype);
swaps(&to->deviceid);
swapl(&to->time);
swapl(&to->detail);
swapl(&to->root);
swapl(&to->event);
swapl(&to->child);
swapl(&to->root_x);
swapl(&to->root_y);
swapl(&to->event_x);
swapl(&to->event_y);
swapl(&to->delta_x);
swapl(&to->delta_y);
swapl(&to->delta_unaccel_x);
swapl(&to->delta_unaccel_y);
swapl(&to->scale);
swapl(&to->delta_angle);
swaps(&to->sourceid);
swapl(&to->mods.base_mods);
swapl(&to->mods.latched_mods);
swapl(&to->mods.locked_mods);
swapl(&to->mods.effective_mods);
swapl(&to->flags);
}
static void
SGestureSwipeEvent(xXIGestureSwipeEvent* from,
xXIGestureSwipeEvent* to)
{
*to = *from;
swaps(&to->sequenceNumber);
swapl(&to->length);
swaps(&to->evtype);
swaps(&to->deviceid);
swapl(&to->time);
swapl(&to->detail);
swapl(&to->root);
swapl(&to->event);
swapl(&to->child);
swapl(&to->root_x);
swapl(&to->root_y);
swapl(&to->event_x);
swapl(&to->event_y);
swapl(&to->delta_x);
swapl(&to->delta_y);
swapl(&to->delta_unaccel_x);
swapl(&to->delta_unaccel_y);
swaps(&to->sourceid);
swapl(&to->mods.base_mods);
swapl(&to->mods.latched_mods);
swapl(&to->mods.locked_mods);
swapl(&to->mods.effective_mods);
swapl(&to->flags);
}
/** Event swapping function for XI2 events. */
void _X_COLD
void
XI2EventSwap(xGenericEvent *from, xGenericEvent *to)
{
switch (from->evtype) {
@ -968,29 +885,28 @@ XI2EventSwap(xGenericEvent *from, xGenericEvent *to)
case XI_RawTouchEnd:
SRawEvent((xXIRawEvent *) from, (xXIRawEvent *) to);
break;
case XI_BarrierHit:
case XI_BarrierLeave:
SBarrierEvent((xXIBarrierEvent *) from,
(xXIBarrierEvent *) to);
break;
case XI_GesturePinchBegin:
case XI_GesturePinchUpdate:
case XI_GesturePinchEnd:
SGesturePinchEvent((xXIGesturePinchEvent*) from,
(xXIGesturePinchEvent*) to);
break;
case XI_GestureSwipeBegin:
case XI_GestureSwipeUpdate:
case XI_GestureSwipeEnd:
SGestureSwipeEvent((xXIGestureSwipeEvent*) from,
(xXIGestureSwipeEvent*) to);
break;
default:
ErrorF("[Xi] Unknown event type to swap. This is a bug.\n");
break;
}
}
/**************************************************************************
*
* Allow the specified event to have its propagation suppressed.
* The default is to not allow suppression of propagation.
*
*/
static void
AllowPropagateSuppress(Mask mask)
{
int i;
for (i = 0; i < MAXDEVICES; i++)
PropagateMask[i] |= mask;
}
/**************************************************************************
*
* Record an event mask where there is no unique corresponding event type.
@ -1011,6 +927,23 @@ SetEventInfo(Mask mask, int constant)
EventInfo[ExtEventIndex++].type = constant;
}
/**************************************************************************
*
* Allow the specified event to be restricted to being selected by one
* client at a time.
* The default is to allow more than one client to select the event.
*
*/
static void
SetExclusiveAccess(Mask mask)
{
int i;
for (i = 0; i < MAXDEVICES; i++)
ExtExclusiveMasks[i] |= mask;
}
/**************************************************************************
*
* Assign the specified mask to the specified event.
@ -1072,16 +1005,20 @@ FixExtensionEvents(ExtensionEntry * extEntry)
DeviceBusy += extEntry->errorBase;
BadClass += extEntry->errorBase;
SetMaskForExtEvent(KeyPressMask, DeviceKeyPress);
SetMaskForExtEvent(DeviceKeyPressMask, DeviceKeyPress);
AllowPropagateSuppress(DeviceKeyPressMask);
SetCriticalEvent(DeviceKeyPress);
SetMaskForExtEvent(KeyReleaseMask, DeviceKeyRelease);
SetMaskForExtEvent(DeviceKeyReleaseMask, DeviceKeyRelease);
AllowPropagateSuppress(DeviceKeyReleaseMask);
SetCriticalEvent(DeviceKeyRelease);
SetMaskForExtEvent(ButtonPressMask, DeviceButtonPress);
SetMaskForExtEvent(DeviceButtonPressMask, DeviceButtonPress);
AllowPropagateSuppress(DeviceButtonPressMask);
SetCriticalEvent(DeviceButtonPress);
SetMaskForExtEvent(ButtonReleaseMask, DeviceButtonRelease);
SetMaskForExtEvent(DeviceButtonReleaseMask, DeviceButtonRelease);
AllowPropagateSuppress(DeviceButtonReleaseMask);
SetCriticalEvent(DeviceButtonRelease);
SetMaskForExtEvent(DeviceProximityMask, ProximityIn);
@ -1089,7 +1026,8 @@ FixExtensionEvents(ExtensionEntry * extEntry)
SetMaskForExtEvent(DeviceStateNotifyMask, DeviceStateNotify);
SetMaskForExtEvent(PointerMotionMask, DeviceMotionNotify);
SetMaskForExtEvent(DevicePointerMotionMask, DeviceMotionNotify);
AllowPropagateSuppress(DevicePointerMotionMask);
SetCriticalEvent(DeviceMotionNotify);
SetEventInfo(DevicePointerMotionHintMask, _devicePointerMotionHint);
@ -1107,6 +1045,8 @@ FixExtensionEvents(ExtensionEntry * extEntry)
SetMaskForExtEvent(ChangeDeviceNotifyMask, ChangeDeviceNotify);
SetEventInfo(DeviceButtonGrabMask, _deviceButtonGrab);
SetExclusiveAccess(DeviceButtonGrabMask);
SetEventInfo(DeviceOwnerGrabButtonMask, _deviceOwnerGrabButton);
SetEventInfo(DevicePresenceNotifyMask, _devicePresence);
SetMaskForExtEvent(DevicePropertyNotifyMask, DevicePropertyNotify);
@ -1197,8 +1137,6 @@ IResetProc(ExtensionEntry * unused)
free(xi_all_devices.name);
free(xi_all_master_devices.name);
XIBarrierReset();
}
/***********************************************************************
@ -1238,7 +1176,7 @@ MakeDeviceTypeAtoms(void)
*/
#define DO_SWAP(func,type) func ((type *)from, (type *)to)
static void _X_COLD
static void
SEventIDispatch(xEvent *from, xEvent *to)
{
int type = from->u.u.type & 0177;
@ -1322,8 +1260,8 @@ XInputExtensionInit(void)
(&XIClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(XIClientRec)))
FatalError("Cannot request private for XI.\n");
if (!XIBarrierInit())
FatalError("Could not initialize barriers.\n");
if (!AddCallback(&ClientStateCallback, XIClientCallback, 0))
FatalError("Failed to add callback to XI.\n");
extEntry = AddExtension(INAME, IEVENTS, IERRORS, ProcIDispatch,
SProcIDispatch, IResetProc, StandardMinorOpcode);

View file

@ -50,7 +50,9 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
@ -59,6 +61,20 @@ SOFTWARE.
#include "getbmap.h"
/***********************************************************************
*
* This procedure gets the button mapping for the specified device.
*
*/
int
SProcXGetDeviceButtonMapping(ClientPtr client)
{
REQUEST(xGetDeviceButtonMappingReq);
swaps(&stuff->length);
return (ProcXGetDeviceButtonMapping(client));
}
/***********************************************************************
*
* This procedure gets the button mapping for the specified device.
@ -106,7 +122,7 @@ ProcXGetDeviceButtonMapping(ClientPtr client)
*
*/
void _X_COLD
void
SRepXGetDeviceButtonMapping(ClientPtr client, int size,
xGetDeviceButtonMappingReply * rep)
{

View file

@ -30,6 +30,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef GETBMAP_H
#define GETBMAP_H 1
int SProcXGetDeviceButtonMapping(ClientPtr /* client */
);
int ProcXGetDeviceButtonMapping(ClientPtr /* client */
);

View file

@ -50,7 +50,9 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
@ -66,10 +68,11 @@ SOFTWARE.
*
*/
int _X_COLD
int
SProcXGetDeviceControl(ClientPtr client)
{
REQUEST(xGetDeviceControlReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xGetDeviceControlReq);
swaps(&stuff->control);
return (ProcXGetDeviceControl(client));
@ -150,7 +153,7 @@ CopySwapDeviceEnable(ClientPtr client, DeviceIntPtr dev, char *buf)
*
*/
void _X_COLD
void
SRepXGetDeviceControl(ClientPtr client, int size, xGetDeviceControlReply * rep)
{
swaps(&rep->sequenceNumber);

View file

@ -50,7 +50,9 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
@ -59,6 +61,21 @@ SOFTWARE.
#include "getfctl.h"
/***********************************************************************
*
* This procedure gets the control attributes for an extension device,
* for clients on machines with a different byte ordering than the server.
*
*/
int
SProcXGetFeedbackControl(ClientPtr client)
{
REQUEST(xGetFeedbackControlReq);
swaps(&stuff->length);
return (ProcXGetFeedbackControl(client));
}
/***********************************************************************
*
* This procedure copies KbdFeedbackClass data, swapping if necessary.
@ -80,7 +97,6 @@ CopySwapKbdFeedback(ClientPtr client, KbdFeedbackPtr k, char **buf)
k2->pitch = k->ctrl.bell_pitch;
k2->duration = k->ctrl.bell_duration;
k2->led_mask = k->ctrl.leds;
k2->led_values = k->ctrl.leds;
k2->global_auto_repeat = k->ctrl.autoRepeat;
for (i = 0; i < 32; i++)
k2->auto_repeats[i] = k->ctrl.autoRepeats[i];
@ -242,7 +258,7 @@ CopySwapBellFeedback(ClientPtr client, BellFeedbackPtr b, char **buf)
*
*/
void _X_COLD
void
SRepXGetFeedbackControl(ClientPtr client, int size,
xGetFeedbackControlReply * rep)
{

View file

@ -30,6 +30,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef GETFCTL_H
#define GETFCTL_H 1
int SProcXGetFeedbackControl(ClientPtr /* client */
);
int ProcXGetFeedbackControl(ClientPtr /* client */
);

View file

@ -50,7 +50,9 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "windowstr.h" /* focus struct */
#include "inputstr.h" /* DeviceIntPtr */
@ -60,6 +62,20 @@ SOFTWARE.
#include "getfocus.h"
/***********************************************************************
*
* This procedure gets the focus for a device.
*
*/
int
SProcXGetDeviceFocus(ClientPtr client)
{
REQUEST(xGetDeviceFocusReq);
swaps(&stuff->length);
return (ProcXGetDeviceFocus(client));
}
/***********************************************************************
*
* This procedure gets the focus for a device.
@ -114,7 +130,7 @@ ProcXGetDeviceFocus(ClientPtr client)
*
*/
void _X_COLD
void
SRepXGetDeviceFocus(ClientPtr client, int size, xGetDeviceFocusReply * rep)
{
swaps(&rep->sequenceNumber);

View file

@ -30,6 +30,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef GETFOCUS_H
#define GETFOCUS_H 1
int SProcXGetDeviceFocus(ClientPtr /* client */
);
int ProcXGetDeviceFocus(ClientPtr /* client */
);

View file

@ -50,7 +50,9 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
@ -62,6 +64,21 @@ SOFTWARE.
#include "getkmap.h"
/***********************************************************************
*
* This procedure gets the key mapping for an extension device,
* for clients on machines with a different byte ordering than the server.
*
*/
int
SProcXGetDeviceKeyMapping(ClientPtr client)
{
REQUEST(xGetDeviceKeyMappingReq);
swaps(&stuff->length);
return (ProcXGetDeviceKeyMapping(client));
}
/***********************************************************************
*
* Get the device key mapping.
@ -129,7 +146,7 @@ ProcXGetDeviceKeyMapping(ClientPtr client)
*
*/
void _X_COLD
void
SRepXGetDeviceKeyMapping(ClientPtr client, int size,
xGetDeviceKeyMappingReply * rep)
{

View file

@ -30,6 +30,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef GETKMAP_H
#define GETKMAP_H 1
int SProcXGetDeviceKeyMapping(ClientPtr /* client */
);
int ProcXGetDeviceKeyMapping(ClientPtr /* client */
);

View file

@ -50,7 +50,9 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
@ -59,6 +61,21 @@ SOFTWARE.
#include "getmmap.h"
/***********************************************************************
*
* This procedure gets the modifier mapping for an extension device,
* for clients on machines with a different byte ordering than the server.
*
*/
int
SProcXGetDeviceModifierMapping(ClientPtr client)
{
REQUEST(xGetDeviceModifierMappingReq);
swaps(&stuff->length);
return (ProcXGetDeviceModifierMapping(client));
}
/***********************************************************************
*
* Get the device Modifier mapping.
@ -108,7 +125,7 @@ ProcXGetDeviceModifierMapping(ClientPtr client)
*
*/
void _X_COLD
void
SRepXGetDeviceModifierMapping(ClientPtr client, int size,
xGetDeviceModifierMappingReply * rep)
{

View file

@ -30,6 +30,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef GETMMAP_H
#define GETMMAP_H 1
int SProcXGetDeviceModifierMapping(ClientPtr /* client */
);
int ProcXGetDeviceModifierMapping(ClientPtr /* client */
);

View file

@ -50,17 +50,17 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/dix_priv.h"
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structs */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exglobals.h"
#include "swaprep.h"
#include "getprop.h"
extern XExtEventInfo EventInfo[];
@ -72,10 +72,11 @@ extern int ExtEventIndex;
*
*/
int _X_COLD
int
SProcXGetDeviceDontPropagateList(ClientPtr client)
{
REQUEST(xGetDeviceDontPropagateListReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xGetDeviceDontPropagateListReq);
swapl(&stuff->window);
return (ProcXGetDeviceDontPropagateList(client));
@ -117,9 +118,7 @@ ProcXGetDeviceDontPropagateList(ClientPtr client)
ClassFromMask(NULL, others->dontPropagateMask[i], i, &count, COUNT);
if (count) {
rep.count = count;
buf = xallocarray(rep.count, sizeof(XEventClass));
if (buf == NULL)
return BadAlloc;
buf = (XEventClass *) malloc(rep.count * sizeof(XEventClass));
rep.length = bytes_to_int32(rep.count * sizeof(XEventClass));
tbuf = buf;
@ -174,7 +173,7 @@ XEventClass
*
*/
void _X_COLD
void
SRepXGetDeviceDontPropagateList(ClientPtr client, int size,
xGetDeviceDontPropagateListReply * rep)
{

View file

@ -50,17 +50,17 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/dix_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window struct */
#include "exglobals.h"
#include "swaprep.h"
#include "getprop.h"
#include "getselev.h"
@ -70,10 +70,11 @@ SOFTWARE.
*
*/
int _X_COLD
int
SProcXGetSelectedExtensionEvents(ClientPtr client)
{
REQUEST(xGetSelectedExtensionEventsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xGetSelectedExtensionEventsReq);
swapl(&stuff->window);
return (ProcXGetSelectedExtensionEvents(client));
@ -163,7 +164,7 @@ ProcXGetSelectedExtensionEvents(ClientPtr client)
*
*/
void _X_COLD
void
SRepXGetSelectedExtensionEvents(ClientPtr client, int size,
xGetSelectedExtensionEventsReply * rep)
{

View file

@ -50,7 +50,9 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
@ -68,10 +70,11 @@ XExtensionVersion XIVersion;
*
*/
int _X_COLD
int
SProcXGetExtensionVersion(ClientPtr client)
{
REQUEST(xGetExtensionVersionReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xGetExtensionVersionReq);
swaps(&stuff->nbytes);
return (ProcXGetExtensionVersion(client));
@ -91,7 +94,7 @@ ProcXGetExtensionVersion(ClientPtr client)
REQUEST(xGetExtensionVersionReq);
REQUEST_AT_LEAST_SIZE(xGetExtensionVersionReq);
if (client->req_len != bytes_to_int32(sizeof(xGetExtensionVersionReq) +
if (stuff->length != bytes_to_int32(sizeof(xGetExtensionVersionReq) +
stuff->nbytes))
return BadLength;
@ -117,7 +120,7 @@ ProcXGetExtensionVersion(ClientPtr client)
*
*/
void _X_COLD
void
SRepXGetExtensionVersion(ClientPtr client, int size,
xGetExtensionVersionReply * rep)
{

View file

@ -50,7 +50,9 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
@ -70,17 +72,17 @@ extern int ExtEventIndex;
*
*/
int _X_COLD
int
SProcXGrabDevice(ClientPtr client)
{
REQUEST(xGrabDeviceReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xGrabDeviceReq);
swapl(&stuff->grabWindow);
swapl(&stuff->time);
swaps(&stuff->event_count);
if (client->req_len !=
if (stuff->length !=
bytes_to_int32(sizeof(xGrabDeviceReq)) + stuff->event_count)
return BadLength;
@ -107,7 +109,7 @@ ProcXGrabDevice(ClientPtr client)
REQUEST(xGrabDeviceReq);
REQUEST_AT_LEAST_SIZE(xGrabDeviceReq);
if (client->req_len !=
if (stuff->length !=
bytes_to_int32(sizeof(xGrabDeviceReq)) + stuff->event_count)
return BadLength;
@ -151,7 +153,7 @@ ProcXGrabDevice(ClientPtr client)
* set when XI starts up) and binary OR's the device's mask to whatever the
* event mask for the given event type was.
* If an error occurs, it is sent to the client. Errors are generated if
* - if the device given in the event class is invalid
* - if the device given in the event classs is invalid
* - if the device in the class list is not the device given as parameter (no
* error if parameter is NULL)
*
@ -173,7 +175,10 @@ CreateMaskFromList(ClientPtr client, XEventClass * list, int count,
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;
@ -189,7 +194,7 @@ CreateMaskFromList(ClientPtr client, XEventClass * list, int count,
for (j = 0; j < ExtEventIndex; j++)
if (EventInfo[j].type == (*list & 0xff)) {
mask[device].mask |= EventInfo[j].mask;
mask[device].dev = (void *) tdev;
mask[device].dev = (Pointer) tdev;
break;
}
}
@ -203,7 +208,7 @@ CreateMaskFromList(ClientPtr client, XEventClass * list, int count,
*
*/
void _X_COLD
void
SRepXGrabDevice(ClientPtr client, int size, xGrabDeviceReply * rep)
{
swaps(&rep->sequenceNumber);

View file

@ -50,17 +50,18 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/exevents_priv.h"
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exevents.h"
#include "exglobals.h"
#include "xace.h"
#include "grabdev.h"
#include "grabdevb.h"
@ -70,10 +71,11 @@ SOFTWARE.
*
*/
int _X_COLD
int
SProcXGrabDeviceButton(ClientPtr client)
{
REQUEST(xGrabDeviceButtonReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xGrabDeviceButtonReq);
swapl(&stuff->grabWindow);
swaps(&stuff->modifiers);
@ -105,7 +107,7 @@ ProcXGrabDeviceButton(ClientPtr client)
REQUEST(xGrabDeviceButtonReq);
REQUEST_AT_LEAST_SIZE(xGrabDeviceButtonReq);
if (client->req_len !=
if (stuff->length !=
bytes_to_int32(sizeof(xGrabDeviceButtonReq)) + stuff->event_count)
return BadLength;
@ -123,7 +125,7 @@ ProcXGrabDeviceButton(ClientPtr client)
}
else {
mdev = PickKeyboard(client);
ret = XaceHookDeviceAccess(client, mdev, DixUseAccess);
ret = XaceHook(XACE_DEVICE_ACCESS, client, mdev, DixUseAccess);
if (ret != Success)
return ret;
}

View file

@ -50,17 +50,18 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/exevents_priv.h"
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exevents.h"
#include "exglobals.h"
#include "xace.h"
#include "grabdev.h"
#include "grabdevk.h"
@ -70,10 +71,11 @@ SOFTWARE.
*
*/
int _X_COLD
int
SProcXGrabDeviceKey(ClientPtr client)
{
REQUEST(xGrabDeviceKeyReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xGrabDeviceKeyReq);
swapl(&stuff->grabWindow);
swaps(&stuff->modifiers);
@ -103,7 +105,7 @@ ProcXGrabDeviceKey(ClientPtr client)
REQUEST(xGrabDeviceKeyReq);
REQUEST_AT_LEAST_SIZE(xGrabDeviceKeyReq);
if (client->req_len !=
if (stuff->length !=
bytes_to_int32(sizeof(xGrabDeviceKeyReq)) + stuff->event_count)
return BadLength;
@ -121,7 +123,7 @@ ProcXGrabDeviceKey(ClientPtr client)
}
else {
mdev = PickKeyboard(client);
ret = XaceHookDeviceAccess(client, mdev, DixUseAccess);
ret = XaceHook(XACE_DEVICE_ACCESS, client, mdev, DixUseAccess);
if (ret != Success)
return ret;
}

View file

@ -50,15 +50,16 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/exevents_priv.h"
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exevents.h"
#include "exglobals.h"
#include "gtmotion.h"
/***********************************************************************
@ -67,10 +68,11 @@ SOFTWARE.
*
*/
int _X_COLD
int
SProcXGetDeviceMotionEvents(ClientPtr client)
{
REQUEST(xGetDeviceMotionEventsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xGetDeviceMotionEventsReq);
swapl(&stuff->start);
swapl(&stuff->stop);
@ -129,7 +131,7 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
num_events = v->numMotionEvents;
if (num_events) {
size = sizeof(Time) + (axes * sizeof(INT32));
rep.nEvents = GetMotionHistory(dev, (xTimecoord **) &coords, /* XXX */
rep.nEvents = GetMotionHistory(dev, (xTimecoord **) & coords, /* XXX */
start.milliseconds, stop.milliseconds,
(ScreenPtr) NULL, FALSE);
}
@ -160,7 +162,7 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
*
*/
void _X_COLD
void
SRepXGetDeviceMotionEvents(ClientPtr client, int size,
xGetDeviceMotionEventsReply * rep)
{

View file

@ -50,24 +50,38 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h> /* for inputstr.h */
#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/input_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "XIstubs.h"
#include "extnsionst.h"
#include "exevents.h"
#include "xace.h"
#include "xkbsrv.h"
#include "xkbstr.h"
#include "listdev.h"
/***********************************************************************
*
* This procedure lists the input devices available to the server.
*
*/
int
SProcXListInputDevices(ClientPtr client)
{
REQUEST(xListInputDevicesReq);
swaps(&stuff->length);
return (ProcXListInputDevices(client));
}
/***********************************************************************
*
* This procedure calculates the size of the information to be returned
@ -105,9 +119,9 @@ SizeDeviceInfo(DeviceIntPtr d, int *namesize, int *size)
*/
static void
CopyDeviceName(char **namebuf, const char *name)
CopyDeviceName(char **namebuf, char *name)
{
char *nameptr = *namebuf;
char *nameptr = (char *) *namebuf;
if (name) {
*nameptr++ = strlen(name);
@ -295,7 +309,7 @@ ShouldSkipDevice(ClientPtr client, DeviceIntPtr d)
{
/* don't send master devices other than VCP/VCK */
if (!IsMaster(d) || d == inputInfo.pointer ||d == inputInfo.keyboard) {
int rc = XaceHookDeviceAccess(client, d, DixGetAttrAccess);
int rc = XaceHook(XACE_DEVICE_ACCESS, client, d, DixGetAttrAccess);
if (rc == Success)
return FALSE;
@ -336,7 +350,7 @@ ProcXListInputDevices(ClientPtr client)
};
/* allocate space for saving skip value */
skip = calloc(inputInfo.numDevices, sizeof(Bool));
skip = calloc(sizeof(Bool), inputInfo.numDevices);
if (!skip)
return BadAlloc;
@ -363,10 +377,6 @@ ProcXListInputDevices(ClientPtr client)
/* allocate space for reply */
total_length = numdevs * sizeof(xDeviceInfo) + size + namesize;
devbuf = (char *) calloc(1, total_length);
if (!devbuf) {
free(skip);
return BadAlloc;
}
classbuf = devbuf + (numdevs * sizeof(xDeviceInfo));
namebuf = classbuf + size;
savbuf = devbuf;
@ -403,7 +413,7 @@ ProcXListInputDevices(ClientPtr client)
*
*/
void _X_COLD
void
SRepXListInputDevices(ClientPtr client, int size, xListInputDevicesReply * rep)
{
swaps(&rep->sequenceNumber);

View file

@ -32,6 +32,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define VPC 20 /* Max # valuators per chunk */
int SProcXListInputDevices(ClientPtr /* client */
);
int ProcXListInputDevices(ClientPtr /* client */
);

View file

@ -1,67 +0,0 @@
srcs_xi = [
'allowev.c',
'chgdctl.c',
'chgfctl.c',
'chgkbd.c',
'chgkmap.c',
'chgprop.c',
'chgptr.c',
'closedev.c',
'devbell.c',
'exevents.c',
'extinit.c',
'getbmap.c',
'getdctl.c',
'getfctl.c',
'getfocus.c',
'getkmap.c',
'getmmap.c',
'getprop.c',
'getselev.c',
'getvers.c',
'grabdev.c',
'grabdevb.c',
'grabdevk.c',
'gtmotion.c',
'listdev.c',
'opendev.c',
'queryst.c',
'selectev.c',
'sendexev.c',
'setbmap.c',
'setdval.c',
'setfocus.c',
'setmmap.c',
'setmode.c',
'ungrdev.c',
'ungrdevb.c',
'ungrdevk.c',
'xiallowev.c',
'xibarriers.c',
'xichangecursor.c',
'xichangehierarchy.c',
'xigetclientpointer.c',
'xigrabdev.c',
'xipassivegrab.c',
'xiproperty.c',
'xiquerydevice.c',
'xiquerypointer.c',
'xiqueryversion.c',
'xiselectev.c',
'xisetclientpointer.c',
'xisetdevfocus.c',
'xiwarppointer.c',
]
libxserver_xi = static_library('libxserver_xi',
srcs_xi,
include_directories: inc,
dependencies: common_dep,
)
srcs_xi_stubs = ['stubs.c']
libxserver_xi_stubs = static_library('libxserver_xi_stubs',
srcs_xi_stubs,
include_directories: inc,
dependencies: common_dep,
)

View file

@ -50,7 +50,9 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
@ -64,6 +66,21 @@ SOFTWARE.
extern CARD8 event_base[];
/***********************************************************************
*
* This procedure swaps the request if the server and client have different
* byte orderings.
*
*/
int
SProcXOpenDevice(ClientPtr client)
{
REQUEST(xOpenDeviceReq);
swaps(&stuff->length);
return (ProcXOpenDevice(client));
}
/***********************************************************************
*
* This procedure causes the server to open an input device.
@ -146,7 +163,7 @@ ProcXOpenDevice(ClientPtr client)
*
*/
void _X_COLD
void
SRepXOpenDevice(ClientPtr client, int size, xOpenDeviceReply * rep)
{
swaps(&rep->sequenceNumber);

View file

@ -30,6 +30,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef OPENDEV_H
#define OPENDEV_H 1
int SProcXOpenDevice(ClientPtr /* client */
);
int ProcXOpenDevice(ClientPtr /* client */
);

View file

@ -32,21 +32,35 @@ from The Open Group.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/exevents_priv.h"
#include "dix/input_priv.h"
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exevents.h"
#include "exglobals.h"
#include "xkbsrv.h"
#include "xkbstr.h"
#include "queryst.h"
/***********************************************************************
*
* This procedure allows a client to query the state of a device.
*
*/
int
SProcXQueryDeviceState(ClientPtr client)
{
REQUEST(xQueryDeviceStateReq);
swaps(&stuff->length);
return (ProcXQueryDeviceState(client));
}
/***********************************************************************
*
* This procedure allows frozen events to be routed.
@ -165,7 +179,7 @@ ProcXQueryDeviceState(ClientPtr client)
*
*/
void _X_COLD
void
SRepXQueryDeviceState(ClientPtr client, int size, xQueryDeviceStateReply * rep)
{
swaps(&rep->sequenceNumber);

View file

@ -30,6 +30,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef QUERYST_H
#define QUERYST_H 1
int SProcXQueryDeviceState(ClientPtr /* client */
);
int ProcXQueryDeviceState(ClientPtr /* client */
);

View file

@ -50,21 +50,23 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#include <X11/extensions/XI.h>
#include <X11/extensions/XI2.h>
#include <X11/extensions/XIproto.h>
#include "dix/dix_priv.h"
#include "dix/exevents_priv.h"
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XI2.h>
#include <X11/extensions/XIproto.h>
#include "exevents.h"
#include "exglobals.h"
#include "grabdev.h"
#include "selectev.h"
extern Mask ExtExclusiveMasks[];
static int
HandleDevicePresenceMask(ClientPtr client, WindowPtr win,
XEventClass * cls, CARD16 *count)
@ -117,10 +119,11 @@ HandleDevicePresenceMask(ClientPtr client, WindowPtr win,
*
*/
int _X_COLD
int
SProcXSelectExtensionEvent(ClientPtr client)
{
REQUEST(xSelectExtensionEventReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xSelectExtensionEventReq);
swapl(&stuff->window);
swaps(&stuff->count);
@ -147,7 +150,7 @@ ProcXSelectExtensionEvent(ClientPtr client)
REQUEST(xSelectExtensionEventReq);
REQUEST_AT_LEAST_SIZE(xSelectExtensionEventReq);
if (client->req_len !=
if (stuff->length !=
bytes_to_int32(sizeof(xSelectExtensionEventReq)) + stuff->count)
return BadLength;
@ -172,7 +175,7 @@ ProcXSelectExtensionEvent(ClientPtr client)
}
if ((ret =
SelectForWindow((DeviceIntPtr) tmp[i].dev, pWin, client,
tmp[i].mask, DeviceButtonGrabMask)) != Success)
tmp[i].mask, ExtExclusiveMasks[i])) != Success)
return ret;
}

View file

@ -50,17 +50,18 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/exevents_priv.h"
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* Window */
#include "extnsionst.h" /* EventSwapPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exevents.h"
#include "exglobals.h"
#include "grabdev.h"
#include "sendexev.h"
@ -72,38 +73,31 @@ extern int lastEvent; /* Defined in extension.c */
*
*/
int _X_COLD
int
SProcXSendExtensionEvent(ClientPtr client)
{
CARD32 *p;
int i;
xEvent eventT = { .u.u.type = 0 };
xEvent eventT;
xEvent *eventP;
EventSwapPtr proc;
REQUEST(xSendExtensionEventReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xSendExtensionEventReq);
swapl(&stuff->destination);
swaps(&stuff->count);
if (client->req_len !=
if (stuff->length !=
bytes_to_int32(sizeof(xSendExtensionEventReq)) + stuff->count +
bytes_to_int32(stuff->num_events * sizeof(xEvent)))
return BadLength;
eventP = (xEvent *) &stuff[1];
for (i = 0; i < stuff->num_events; i++, eventP++) {
if (eventP->u.u.type == GenericEvent) {
client->errorValue = eventP->u.u.type;
return BadValue;
}
proc = EventSwapVector[eventP->u.u.type & 0177];
/* no swapping proc; invalid event type? */
if (proc == NotImplemented) {
client->errorValue = eventP->u.u.type;
if (proc == NotImplemented) /* no swapping proc; invalid event type? */
return BadValue;
}
(*proc) (eventP, &eventT);
*eventP = eventT;
}
@ -123,7 +117,7 @@ SProcXSendExtensionEvent(ClientPtr client)
int
ProcXSendExtensionEvent(ClientPtr client)
{
int ret, i;
int ret;
DeviceIntPtr dev;
xEvent *first;
XEventClass *list;
@ -132,7 +126,7 @@ ProcXSendExtensionEvent(ClientPtr client)
REQUEST(xSendExtensionEventReq);
REQUEST_AT_LEAST_SIZE(xSendExtensionEventReq);
if (client->req_len !=
if (stuff->length !=
bytes_to_int32(sizeof(xSendExtensionEventReq)) + stuff->count +
(stuff->num_events * bytes_to_int32(sizeof(xEvent))))
return BadLength;
@ -141,18 +135,13 @@ ProcXSendExtensionEvent(ClientPtr client)
if (ret != Success)
return ret;
if (stuff->num_events == 0)
return ret;
/* The client's event type must be one defined by an extension. */
first = ((xEvent *) &stuff[1]);
for (i = 0; i < stuff->num_events; i++) {
if (!((EXTENSION_EVENT_BASE <= first[i].u.u.type) &&
(first[i].u.u.type < lastEvent))) {
client->errorValue = first[i].u.u.type;
return BadValue;
}
if (!((EXTENSION_EVENT_BASE <= first->u.u.type) &&
(first->u.u.type < lastEvent))) {
client->errorValue = first->u.u.type;
return BadValue;
}
list = (XEventClass *) (first + stuff->num_events);

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