Compare commits

..

108 commits

Author SHA1 Message Date
Peter Hutterer
60e0d20566 configure.ac: Bump to Version 1.12.3
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-07-09 10:44:01 +10:00
Torsten Kaiser
738e55ebbd xfree86: EDID Est III parsing skips some modes
This loop needs to count from 7 to 0, not only from 7 to 1.
The current code always skips the modes {1152, 864, 75, 0}, {1280, 1024, 85, 0},
{1400, 1050, 75, 0}, {1600, 1200, 70, 0} and {1920, 1200, 60, 0}.

Signed-off-by: Torsten Kaiser <x11@ariolc.dyndns.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 7c9d8cbd36)
2012-07-09 10:39:29 +10:00
Torsten Kaiser
f27fcb81c4 xfree86: EDID Est III parsing can walk off end of array
Using -O3 gcc notes that m could reach beyound the end of the EstIIIModes array,
if the last bits of the 11s byte where set.
Fix this, by extending the array to cover all possible bits from est.

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

Signed-off-by: Torsten Kaiser <x11@ariolc.dyndns.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 0b3abacb64)
2012-07-09 10:39:24 +10:00
Peter Hutterer
e4497cd002 xfree86: always enable SIGIO on OsVendorInit (#50957)
Drivers call xf86InstallSIGIOHandler() for their fd on DEVICE_ON. That
function does not actually enable the signal if it was blocked to begin
with. As a result, if one vt-switches away from the server (SIGIO is
blocked) and then triggers a server regeneration, the signal remains
blocked and input devices are dead.

Avoid this by always unblocking SIGIO when we start the server.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 9f1edced9a)
2012-07-09 10:39:03 +10:00
Peter Hutterer
ac85a6866f Xi: extend PropagateMask to EMASKSIZE
Number of devices is 2 + MAXDEVICES, with index 0 and 1 reserved for
XIAll{Master}Devices. At the current size, PropagateMask would be overrun in
RecalculateDeviceDeliverableEvents().

Found by Coverity.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 12bfb4cf1b)
2012-07-09 10:39:02 +10:00
Peter Hutterer
eca5de2f1a dix: fix memory leak in TouchEventHistoryReplay
Don't leak if ti->history is NULL.

Found by coverity.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit a9c09f8f8e)
2012-07-09 10:39:02 +10:00
Peter Hutterer
c4d28c40bf xfree86: fix use-after-free issue in checkInput
*dev is the condition of the while loop we're in, reset to NULL after
freeing

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit e3f47be9fb)
2012-07-09 10:39:02 +10:00
Peter Hutterer
487e8e8299 configure.ac: Version bump to 1.12.2.902 (1.12.3 RC2)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-07-02 10:15:14 +10:00
Andy Ritger
d21b6f0a2d randr: Don't recurse into mieqProcessInputEvents() from RRTellChanged().
Call UpdateCurrentTimeIf(), not UpdateCurrentTime(), from RRTellChanged().
The latter calls ProcessInputEvents(), which can trigger a recursion
into mieqProcessInputEvents().  The former omits the call to
ProcessInputEvents().

Signed-off-by: Andy Ritger <aritger@nvidia.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit dae317e726)
2012-07-01 09:45:42 +10:00
Peter Hutterer
a6de3eac66 dix: if the scroll valuator reaches INT_MAX, reset to 0
Too much scrolling down may eventually trigger an overflow of the valuator.
If this happens, reset the valuator to 0 and skip this event for button
emulation. Clients will have to figure out a way to deal with this, but a
scroll event from (close to) INT_MAX to 0 is a hint of that it needs to be
ignored.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
(cherry picked from commit 54476b5e44)
2012-07-01 09:36:04 +10:00
Peter Hutterer
b0be2d29b2 Xi: fix XITouchClass sourceid assignment
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
(cherry picked from commit 72cfc1a097)
2012-06-25 14:05:03 +10:00
Peter Hutterer
4af8e22b1a xkb: warn if XKB SlowKeys have been automatically enabled
Slow keys are enabled when the XKB AccessX features are generally enabled
(ctrls->enabled_ctrls & XkbAccessXKeysMask) and either shift key is held for
8 seconds. For the unsuspecting user this appears as if the keyboard
suddenly stops working.

Print a warning to the log, so we can later tell them "told you so".

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
(cherry picked from commit ff41753b1b)
2012-06-20 11:40:41 +10:00
Peter Hutterer
0cecc4fc0f configure.ac: Version bump to 1.12.2.901 (1.12.3 RC1)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-06-15 13:09:50 +10:00
Julien Cristau
aaf4890627 Xi: make stub DeleteInputDeviceRequest call RemoveDevice
DeleteInputDeviceRequest is called from CloseDownDevices on reset, so
call RemoveDevice to avoid leaking devices in Xvfb/Xnest/Xwin.

Signed-off-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit e4153c1d91)
2012-06-05 12:10:36 +10:00
Marcin Slusarz
f4a1ecb928 xfree86: fix mouse wheel support for DGA clients
xf86-input-evdev (since "smooth scrolling" support was added) can send mouse
motion and wheel events in one batch, so we need to handle it properly.
Otherwise mouse wheel events which come with motion events are lost
and separate mouse wheel events are handled through non-DGA path.

Signed-off-by: Marcin Slusarz <marcin.slusarz@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 2d4fda4b09)
2012-06-05 12:10:29 +10:00
Peter Hutterer
889ce06946 dix: undo transformation for missing valuators (#49347)
last.valuators contains the transformed valuators of the device. If the
device submits events with x/y missing, we need to get that from
last.valuators and undo the transformation to that axis.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
(cherry picked from commit 749a593e49)
2012-06-05 12:10:15 +10:00
Siddhesh Poyarekar
4c21adab7c xkb: Allocate size_syms correctly when width of a type increases
The current code seems to skip syms with width less than
type->num_levels when calculating the total size for the new
size_syms. This leads to less space being allocated than necessary
during the next phase, which is to copy over the syms to the new
location. This results in an overflow leading to a crash.

Signed-off-by: Siddhesh Poyarekar <siddhesh.poyarekar@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 42ae2e8199)
2012-06-05 12:02:28 +10:00
Michal Suchanek
472c2d1af7 Fix crash for motion events from devices without valuators
A WarpPointer request may trigger a motion event on a device without
valuators. That request is ignored by GetPointerEvents but during smooth
scroll emulation we dereference dev->valuators to get the number of axes.

Break out early if the device doesn't have valuators.

Signed-off-by: Michal Suchanek <hramrach@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 88c767edb0)
2012-06-05 12:02:28 +10:00
Alan Coopersmith
97cae5e07a Convert sbusPaletteKey to latest DevPrivate API
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 96e0ab5496)
2012-05-29 13:19:08 -07:00
Alan Coopersmith
3484ef2de5 cvt man page should use Hz, not kHz, for vertical refresh rate
https://bugs.freedesktop.org/show_bug.cgi?id=48311

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Julien Cristau <jcristau@debian.org>
(cherry picked from commit c3180a74a4)
2012-05-29 13:18:59 -07:00
Alan Coopersmith
a5808eae02 Undocument Font Module loading
Code was deleted in commit affec10635

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit 5a3a98fcb7)
2012-05-29 13:18:41 -07:00
Alan Coopersmith
9a4e2d80a5 Undocument mandatory loadable modules
The code to implement was deleted when BaseModules[] was emptied by
the replacement of the "pcidata" module with libpciaccess calls
in commit 46f55f5dea.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit afcb7ba24e)
2012-05-29 13:18:27 -07:00
Jeremy Huddleston
19126c0b36 XQuartz: Avoid a race in initialization of darwinPointer
http://xquartz.macosforge.org/trac/ticket/579

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit acdc4f54ee)
2012-05-29 13:17:03 -07:00
Jeremy Huddleston
198a876e34 XQuartz: Provide fls implementation for Tiger
Regression-from: 30623d6ff7
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit f5fc533411)
2012-05-29 13:17:03 -07:00
Jeremy Huddleston
300970f8f8 XQuartz: Tiger build fix
http://trac.macports.org/ticket/34364

Regression-from: 662d41acdd

Reported-by: Peter Dyballa <Peter_Dyballa@Freenet.DE>
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit e0097ce971)
2012-05-29 13:17:02 -07:00
Jeremy Huddleston
21956e2f8e XQuartz: Workaround an SDK bug on Leopard/x86_64
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit 4acbaa3027)
2012-05-29 13:17:02 -07:00
Jeremy Huddleston
131fe8fbd1 configure.ac: Version bump to 1.12.2
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2012-05-29 13:05:17 -07:00
Jeremy Huddleston
4a2b8eebd1 configure.ac: Version bump to 1.12.1.902 (1.12.2 RC2)
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2012-05-19 22:11:19 -07:00
Jeremy Huddleston
32235e9786 Merge remote-tracking branch 'whot/server-1.12-branch' into server-1.12-branch 2012-05-17 09:56:29 -07:00
Chase Douglas
dab90b60f3 Report touch emulated buttons in XIQueryPointer for XI 2.1 and earlier
XInput 2.1 and earlier clients do not know about touches. We must report
touch emulated button presses for these clients. For later clients, we
only report true pointer button presses.

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 ee542b8559)
2012-05-14 15:54:26 +10:00
Chase Douglas
04474fc6a4 Report logical button state in ProcXIQueryPointer
Physical button state is usually meaningless to an X client.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 1e7b500a8e)
2012-05-14 15:54:25 +10:00
Daniel Kurtz
3b25ed442c os/log: refactor logging
It is not safe to ever use an arbitrary (possibly user supplied) string as
part of the format for a *sprintf() call.

For example:
  1. Name a Bluetooth keyboard "%n%n%n%n%n%n%n%n"
  2. Pair it with a computer running X and try to use it
  3. X is not happy when trying to do the following in xf86-input-evdev:
     xf86IDrvMsg(pInfo, X_CONFIG, "Device: \"%s\"\n", device);
     because LogVHdrMessageVerb() has put the %n from the device name
     into a format string of the form:
        "evdev: %n%n%n%n%n%n%n%n: Device: \"%s\"\n"

Instead, build up a log message in place by appending successive formatted
strings by sncprintf'ing to the end of the previous.

Signed-off-by: Daniel Kurtz <djkurtz@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 c91d00e0f3)
2012-05-14 15:54:05 +10:00
Daniel Kurtz
34a82b393a os/log: only write timestamp if a message is actually written to logfile
The current code will write a timestamps into the logFile whenever
the last message ended with a '\n' - even if the verb for that timestamp
is at too high a level.  This timestamp will sit there with no matching
message until the next call to LogVWrite with a valid verb.

In other words, in some cases, timestamps in the X.org.log are for some
completely unrelated message that was previously ignored due to
insufficient verbosity, and not for the message that appears next to it
in the log file.

We keep the current policy which appears to be to only apply timestamps if
a message is actually written to a log file.  That is, no timestamps on
stderr, or in the mem buffer.  Therefore, the timestamp stringification
is moved to the conditional where it is used.

Since logging uses a fixed length buffer, this patch also forces a '\n'
whenever a buffer is terminated due to a too-long write request.  This
allows the newline detection to work even on overflow, and also cleans up
the log a bit in the overflow case.

Signed-off-by: Daniel Kurtz <djkurtz@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 6ce0eac4f8)
2012-05-14 15:54:03 +10:00
Daniel Kurtz
8998037f18 os/xprintf: add Xvscnprintf and Xscnprintf
Normal snprintf() usually returns the number of bytes that would have been
written into a buffer had the buffer been long enough.

The scnprintf() variants return the actual number of bytes written,
excluding the trailing '\0'.

Signed-off-by: Daniel Kurtz <djkurtz@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 5c2e2a164d)
2012-05-14 15:54:02 +10:00
Daniel Kurtz
9a2030ea26 os/log: trivial cleanups
* space->tab
 * remove comment that doesn't make any sense

Signed-off-by: Daniel Kurtz <djkurtz@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 c30862879d)
2012-05-14 15:54:00 +10:00
Jeremy Huddleston
58dfb13953 Revert "dix: when disabling a device, release all buttons and keys"
This reverts commit 90299556db.

The commit being reverted triggered a segfault on server shutdown when a
device posts raw events after the root windows are forced to NULL.

https://lists.debian.org/debian-x/2012/05/msg00240.html

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2012-05-10 00:53:20 -07:00
Michal Suchanek
f012f0c48d dmx: Annotate dmxlog.c with _X_ATTRIBUTE_PRINTF and _X_NORETURN
and fix resulting printf warning in dmxLogVisual

Signed-off-by: Michal Suchanek <hramrach@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit d662fa2450)
2012-05-10 00:50:35 -07:00
Peter Hutterer
f8d2ca759a dix: indentation fix
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit ebf214876a)
2012-05-10 00:50:34 -07:00
Daniel Kurtz
15607cf2dc dix: don't BUG_WARN for button events from button-only device
Events from button-only devices still need coordinates, and they get them
from scale_to_desktop().  Therefore, a dev without valuators is not a bug.
However, a dev with valuators, but less than two of them still is a bug.

This was noticed when unplugging a "Creative Technology SB Arena Headset",
which has some BTNs and some KEYs, but no REL or ABS valuators.
It emits [BTN_3] = 0 on unplug, which would trigger the BUG_WARN.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit c5a45b0f76)
2012-05-10 00:50:34 -07:00
Keith Packard
3ad72a8008 hw/xfree86: Re-indent xf86vmode.c
This is the result of re-running the 'x-indent.sh' script over
xf86vmode.c to clean up the disaster caused by broken syntax in the
file.

Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 9779b904c7)
2012-05-10 00:50:34 -07:00
Keith Packard
b5bf0ac540 hw/xfree86: Spurious ');' in xf86vmode.c messed up indentation badly
Inside the unfinished XF86VIDMODE_EVENTS #ifdef block the
function definition for xf86VidModeNotifyEvent had an extra ');'
before the prototype argument declarations. This was harmless for the
compiler as the code never gets used, but completely messed up the
file re-indentation. This patch removes the spurious characters in
preparation for re-indenting the file.

Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 592bd0ae2b)
2012-05-10 00:50:34 -07:00
Jeremy Huddleston
943cac51e4 configure.ac: Bump to 1.12.1.901 (1.12.2 RC1)
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2012-05-07 00:03:01 -07:00
Jeremy Huddleston
22a1953c4a XQuartz: Make sure we tell startx the correct server binary to use in our fallback path
With multiple servers installed, we can't be certain if X is Xorg or Xquartz

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit 93d6ba5b71)
2012-05-02 21:03:28 -07:00
Peter Hutterer
90299556db dix: when disabling a device, release all buttons and keys
A suspend-induced device disable may happen before the device gets to see
the button release event. On resume, the server's internal state still has
some buttons pressed, causing inconsistent behaviour.

Force the release and the matching events to be sent to the client.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
(cherry picked from commit f3410b97cf)

Conflicts:

	dix/devices.c
2012-05-03 11:24:44 +10:00
Peter Hutterer
b53cdf4c53 dix: don't emulate scroll events for non-existing axes (#47281)
Test case:
- create a device with REL_HWHEEL and ABS_X and ABS_Y. evdev 2.7.0 will set
  that up as device with 1 relative axis
- move pointer to VGA1
- xrandr --output VGA1 --off

Warps the pointer to the new spot and calls GPE with the x/y mask bits set.
When running through the loop to check for scroll event, this overruns the
axes and may try to emulate scroll events based on random garbage in the
memory. If that memory contained non-zero for the scroll type but near-zero
for the increment field, the server would hang in an infinite loop.

This was the trigger for this suggested, never-merged, patch here:
http://patchwork.freedesktop.org/patch/9543/

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
(cherry picked from commit af88b43f9e)
2012-05-03 11:23:56 +10:00
Peter Hutterer
9ddf9e2388 os: make timers signal-safe
If TimerSet() is called from a signal handler (synaptics tap handling code)
may result in list corruption if we're currently inside TimerSet().

See backtrace in
https://bugzilla.redhat.com/show_bug.cgi?id=814869

Block signals for all list manipulations in the timers.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
(cherry picked from commit 08962951de)
2012-05-03 11:23:52 +10:00
Chase Douglas
345761be71 TouchListenerAcceptReject: Warn and return early on bad listener index
Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Bryce Harrington <bryce@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 5c361d59c5)
2012-05-03 11:23:47 +10:00
Michal Suchanek
ed33772a0d xfree86: workaround crash on close
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=41653

Signed-off-by: Michal Suchanek <hramrach@gmail.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Tested-by: Knut Petersen <Knut_Petersen@t-online.de>
(cherry picked from commit fa6dddc6ce)
2012-04-26 21:07:09 -07:00
Jonas Maebe
e4dbdee392 glapi: Correct size of allocated _glapi_table struct
The __glapi_gentable_set_remaining_noop() routine treats the _glapi_struct
as an array of _glapi_get_dispatch_table_size() pointers, so we have to
allocate _glapi_get_dispatch_table_size()*sizeof(void*) bytes rather than
sizeof(struct _glapi_struct) bytes.

Signed-off-by: Jonas Maebe <jonas.maebe@elis.ugent.be>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit adcb48a29d)
2012-04-26 21:07:09 -07:00
Jeremy Huddleston
6b45dff024 XQuartz: darwinPointer now sends both absolute and relative motion
This should hopefully help out wine clients that were continuing to
have issues after the earlier changes.

http://xquartz.macosforge.org/trac/ticket/548

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit e34519e525)
2012-04-26 21:07:09 -07:00
Jeremy Huddleston
0d13e62da2 XQuartz: Add a hack to better handle clicky wheel scroll mice
We loose information from AppKit being in our way.  Before adopting
smooth scrolling, we always rounded-up the number of scroll button
clicks per NSEvent.  Now, the scroll value is accumulated in the
dix, and clicky scroll wheels with legacy X11 clients are seeing
an accumulation of error due to so many translations (button press
to smooth scrolling value in AppKit, passed to the dix, and then
synthesized into a button press).  This attempts to make the
situation better.

http://xquartz.macosforge.org/trac/ticket/562

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit 662d41acdd)
2012-04-26 21:07:09 -07:00
Jeremy Huddleston
287f8271a3 XQuartz: Use screenInfo.{width,height} instead of grabbing it from the first screen
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit eda85290ae)
2012-04-26 21:07:09 -07:00
Jeremy Huddleston
67cc65ba3c XQuartz: Separate out tablet and mouse event delivery into separate functions
This should have no immediate impact aside from fake mouse buttons no longer
working with tablets (where they aren't needed or desired anyways).  This
prepares us for future changes.

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit b99586c908)
2012-04-26 21:07:08 -07:00
Jeremy Huddleston
72226dc434 XQuartz: Correct calculation of the size of our file descriptor array in console_redirect
Reported-by: Joe Rohde <joer@valvesoftware.com>
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit 30623d6ff7)
2012-04-26 21:07:08 -07:00
Jeremy Huddleston
8a48d44574 XQuartz: Fix a deadlock in pre-dispatch code
The fact that this has been in place so long makes me really wonder if
anybody cares about this running in Tiger or Leopard.

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit b4c4c65a35)
2012-04-26 21:07:08 -07:00
Chase Douglas
9ef48c9fff Replay original touch begin event instead of generated begin event
The generated event does not have axes other than X and Y and has a
newer timestamp. In particular, the newer timestamp may be newer than
the real touch end event, which may be stuck in the syncEvents queue. If
a client uses the timestamps for grabbing bad things may happen.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 00cf1c40b2)
2012-04-26 13:35:24 +10:00
Chase Douglas
73cd880fe0 Update currentTime in dispatch loop
A request, like input device grabs, may check a request timestamp
against currentTime. It is possible for currentTime to lag a previously
sent event timestamp. If the client makes a request based on such an
event timestamp, the request may fail the validity check against
currentTime unless we always update the time before processing the
request.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 312910b4e3)
2012-04-26 13:35:21 +10:00
Chase Douglas
96d8df5bc9 Update device state including when touch record does not exist
If a touch is physically active, the pointer core state should reflect
that the first button is pressed. Currently, this only occurs when there
are active listeners of the touch sequence. By moving the device state
updating to the beginning of touch processing we ensure it is updated
according to the processed physical state no matter what.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit a986f2f30c)
2012-04-26 13:35:20 +10:00
Chase Douglas
a9dbdb4969 Check other clients' core masks properly when adding touch listener
The current code checks the core event mask as though it were an XI
mask. This change fixes the checks so the proper client and event masks
are used.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit ec9c429583)
2012-04-26 13:35:18 +10:00
Chase Douglas
04431dd5e6 Ensure touch is ended when last listener is rejected
Currently, the touch is only logically ended if the touch has physically
ended. If the touch hasn't physically ended, the touch record is never
ended. If there aren't any more listeners, we don't need to keep the dix
touch record around any more.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit e175971a6f)
2012-04-26 13:35:14 +10:00
Chase Douglas
8ce9616a2c Create a new dix touch record for an emulated touch with no listeners
As a special case, if a still physically active pointer emulated touch
has no listeners and the device is explicitly grabbed for pointer
events, create a new dix touch record for the grab only.

This allows for clients to "hand off" grabs. For example, when dragging
a window under compiz the window decorator sees the button press and
then ungrabs the implicit grab. It then tells compiz to grab the device,
and compiz then moves the window with the pointer motion. This is racy,
but is allowed by the input protocol for pointer events when there are
no other clients with a grab on the device.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit d0449851d1)
2012-04-26 13:35:13 +10:00
Chase Douglas
da9cedb1e5 Rename TouchEnsureSprite to TouchBuildSprite and event type checks
The function will be used for building a sprite for pointer emulation
after an explicit device grab. This commit refactors the code so that
TouchBuildSprite will function with any event type and moves the checks
to the caller.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 3d06bfe93d)
2012-04-26 13:35:12 +10:00
Chase Douglas
7be71cb089 When activating an explicit grab, update owning listener
Pointer passive grabs may be changed by the grabbing client. This allows
for a selecting client to change an implicit grab to an active grab,
which is the mechanism used for pop-up windows like application menus.

We need to do the same thing with touches. If the grabbing client is the
owner of a touch sequence, change the listener record to reflect the new
grab. If the grabbing client is not the owner, nothing changes for the
touch.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 2efbed23c2)
2012-04-26 13:35:11 +10:00
Chase Douglas
8ccc6ad637 Don't deactivate implicit pointer grab on fake touch end event
Fake touch end events are generated by touch acceptance and rejection.
These should not cause implicit pointer grabs to be deactivated.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit ef64b5ee97)
2012-04-26 13:35:10 +10:00
Chase Douglas
ea3afab228 End a pointer emulated touch event only on a "real" end event
Fake end events are generated by touch acceptance or rejection. These
should not end the touch point.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit fc518cd9f5)
2012-04-26 13:35:09 +10:00
Chase Douglas
fac2c4a5dc On touch accept, only process end event for owner if it has seen the end
We still need to generate the touch ownership event to process the
ending of the touch event in the case where the owner has the end
already.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 80d7d1ec6a)
2012-04-26 13:35:03 +10:00
Chase Douglas
aaf0063bde Fix copy/paste error from before git history in UpdateCurrentTimeIf()
See UpdateCurrentTime() for reference. I don't know what bug this might
trigger, but it wouldn't hurt to fix this.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 8dfd98245d)
2012-04-26 13:35:01 +10:00
Chase Douglas
acb74b9b36 When deactivating an explicit pointer grab, reject all grabs on touches
Explicit pointer grabs are placed at the head of the touch listener
array for pointer emulated touches. If the grab is deactivated, we must
remove it from all touches for the device.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 6ca30cb33e)
2012-04-26 13:35:00 +10:00
Chase Douglas
0dea2b1c93 Accept touch sequence for pointer listener after second event delivery
This is a bit of unimplemented code for touchscreen pointer emulation. A
pointer grabbing client currently never accepts the touch sequence. The
sequence must be accepted once any touch-derived event is irrevocably
delivered to a client.

The first pointer event, derived from a touch begin event, may be caught
in a sync grab and then replayed. This is essentially a revocable
delivery of an event. Thus, we must wait till a non-begin event is
delivered.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit cacdb9a740)
2012-04-26 13:34:59 +10:00
Chase Douglas
2bb2eeb05c Split out helper function TouchListenerAcceptReject()
This will be used for accepting and rejecting touches in the future.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 447fe7a1a7)
2012-04-26 13:34:57 +10:00
Chase Douglas
a37539e794 Only set XI2 mask if pointer emulation is for XI2 client
The current code returns a reference to memory that may not actually be
an XI2 mask. Instead, only return a value when an XI2 client has
selected for events.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 93c3340364)
2012-04-26 13:34:56 +10:00
Chase Douglas
d21d69c2d6 Check core event mask properly for pointer emulated touch events
The current code checks the core event mask as though it were an XI2
mask. This change fixes the checks so the proper client and event masks
are used.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 4c1dfd2193)
2012-04-26 13:34:54 +10:00
Chase Douglas
3d3ed60230 Use touch state when querying pointer through core protocol
QueryPointer is part of the core protocol. As such, it knows nothing
about touch devices. Touches are converted to button 1 press, pointer
motion, and button 1 release for core clients, so we should ensure the
pointer state mask has button 1 set when XQueryPointer is used.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 12188c8a8a)
2012-04-26 13:33:12 +10:00
Chase Douglas
50b71dcfb8 Ensure sequential touches are pointer emulated sequentially
Issue:
* Two sequential touches (i.e. down, up, down, up)
* Both are grabbed by a touch grab
* Both have a second listener in the form of a pointer grab or selection
* The second and first touches are rejected in that order

The first touch must be pointer emulated before the second touch, so the
second touch must be paused until the first touch is rejected or
accepted and all events are delivered to pointer clients.

This change ensures all pointer emulated events are emitted
sequentially. It necessarily imposes a delay on further touch events
when pointer grabs and selections are used, but there is no way around
it.

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 32ece7c09b)
2012-04-26 13:33:07 +10:00
Chase Douglas
fb01dfb55a Update event type when delivering end event to a pointer listener
Just like when we deliver to a touch listener, we must convert a touch
end event to an update event for further clients. This also ensures that
the touch record is not deleted at the end of ProcessTouchEvent().

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 163b0f375d)
2012-04-26 13:33:04 +10:00
Chase Douglas
b56c1f95bb Don't update listener after deactivating implicit pointer grab
After the pointer grab is deactivated, the touch listener record is
updated at the end of DeliverTouchEmulatedEvent. However, the touch
record is ended when the grab is deactivated, so the update to the
listener record is in an array of memory that has been freed.

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 210cd12c47)
2012-04-26 13:33:00 +10:00
Andreas Wettstein
8ca5a94f45 XKB: Redirect actions defunct with Gtk3 (XInput?)
When redirect actions are used with Gtk3, Gtk3 complained about
events not holding a GdkDevice.  This was caused by device IDs
not being set for redirect actions.

More seriously, Gtk3 did not receive state changes redirect
actions might specify.  This was because event_set_state in
dix/inpututils.c accesses the prev_state field, but the changes
for the redirect action were only put into the state field.

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 9e017cf0cf)
2012-04-26 13:30:47 +10:00
Peter Hutterer
d75da4eccb dix: IsFloating() on master devices is always false
There are a few subtle bugs during startup where IsFloating() returns true
if the device is a master device that is not yet paired with its keyboard
device.

Force IsFloating() to always return FALSE for master devices, that was the
intent after all and any code that relies on the other behaviour should be
fixed instead.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Tested-by: Jon TURNEY <jon.turney@dronecode.org.uk>
(cherry picked from commit 5497ce3da4)
2012-04-26 13:29:55 +10:00
Jeremy Huddleston
38e73f7fc2 configure.ac: Bump to 1.12.1
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2012-04-13 15:44:08 -07:00
Jeremy Huddleston
d603515dbf configure.ac: Bump to 1.12.0.902 (1.12.1 RC2)
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2012-04-09 19:37:31 -07:00
Jeremy Huddleston
7e62bc31c6 test: Fix make dist
I don't know why this fixes the problem with make dist, but it does...

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2012-04-09 19:36:39 -07:00
Jeremy Huddleston
ad89533327 Revert "xfree86: workaround crash on close"
This reverts commit b704d91463.

This was causing some regressions.  Reverting as discussed on xorg-devel.
2012-04-09 19:36:38 -07:00
Chase Douglas
259aa5a69b Implement passive touch ungrabbing
Whoops. Forgot to implement this. The code currently generates an error
due to the unhandled grab type.

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

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 1110facdfe)
2012-04-05 17:53:16 -07:00
Jeremy Huddleston
42474e98ec XQuartz: Automatically start our virtual tablet devices
Fixes: https://bugs.launchpad.net/inkscape/+bug/972914
Regression introduced by: 7790dc8638

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit e9d3848d7b)
2012-04-05 17:52:57 -07:00
Jeremy Huddleston
4b3ac1b563 XQuartz: Tiger build fix
Fixes: https://trac.macports.org/ticket/33818

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit 6cb83b78c4)
2012-04-05 17:52:49 -07:00
Michal Suchanek
b704d91463 xfree86: workaround crash on close
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=41653

Signed-off-by: Michal Suchanek <hramrach@gmail.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit 55f552adb6)
2012-04-05 17:41:05 -07:00
Jeremy Huddleston
391f75e875 configure.ac: Bump to 1.12.0.901 (1.12.1 RC1)
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2012-03-30 16:01:57 -07:00
Peter Hutterer
5eb2006220 dix: set raw event values before adding up relative values (#46976)
Regression introduced in 4e52cc0ef4

Raw event values are values as-is from the driver, modified only be
transformation or acceleration. 4e52cc caused the mask to be updated from
relative to absolute coordinates which then got written into the raw events.

Move the raw event update into the respective branches for absolute/relative
events.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Tested-by: Sven Arvidsson <sa@whiz.se>
Reviewed-by: Simon Thum <simon.thum@gmx.de>
(cherry picked from commit 908ab3d580)
2012-03-30 14:51:37 -07:00
Peter Hutterer
a095f7ae96 dix: fix compiler warning "unused variable 'scr'"
getevents.c: In function 'updateSlaveDeviceCoords':
getevents.c:326:15: warning: unused variable 'scr' [-Wunused-variable]

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 9c3bd3ae65)
2012-03-30 14:51:36 -07:00
Peter Hutterer
d0a6d9bcef Xext: drop InitServertime() declaration.
Not implemented anywhere.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Bryce Harrington <bryce@canonical.com>
(cherry picked from commit 5910f2df58)
2012-03-30 14:51:33 -07:00
Chase Douglas
f8446ad3d7 Use a new sprite trace for indirect touches when all touches have physically ended
All touches of an indirect device, such as a trackpad, are sent to the
same window set. When there are no active touches, a new window set is
created; otherwise, the window set of an existing touch is copied.

The current code checks for any logically active touches. This includes
touches that have physically ended but are still logically active due to
unhandled touch grabs. Instead, we want a new window set whenever there
are no physically active touches.

This change skips over logically active but pending end touches, which
are touches that have physically ended.

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 31df08a449)
2012-03-30 14:51:29 -07:00
Chase Douglas
5a3ec826e6 Xi: Fix TouchEnd to TouchUpdate change for one accepted grab
If there is only one listener of a touch, the listener is a grab, and is
accepted before the touch has ended, the current code will not end the
touch record when the touch does end.

This change adds a listener state for when a touch is accepted but has
not yet ended. We now keep the touch record alive in this state, but end
it when the touch ends.

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 58427e08a4)
2012-03-30 14:51:24 -07:00
Peter Hutterer
a8c9a93c66 dix: when rescaling from master, rescale from desktop dimensions (#46657)
master->last.valuators[] is in desktop dimensions, so use those as
rescale axis ranges, not the screen. Otherwise, a rescale on any screen
not the top-left will cause out-of-bounds coordinates which will always
map to the bottom-right screen, causing the device to be stuck on that
screen.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
(cherry picked from commit eb84c154ed)
2012-03-30 14:44:18 -07:00
Peter Hutterer
bc8dc7183b Xext: return BadAccess if PickPointer fails (#45796)
PickPointer or PickKeyboard return NULL, all MDs are currently disabled and
we cannot emulate a core event. This wasn't anticipated by the protocol, so
we don't really have an error code we may use here - BadAccess is simply the
least bad of the possible ones.

And returning BadAccess beats crashing the server.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 6b6afd3d01)
2012-03-30 14:44:02 -07:00
Jeremy Huddleston
1e2a7462be XQuartz: Use scrolling valuators
This lets use send more accurate data to Xi clients and uses dix
for legacy scroll buttons rather than reinventing the wheel.

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 31646d8fa9)
2012-03-27 11:50:47 -07:00
Jeremy Huddleston
67d20e393f XQuartz: Use AllocDevicePair to allocate our keyboard and mouse at the same time
Also correct isMaster to FALSE while we're here.

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 7790dc8638)
2012-03-27 11:50:47 -07:00
Jeremy Huddleston
3ee84899b1 XQuartz: Call update_desktop_dimensions() after updating our screen coordinates
Fixes: http://xquartz.macosforge.org/trac/ticket/555
Regression from: 8bebb4b489

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 74fb534bf1)
2012-03-27 11:50:46 -07:00
Jeremy Huddleston
815414858b XQuartz: Formatting cleanup for sendX11NSEvent
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit 41a46546e9)
2012-03-27 11:50:46 -07:00
Jeremy Huddleston
3413570318 XQuartz: Source formatting cleanup
indent butchered Objective-C formatting.  This patch was created by:

1) Reverting the indent changes in hw/xquartz
2) Editing X11Application.m and chaning some #ifdef logic to work
   with uncrustify
3) Hand edited some (c) notifications
4) Opened all XQuartz sources in XCode and re-indented (^I)
5) Ran uncrustify with this configuration
   (as close to the indent rules as I could get):

tok_split_gte=false
utf8_byte=true
utf8_force=true
indent_cmt_with_tabs=false
indent_align_string=false
indent_braces=false
indent_braces_no_func=false
indent_braces_no_class=false
indent_braces_no_struct=false
indent_brace_parent=false
indent_namespace=false
indent_extern=false
indent_class=false
indent_class_colon=false
indent_else_if=false
indent_var_def_cont=false
indent_func_call_param=false
indent_func_def_param=false
indent_func_proto_param=false
indent_func_class_param=false
indent_func_ctor_var_param=false
indent_template_param=false
indent_func_param_double=false
indent_relative_single_line_comments=false
indent_col1_comment=false
indent_access_spec_body=false
indent_paren_nl=false
indent_comma_paren=false
indent_bool_paren=false
indent_first_bool_expr=false
indent_square_nl=false
indent_preserve_sql=false
indent_align_assign=true
sp_balance_nested_parens=false
align_keep_tabs=false
align_with_tabs=false
align_on_tabstop=false
align_number_left=false
align_func_params=false
align_same_func_call_params=false
align_var_def_colon=true
align_var_def_attribute=true
align_var_def_inline=true
align_right_cmt_mix=false
align_on_operator=false
align_mix_var_proto=false
align_single_line_func=false
align_single_line_brace=false
align_nl_cont=false
align_left_shift=true
align_oc_decl_colon=true
nl_collapse_empty_body=true
nl_assign_leave_one_liners=true
nl_class_leave_one_liners=true
nl_enum_leave_one_liners=true
nl_getset_leave_one_liners=true
nl_func_leave_one_liners=true
nl_if_leave_one_liners=true
nl_multi_line_cond=false
nl_multi_line_define=false
nl_before_case=true
nl_after_case=true
nl_after_return=false
nl_after_semicolon=true
nl_after_brace_open=true
nl_after_brace_open_cmt=false
nl_after_vbrace_open=false
nl_after_vbrace_open_empty=false
nl_after_brace_close=false
nl_after_vbrace_close=false
nl_define_macro=false
nl_squeeze_ifdef=false
nl_ds_struct_enum_cmt=false
nl_ds_struct_enum_close_brace=false
nl_create_if_one_liner=false
nl_create_for_one_liner=false
nl_create_while_one_liner=false
ls_for_split_full=false
ls_func_split_full=false
nl_after_multiline_comment=false
eat_blanks_after_open_brace=false
eat_blanks_before_close_brace=false
mod_full_brace_if_chain=false
mod_pawn_semicolon=false
mod_full_paren_if_bool=false
mod_remove_extra_semicolon=false
mod_sort_import=false
mod_sort_using=false
mod_sort_include=false
mod_move_case_break=false
mod_remove_empty_return=false
cmt_indent_multi=true
cmt_c_group=false
cmt_c_nl_start=false
cmt_c_nl_end=false
cmt_cpp_group=false
cmt_cpp_nl_start=false
cmt_cpp_nl_end=false
cmt_cpp_to_c=false
cmt_star_cont=false
cmt_multi_check_last=true
cmt_insert_before_preproc=false
pp_indent_at_level=false
pp_region_indent_code=false
pp_if_indent_code=false
pp_define_at_level=false
indent_columns=4
indent_brace=0
indent_switch_case=0
align_struct_init_span=2
align_pp_define_gap=0
align_pp_define_span=2
align_oc_msg_colon_span=16
nl_end_of_file_min=1
nl_func_var_def_blk=0
code_width=78
nl_max=2
newlines=auto
indent_with_tabs=0
sp_arith=force
sp_assign=force
sp_assign_default=force
sp_before_assign=force
sp_after_assign=force
sp_enum_assign=force
sp_enum_before_assign=force
sp_enum_after_assign=force
sp_pp_stringify=add
sp_bool=force
sp_compare=force
sp_inside_paren=remove
sp_paren_paren=remove
sp_paren_brace=force
sp_before_ptr_star=ignore
sp_before_unnamed_ptr_star=force
sp_before_byref=force
sp_before_unnamed_byref=force
sp_after_byref=remove
sp_after_type=force
sp_before_sparen=force
sp_inside_sparen=remove
sp_inside_sparen_close=remove
sp_after_sparen=force
sp_sparen_brace=force
sp_special_semi=force
sp_before_semi=remove
sp_after_semi=force
sp_after_semi_for=force
sp_after_semi_for_empty=remove
sp_before_square=remove
sp_inside_square=remove
sp_after_comma=force
sp_before_comma=remove
sp_paren_comma=force
sp_before_ellipsis=force
sp_after_class_colon=force
sp_before_class_colon=force
sp_before_case_colon=remove
sp_after_cast=remove
sp_inside_paren_cast=remove
sp_sizeof_paren=remove
sp_inside_braces_enum=force
sp_inside_braces_struct=force
sp_inside_braces=force
sp_inside_braces_empty=remove
sp_func_proto_paren=remove
sp_func_def_paren=remove
sp_inside_fparens=remove
sp_inside_fparen=remove
sp_square_fparen=remove
sp_fparen_brace=force
sp_func_call_paren=remove
sp_func_call_paren_empty=remove
sp_return_paren=force
sp_attribute_paren=remove
sp_defined_paren=remove
sp_macro=force
sp_macro_func=force
sp_else_brace=force
sp_brace_else=force
sp_brace_typedef=force
sp_not=remove
sp_inv=remove
nl_start_of_file=remove
nl_end_of_file=force
nl_assign_square=remove
nl_after_square_assign=remove
nl_fcall_brace=remove
nl_enum_brace=remove
nl_struct_brace=remove
nl_union_brace=remove
nl_if_brace=remove
nl_brace_else=force
nl_elseif_brace=remove
nl_else_brace=remove
nl_else_if=remove
nl_for_brace=remove
nl_do_brace=remove
nl_brace_while=remove
nl_switch_brace=remove
nl_case_colon_brace=force
nl_func_type_name=force
nl_func_type_name_class=force
nl_func_proto_type_name=force
nl_func_paren=remove
nl_func_def_paren=remove
nl_func_decl_start=remove
nl_func_def_start=remove
nl_func_decl_args=remove
nl_func_decl_end=remove
nl_func_def_end=remove
nl_func_decl_end_single=remove
nl_func_def_end_single=remove
nl_func_decl_empty=remove
nl_func_def_empty=remove
nl_fdef_brace=force
nl_return_expr=remove
nl_before_if=ignore
nl_after_if=ignore
nl_before_for=ignore
nl_after_for=ignore
nl_before_while=ignore
nl_after_while=ignore
nl_before_switch=ignore
nl_after_switch=ignore
nl_before_do=ignore
nl_after_do=ignore
pp_space=remove

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit 5324557c7b)

Conflicts:

	hw/xquartz/X11Application.h
	hw/xquartz/X11Application.m

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2012-03-27 11:50:46 -07:00
Jeremy Huddleston
c0b4dec9f2 XQuartz: Add a defaults option to disable the RENDER extension
RENDER has some ugly issues on XQuartz, so add an option to disable RENDER.

Enables workaround for: https://bugs.freedesktop.org/show_bug.cgi?id=26124

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit 0bb8a2566d)
2012-03-27 11:50:45 -07:00
Jeremy Huddleston
a6f856a72f XQuartz: Use doubles for input valuators
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit 5ff46d651a)
2012-03-27 11:50:45 -07:00
Jeremy Huddleston
3998ff2298 XQuartz: Xi: darwinPointer is now Relative
There is really no real reason why this should be necessary, but wine
developers are stuborn, so doing this to try to work around this wine
issue:

http://bugs.winehq.org/show_bug.cgi?id=29732

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit cd84c0949a)
2012-03-27 11:50:45 -07:00
Jeremy Huddleston
cdd704da19 XQuartz: Move our logs into an X11 subdirectory
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit 87939bf831)
2012-03-27 11:50:44 -07:00
Daniel Stone
5926ed85a1 Indentation: Change '& stuff' to '&stuff'
If the typedef wasn't perfect, indent would get confused and change:
    foo = (SomePointlessTypedef *) &stuff[1];
to:
    foo = (SomePointlessTypedef *) & stuff[1];

Fix this up with a really naïve sed script, plus some hand-editing to
change some false positives in XKB back.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
(cherry picked from commit ab3a815a75)
2012-03-27 11:50:43 -07:00
Daniel Stone
dfecff4279 Xinerama: Fix up obnoxiously-indented code
Comments inside of conditionals confuse indent to death.  Which is fair
enough really.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
(cherry picked from commit 58b1f739d7)
2012-03-27 11:50:43 -07:00
Keith Packard
8384075e1a Introduce a consistent coding style
This is strictly the application of the script 'x-indent-all.sh'
from util/modular. Compared to the patch that Daniel posted in
January, I've added a few indent flags:

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

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

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

The comparison was done with this script:

dir1=$1
dir2=$2

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

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

Signed-off-by: Keith Packard <keithp@keithp.com>
Acked-by: Daniel Stone <daniel@fooishbar.org>
Acked-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit 9838b7032e)
2012-03-27 11:50:40 -07:00
Keith Packard
d9a9788bb1 Handle blank betweeen type and name in sdksyms.sh
indent sometimes adds a blank line between the type and the name in a
function declaration that includes _X_EXPORT, so handle that before
the files are re-indented.

Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 75199129c6)
2012-03-27 11:50:38 -07:00
Jeremy Huddleston
3590d0bb77 test: Fix 'make dist' for configurations that build the Xorg DDX
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit df327f98f6)
2012-03-27 11:50:38 -07:00
1932 changed files with 341126 additions and 172974 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

29
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.
@ -1813,7 +1788,7 @@ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
Copyright (c) 1987, 1990, 1993
Copyright (c) 1989, 1990, 1993, 1994
The Regents of the University of California. All rights reserved.
This code is derived from software contributed to Berkeley by

97
Makefile.am Normal file
View file

@ -0,0 +1,97 @@
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

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.

133
Xext/Makefile.am Normal file
View file

@ -0,0 +1,133 @@
# libXext.la: includes all extensions and should be linked into Xvfb,
# Xnest, Xdmx and Xprt
# libXextbuiltin.la: includes those extensions that are built directly into
# Xorg by default
# libXextmodule.la: includes those extensions that are built into a module
# that Xorg loads
if XORG
noinst_LTLIBRARIES = libXext.la libXextbuiltin.la libXextmodule.la
else
noinst_LTLIBRARIES = libXext.la
endif
INCLUDES = -I$(top_srcdir)/hw/xfree86/dixmods/extmod
AM_CFLAGS = $(DIX_CFLAGS)
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
# Sources always included in libXextmodule.la & libXext.la. That's right, zero.
MODULE_SRCS =
MODULE_LIBS =
# Optional sources included if extension enabled by configure.ac rules
# 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
MODULE_SRCS += $(XV_SRCS)
endif
# XResource extension: lets clients get data about per-client resource usage
RES_SRCS = xres.c
if RES
MODULE_SRCS += $(RES_SRCS)
endif
# MIT ScreenSaver extension
SCREENSAVER_SRCS = saver.c
if SCREENSAVER
MODULE_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
MODULE_SRCS += $(XSELINUX_SRCS)
MODULE_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
MODULE_SRCS += $(DPMS_SRCS)
endif
# Now take all of the above, mix well, bake for 10 minutes and get libXext*.la
libXext_la_SOURCES = $(BUILTIN_SRCS) $(MODULE_SRCS)
libXext_la_LIBADD = $(MODULE_LIBS)
if XORG
libXextbuiltin_la_SOURCES = $(BUILTIN_SRCS)
libXextmodule_la_SOURCES = $(MODULE_SRCS)
libXextmodule_la_LIBADD = $(MODULE_LIBS)
endif
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,21 @@ 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 "modinit.h"
void BigReqExtensionInit(INITARGS);
static int
ProcBigReqDispatch(ClientPtr client)
@ -45,26 +48,28 @@ ProcBigReqDispatch(ClientPtr client)
REQUEST(xBigReqEnableReq);
xBigReqEnableReply rep;
if (client->swapped) {
swaps(&stuff->length);
}
if (stuff->brReqType != X_BigReqEnable)
return BadRequest;
REQUEST_SIZE_MATCH(xBigReqEnableReq);
client->big_requests = TRUE;
rep = (xBigReqEnableReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.max_request_size = maxBigRequestSize
};
memset(&rep, 0, sizeof(xBigReqEnableReply));
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.max_request_size = maxBigRequestSize;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.max_request_size);
}
WriteToClient(client, sizeof(xBigReqEnableReply), &rep);
WriteToClient(client, sizeof(xBigReqEnableReply), (char *) &rep);
return Success;
}
void
BigReqExtensionInit(void)
BigReqExtensionInit(INITARGS)
{
AddExtension(XBigReqExtensionName, 0, 0,
ProcBigReqDispatch, ProcBigReqDispatch,

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,276 +39,27 @@ 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 "modinit.h"
static int
ProcDPMSGetVersion(ClientPtr client)
{
/* REQUEST(xDPMSGetVersionReq); */
xDPMSGetVersionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.majorVersion = SERVER_DPMS_MAJOR_VERSION,
.minorVersion = SERVER_DPMS_MINOR_VERSION
};
xDPMSGetVersionReply rep;
REQUEST_SIZE_MATCH(xDPMSGetVersionReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.majorVersion = DPMSMajorVersion;
rep.minorVersion = DPMSMinorVersion;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.majorVersion);
swaps(&rep.minorVersion);
}
WriteToClient(client, sizeof(xDPMSGetVersionReply), &rep);
WriteToClient(client, sizeof(xDPMSGetVersionReply), (char *) &rep);
return Success;
}
@ -318,19 +67,19 @@ static int
ProcDPMSCapable(ClientPtr client)
{
/* REQUEST(xDPMSCapableReq); */
xDPMSCapableReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.capable = TRUE
};
xDPMSCapableReply rep;
REQUEST_SIZE_MATCH(xDPMSCapableReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.capable = DPMSCapableFlag;
if (client->swapped) {
swaps(&rep.sequenceNumber);
}
WriteToClient(client, sizeof(xDPMSCapableReply), &rep);
WriteToClient(client, sizeof(xDPMSCapableReply), (char *) &rep);
return Success;
}
@ -338,24 +87,24 @@ static int
ProcDPMSGetTimeouts(ClientPtr client)
{
/* REQUEST(xDPMSGetTimeoutsReq); */
xDPMSGetTimeoutsReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.standby = DPMSStandbyTime / MILLI_PER_SECOND,
.suspend = DPMSSuspendTime / MILLI_PER_SECOND,
.off = DPMSOffTime / MILLI_PER_SECOND
};
xDPMSGetTimeoutsReply rep;
REQUEST_SIZE_MATCH(xDPMSGetTimeoutsReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.standby = DPMSStandbyTime / MILLI_PER_SECOND;
rep.suspend = DPMSSuspendTime / MILLI_PER_SECOND;
rep.off = DPMSOffTime / MILLI_PER_SECOND;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.standby);
swaps(&rep.suspend);
swaps(&rep.off);
}
WriteToClient(client, sizeof(xDPMSGetTimeoutsReply), &rep);
WriteToClient(client, sizeof(xDPMSGetTimeoutsReply), (char *) &rep);
return Success;
}
@ -390,10 +139,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 +151,6 @@ ProcDPMSEnable(ClientPtr client)
static int
ProcDPMSDisable(ClientPtr client)
{
Bool was_enabled = DPMSEnabled;
/* REQUEST(xDPMSDisableReq); */
REQUEST_SIZE_MATCH(xDPMSDisableReq);
@ -411,8 +158,6 @@ ProcDPMSDisable(ClientPtr client)
DPMSSet(client, DPMSModeOn);
DPMSEnabled = FALSE;
if (was_enabled)
SendDPMSInfoNotify();
return Success;
}
@ -443,21 +188,21 @@ static int
ProcDPMSInfo(ClientPtr client)
{
/* REQUEST(xDPMSInfoReq); */
xDPMSInfoReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.power_level = DPMSPowerLevel,
.state = DPMSEnabled
};
xDPMSInfoReply rep;
REQUEST_SIZE_MATCH(xDPMSInfoReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.power_level = DPMSPowerLevel;
rep.state = DPMSEnabled;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.power_level);
}
WriteToClient(client, sizeof(xDPMSInfoReply), &rep);
WriteToClient(client, sizeof(xDPMSInfoReply), (char *) &rep);
return Success;
}
@ -483,27 +228,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 +281,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 +316,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 +335,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)
DPMSExtensionInit(INITARGS)
{
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,32 @@
* 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"
DevPrivateKeyRec GEClientPrivateKeyRec;
#define GEClientPrivateKey (&GEClientPrivateKeyRec)
int RT_GECLIENT = 0;
/** Struct to keep information about registered extensions */
typedef struct _GEExtension {
/** Event swapping routine */
void (*evswap) (xGenericEvent *from, xGenericEvent *to);
} GEExtension, *GEExtensionPtr;
GEExtension GEExtensions[MAXEXTENSIONS];
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)
/************************************************************/
@ -69,16 +65,14 @@ ProcGEQueryVersion(ClientPtr client)
REQUEST_SIZE_MATCH(xGEQueryVersionReq);
rep = (xGEQueryVersionReply) {
.repType = X_Reply,
.RepType = X_GEQueryVersion,
.sequenceNumber = client->sequence,
.length = 0,
rep.repType = X_Reply;
rep.RepType = X_GEQueryVersion;
rep.length = 0;
rep.sequenceNumber = client->sequence;
/* return the supported version by the server */
.majorVersion = SERVER_GE_MAJOR_VERSION,
.minorVersion = SERVER_GE_MINOR_VERSION
};
/* return the supported version by the server */
rep.majorVersion = SERVER_GE_MAJOR_VERSION;
rep.minorVersion = SERVER_GE_MINOR_VERSION;
/* Remember version the client requested */
pGEClient->major_version = stuff->majorVersion;
@ -91,23 +85,33 @@ ProcGEQueryVersion(ClientPtr client)
swaps(&rep.minorVersion);
}
WriteToClient(client, sizeof(xGEQueryVersionReply), &rep);
WriteToClient(client, sizeof(xGEQueryVersionReply), (char *) &rep);
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 +120,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 +174,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 +196,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
@ -40,4 +78,6 @@ extern _X_EXPORT void GERegisterExtension(int extension,
extern _X_EXPORT void GEInitEvent(xGenericEvent *ev, int extension);
extern _X_EXPORT void GEExtensionInit(void);
#endif /* _GEEXT_H_ */

View file

@ -1,5 +1,5 @@
/*
* Copyright © 2011 Daniel Stone
* 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,36 +20,35 @@
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Author: Daniel Stone <daniel@fooishbar.org>
* Author: Peter Hutterer, University of South Australia, NICTA
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef XF86EXTENSIONS_H
#define XF86EXTENSIONS_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>
#ifdef XF86DRI
extern _X_EXPORT Bool noXFree86DRIExtension;
extern void XFree86DRIExtensionInit(void);
#endif
extern _X_EXPORT DevPrivateKeyRec GEClientPrivateKeyRec;
#ifdef DRI2
#include <X11/extensions/dri2proto.h>
extern _X_EXPORT Bool noDRI2Extension;
extern void DRI2ExtensionInit(void);
#endif
#define GEClientPrivateKey (&GEClientPrivateKeyRec)
#ifdef XF86VIDMODE
#include <X11/extensions/xf86vmproto.h>
extern _X_EXPORT Bool noXFree86VidModeExtension;
extern void XFree86VidModeExtensionInit(void);
#endif
typedef struct _GEClientInfo {
CARD32 major_version;
CARD32 minor_version;
} GEClientInfoRec, *GEClientInfoPtr;
#ifdef XFreeXDGA
#include <X11/extensions/xf86dgaproto.h>
extern _X_EXPORT Bool noXFree86DGAExtension;
extern void XFree86DGAExtensionInit(void);
extern void XFree86DGARegister(void);
#endif
#define GEGetClient(pClient) ((GEClientInfoPtr)(dixLookupPrivate(&((pClient)->devPrivates), GEClientPrivateKey)))
#endif
extern _X_EXPORT int (*ProcGEVector[ /*GENumRequests */ ]) (ClientPtr);
extern _X_EXPORT int (*SProcGEVector[ /*GENumRequests */ ]) (ClientPtr);
#endif /* _GEINT_H_ */

View file

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

View file

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

View file

@ -1,77 +0,0 @@
srcs_xext = [
'bigreq.c',
'geext.c',
'shape.c',
'sleepuntil.c',
'sync.c',
'xcmisc.c',
'xtest.c',
]
hdrs_xext = [
'geext.h',
'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 "modinit.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
};
@ -146,7 +150,7 @@ static const GCFuncs XineramaGCFuncs = {
(pGC)->funcs = &XineramaGCFuncs;
static Bool
XineramaCloseScreen(ScreenPtr pScreen)
XineramaCloseScreen(int i, ScreenPtr pScreen)
{
PanoramiXScreenPtr pScreenPriv = (PanoramiXScreenPtr)
dixLookupPrivate(&pScreen->devPrivates, PanoramiXScreenKey);
@ -157,9 +161,9 @@ XineramaCloseScreen(ScreenPtr pScreen)
if (pScreen->myNum == 0)
RegionUninit(&PanoramiXScreenRegion);
free(pScreenPriv);
free((pointer) pScreenPriv);
return (*pScreen->CloseScreen) (pScreen);
return (*pScreen->CloseScreen) (i, pScreen);
}
static Bool
@ -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,13 +428,13 @@ XineramaReinitData(void)
/*
* PanoramiXExtensionInit():
* Called from InitExtensions in main().
* Called from InitExtensions in main().
* Register PanoramiXeen Extension
* Initialize global variables.
*/
void
PanoramiXExtensionInit(void)
PanoramiXExtensionInit(int argc, char *argv[])
{
int i;
Bool success = FALSE;
@ -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,10 +892,8 @@ PanoramiXResetProc(ExtensionEntry * extEntry)
int i;
PanoramiXRenderReset();
#ifdef XFIXES
PanoramiXFixesReset();
PanoramiXDamageReset();
#ifdef COMPOSITE
PanoramiXCompositeReset ();
#endif
screenInfo.numScreens = PanoramiXNumScreens;
for (i = 256; i--;)
@ -898,22 +904,21 @@ int
ProcPanoramiXQueryVersion(ClientPtr client)
{
/* REQUEST(xPanoramiXQueryVersionReq); */
xPanoramiXQueryVersionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.majorVersion = SERVER_PANORAMIX_MAJOR_VERSION,
.minorVersion = SERVER_PANORAMIX_MINOR_VERSION
};
xPanoramiXQueryVersionReply rep;
REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.majorVersion = SERVER_PANORAMIX_MAJOR_VERSION;
rep.minorVersion = SERVER_PANORAMIX_MINOR_VERSION;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.majorVersion);
swaps(&rep.minorVersion);
}
WriteToClient(client, sizeof(xPanoramiXQueryVersionReply), &rep);
WriteToClient(client, sizeof(xPanoramiXQueryVersionReply), (char *) &rep);
return Success;
}
@ -930,19 +935,17 @@ ProcPanoramiXGetState(ClientPtr client)
if (rc != Success)
return rc;
rep = (xPanoramiXGetStateReply) {
.type = X_Reply,
.state = !noPanoramiXExtension,
.sequenceNumber = client->sequence,
.length = 0,
.window = stuff->window
};
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.state = !noPanoramiXExtension;
rep.window = stuff->window;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.window);
}
WriteToClient(client, sizeof(xPanoramiXGetStateReply), &rep);
WriteToClient(client, sizeof(xPanoramiXGetStateReply), (char *) &rep);
return Success;
}
@ -960,19 +963,17 @@ ProcPanoramiXGetScreenCount(ClientPtr client)
if (rc != Success)
return rc;
rep = (xPanoramiXGetScreenCountReply) {
.type = X_Reply,
.ScreenCount = PanoramiXNumScreens,
.sequenceNumber = client->sequence,
.length = 0,
.window = stuff->window
};
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.ScreenCount = PanoramiXNumScreens;
rep.window = stuff->window;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.window);
}
WriteToClient(client, sizeof(xPanoramiXGetScreenCountReply), &rep);
WriteToClient(client, sizeof(xPanoramiXGetScreenCountReply), (char *) &rep);
return Success;
}
@ -984,25 +985,22 @@ 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;
rep = (xPanoramiXGetScreenSizeReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
/* screen dimensions */
.width = screenInfo.screens[stuff->screen]->width,
.height = screenInfo.screens[stuff->screen]->height,
.window = stuff->window,
.screen = stuff->screen
};
rep.width = screenInfo.screens[stuff->screen]->width;
rep.height = screenInfo.screens[stuff->screen]->height;
rep.window = stuff->window;
rep.screen = stuff->screen;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
@ -1011,7 +1009,7 @@ ProcPanoramiXGetScreenSize(ClientPtr client)
swapl(&rep.window);
swapl(&rep.screen);
}
WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply), &rep);
WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply), (char *) &rep);
return Success;
}
@ -1023,24 +1021,24 @@ ProcXineramaIsActive(ClientPtr client)
REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
rep = (xXineramaIsActiveReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
#if 1
{
/* The following hack fools clients into thinking that Xinerama
* is disabled even though it is not. */
.state = !noPanoramiXExtension && !PanoramiXExtensionDisabledHack
rep.state = !noPanoramiXExtension && !PanoramiXExtensionDisabledHack;
}
#else
.state = !noPanoramiXExtension;
rep.state = !noPanoramiXExtension;
#endif
};
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.state);
}
WriteToClient(client, sizeof(xXineramaIsActiveReply), &rep);
WriteToClient(client, sizeof(xXineramaIsActiveReply), (char *) &rep);
return Success;
}
@ -1048,22 +1046,20 @@ int
ProcXineramaQueryScreens(ClientPtr client)
{
/* REQUEST(xXineramaQueryScreensReq); */
CARD32 number = (noPanoramiXExtension) ? 0 : PanoramiXNumScreens;
xXineramaQueryScreensReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = bytes_to_int32(number * sz_XineramaScreenInfo),
.number = number
};
xXineramaQueryScreensReply rep;
REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.number = (noPanoramiXExtension) ? 0 : PanoramiXNumScreens;
rep.length = bytes_to_int32(rep.number * sz_XineramaScreenInfo);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.number);
}
WriteToClient(client, sizeof(xXineramaQueryScreensReply), &rep);
WriteToClient(client, sizeof(xXineramaQueryScreensReply), (char *) &rep);
if (!noPanoramiXExtension) {
xXineramaScreenInfo scratch;
@ -1081,7 +1077,7 @@ ProcXineramaQueryScreens(ClientPtr client)
swaps(&scratch.width);
swaps(&scratch.height);
}
WriteToClient(client, sz_XineramaScreenInfo, &scratch);
WriteToClient(client, sz_XineramaScreenInfo, (char *) &scratch);
}
}

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;
@ -568,18 +566,14 @@ PanoramiXGetGeometry(ClientPtr client)
if (rc != Success)
return rc;
rep = (xGetGeometryReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.root = screenInfo.screens[0]->root->drawable.id,
.depth = pDraw->depth,
.width = pDraw->width,
.height = pDraw->height,
.x = 0,
.y = 0,
.borderWidth = 0
};
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.root = screenInfo.screens[0]->root->drawable.id;
rep.depth = pDraw->depth;
rep.width = pDraw->width;
rep.height = pDraw->height;
rep.x = rep.y = rep.borderWidth = 0;
if (stuff->id == rep.root) {
xWindowRoot *root = (xWindowRoot *)
@ -623,13 +617,11 @@ PanoramiXTranslateCoords(ClientPtr client)
rc = dixLookupWindow(&pDst, stuff->dstWid, client, DixReadAccess);
if (rc != Success)
return rc;
rep = (xTranslateCoordsReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.sameScreen = xTrue,
.child = None
};
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.sameScreen = xTrue;
rep.child = None;
if ((pWin == screenInfo.screens[0]->root) ||
(pWin->drawable.id == screenInfo.screens[0]->screensaver.wid)) {
@ -689,7 +681,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 +721,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 +760,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 +768,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 +777,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 +786,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 +840,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 +848,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 +857,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 +866,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 +899,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 +930,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 +955,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 +980,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 +1009,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 +1031,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 +1044,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 +1054,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 +1071,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 +1085,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 +1097,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 +1117,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 +1187,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 +1213,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 +1230,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 +1300,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 +1321,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 +1329,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 +1337,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 +1386,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 +1394,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 +1402,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 +1451,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 +1459,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 +1471,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 +1519,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 +1527,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 +1539,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 +1586,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 +1594,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 +1606,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 +1651,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 +1659,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 +1668,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 +1717,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 +1725,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 +1737,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 +1784,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 +1792,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 +1804,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 +1849,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 +1857,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 +1903,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,19 +1953,11 @@ 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,
.sequenceNumber = client->sequence,
.visual = wVisual(((WindowPtr) pDraw)),
.depth = pDraw->depth
};
xgi.visual = wVisual(((WindowPtr) pDraw));
xgi.type = X_Reply;
xgi.sequenceNumber = client->sequence;
xgi.depth = pDraw->depth;
if (format == ZPixmap) {
widthBytesLine = PixmapBytePad(w, pDraw->depth);
length = widthBytesLine * h;
@ -2050,7 +1982,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);
@ -2070,7 +2003,7 @@ PanoramiXGetImage(ClientPtr client)
format, planemask, pBuf, widthBytesLine,
isRoot);
WriteToClient(client, (int) (nlines * widthBytesLine), pBuf);
(void) WriteToClient(client, (int) (nlines * widthBytesLine), pBuf);
linesDone += nlines;
}
}
@ -2087,7 +2020,8 @@ PanoramiXGetImage(ClientPtr client)
nlines, format, plane, pBuf,
widthBytesLine, isRoot);
WriteToClient(client, (int)(nlines * widthBytesLine), pBuf);
(void) WriteToClient(client,
(int) (nlines * widthBytesLine), pBuf);
linesDone += nlines;
}
@ -2114,7 +2048,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 +2056,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 +2091,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 +2099,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 +2134,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 +2142,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 +2177,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 +2185,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 +2218,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 +2259,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 +2289,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 +2328,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 +2353,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 +2379,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 +2405,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 +2431,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 +2457,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 +2483,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 +2507,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 +2533,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,50 @@ 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 "modinit.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 +106,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 +130,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 +167,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 +190,8 @@ typedef struct _ScreenSaverScreenPrivate {
Colormap installedMap;
} ScreenSaverScreenPrivateRec, *ScreenSaverScreenPrivatePtr;
static ScreenSaverScreenPrivatePtr MakeScreenPrivate(ScreenPtr pScreen);
static ScreenSaverScreenPrivatePtr MakeScreenPrivate(ScreenPtr /* pScreen */
);
static DevPrivateKeyRec ScreenPrivateKeyRec;
@ -182,6 +203,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 +227,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 +277,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 +287,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 +318,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 +340,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 +362,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 +376,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;
@ -365,10 +388,8 @@ ScreenSaverFreeSuspend(void *value, XID id)
if (screenIsSaved != SCREEN_SAVER_ON)
#endif
{
DeviceIntPtr dev;
UpdateCurrentTimeIf();
nt_list_for_each_entry(dev, inputInfo.devices, next)
NoticeTime(dev, currentTime);
lastDeviceEventTime = currentTime;
SetScreenSaverTimer();
}
}
@ -382,6 +403,7 @@ SendScreenSaverNotify(ScreenPtr pScreen, int state, Bool forced)
ScreenSaverScreenPrivatePtr pPriv;
ScreenSaverEventPtr pEv;
unsigned long mask;
xScreenSaverNotifyEvent ev;
int kind;
UpdateCurrentTimeIf();
@ -399,22 +421,20 @@ SendScreenSaverNotify(ScreenPtr pScreen, int state, Bool forced)
else
kind = ScreenSaverInternal;
for (pEv = pPriv->events; pEv; pEv = pEv->next) {
if (pEv->mask & mask) {
xScreenSaverNotifyEvent ev = {
.type = ScreenSaverNotify + ScreenSaverEventBase,
.state = state,
.timestamp = currentTime.milliseconds,
.root = pScreen->root->drawable.id,
.window = pScreen->screensaver.wid,
.kind = kind,
.forced = forced
};
WriteEventsToClient(pEv->client, 1, (xEvent *) &ev);
}
if (!(pEv->mask & mask))
continue;
ev.type = ScreenSaverNotify + ScreenSaverEventBase;
ev.state = state;
ev.timestamp = currentTime.milliseconds;
ev.root = pScreen->root->drawable.id;
ev.window = pScreen->screensaver.wid;
ev.kind = kind;
ev.forced = forced;
WriteEventsToClient(pEv->client, 1, (xEvent *) &ev);
}
}
static void _X_COLD
static void
SScreenSaverNotifyEvent(xScreenSaverNotifyEvent * from,
xScreenSaverNotifyEvent * to)
{
@ -436,8 +456,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 +475,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 +508,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 +525,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 +552,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 +590,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 +621,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;
}
@ -598,23 +631,19 @@ ScreenSaverHandle(ScreenPtr pScreen, int xstate, Bool force)
static int
ProcScreenSaverQueryVersion(ClientPtr client)
{
xScreenSaverQueryVersionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.majorVersion = SERVER_SAVER_MAJOR_VERSION,
.minorVersion = SERVER_SAVER_MINOR_VERSION
};
xScreenSaverQueryVersionReply rep;
REQUEST_SIZE_MATCH(xScreenSaverQueryVersionReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.majorVersion = SERVER_SAVER_MAJOR_VERSION;
rep.minorVersion = SERVER_SAVER_MINOR_VERSION;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.majorVersion);
swaps(&rep.minorVersion);
}
WriteToClient(client, sizeof(xScreenSaverQueryVersionReply), &rep);
WriteToClient(client, sizeof(xScreenSaverQueryVersionReply), (char *) &rep);
return Success;
}
@ -634,7 +663,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,14 +672,12 @@ ProcScreenSaverQueryInfo(ClientPtr client)
pPriv = GetScreenPrivate(pDraw->pScreen);
UpdateCurrentTime();
lastInput = GetTimeInMillis() - LastEventTime(XIAllDevices).milliseconds;
lastInput = GetTimeInMillis() - lastDeviceEventTime.milliseconds;
rep = (xScreenSaverQueryInfoReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.window = pSaver->wid
};
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.window = pSaver->wid;
if (screenIsSaved != SCREEN_SAVER_OFF) {
rep.state = ScreenSaverOn;
if (ScreenSaverTime)
@ -686,7 +714,7 @@ ProcScreenSaverQueryInfo(ClientPtr client)
swapl(&rep.idle);
swapl(&rep.eventMask);
}
WriteToClient(client, sizeof(xScreenSaverQueryInfoReply), &rep);
WriteToClient(client, sizeof(xScreenSaverQueryInfoReply), (char *) &rep);
return Success;
}
@ -703,7 +731,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 +742,9 @@ ProcScreenSaverSelectInput(ClientPtr client)
}
static int
ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
ScreenSaverSetAttributes(ClientPtr client)
{
REQUEST(xScreenSaverSetAttributesReq);
DrawablePtr pDraw;
WindowPtr pParent;
ScreenPtr pScreen;
@ -737,6 +767,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 +775,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 +827,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 +864,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 +914,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 +946,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 +1030,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 +1049,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 +1068,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 +1085,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 +1110,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 +1121,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 +1138,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 +1150,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 +1161,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 +1184,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 +1262,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 +1277,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,45 +1343,45 @@ 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;
}
void
ScreenSaverExtensionInit(void)
ScreenSaverExtensionInit(INITARGS)
{
ExtensionEntry *extEntry;
int i;

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,9 +34,11 @@ 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 "extinit.h"
#include <X11/extensions/securproto.h>
#include "modinit.h"
#include "protocol-versions.h"
/* Extension stuff */
@ -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;
@ -201,12 +192,12 @@ SecurityDeleteAuthorization(void *value, XID id)
while ((pEventClient = pAuth->eventClients)) {
/* send revocation event event */
xSecurityAuthorizationRevokedEvent are = {
.type = SecurityEventBase + XSecurityAuthorizationRevoked,
.authId = pAuth->id
};
xSecurityAuthorizationRevokedEvent are;
are.type = SecurityEventBase + XSecurityAuthorizationRevoked;
are.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 */
@ -347,22 +338,21 @@ static int
ProcSecurityQueryVersion(ClientPtr client)
{
/* REQUEST(xSecurityQueryVersionReq); */
xSecurityQueryVersionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.majorVersion = SERVER_SECURITY_MAJOR_VERSION,
.minorVersion = SERVER_SECURITY_MINOR_VERSION
};
xSecurityQueryVersionReply rep;
REQUEST_SIZE_MATCH(xSecurityQueryVersionReq);
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.length = 0;
rep.majorVersion = SERVER_SECURITY_MAJOR_VERSION;
rep.minorVersion = SERVER_SECURITY_MINOR_VERSION;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.majorVersion);
swaps(&rep.minorVersion);
}
WriteToClient(client, SIZEOF(xSecurityQueryVersionReply), &rep);
(void) WriteToClient(client, SIZEOF(xSecurityQueryVersionReply),
(char *) &rep);
return Success;
} /* ProcSecurityQueryVersion */
@ -376,7 +366,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 +379,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 +451,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 */
@ -538,13 +528,11 @@ ProcSecurityGenerateAuthorization(ClientPtr client)
/* tell client the auth id and data */
rep = (xSecurityGenerateAuthorizationReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = bytes_to_int32(authdata_len),
.authId = authId,
.dataLength = authdata_len
};
rep.type = X_Reply;
rep.length = bytes_to_int32(authdata_len);
rep.sequenceNumber = client->sequence;
rep.authId = authId;
rep.dataLength = authdata_len;
if (client->swapped) {
swapl(&rep.length);
@ -553,13 +541,14 @@ ProcSecurityGenerateAuthorization(ClientPtr client)
swaps(&rep.dataLength);
}
WriteToClient(client, SIZEOF(xSecurityGenerateAuthorizationReply), &rep);
WriteToClient(client, SIZEOF(xSecurityGenerateAuthorizationReply),
(char *) &rep);
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 +571,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 +598,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 +626,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 +662,7 @@ SProcSecurityDispatch(ClientPtr client)
}
} /* SProcSecurityDispatch */
static void _X_COLD
static void
SwapSecurityAuthorizationRevokedEvent(xSecurityAuthorizationRevokedEvent * from,
xSecurityAuthorizationRevokedEvent * to)
{
@ -694,7 +689,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 +733,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 +744,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 +758,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 +773,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 +804,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 +823,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 +842,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 +855,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 +884,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 +896,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 +908,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 +925,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 +951,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 +970,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);
}
@ -1033,7 +1025,7 @@ SecurityResetProc(ExtensionEntry * extEntry)
*/
void
SecurityExtensionInit(void)
SecurityExtensionInit(INITARGS)
{
ExtensionEntry *extEntry;
int ret = TRUE;

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 "modinit.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 */
@ -205,23 +204,22 @@ CreateClipShape(WindowPtr pWin)
static int
ProcShapeQueryVersion(ClientPtr client)
{
xShapeQueryVersionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.majorVersion = SERVER_SHAPE_MAJOR_VERSION,
.minorVersion = SERVER_SHAPE_MINOR_VERSION
};
xShapeQueryVersionReply rep;
REQUEST_SIZE_MATCH(xShapeQueryVersionReq);
memset(&rep, 0, sizeof(xShapeQueryVersionReply));
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.majorVersion = SERVER_SHAPE_MAJOR_VERSION;
rep.minorVersion = SERVER_SHAPE_MINOR_VERSION;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.majorVersion);
swaps(&rep.minorVersion);
}
WriteToClient(client, sizeof(xShapeQueryVersionReply), &rep);
WriteToClient(client, sizeof(xShapeQueryVersionReply), (char *) &rep);
return Success;
}
@ -266,7 +264,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 +295,7 @@ ProcShapeRectangles(ClientPtr client)
stuff->xOff, stuff->yOff, createDefault);
}
#ifdef XINERAMA
#ifdef PANORAMIX
static int
ProcPanoramiXShapeRectangles(ClientPtr client)
{
@ -307,7 +305,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 +318,7 @@ ProcPanoramiXShapeRectangles(ClientPtr client)
}
return result;
}
#endif /* XINERAMA */
#endif
/**************
* ProcShapeMask
@ -362,8 +360,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 +393,7 @@ ProcShapeMask(ClientPtr client)
stuff->xOff, stuff->yOff, createDefault);
}
#ifdef XINERAMA
#ifdef PANORAMIX
static int
ProcPanoramiXShapeMask(ClientPtr client)
{
@ -405,13 +403,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 +427,7 @@ ProcPanoramiXShapeMask(ClientPtr client)
}
return result;
}
#endif /* XINERAMA */
#endif
/************
* ProcShapeCombine
@ -523,7 +521,7 @@ ProcShapeCombine(ClientPtr client)
stuff->xOff, stuff->yOff, createDefault);
}
#ifdef XINERAMA
#ifdef PANORAMIX
static int
ProcPanoramiXShapeCombine(ClientPtr client)
{
@ -533,12 +531,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 +550,7 @@ ProcPanoramiXShapeCombine(ClientPtr client)
}
return result;
}
#endif /* XINERAMA */
#endif
/*************
* ProcShapeOffset
@ -594,7 +592,7 @@ ProcShapeOffset(ClientPtr client)
return Success;
}
#ifdef XINERAMA
#ifdef PANORAMIX
static int
ProcPanoramiXShapeOffset(ClientPtr client)
{
@ -604,7 +602,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 +615,7 @@ ProcPanoramiXShapeOffset(ClientPtr client)
}
return result;
}
#endif /* XINERAMA */
#endif
static int
ProcShapeQueryExtents(ClientPtr client)
@ -633,13 +631,12 @@ ProcShapeQueryExtents(ClientPtr client)
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
return rc;
rep = (xShapeQueryExtentsReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.boundingShaped = (wBoundingShape(pWin) != 0),
.clipShaped = (wClipShape(pWin) != 0)
};
memset(&rep, 0, sizeof(xShapeQueryExtentsReply));
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.boundingShaped = (wBoundingShape(pWin) != 0);
rep.clipShaped = (wClipShape(pWin) != 0);
if ((region = wBoundingShape(pWin))) {
/* this is done in two steps because of a compiler bug on SunOS 4.1.3 */
pExtents = RegionExtents(region);
@ -682,12 +679,12 @@ ProcShapeQueryExtents(ClientPtr client)
swaps(&rep.widthClipShape);
swaps(&rep.heightClipShape);
}
WriteToClient(client, sizeof(xShapeQueryExtentsReply), &rep);
WriteToClient(client, sizeof(xShapeQueryExtentsReply), (char *) &rep);
return Success;
}
/*ARGSUSED*/ static int
ShapeFreeClient(void *data, XID id)
ShapeFreeClient(pointer data, XID id)
{
ShapeEventPtr pShapeEvent;
WindowPtr pWin;
@ -696,7 +693,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 +706,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 +719,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 +738,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 +768,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 +780,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;
@ -827,12 +824,13 @@ void
SendShapeNotify(WindowPtr pWin, int which)
{
ShapeEventPtr *pHead, pShapeEvent;
xShapeNotifyEvent se;
BoxRec extents;
RegionPtr region;
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,19 +880,16 @@ SendShapeNotify(WindowPtr pWin, int which)
default:
return;
}
UpdateCurrentTimeIf();
for (pShapeEvent = *pHead; pShapeEvent; pShapeEvent = pShapeEvent->next) {
xShapeNotifyEvent se = {
.type = ShapeNotify + ShapeEventBase,
.kind = which,
.window = pWin->drawable.id,
.x = extents.x1,
.y = extents.y1,
.width = extents.x2 - extents.x1,
.height = extents.y2 - extents.y1,
.time = currentTime.milliseconds,
.shaped = shaped
};
se.type = ShapeNotify + ShapeEventBase;
se.kind = which;
se.window = pWin->drawable.id;
se.x = extents.x1;
se.y = extents.y1;
se.width = extents.x2 - extents.x1;
se.height = extents.y2 - extents.y1;
se.time = currentTime.milliseconds;
se.shaped = shaped;
WriteEventsToClient(pShapeEvent->client, 1, (xEvent *) &se);
}
}
@ -912,7 +907,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;
@ -925,17 +920,15 @@ ProcShapeInputSelected(ClientPtr client)
}
}
}
rep = (xShapeInputSelectedReply) {
.type = X_Reply,
.enabled = enabled,
.sequenceNumber = client->sequence,
.length = 0
};
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.enabled = enabled;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
}
WriteToClient(client, sizeof(xShapeInputSelectedReply), &rep);
WriteToClient(client, sizeof(xShapeInputSelectedReply), (char *) &rep);
return Success;
}
@ -998,7 +991,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++) {
@ -1008,21 +1001,19 @@ ProcShapeGetRectangles(ClientPtr client)
rects[i].height = box->y2 - box->y1;
}
}
rep = (xShapeGetRectanglesReply) {
.type = X_Reply,
.ordering = YXBanded,
.sequenceNumber = client->sequence,
.length = bytes_to_int32(nrects * sizeof(xRectangle)),
.nrects = nrects
};
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.length = bytes_to_int32(nrects * sizeof(xRectangle));
rep.ordering = YXBanded;
rep.nrects = nrects;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.nrects);
SwapShorts((short *) rects, (unsigned long) nrects * 4);
}
WriteToClient(client, sizeof(rep), &rep);
WriteToClient(client, nrects * sizeof(xRectangle), rects);
WriteToClient(client, sizeof(rep), (char *) &rep);
WriteToClient(client, nrects * sizeof(xRectangle), (char *) rects);
free(rects);
return Success;
}
@ -1035,32 +1026,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 +1066,7 @@ ProcShapeDispatch(ClientPtr client)
}
}
static void _X_COLD
static void
SShapeNotifyEvent(xShapeNotifyEvent * from, xShapeNotifyEvent * to)
{
to->type = from->type;
@ -1090,10 +1081,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 +1104,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 +1118,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 +1132,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 +1145,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 "modinit.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;
}
@ -194,14 +202,14 @@ CheckForShmSyscall(void)
#endif
static Bool
ShmCloseScreen(ScreenPtr pScreen)
ShmCloseScreen(int i, ScreenPtr pScreen)
{
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
pScreen->CloseScreen = screen_priv->CloseScreen;
dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, NULL);
free(screen_priv);
return (*pScreen->CloseScreen) (pScreen);
return (*pScreen->CloseScreen) (i, pScreen);
}
static ShmScrPrivateRec *
@ -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;
}
@ -277,20 +285,19 @@ ShmRegisterFbFuncs(ScreenPtr pScreen)
static int
ProcShmQueryVersion(ClientPtr client)
{
xShmQueryVersionReply rep = {
.type = X_Reply,
.sharedPixmaps = sharedPixmaps,
.sequenceNumber = client->sequence,
.length = 0,
.majorVersion = SERVER_SHM_MAJOR_VERSION,
.minorVersion = SERVER_SHM_MINOR_VERSION,
.uid = geteuid(),
.gid = getegid(),
.pixmapFormat = sharedPixmaps ? ZPixmap : 0
};
xShmQueryVersionReply rep;
REQUEST_SIZE_MATCH(xShmQueryVersionReq);
memset(&rep, 0, sizeof(xShmQueryVersionReply));
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.sharedPixmaps = sharedPixmaps;
rep.pixmapFormat = sharedPixmaps ? ZPixmap : 0;
rep.majorVersion = SERVER_SHM_MAJOR_VERSION;
rep.minorVersion = SERVER_SHM_MINOR_VERSION;
rep.uid = geteuid();
rep.gid = getegid();
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
@ -299,13 +306,13 @@ ProcShmQueryVersion(ClientPtr client)
swaps(&rep.uid);
swaps(&rep.gid);
}
WriteToClient(client, sizeof(xShmQueryVersionReply), &rep);
WriteToClient(client, sizeof(xShmQueryVersionReply), (char *) &rep);
return Success;
}
/*
* 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 +390,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 +401,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 +409,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 +425,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 +455,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 +477,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 {
@ -599,14 +594,14 @@ ProcShmPutImage(ClientPtr client)
stuff->dstX, stuff->dstY, shmdesc->addr + stuff->offset);
if (stuff->sendEvent) {
xShmCompletionEvent ev = {
.type = ShmCompletionCode,
.drawable = stuff->drawable,
.minorEvent = X_ShmPutImage,
.majorEvent = ShmReqCode,
.shmseg = stuff->shmseg,
.offset = stuff->offset
};
xShmCompletionEvent ev;
ev.type = ShmCompletionCode;
ev.drawable = stuff->drawable;
ev.minorEvent = X_ShmPutImage;
ev.majorEvent = ShmReqCode;
ev.shmseg = stuff->shmseg;
ev.offset = stuff->offset;
WriteEventsToClient(client, 1, (xEvent *) &ev);
}
@ -621,8 +616,6 @@ ProcShmGetImage(ClientPtr client)
Mask plane = 0;
xShmGetImageReply xgi;
ShmDescPtr shmdesc;
VisualID visual = None;
RegionPtr pVisibleRegion = NULL;
int rc;
REQUEST(xShmGetImageReq);
@ -637,7 +630,7 @@ ProcShmGetImage(ClientPtr client)
return rc;
VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client);
if (pDraw->type == DRAWABLE_WINDOW) {
if ( /* check for being viewable */
if ( /* check for being viewable */
!((WindowPtr) pDraw)->realized ||
/* check for being on screen */
pDraw->x + stuff->x < 0 ||
@ -653,27 +646,19 @@ ProcShmGetImage(ClientPtr client)
stuff->y + (int) stuff->height >
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);
xgi.visual = wVisual(((WindowPtr) pDraw));
}
else {
if (stuff->x < 0 ||
stuff->x + (int) stuff->width > pDraw->width ||
stuff->y < 0 || stuff->y + (int) stuff->height > pDraw->height)
return BadMatch;
visual = None;
xgi.visual = None;
}
xgi = (xShmGetImageReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.visual = visual,
.depth = pDraw->depth
};
xgi.type = X_Reply;
xgi.length = 0;
xgi.sequenceNumber = client->sequence;
xgi.depth = pDraw->depth;
if (stuff->format == ZPixmap) {
length = PixmapBytePad(stuff->width, pDraw->depth) * stuff->height;
}
@ -695,11 +680,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 +691,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;
}
}
@ -727,12 +702,12 @@ ProcShmGetImage(ClientPtr client)
swapl(&xgi.visual);
swapl(&xgi.size);
}
WriteToClient(client, sizeof(xShmGetImageReply), &xgi);
WriteToClient(client, sizeof(xShmGetImageReply), (char *) &xgi);
return Success;
}
#ifdef XINERAMA
#ifdef PANORAMIX
static int
ProcPanoramiXShmPutImage(ClientPtr client)
{
@ -743,12 +718,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 +772,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 +816,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,21 +829,25 @@ 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.visual = wVisual(((WindowPtr) pDraw));
xgi.type = X_Reply;
xgi.length = 0;
xgi.sequenceNumber = client->sequence;
xgi.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)));
}
xgi = (xShmGetImageReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.visual = wVisual(((WindowPtr) pDraw)),
.depth = pDraw->depth
};
VERIFY_SHMSIZE(shmdesc, stuff->offset, length, client);
xgi.size = length;
if (length == 0) { /* nothing to do */
@ -911,7 +877,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
swapl(&xgi.visual);
swapl(&xgi.size);
}
WriteToClient(client, sizeof(xShmGetImageReply), &xgi);
WriteToClient(client, sizeof(xShmGetImageReply), (char *) &xgi);
return Success;
}
@ -997,17 +963,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 +978,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 +988,7 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
return result;
}
#endif /* XINERAMA */
#endif
static PixmapPtr
fbShmCreatePixmap(ScreenPtr pScreen,
@ -1043,7 +1003,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 +1072,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 +1082,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 +1135,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 +1186,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 +1203,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 +1218,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,19 +1235,13 @@ 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;
}
}
void
ShmExtensionInit(void)
ShmExtensionInit(INITARGS)
{
ExtensionEntry *extEntry;
int i;

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
@ -51,7 +51,6 @@ PERFORMANCE OF THIS SOFTWARE.
#ifndef _SYNCSRV_H_
#define _SYNCSRV_H_
#include "list.h"
#include "misync.h"
#include "misyncstr.h"
@ -66,25 +65,19 @@ typedef enum {
XSyncCounterUnrestricted
} SyncCounterType;
typedef void (*SyncSystemCounterQueryValue)(void *counter,
int64_t *value_return
);
typedef void (*SyncSystemCounterBracketValues)(void *counter,
int64_t *pbracket_less,
int64_t *pbracket_greater
);
typedef struct _SysCounterInfo {
SyncCounter *pCounter;
char *name;
int64_t resolution;
int64_t bracket_greater;
int64_t bracket_less;
const char *name;
CARD64 resolution;
CARD64 bracket_greater;
CARD64 bracket_less;
SyncCounterType counterType; /* how can this counter change */
SyncSystemCounterQueryValue QueryValue;
SyncSystemCounterBracketValues BracketValues;
void *private;
struct xorg_list entry;
void (*QueryValue) (pointer /*pCounter */ ,
CARD64 * /*freshvalue */
);
void (*BracketValues) (pointer /*pCounter */ ,
CARD64 * /*lessthan */ ,
CARD64 * /*greaterthan */
);
} SysCounterInfo;
typedef struct _SyncAlarmClientList {
@ -97,7 +90,7 @@ typedef struct _SyncAlarm {
SyncTrigger trigger;
ClientPtr client;
XSyncAlarm alarm_id;
int64_t delta;
CARD64 delta;
int events;
int state;
SyncAlarmClientList *pEventClients;
@ -111,7 +104,7 @@ typedef struct {
typedef struct {
SyncTrigger trigger;
int64_t event_threshold;
CARD64 event_threshold;
SyncAwaitHeader *pHeader;
} SyncAwait;
@ -120,32 +113,33 @@ typedef union {
SyncAwait await;
} SyncAwaitUnion;
extern SyncCounter* SyncCreateSystemCounter(const char *name,
int64_t initial_value,
int64_t resolution,
SyncCounterType counterType,
SyncSystemCounterQueryValue QueryValue,
SyncSystemCounterBracketValues BracketValues
extern pointer SyncCreateSystemCounter(const char * /* name */ ,
CARD64 /* inital_value */ ,
CARD64 /* resolution */ ,
SyncCounterType
/* change characterization */ ,
void (* /*QueryValue */ )(
pointer
/* pCounter */
,
CARD64 * /* pValue_return */ ), /* XXX prototype */
void (* /*BracketValues */ )(
pointer
/* pCounter */
,
CARD64 *
/* pbracket_less */
,
CARD64 *
/* pbracket_greater */
)
);
extern void SyncChangeCounter(SyncCounter *pCounter,
int64_t new_value);
extern void SyncChangeCounter(SyncCounter * /* pCounter */ ,
CARD64 /* new_value */
);
extern void SyncDestroySystemCounter(void *pCounter);
extern 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);
extern void SyncDestroySystemCounter(pointer pCounter);
extern void SyncExtensionInit(void);
#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,29 +38,27 @@ from The Open Group.
#include "extnsionst.h"
#include "swaprep.h"
#include <X11/extensions/xcmiscproto.h>
#include "extinit_priv.h"
#include "modinit.h"
#include <stdint.h>
static int
ProcXCMiscGetVersion(ClientPtr client)
{
xXCMiscGetVersionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.majorVersion = XCMiscMajorVersion,
.minorVersion = XCMiscMinorVersion
};
xXCMiscGetVersionReply rep;
REQUEST_SIZE_MATCH(xXCMiscGetVersionReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.majorVersion = XCMiscMajorVersion;
rep.minorVersion = XCMiscMinorVersion;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.majorVersion);
swaps(&rep.minorVersion);
}
WriteToClient(client, sizeof(xXCMiscGetVersionReply), &rep);
WriteToClient(client, sizeof(xXCMiscGetVersionReply), (char *) &rep);
return Success;
}
@ -70,19 +70,17 @@ ProcXCMiscGetXIDRange(ClientPtr client)
REQUEST_SIZE_MATCH(xXCMiscGetXIDRangeReq);
GetXIDRange(client->index, FALSE, &min_id, &max_id);
rep = (xXCMiscGetXIDRangeReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.start_id = min_id,
.count = max_id - min_id + 1
};
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.start_id = min_id;
rep.count = max_id - min_id + 1;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.start_id);
swapl(&rep.count);
}
WriteToClient(client, sizeof(xXCMiscGetXIDRangeReply), &rep);
WriteToClient(client, sizeof(xXCMiscGetXIDRangeReply), (char *) &rep);
return Success;
}
@ -99,23 +97,21 @@ 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;
}
count = GetXIDList(client, stuff->count, pids);
rep = (xXCMiscGetXIDListReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = count,
.count = count
};
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.length = count;
rep.count = count;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.count);
}
WriteToClient(client, sizeof(xXCMiscGetXIDListReply), &rep);
WriteToClient(client, sizeof(xXCMiscGetXIDListReply), (char *) &rep);
if (count) {
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, count * sizeof(XID), pids);
@ -140,27 +136,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 +175,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:
@ -177,7 +184,7 @@ SProcXCMiscDispatch(ClientPtr client)
}
void
XCMiscExtensionInit(void)
XCMiscExtensionInit(INITARGS)
{
AddExtension(XCMiscExtensionName, 0, 0,
ProcXCMiscDispatch, SProcXCMiscDispatch,

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,21 @@
#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 "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 +95,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 +110,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 +122,7 @@ CheckForShmSyscall(void)
/* Allocation failed */
badSysCall = TRUE;
}
OsSignal(SIGSYS, oldHandler);
signal(SIGSYS, oldHandler);
return !badSysCall;
}
@ -126,7 +134,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 +229,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 +248,7 @@ XF86BigfontFreeFontShm(FontPtr pFont)
void
XF86BigfontCleanup(void)
{
#ifdef MITSHM
#ifdef HAS_SHM
while (ShmList)
shmdealloc(ShmList);
#endif
@ -269,24 +277,28 @@ ProcXF86BigfontQueryVersion(ClientPtr client)
xXF86BigfontQueryVersionReply reply;
REQUEST_SIZE_MATCH(xXF86BigfontQueryVersionReq);
reply = (xXF86BigfontQueryVersionReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.majorVersion = SERVER_XF86BIGFONT_MAJOR_VERSION,
.minorVersion = SERVER_XF86BIGFONT_MINOR_VERSION,
.uid = geteuid(),
.gid = getegid(),
#ifdef MITSHM
.signature = signature,
.capabilities = (client->local && !client->swapped)
? XF86Bigfont_CAP_LocalShm : 0
reply.type = X_Reply;
reply.length = 0;
reply.sequenceNumber = client->sequence;
reply.majorVersion = SERVER_XF86BIGFONT_MAJOR_VERSION;
reply.minorVersion = SERVER_XF86BIGFONT_MINOR_VERSION;
reply.uid = geteuid();
reply.gid = getegid();
#ifdef HAS_SHM
reply.signature = signature;
#else
.signature = 0,
.capabilities = 0
reply.signature = 0; /* This is redundant. Avoids uninitialized memory. */
#endif
};
reply.capabilities =
#ifdef HAS_SHM
(LocalClient(client) && !client->swapped ? XF86Bigfont_CAP_LocalShm : 0)
#else
0
#endif
; /* may add more bits here in future versions */
if (client->swapped) {
char tmp;
swaps(&reply.sequenceNumber);
swapl(&reply.length);
swaps(&reply.majorVersion);
@ -295,13 +307,16 @@ ProcXF86BigfontQueryVersion(ClientPtr client)
swapl(&reply.gid);
swapl(&reply.signature);
}
WriteToClient(client, sizeof(xXF86BigfontQueryVersionReply), &reply);
WriteToClient(client,
sizeof(xXF86BigfontQueryVersionReply), (char *) &reply);
return Success;
}
static void
swapCharInfo(xCharInfo * pCI)
{
char tmp;
swaps(&pCI->leftSideBearing);
swaps(&pCI->rightSideBearing);
swaps(&pCI->characterWidth);
@ -329,7 +344,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
int nCharInfos;
int shmid;
#ifdef MITSHM
#ifdef HAS_SHM
ShmDescPtr pDesc = NULL;
#else
#define pDesc 0
@ -339,10 +354,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 +368,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 +389,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 +407,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 +442,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 +469,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);
@ -538,7 +555,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
? nUniqCharInfos * sizeof(xCharInfo)
+ (nCharInfos + 1) / 2 * 2 * sizeof(CARD16)
: 0);
xXF86BigfontQueryFontReply *reply = calloc(1, rlength);
xXF86BigfontQueryFontReply *reply = malloc(rlength);
char *p;
if (!reply) {
@ -570,6 +587,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 +615,8 @@ ProcXF86BigfontQueryFont(ClientPtr client)
prFP->name = pFP->name;
prFP->value = pFP->value;
if (client->swapped) {
char tmp;
swapl(&prFP->name);
swapl(&prFP->value);
}
@ -617,11 +638,13 @@ ProcXF86BigfontQueryFont(ClientPtr client)
for (j = 0; j < nCharInfos; j++, ps++) {
*ps = pIndex2UniqIndex[j];
if (client->swapped) {
char tmp;
swaps(ps);
}
}
}
WriteToClient(client, rlength, reply);
WriteToClient(client, rlength, (char *) reply);
free(reply);
if (nCharInfos > 0) {
if (shmid == -1)
@ -648,23 +671,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 +717,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 +737,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

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

File diff suppressed because it is too large Load diff

View file

@ -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 "modinit.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;
@ -66,26 +63,28 @@ SELinuxCopyContext(char *ptr, unsigned len)
static int
ProcSELinuxQueryVersion(ClientPtr client)
{
SELinuxQueryVersionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.server_major = SELINUX_MAJOR_VERSION,
.server_minor = SELINUX_MINOR_VERSION
};
SELinuxQueryVersionReply rep;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.server_major = SELINUX_MAJOR_VERSION;
rep.server_minor = SELINUX_MINOR_VERSION;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.server_major);
swaps(&rep.server_minor);
}
WriteToClient(client, sizeof(rep), &rep);
WriteToClient(client, sizeof(rep), (char *) &rep);
return Success;
}
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,12 +93,10 @@ SELinuxSendContextReply(ClientPtr client, security_id_t sid)
len = strlen(ctx) + 1;
}
SELinuxGetContextReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = bytes_to_int32(len),
.context_len = len
};
rep.type = X_Reply;
rep.length = bytes_to_int32(len);
rep.sequenceNumber = client->sequence;
rep.context_len = len;
if (client->swapped) {
swapl(&rep.length);
@ -107,7 +104,7 @@ SELinuxSendContextReply(ClientPtr client, security_id_t sid)
swapl(&rep.context_len);
}
WriteToClient(client, sizeof(SELinuxGetContextReply), &rep);
WriteToClient(client, sizeof(SELinuxGetContextReply), (char *) &rep);
WriteToClient(client, len, ctx);
freecon(ctx);
return Success;
@ -118,7 +115,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 +163,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 +243,7 @@ ProcSELinuxGetDrawableContext(ClientPtr client)
}
static int
ProcSELinuxGetPropertyContext(ClientPtr client, void *privKey)
ProcSELinuxGetPropertyContext(ClientPtr client, pointer privKey)
{
WindowPtr pWin;
PropertyPtr pProp;
@ -270,7 +267,7 @@ ProcSELinuxGetPropertyContext(ClientPtr client, void *privKey)
}
static int
ProcSELinuxGetSelectionContext(ClientPtr client, void *privKey)
ProcSELinuxGetSelectionContext(ClientPtr client, pointer privKey)
{
Selection *pSel;
SELinuxObjectRec *obj;
@ -341,9 +338,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,12 +372,10 @@ SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec * items,
}
/* Send reply to client */
SELinuxListItemsReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = size,
.count = count
};
rep.type = X_Reply;
rep.length = size;
rep.sequenceNumber = client->sequence;
rep.count = count;
if (client->swapped) {
swapl(&rep.length);
@ -384,8 +383,8 @@ SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec * items,
swapl(&rep.count);
}
WriteToClient(client, sizeof(SELinuxListItemsReply), &rep);
WriteToClient(client, size * 4, buf);
WriteToClient(client, sizeof(SELinuxListItemsReply), (char *) &rep);
WriteToClient(client, size * 4, (char *) buf);
/* Free stuff and return */
rc = Success;
@ -449,10 +448,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 +524,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 +540,7 @@ SProcSELinuxSetCreateContext(ClientPtr client, unsigned offset)
return ProcSELinuxSetCreateContext(client, offset);
}
static int _X_COLD
static int
SProcSELinuxSetDeviceContext(ClientPtr client)
{
REQUEST(SELinuxSetContextReq);
@ -554,7 +551,7 @@ SProcSELinuxSetDeviceContext(ClientPtr client)
return ProcSELinuxSetDeviceContext(client);
}
static int _X_COLD
static int
SProcSELinuxGetDeviceContext(ClientPtr client)
{
REQUEST(SELinuxGetContextReq);
@ -564,7 +561,7 @@ SProcSELinuxGetDeviceContext(ClientPtr client)
return ProcSELinuxGetDeviceContext(client);
}
static int _X_COLD
static int
SProcSELinuxGetDrawableContext(ClientPtr client)
{
REQUEST(SELinuxGetContextReq);
@ -574,8 +571,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 +582,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 +592,7 @@ SProcSELinuxGetSelectionContext(ClientPtr client, void *privKey)
return ProcSELinuxGetSelectionContext(client, privKey);
}
static int _X_COLD
static int
SProcSELinuxListProperties(ClientPtr client)
{
REQUEST(SELinuxGetContextReq);
@ -605,7 +602,7 @@ SProcSELinuxListProperties(ClientPtr client)
return ProcSELinuxListProperties(client);
}
static int _X_COLD
static int
SProcSELinuxGetClientContext(ClientPtr client)
{
REQUEST(SELinuxGetContextReq);
@ -615,11 +612,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);
@ -684,8 +683,10 @@ SELinuxResetProc(ExtensionEntry * extEntry)
}
void
SELinuxExtensionInit(void)
SELinuxExtensionInit(INITARGS)
{
ExtensionEntry *extEntry;
/* Check SELinux mode on system, configuration file, and boolean */
if (!is_selinux_enabled()) {
LogMessage(X_INFO, "SELinux: Disabled on system\n");
@ -705,7 +706,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 "modinit.h"
extern int DeviceValuator;
/* XTest events are sent during request processing and may be interruped by
* a SIGIO. We need a separate event list to avoid events overwriting each
* other's memory.
*/
* 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 */
@ -91,21 +88,19 @@ static int XTestSwapFakeInput(ClientPtr /* client */ ,
static int
ProcXTestGetVersion(ClientPtr client)
{
xXTestGetVersionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.majorVersion = XTestMajorVersion,
.minorVersion = XTestMinorVersion
};
xXTestGetVersionReply rep;
REQUEST_SIZE_MATCH(xXTestGetVersionReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.majorVersion = XTestMajorVersion;
rep.minorVersion = XTestMinorVersion;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.minorVersion);
}
WriteToClient(client, sizeof(xXTestGetVersionReply), &rep);
WriteToClient(client, sizeof(xXTestGetVersionReply), (char *) &rep);
return Success;
}
@ -132,55 +127,24 @@ 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;
}
}
rep = (xXTestCompareCursorReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.same = (wCursor(pWin) == pCursor)
};
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.same = (wCursor(pWin) == pCursor);
if (client->swapped) {
swaps(&rep.sequenceNumber);
}
WriteToClient(client, sizeof(xXTestCompareCursorReply), &rep);
WriteToClient(client, sizeof(xXTestCompareCursorReply), (char *) &rep);
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 +154,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 +239,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 +304,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 +317,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 +341,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 +375,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 +398,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 +459,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 +490,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 +505,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 +541,7 @@ SProcXTestDispatch(ClientPtr client)
case X_XTestFakeInput:
return SProcXTestFakeInput(client);
case X_XTestGrabControl:
return ProcXTestGrabControl(client);
return SProcXTestGrabControl(client);
default:
return BadRequest;
}
@ -689,7 +675,7 @@ XTestExtensionTearDown(ExtensionEntry * e)
}
void
XTestExtensionInit(void)
XTestExtensionInit(INITARGS)
{
AddExtension(XTestExtensionName, 0, 0,
ProcXTestDispatch, SProcXTestDispatch,

File diff suppressed because it is too large Load diff

View file

@ -4,13 +4,13 @@ and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Digital or MIT not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
@ -25,18 +25,18 @@ SOFTWARE.
#ifndef XVDIX_H
#define XVDIX_H
/*
** File:
** File:
**
** xvdix.h --- Xv device independent header file
**
** Author:
** Author:
**
** David Carver (Digital Workstation Engineering/Project Athena)
**
** Revisions:
**
** 29.08.91 Carver
** - removed UnrealizeWindow wrapper unrealizing windows no longer
** - removed UnrealizeWindow wrapper unrealizing windows no longer
** preempts video
**
** 11.06.91 Carver
@ -55,6 +55,23 @@ SOFTWARE.
#include "scrnintstr.h"
#include <X11/extensions/Xvproto.h>
#ifndef XorgLoader
extern _X_EXPORT unsigned long XvExtensionGeneration;
extern _X_EXPORT unsigned long XvScreenGeneration;
extern _X_EXPORT unsigned long XvResourceGeneration;
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;
#endif
typedef struct {
int numerator;
int denominator;
@ -70,7 +87,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 +159,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 +200,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 +215,59 @@ typedef struct {
DestroyWindowProcPtr DestroyWindow;
DestroyPixmapProcPtr DestroyPixmap;
CloseScreenProcPtr CloseScreen;
Bool (*ddCloseScreen) (int, ScreenPtr);
int (*ddQueryAdaptors) (ScreenPtr, XvAdaptorPtr *, int *);
DevUnion devPriv;
} XvScreenRec, *XvScreenPtr;
#define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = ((XvScreenPtr) \
dixLookupPrivate(&(pScreen)->devPrivates, XvScreenKey))->field)
#define SCREEN_EPILOGUE(pScreen, field, wrapper)\
((pScreen)->field = wrapper)
/* Errors */
#define _XvBadPort (XvBadPort+XvErrorBase)
#define _XvBadEncoding (XvBadEncoding+XvErrorBase)
#ifndef XorgLoader
extern _X_EXPORT int ProcXvDispatch(ClientPtr);
extern _X_EXPORT int SProcXvDispatch(ClientPtr);
extern _X_EXPORT void XvExtensionInit(void);
extern _X_EXPORT int XvScreenInit(ScreenPtr);
extern _X_EXPORT DevPrivateKey XvGetScreenKey(void);
extern _X_EXPORT unsigned long XvGetRTPort(void);
extern _X_EXPORT 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 /* XorgLoader */
#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,55 @@ 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 "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 */
@ -141,16 +129,16 @@ static void WriteSwappedVideoNotifyEvent(xvEvent *, xvEvent *);
static void WriteSwappedPortNotifyEvent(xvEvent *, xvEvent *);
static Bool CreateResourceTypes(void);
static Bool XvCloseScreen(ScreenPtr);
static Bool XvCloseScreen(int, 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 +155,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 +255,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;
}
@ -302,7 +290,7 @@ XvScreenInit(ScreenPtr pScreen)
}
static Bool
XvCloseScreen(ScreenPtr pScreen)
XvCloseScreen(int ii, ScreenPtr pScreen)
{
XvScreenPtr pxvs;
@ -313,11 +301,13 @@ XvCloseScreen(ScreenPtr pScreen)
pScreen->DestroyWindow = pxvs->DestroyWindow;
pScreen->CloseScreen = pxvs->CloseScreen;
(*pxvs->ddCloseScreen) (ii, pScreen);
free(pxvs);
dixSetPrivate(&pScreen->devPrivates, XvScreenKey, NULL);
return (*pScreen->CloseScreen) (pScreen);
return (*pScreen->CloseScreen) (ii, pScreen);
}
static void
@ -338,24 +328,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 +367,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 +379,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 +471,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 +480,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 +499,7 @@ XvdiDestroyVideoNotifyList(void *pn, XID id)
}
static int
XvdiDestroyEncoding(void *value, XID id)
XvdiDestroyEncoding(pointer value, XID id)
{
return Success;
}
@ -460,20 +507,19 @@ XvdiDestroyEncoding(void *value, XID id)
static int
XvdiSendVideoNotify(XvPortPtr pPort, DrawablePtr pDraw, int reason)
{
xvEvent event;
XvVideoNotifyPtr pn;
dixLookupResourceByType((void **) &pn, pDraw->id, XvRTVideoNotifyList,
dixLookupResourceByType((pointer *) &pn, pDraw->id, XvRTVideoNotifyList,
serverClient, DixReadAccess);
while (pn) {
xvEvent event = {
.u.videoNotify.reason = reason,
.u.videoNotify.time = currentTime.milliseconds,
.u.videoNotify.drawable = pDraw->id,
.u.videoNotify.port = pPort->id
};
event.u.u.type = XvEventBase + XvVideoNotify;
WriteEventsToClient(pn->client, 1, (xEventPtr) &event);
event.u.videoNotify.time = currentTime.milliseconds;
event.u.videoNotify.drawable = pDraw->id;
event.u.videoNotify.port = pPort->id;
event.u.videoNotify.reason = reason;
WriteEventsToClient(pn->client, 1, (xEventPtr) & event);
pn = pn->next;
}
@ -481,22 +527,21 @@ XvdiSendVideoNotify(XvPortPtr pPort, DrawablePtr pDraw, int reason)
}
static int
int
XvdiSendPortNotify(XvPortPtr pPort, Atom attribute, INT32 value)
{
xvEvent event;
XvPortNotifyPtr pn;
pn = pPort->pNotify;
while (pn) {
xvEvent event = {
.u.portNotify.time = currentTime.milliseconds,
.u.portNotify.port = pPort->id,
.u.portNotify.attribute = attribute,
.u.portNotify.value = value
};
event.u.u.type = XvEventBase + XvPortNotify;
WriteEventsToClient(pn->client, 1, (xEventPtr) &event);
event.u.portNotify.time = currentTime.milliseconds;
event.u.portNotify.port = pPort->id;
event.u.portNotify.attribute = attribute;
event.u.portNotify.value = value;
WriteEventsToClient(pn->client, 1, (xEventPtr) & event);
pn = pn->next;
}
@ -544,7 +589,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 +631,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 +667,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 +706,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 +746,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 +840,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 +857,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 +869,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 +878,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 +901,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 +938,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 +950,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 +978,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 +1043,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 +1057,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 +1076,7 @@ WriteSwappedVideoNotifyEvent(xvEvent * from, xvEvent * to)
}
static void _X_COLD
static void
WriteSwappedPortNotifyEvent(xvEvent * from, xvEvent * to)
{
@ -1024,77 +1088,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,21 @@
#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 "servermd.h"
#include <X11/Xfuncproto.h>
#include "xvdix.h"
#include <X11/extensions/XvMC.h>
#include <X11/extensions/Xvproto.h>
#include <X11/extensions/XvMCproto.h>
@ -36,6 +36,8 @@ static DevPrivateKeyRec XvMCScreenKeyRec;
#define XvMCScreenKey (&XvMCScreenKeyRec)
static Bool XvMCInUse;
unsigned long XvMCGeneration = 0;
int XvMCReqCode;
int XvMCEventBase;
@ -58,7 +60,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 +77,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 +86,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 +101,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;
}
@ -107,18 +109,16 @@ XvMCDestroySubpictureRes(void *data, XID id)
static int
ProcXvMCQueryVersion(ClientPtr client)
{
xvmcQueryVersionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.major = SERVER_XVMC_MAJOR_VERSION,
.minor = SERVER_XVMC_MINOR_VERSION
};
xvmcQueryVersionReply rep;
/* REQUEST(xvmcQueryVersionReq); */
REQUEST_SIZE_MATCH(xvmcQueryVersionReq);
WriteToClient(client, sizeof(xvmcQueryVersionReply), &rep);
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.length = 0;
rep.major = SERVER_XVMC_MAJOR_VERSION;
rep.minor = SERVER_XVMC_MINOR_VERSION;
WriteToClient(client, sizeof(xvmcQueryVersionReply), (char *) &rep);
return Success;
}
@ -132,7 +132,6 @@ ProcXvMCListSurfaceTypes(ClientPtr client)
xvmcSurfaceInfo info;
XvMCAdaptorPtr adaptor = NULL;
XvMCSurfaceInfoPtr surface;
int num_surfaces;
REQUEST(xvmcListSurfaceTypesReq);
REQUEST_SIZE_MATCH(xvmcListSurfaceTypesReq);
@ -152,17 +151,14 @@ ProcXvMCListSurfaceTypes(ClientPtr client)
}
}
num_surfaces = (adaptor) ? adaptor->num_surfaces : 0;
rep = (xvmcListSurfaceTypesReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.num = num_surfaces,
.length = bytes_to_int32(num_surfaces * sizeof(xvmcSurfaceInfo)),
};
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.num = (adaptor) ? adaptor->num_surfaces : 0;
rep.length = bytes_to_int32(rep.num * sizeof(xvmcSurfaceInfo));
WriteToClient(client, sizeof(xvmcListSurfaceTypesReply), &rep);
WriteToClient(client, sizeof(xvmcListSurfaceTypesReply), (char *) &rep);
for (i = 0; i < num_surfaces; i++) {
for (i = 0; i < rep.num; i++) {
surface = adaptor->surfaces[i];
info.surface_type_id = surface->surface_type_id;
info.chroma_format = surface->chroma_format;
@ -172,7 +168,7 @@ ProcXvMCListSurfaceTypes(ClientPtr client)
info.subpicture_max_height = surface->subpicture_max_height;
info.mc_type = surface->mc_type;
info.flags = surface->flags;
WriteToClient(client, sizeof(xvmcSurfaceInfo), &info);
WriteToClient(client, sizeof(xvmcSurfaceInfo), (char *) &info);
}
return Success;
@ -250,23 +246,18 @@ ProcXvMCCreateContext(ClientPtr client)
free(pContext);
return result;
}
if (!AddResource(pContext->context_id, XvMCRTContext, pContext)) {
free(data);
return BadAlloc;
}
rep = (xvmcCreateContextReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = dwords,
.width_actual = pContext->width,
.height_actual = pContext->height,
.flags_return = pContext->flags
};
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.width_actual = pContext->width;
rep.height_actual = pContext->height;
rep.flags_return = pContext->flags;
rep.length = dwords;
WriteToClient(client, sizeof(xvmcCreateContextReply), &rep);
WriteToClient(client, sizeof(xvmcCreateContextReply), (char *) &rep);
if (dwords)
WriteToClient(client, dwords << 2, data);
WriteToClient(client, dwords << 2, (char *) data);
AddResource(pContext->context_id, XvMCRTContext, pContext);
free(data);
@ -276,7 +267,7 @@ ProcXvMCCreateContext(ClientPtr client)
static int
ProcXvMCDestroyContext(ClientPtr client)
{
void *val;
pointer val;
int rc;
REQUEST(xvmcDestroyContextReq);
@ -287,7 +278,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 +297,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,20 +320,15 @@ 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,
.length = dwords
};
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.length = dwords;
WriteToClient(client, sizeof(xvmcCreateSurfaceReply), &rep);
WriteToClient(client, sizeof(xvmcCreateSurfaceReply), (char *) &rep);
if (dwords)
WriteToClient(client, dwords << 2, data);
WriteToClient(client, dwords << 2, (char *) data);
AddResource(pSurface->surface_id, XvMCRTSurface, pSurface);
free(data);
@ -354,7 +340,7 @@ ProcXvMCCreateSurface(ClientPtr client)
static int
ProcXvMCDestroySurface(ClientPtr client)
{
void *val;
pointer val;
int rc;
REQUEST(xvmcDestroySurfaceReq);
@ -365,7 +351,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 +372,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,28 +435,23 @@ 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,
.length = dwords,
.width_actual = pSubpicture->width,
.height_actual = pSubpicture->height,
.num_palette_entries = pSubpicture->num_palette_entries,
.entry_bytes = pSubpicture->entry_bytes,
.component_order[0] = pSubpicture->component_order[0],
.component_order[1] = pSubpicture->component_order[1],
.component_order[2] = pSubpicture->component_order[2],
.component_order[3] = pSubpicture->component_order[3]
};
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.width_actual = pSubpicture->width;
rep.height_actual = pSubpicture->height;
rep.num_palette_entries = pSubpicture->num_palette_entries;
rep.entry_bytes = pSubpicture->entry_bytes;
rep.component_order[0] = pSubpicture->component_order[0];
rep.component_order[1] = pSubpicture->component_order[1];
rep.component_order[2] = pSubpicture->component_order[2];
rep.component_order[3] = pSubpicture->component_order[3];
rep.length = dwords;
WriteToClient(client, sizeof(xvmcCreateSubpictureReply), &rep);
WriteToClient(client, sizeof(xvmcCreateSubpictureReply), (char *) &rep);
if (dwords)
WriteToClient(client, dwords << 2, data);
WriteToClient(client, dwords << 2, (char *) data);
AddResource(pSubpicture->subpicture_id, XvMCRTSubpicture, pSubpicture);
free(data);
@ -482,7 +463,7 @@ ProcXvMCCreateSubpicture(ClientPtr client)
static int
ProcXvMCDestroySubpicture(ClientPtr client)
{
void *val;
pointer val;
int rc;
REQUEST(xvmcDestroySubpictureReq);
@ -493,7 +474,7 @@ ProcXvMCDestroySubpicture(ClientPtr client)
if (rc != Success)
return rc;
FreeResource(stuff->subpicture_id, X11_RESTYPE_NONE);
FreeResource(stuff->subpicture_id, RT_NONE);
return Success;
}
@ -544,17 +525,15 @@ ProcXvMCListSubpictureTypes(ClientPtr client)
if (!surface)
return BadMatch;
rep = (xvmcListSubpictureTypesReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.num = 0
};
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.num = 0;
if (surface->compatible_subpictures)
rep.num = surface->compatible_subpictures->num_xvimages;
rep.length = bytes_to_int32(rep.num * sizeof(xvImageFormatInfo));
WriteToClient(client, sizeof(xvmcListSubpictureTypesReply), &rep);
WriteToClient(client, sizeof(xvmcListSubpictureTypesReply), (char *) &rep);
for (i = 0; i < rep.num; i++) {
pImage = NULL;
@ -590,7 +569,7 @@ ProcXvMCListSubpictureTypes(ClientPtr client)
info.vert_v_period = pImage->vert_v_period;
memcpy(&info.comp_order, pImage->component_order, 32);
info.scanline_order = pImage->scanline_order;
WriteToClient(client, sizeof(xvImageFormatInfo), &info);
WriteToClient(client, sizeof(xvImageFormatInfo), (char *) &info);
}
return Success;
@ -616,16 +595,13 @@ ProcXvMCGetDRInfo(ClientPtr client)
pScreen = pPort->pAdaptor->pScreen;
pScreenPriv = XVMC_GET_PRIVATE(pScreen);
rep = (xvmcGetDRInfoReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.major = pScreenPriv->major,
.minor = pScreenPriv->minor,
.patchLevel = pScreenPriv->patchLevel,
.nameLen = bytes_to_int32(strlen(pScreenPriv->clientDriverName) + 1),
.busIDLen = bytes_to_int32(strlen(pScreenPriv->busID) + 1),
.isLocal = 1
};
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.major = pScreenPriv->major;
rep.minor = pScreenPriv->minor;
rep.patchLevel = pScreenPriv->patchLevel;
rep.nameLen = bytes_to_int32(strlen(pScreenPriv->clientDriverName) + 1);
rep.busIDLen = bytes_to_int32(strlen(pScreenPriv->busID) + 1);
rep.length = rep.nameLen + rep.busIDLen;
rep.nameLen <<= 2;
@ -636,6 +612,7 @@ ProcXvMCGetDRInfo(ClientPtr client)
* segment she prepared for us.
*/
rep.isLocal = 1;
#ifdef HAS_XVMCSHM
patternP = (CARD32 *) shmat(stuff->shmKey, NULL, SHM_RDONLY);
if (-1 != (long) patternP) {
@ -657,7 +634,7 @@ ProcXvMCGetDRInfo(ClientPtr client)
}
#endif /* HAS_XVMCSHM */
WriteToClient(client, sizeof(xvmcGetDRInfoReply), &rep);
WriteToClient(client, sizeof(xvmcGetDRInfoReply), (char *) &rep);
if (rep.length) {
WriteToClient(client, rep.nameLen, pScreenPriv->clientDriverName);
WriteToClient(client, rep.busIDLen, pScreenPriv->busID);
@ -687,7 +664,7 @@ ProcXvMCDispatch(ClientPtr client)
return BadRequest;
}
static int _X_COLD
static int
SProcXvMCDispatch(ClientPtr client)
{
/* We only support local */
@ -732,7 +709,7 @@ XvMCExtensionInit(void)
}
static Bool
XvMCCloseScreen(ScreenPtr pScreen)
XvMCCloseScreen(int i, ScreenPtr pScreen)
{
XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pScreen);
@ -740,7 +717,7 @@ XvMCCloseScreen(ScreenPtr pScreen)
free(pScreenPriv);
return (*pScreen->CloseScreen) (pScreen);
return (*pScreen->CloseScreen) (i, pScreen);
}
int
@ -808,8 +785,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,17 @@ typedef struct {
XvMCDestroySubpictureProcPtr DestroySubpicture;
} XvMCAdaptorRec, *XvMCAdaptorPtr;
#ifndef XorgLoader
extern _X_EXPORT void XvMCExtensionInit(void);
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
#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);
@ -111,28 +113,20 @@ ProcXChangeDeviceControl(ClientPtr client)
AxisInfoPtr a;
CARD32 *resolution;
xDeviceEnableCtl *e;
devicePresenceNotify dpn;
REQUEST(xChangeDeviceControlReq);
REQUEST_AT_LEAST_EXTRA_SIZE(xChangeDeviceControlReq, sizeof(xDeviceCtl));
REQUEST_AT_LEAST_SIZE(xChangeDeviceControlReq);
len = 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,
};
rep.repType = X_Reply;
rep.RepType = X_ChangeDeviceControl;
rep.length = 0;
rep.sequenceNumber = client->sequence;
switch (stuff->control) {
case DEVICE_RESOLUTION:
@ -190,15 +184,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)
@ -222,13 +209,11 @@ ProcXChangeDeviceControl(ClientPtr client)
out:
if (ret == Success) {
devicePresenceNotify dpn = {
.type = DevicePresenceNotify,
.time = currentTime.milliseconds,
.devchange = DeviceControlChanged,
.deviceid = dev->id,
.control = stuff->control
};
dpn.type = DevicePresenceNotify;
dpn.time = currentTime.milliseconds;
dpn.devchange = DeviceControlChanged;
dpn.deviceid = dev->id;
dpn.control = stuff->control;
SendEventToAllWindows(dev, DevicePresenceNotifyMask,
(xEvent *) &dpn, 1);
@ -245,11 +230,11 @@ ProcXChangeDeviceControl(ClientPtr client)
*
*/
void _X_COLD
void
SRepXChangeDeviceControl(ClientPtr client, int size,
xChangeDeviceControlReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
WriteToClient(client, size, (char *) 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,10 +30,19 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef CHGPTR_H
#define CHGPTR_H 1
int SProcXChangePointerDevice(ClientPtr /* client */
);
int ProcXChangePointerDevice(ClientPtr /* client */
);
void DeleteFocusClassDeviceStruct(DeviceIntPtr /* dev */
);
void SendEventToAllWindows(DeviceIntPtr /* dev */ ,
Mask /* mask */ ,
xEvent * /* ev */ ,
int /* count */
);
#endif /* CHGPTR_H */

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

@ -49,9 +49,13 @@ SOFTWARE.
* Dispatch routines and initialization routines for the X input extension.
*
*/
#define ARRAY_SIZE(_a) (sizeof((_a)) / sizeof((_a)[0]))
#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 +64,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 +124,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;
@ -148,34 +150,37 @@ const Mask ChangeDeviceNotifyMask = (1L << 16);
const Mask DeviceButtonGrabMask = (1L << 17);
const Mask DeviceOwnerGrabButtonMask = (1L << 17);
const Mask DevicePresenceNotifyMask = (1L << 18);
const Mask DevicePropertyNotifyMask = (1L << 19);
const Mask XIAllMasks = (1L << 20) - 1;
const Mask DeviceEnterWindowMask = (1L << 18);
const Mask DeviceLeaveWindowMask = (1L << 19);
const Mask DevicePropertyNotifyMask = (1L << 20);
const Mask XIAllMasks = (1L << 21) - 1;
int ExtEventIndex;
Mask ExtExclusiveMasks[EMASKSIZE];
static struct dev_type {
Atom type;
const char *name;
} dev_type[] = {
{0, XI_KEYBOARD},
{0, XI_MOUSE},
{0, XI_TABLET},
{0, XI_TOUCHSCREEN},
{0, XI_TOUCHPAD},
{0, XI_BARCODE},
{0, XI_BUTTONBOX},
{0, XI_KNOB_BOX},
{0, XI_ONE_KNOB},
{0, XI_NINE_KNOB},
{0, XI_TRACKBALL},
{0, XI_QUADRATURE},
{0, XI_ID_MODULE},
{0, XI_SPACEBALL},
{0, XI_DATAGLOVE},
{0, XI_EYETRACKER},
{0, XI_CURSORKEYS},
{0, XI_FOOTMOUSE}
};
{
0, XI_KEYBOARD}, {
0, XI_MOUSE}, {
0, XI_TABLET}, {
0, XI_TOUCHSCREEN}, {
0, XI_TOUCHPAD}, {
0, XI_BARCODE}, {
0, XI_BUTTONBOX}, {
0, XI_KNOB_BOX}, {
0, XI_ONE_KNOB}, {
0, XI_NINE_KNOB}, {
0, XI_TRACKBALL}, {
0, XI_QUADRATURE}, {
0, XI_ID_MODULE}, {
0, XI_SPACEBALL}, {
0, XI_DATAGLOVE}, {
0, XI_EYETRACKER}, {
0, XI_CURSORKEYS}, {
0, XI_FOOTMOUSE}};
CARD8 event_base[numInputClasses];
XExtEventInfo EventInfo[32];
@ -250,25 +255,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 +280,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 +320,7 @@ static int (*SProcIVector[]) (ClientPtr) = {
SProcXIChangeProperty, /* 57 */
SProcXIDeleteProperty, /* 58 */
SProcXIGetProperty, /* 59 */
SProcXIGetSelectedEvents, /* 60 */
SProcXIBarrierReleasePointer /* 61 */
SProcXIGetSelectedEvents /* 60 */
};
/*****************************************************************
@ -362,6 +365,8 @@ RESTYPE RT_INPUTCLIENT;
extern XExtensionVersion XIVersion;
Mask PropagateMask[EMASKSIZE];
/*****************************************************************
*
* Versioning support
@ -376,6 +381,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 +407,6 @@ ProcIDispatch(ClientPtr client)
if (stuff->data >= ARRAY_SIZE(ProcIVector) || !ProcIVector[stuff->data])
return BadRequest;
UpdateCurrentTimeIf();
return (*ProcIVector[stuff->data]) (client);
}
@ -403,14 +419,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,11 +436,10 @@ SProcIDispatch(ClientPtr client)
*
*/
static void _X_COLD
static void
SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep)
{
/* All we look at is the type field */
/* This is common to all replies */
/* All we look at is the type field */
{ /* This is common to all replies */
if (rep->RepType == X_GetExtensionVersion)
SRepXGetExtensionVersion(client, len,
(xGetExtensionVersionReply *) rep);
@ -516,7 +530,7 @@ static void
SEventDeviceValuator(deviceValuator * from, deviceValuator * to)
{
int i;
INT32 *ip;
INT32 *ip B32;
*to = *from;
swaps(&to->sequenceNumber);
@ -540,7 +554,7 @@ static void
SDeviceStateNotifyEvent(deviceStateNotify * from, deviceStateNotify * to)
{
int i;
INT32 *ip;
INT32 *ip B32;
*to = *from;
swaps(&to->sequenceNumber);
@ -635,7 +649,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 +657,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 +768,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 +842,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 +888,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 +930,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 +1008,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 +1029,8 @@ FixExtensionEvents(ExtensionEntry * extEntry)
SetMaskForExtEvent(DeviceStateNotifyMask, DeviceStateNotify);
SetMaskForExtEvent(PointerMotionMask, DeviceMotionNotify);
SetMaskForExtEvent(DevicePointerMotionMask, DeviceMotionNotify);
AllowPropagateSuppress(DevicePointerMotionMask);
SetCriticalEvent(DeviceMotionNotify);
SetEventInfo(DevicePointerMotionHintMask, _devicePointerMotionHint);
@ -1107,6 +1048,8 @@ FixExtensionEvents(ExtensionEntry * extEntry)
SetMaskForExtEvent(ChangeDeviceNotifyMask, ChangeDeviceNotify);
SetEventInfo(DeviceButtonGrabMask, _deviceButtonGrab);
SetExclusiveAccess(DeviceButtonGrabMask);
SetEventInfo(DeviceOwnerGrabButtonMask, _deviceOwnerGrabButton);
SetEventInfo(DevicePresenceNotifyMask, _devicePresence);
SetMaskForExtEvent(DevicePropertyNotifyMask, DevicePropertyNotify);
@ -1194,11 +1137,6 @@ IResetProc(ExtensionEntry * unused)
EventSwapVector[DevicePresenceNotify] = NotImplemented;
EventSwapVector[DevicePropertyNotify] = NotImplemented;
RestoreExtensionEvents();
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);
@ -1360,9 +1298,9 @@ XInputExtensionInit(void)
memset(&xi_all_devices, 0, sizeof(xi_all_devices));
memset(&xi_all_master_devices, 0, sizeof(xi_all_master_devices));
xi_all_devices.id = XIAllDevices;
xi_all_devices.name = strdup("XIAllDevices");
xi_all_devices.name = "XIAllDevices";
xi_all_master_devices.id = XIAllMasterDevices;
xi_all_master_devices.name = strdup("XIAllMasterDevices");
xi_all_master_devices.name = "XIAllMasterDevices";
inputInfo.all_devices = &xi_all_devices;
inputInfo.all_master_devices = &xi_all_master_devices;

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.
@ -76,13 +92,11 @@ ProcXGetDeviceButtonMapping(ClientPtr client)
REQUEST(xGetDeviceButtonMappingReq);
REQUEST_SIZE_MATCH(xGetDeviceButtonMappingReq);
rep = (xGetDeviceButtonMappingReply) {
.repType = X_Reply,
.RepType = X_GetDeviceButtonMapping,
.sequenceNumber = client->sequence,
.nElts = 0,
.length = 0
};
rep.repType = X_Reply;
rep.RepType = X_GetDeviceButtonMapping;
rep.nElts = 0;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess);
if (rc != Success)
@ -95,7 +109,7 @@ ProcXGetDeviceButtonMapping(ClientPtr client)
rep.nElts = b->numButtons;
rep.length = bytes_to_int32(rep.nElts);
WriteReplyToClient(client, sizeof(xGetDeviceButtonMappingReply), &rep);
WriteToClient(client, rep.nElts, &b->map[1]);
(void) WriteToClient(client, rep.nElts, (char *) &b->map[1]);
return Success;
}
@ -106,11 +120,11 @@ ProcXGetDeviceButtonMapping(ClientPtr client)
*
*/
void _X_COLD
void
SRepXGetDeviceButtonMapping(ClientPtr client, int size,
xGetDeviceButtonMappingReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
WriteToClient(client, size, (char *) 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,12 +153,12 @@ CopySwapDeviceEnable(ClientPtr client, DeviceIntPtr dev, char *buf)
*
*/
void _X_COLD
void
SRepXGetDeviceControl(ClientPtr client, int size, xGetDeviceControlReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
WriteToClient(client, size, (char *) rep);
}
/***********************************************************************
@ -179,12 +182,10 @@ ProcXGetDeviceControl(ClientPtr client)
if (rc != Success)
return rc;
rep = (xGetDeviceControlReply) {
.repType = X_Reply,
.RepType = X_GetDeviceControl,
.sequenceNumber = client->sequence,
.length = 0
};
rep.repType = X_Reply;
rep.RepType = X_GetDeviceControl;
rep.length = 0;
rep.sequenceNumber = client->sequence;
switch (stuff->control) {
case DEVICE_RESOLUTION:

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,14 +258,14 @@ CopySwapBellFeedback(ClientPtr client, BellFeedbackPtr b, char **buf)
*
*/
void _X_COLD
void
SRepXGetFeedbackControl(ClientPtr client, int size,
xGetFeedbackControlReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swaps(&rep->num_feedbacks);
WriteToClient(client, size, rep);
WriteToClient(client, size, (char *) rep);
}
/***********************************************************************
@ -279,13 +295,11 @@ ProcXGetFeedbackControl(ClientPtr client)
if (rc != Success)
return rc;
rep = (xGetFeedbackControlReply) {
.repType = X_Reply,
.RepType = X_GetFeedbackControl,
.sequenceNumber = client->sequence,
.length = 0,
.num_feedbacks = 0
};
rep.repType = X_Reply;
rep.RepType = X_GetFeedbackControl;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.num_feedbacks = 0;
for (k = dev->kbdfeed; k; k = k->next) {
rep.num_feedbacks++;

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.
@ -83,12 +99,10 @@ ProcXGetDeviceFocus(ClientPtr client)
if (!dev->focus)
return BadDevice;
rep = (xGetDeviceFocusReply) {
.repType = X_Reply,
.RepType = X_GetDeviceFocus,
.sequenceNumber = client->sequence,
.length = 0
};
rep.repType = X_Reply;
rep.RepType = X_GetDeviceFocus;
rep.length = 0;
rep.sequenceNumber = client->sequence;
focus = dev->focus;
@ -114,12 +128,12 @@ ProcXGetDeviceFocus(ClientPtr client)
*
*/
void _X_COLD
void
SRepXGetDeviceFocus(ClientPtr client, int size, xGetDeviceFocusReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swapl(&rep->focus);
swapl(&rep->time);
WriteToClient(client, size, rep);
WriteToClient(client, size, (char *) rep);
}

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.
@ -102,13 +119,11 @@ ProcXGetDeviceKeyMapping(ClientPtr client)
if (!syms)
return BadAlloc;
rep = (xGetDeviceKeyMappingReply) {
.repType = X_Reply,
.RepType = X_GetDeviceKeyMapping,
.sequenceNumber = client->sequence,
.keySymsPerKeyCode = syms->mapWidth,
.length = (syms->mapWidth * stuff->count) /* KeySyms are 4 bytes */
};
rep.repType = X_Reply;
rep.RepType = X_GetDeviceKeyMapping;
rep.sequenceNumber = client->sequence;
rep.keySymsPerKeyCode = syms->mapWidth;
rep.length = (syms->mapWidth * stuff->count); /* KeySyms are 4 bytes */
WriteReplyToClient(client, sizeof(xGetDeviceKeyMappingReply), &rep);
client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
@ -129,11 +144,11 @@ ProcXGetDeviceKeyMapping(ClientPtr client)
*
*/
void _X_COLD
void
SRepXGetDeviceKeyMapping(ClientPtr client, int size,
xGetDeviceKeyMappingReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
WriteToClient(client, size, (char *) 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.
@ -84,17 +101,15 @@ ProcXGetDeviceModifierMapping(ClientPtr client)
if (ret != Success)
return ret;
rep = (xGetDeviceModifierMappingReply) {
.repType = X_Reply,
.RepType = X_GetDeviceModifierMapping,
.sequenceNumber = client->sequence,
.numKeyPerModifier = max_keys_per_mod,
rep.repType = X_Reply;
rep.RepType = X_GetDeviceModifierMapping;
rep.numKeyPerModifier = max_keys_per_mod;
rep.sequenceNumber = client->sequence;
/* length counts 4 byte quantities - there are 8 modifiers 1 byte big */
.length = max_keys_per_mod << 1
};
rep.length = max_keys_per_mod << 1;
WriteReplyToClient(client, sizeof(xGetDeviceModifierMappingReply), &rep);
WriteToClient(client, max_keys_per_mod * 8, modkeymap);
WriteToClient(client, max_keys_per_mod * 8, (char *) modkeymap);
free(modkeymap);
@ -108,11 +123,11 @@ ProcXGetDeviceModifierMapping(ClientPtr client)
*
*/
void _X_COLD
void
SRepXGetDeviceModifierMapping(ClientPtr client, int size,
xGetDeviceModifierMappingReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
WriteToClient(client, size, (char *) 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));
@ -100,13 +101,11 @@ ProcXGetDeviceDontPropagateList(ClientPtr client)
REQUEST(xGetDeviceDontPropagateListReq);
REQUEST_SIZE_MATCH(xGetDeviceDontPropagateListReq);
rep = (xGetDeviceDontPropagateListReply) {
.repType = X_Reply,
.RepType = X_GetDeviceDontPropagateList,
.sequenceNumber = client->sequence,
.length = 0,
.count = 0
};
rep.repType = X_Reply;
rep.RepType = X_GetDeviceDontPropagateList;
rep.sequenceNumber = client->sequence;
rep.length = 0;
rep.count = 0;
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
@ -117,9 +116,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,12 +171,12 @@ XEventClass
*
*/
void _X_COLD
void
SRepXGetDeviceDontPropagateList(ClientPtr client, int size,
xGetDeviceDontPropagateListReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swaps(&rep->count);
WriteToClient(client, size, rep);
WriteToClient(client, size, (char *) 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));
@ -101,14 +102,12 @@ ProcXGetSelectedExtensionEvents(ClientPtr client)
REQUEST(xGetSelectedExtensionEventsReq);
REQUEST_SIZE_MATCH(xGetSelectedExtensionEventsReq);
rep = (xGetSelectedExtensionEventsReply) {
.repType = X_Reply,
.RepType = X_GetSelectedExtensionEvents,
.sequenceNumber = client->sequence,
.length = 0,
.this_client_count = 0,
.all_clients_count = 0
};
rep.repType = X_Reply;
rep.RepType = X_GetSelectedExtensionEvents;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.this_client_count = 0;
rep.all_clients_count = 0;
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
@ -163,7 +162,7 @@ ProcXGetSelectedExtensionEvents(ClientPtr client)
*
*/
void _X_COLD
void
SRepXGetSelectedExtensionEvents(ClientPtr client, int size,
xGetSelectedExtensionEventsReply * rep)
{
@ -171,5 +170,5 @@ SRepXGetSelectedExtensionEvents(ClientPtr client, int size,
swapl(&rep->length);
swaps(&rep->this_client_count);
swaps(&rep->all_clients_count);
WriteToClient(client, size, rep);
WriteToClient(client, size, (char *) 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,19 +94,18 @@ 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;
rep = (xGetExtensionVersionReply) {
.repType = X_Reply,
.RepType = X_GetExtensionVersion,
.sequenceNumber = client->sequence,
.length = 0,
.major_version = XIVersion.major_version,
.minor_version = XIVersion.minor_version,
.present = TRUE
};
memset(&rep, 0, sizeof(xGetExtensionVersionReply));
rep.repType = X_Reply;
rep.RepType = X_GetExtensionVersion;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.present = TRUE;
rep.major_version = XIVersion.major_version;
rep.minor_version = XIVersion.minor_version;
WriteReplyToClient(client, sizeof(xGetExtensionVersionReply), &rep);
@ -117,7 +119,7 @@ ProcXGetExtensionVersion(ClientPtr client)
*
*/
void _X_COLD
void
SRepXGetExtensionVersion(ClientPtr client, int size,
xGetExtensionVersionReply * rep)
{
@ -125,5 +127,5 @@ SRepXGetExtensionVersion(ClientPtr client, int size,
swapl(&rep->length);
swaps(&rep->major_version);
swaps(&rep->minor_version);
WriteToClient(client, size, rep);
WriteToClient(client, size, (char *) 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,16 +109,14 @@ 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;
rep = (xGrabDeviceReply) {
.repType = X_Reply,
.RepType = X_GrabDevice,
.sequenceNumber = client->sequence,
.length = 0,
};
rep.repType = X_Reply;
rep.RepType = X_GrabDevice;
rep.sequenceNumber = client->sequence;
rep.length = 0;
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess);
if (rc != Success)
@ -151,7 +151,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 +173,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 +192,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,10 +206,10 @@ CreateMaskFromList(ClientPtr client, XEventClass * list, int count,
*
*/
void _X_COLD
void
SRepXGrabDevice(ClientPtr client, int size, xGrabDeviceReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
WriteToClient(client, size, (char *) rep);
}

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;
}
@ -135,14 +137,13 @@ ProcXGrabDeviceButton(ClientPtr client)
X_GrabDeviceButton)) != Success)
return ret;
param = (GrabParameters) {
.grabtype = XI,
.ownerEvents = stuff->ownerEvents,
.this_device_mode = stuff->this_device_mode,
.other_devices_mode = stuff->other_devices_mode,
.grabWindow = stuff->grabWindow,
.modifiers = stuff->modifiers
};
memset(&param, 0, sizeof(param));
param.grabtype = XI;
param.ownerEvents = stuff->ownerEvents;
param.this_device_mode = stuff->this_device_mode;
param.other_devices_mode = stuff->other_devices_mode;
param.grabWindow = stuff->grabWindow;
param.modifiers = stuff->modifiers;
mask.xi = tmp[stuff->grabbed_device].mask;
ret = GrabButton(client, dev, mdev, stuff->button, &param, XI, &mask);

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;
}
@ -133,14 +135,13 @@ ProcXGrabDeviceKey(ClientPtr client)
X_GrabDeviceKey)) != Success)
return ret;
param = (GrabParameters) {
.grabtype = XI,
.ownerEvents = stuff->ownerEvents,
.this_device_mode = stuff->this_device_mode,
.other_devices_mode = stuff->other_devices_mode,
.grabWindow = stuff->grabWindow,
.modifiers = stuff->modifiers
};
memset(&param, 0, sizeof(param));
param.grabtype = XI;
param.ownerEvents = stuff->ownerEvents;
param.this_device_mode = stuff->this_device_mode;
param.other_devices_mode = stuff->other_devices_mode;
param.grabWindow = stuff->grabWindow;
param.modifiers = stuff->modifiers;
mask.xi = tmp[stuff->grabbed_device].mask;
ret = GrabKey(client, dev, mdev, stuff->key, &param, XI, &mask);

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);
@ -108,15 +110,13 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
if (dev->valuator->motionHintWindow)
MaybeStopDeviceHint(dev, client);
axes = v->numAxes;
rep = (xGetDeviceMotionEventsReply) {
.repType = X_Reply,
.RepType = X_GetDeviceMotionEvents,
.sequenceNumber = client->sequence,
.length = 0,
.nEvents = 0,
.axes = axes,
.mode = Absolute /* XXX we don't do relative at the moment */
};
rep.repType = X_Reply;
rep.RepType = X_GetDeviceMotionEvents;
rep.sequenceNumber = client->sequence;
rep.nEvents = 0;
rep.axes = axes;
rep.mode = Absolute; /* XXX we don't do relative at the moment */
rep.length = 0;
start = ClientTimeToServerTime(stuff->start);
stop = ClientTimeToServerTime(stuff->stop);
if (CompareTimeStamps(start, stop) == LATER ||
@ -129,7 +129,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);
}
@ -147,7 +147,7 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
bufptr++;
}
}
WriteToClient(client, length * 4, coords);
WriteToClient(client, length * 4, (char *) coords);
}
free(coords);
return Success;
@ -160,12 +160,12 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
*
*/
void _X_COLD
void
SRepXGetDeviceMotionEvents(ClientPtr client, int size,
xGetDeviceMotionEventsReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swapl(&rep->nEvents);
WriteToClient(client, size, rep);
WriteToClient(client, size, (char *) 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;
@ -328,15 +342,14 @@ ProcXListInputDevices(ClientPtr client)
REQUEST_SIZE_MATCH(xListInputDevicesReq);
rep = (xListInputDevicesReply) {
.repType = X_Reply,
.RepType = X_ListInputDevices,
.sequenceNumber = client->sequence,
.length = 0
};
memset(&rep, 0, sizeof(xListInputDevicesReply));
rep.repType = X_Reply;
rep.RepType = X_ListInputDevices;
rep.length = 0;
rep.sequenceNumber = client->sequence;
/* allocate space for saving skip value */
skip = calloc(inputInfo.numDevices, sizeof(Bool));
skip = calloc(sizeof(Bool), inputInfo.numDevices);
if (!skip)
return BadAlloc;
@ -363,10 +376,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,10 +412,10 @@ ProcXListInputDevices(ClientPtr client)
*
*/
void _X_COLD
void
SRepXListInputDevices(ClientPtr client, int size, xListInputDevicesReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
WriteToClient(client, size, (char *) rep);
}

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.
@ -100,6 +117,10 @@ ProcXOpenDevice(ClientPtr client)
if (status != Success)
return status;
memset(&rep, 0, sizeof(xOpenDeviceReply));
rep.repType = X_Reply;
rep.RepType = X_OpenDevice;
rep.sequenceNumber = client->sequence;
if (dev->key != NULL) {
evbase[j].class = KeyClass;
evbase[j++].event_type_base = event_base[KeyClass];
@ -127,15 +148,10 @@ ProcXOpenDevice(ClientPtr client)
}
evbase[j].class = OtherClass;
evbase[j++].event_type_base = event_base[OtherClass];
rep = (xOpenDeviceReply) {
.repType = X_Reply,
.RepType = X_OpenDevice,
.sequenceNumber = client->sequence,
.length = bytes_to_int32(j * sizeof(xInputClassInfo)),
.num_classes = j
};
rep.length = bytes_to_int32(j * sizeof(xInputClassInfo));
rep.num_classes = j;
WriteReplyToClient(client, sizeof(xOpenDeviceReply), &rep);
WriteToClient(client, j * sizeof(xInputClassInfo), evbase);
WriteToClient(client, j * sizeof(xInputClassInfo), (char *) evbase);
return Success;
}
@ -146,10 +162,10 @@ ProcXOpenDevice(ClientPtr client)
*
*/
void _X_COLD
void
SRepXOpenDevice(ClientPtr client, int size, xOpenDeviceReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
WriteToClient(client, size, (char *) rep);
}

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.
@ -73,6 +87,11 @@ ProcXQueryDeviceState(ClientPtr client)
REQUEST(xQueryDeviceStateReq);
REQUEST_SIZE_MATCH(xQueryDeviceStateReq);
rep.repType = X_Reply;
rep.RepType = X_QueryDeviceState;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixReadAccess);
if (rc != Success && rc != BadAccess)
return rc;
@ -144,13 +163,8 @@ ProcXQueryDeviceState(ClientPtr client)
}
}
rep = (xQueryDeviceStateReply) {
.repType = X_Reply,
.RepType = X_QueryDeviceState,
.sequenceNumber = client->sequence,
.length = bytes_to_int32(total_length),
.num_classes = num_classes
};
rep.num_classes = num_classes;
rep.length = bytes_to_int32(total_length);
WriteReplyToClient(client, sizeof(xQueryDeviceStateReply), &rep);
if (total_length > 0)
WriteToClient(client, total_length, savbuf);
@ -165,10 +179,10 @@ ProcXQueryDeviceState(ClientPtr client)
*
*/
void _X_COLD
void
SRepXQueryDeviceState(ClientPtr client, int size, xQueryDeviceStateReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
WriteToClient(client, size, (char *) rep);
}

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;
}

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