Compare commits

..

52 commits

Author SHA1 Message Date
Adam Jackson
d88937ba83 xserver 1.19.3
Signed-off-by: Adam Jackson <ajax@redhat.com>
2017-03-15 13:44:05 -04:00
Chris Wilson
b258ed457d os: Fix iteration over busfaults
Fixes a regression from

commit 41da295eb5
Author: Keith Packard <keithp@keithp.com>
Date:   Sun Nov 3 13:12:40 2013 -0800

    Trap SIGBUS to handle truncated shared memory segments

that causes the SIGBUS handler to fail to chain up correctly and
corrupts nearby memory instead.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit acdb5bf2de)
2017-03-15 13:27:11 -04:00
Tobias Stoeckmann
7c4fab2f1f render: Fix out of boundary heap access
ProcRenderCreateRadialGradient and ProcRenderCreateConicalGradient must
be protected against an integer overflow during length check. This is
already included in ProcRenderCreateLinearGradient since the fix for
CVE-2008-2362.

This can only be successfully exploited on a 32 bit system for an
out of boundary read later on. Validated by using ASAN.

Reviewed-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit ac15d4cecc)
2017-03-15 13:27:11 -04:00
Dr.-Ing. Dieter Jurzitza
fbb46e0be8 glamor: Fix missing declaration in dash vertex shader
Fixes a GLSL compilation error:

Failed to compile VS: 0:13(43): error: `pos' undeclared
0:13(14): error: operands to arithmetic operators must be numeric
0:13(13): error: operands to arithmetic operators must be numeric

[1.19: Squash in Michel's typo fix from 0c1574d9]

Tested-by: Stefan Dirsch <sndirsch@suse.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit d8161aeb50)
(cherry picked from commit 0c1574d988)
2017-03-15 13:27:11 -04:00
Olivier Fourdan
18fcb66688 xwayland: Monitor client states to destroy callbacks
In XWayland, dri3_send_open_reply() is called from a sync callback, so
there is a possibility that the client might be gone when we get to the
callback eventually, which leads to a crash in _XSERVTransSendFd() from
WriteFdToClient() .

Client resources can survive the client itself, in which case we
may end up in our sync callback trying to access client's data after
it's been freed/reclaimed.

Add a ClientStateCallback handler to monitor the client state changes
and clear the sync callback set up by the glamor drm code if any.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1416553
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=100040
Tested-by: Mark B <mark.blakeney@bullet-systems.net>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
(cherry picked from commit 937527f979)
2017-03-13 09:56:24 +01:00
Olivier Fourdan
d402b86b45 xwayland: clear cursor frame callback
After an X cursor is unrealized, the seat's corresponding x_cursor is
cleared, but if a frame callback was pending at the time, it will
remain and thus prevent any further cursor update, leaving the window
with no cursor.

Make sure to destroy the frame callback, if any, when that occurs, so
that next time a cursor needs to be set, it won't be ignored for a frame
callback that will never be triggered.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1389327
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Rui Matos <tiagomatos@gmail.com>
(cherry picked from commit d4b7e0eaa4)
2017-03-13 09:56:23 +01:00
Qiang Yu
db1326cd66 present: disable page flip only when a slave crtc is active
This prevents the tearing of moving window in a composite WM
desktop when output slave is attached but none of its crtc is
really active.

[1.19: Also fix DMX_LIBS= in configure.ac so it still links - ajax]

Signed-off-by: Qiang Yu <Qiang.Yu@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
(cherry picked from commit bb9128fdc8)
2017-03-10 11:05:36 -05:00
Chris Wilson
1097bc9c18 Revert "prime: Sync shared pixmap from root window instead of screen pixmap"
This reverts commit b5b292896f.

This breaks the concept of the screen->pixmap_dirty_list as it no longer
tracks the relationship between the PixmapDirtyUpdate src and slave_dst,
for the supposed convenience of not tracking present flips.

Bugzilla: https://bugs.freedesktop.org/100086
Reviewed-by: Adam Jackson <ajax@redhat.com>
2017-03-10 10:56:15 -05:00
Adam Jackson
0ec92f06d4 Revert "present: Allow flipping with PRIME slave outputs"
This reverts commit 5c1dd4eba8.

Bugzilla: https://bugs.freedesktop.org/100086
Reviewed-by: Adam Jackson <ajax@redhat.com>
2017-03-10 10:56:06 -05:00
Adam Jackson
f23e65f963 xserver 1.19.2, no, really
Signed-off-by: Adam Jackson <ajax@redhat.com>
2017-03-02 17:53:04 -05:00
Adam Jackson
96d4df934b xserver 1.19.2
Signed-off-by: Adam Jackson <ajax@redhat.com>
2017-03-02 17:39:51 -05:00
Adam Jackson
f4ff7b6b55 os: Squash missing declaration warning for timingsafe_memcmp
timingsafe_memcmp.c:21:1: warning: no previous prototype for ‘timingsafe_memcmp’ [-Wmissing-prototypes]
 timingsafe_memcmp(const void *b1, const void *b2, size_t len)

Signed-off-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit 5c44169cae)
2017-03-02 17:21:50 -05:00
Adam Jackson
1aa40b96e2 Revert "xserver 1.19.2"
Apparently I need to fight make distcheck some more, so let's not
pretend this is released yet.

This reverts commit 0b4112bc75.
2017-03-02 15:43:15 -05:00
Adam Jackson
0b4112bc75 xserver 1.19.2
Signed-off-by: Adam Jackson <ajax@redhat.com>
2017-03-02 15:07:00 -05:00
Olivier Fourdan
e4dd73b242 xwayland: do not set checkRepeat on master kbd
keyboard_check_repeat() fetches the XWayland seat from the
dev->public.devicePrivate do do its thing.

If a key event is sent programmatically through Xtest, our device is the
virtual core keyboard and that has a dev->public.devicePrivate of NULL,
leading to a segfault in keyboard_check_repeat().

This is the case with "antimicro" which sends key events based on the
joystick buttons.

Don't set the checkRepeat handler on the VCK since it cannot possibly work
anyway and it has no effect on the actual checkRepeat intended functionality.

Bugzilla: https://bugzilla.redhat.com/1416244
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit fe5c340046)
2017-03-02 14:54:29 -05:00
Olivier Fourdan
c84f5c3dd1 xwayland: Make sure we have a focus window
During the InitInput() phase, the wayland events get dequeued so we
can possibly end up calling dispatch_pointer_motion_event().

If this occurs before xwl_seat->focus_window is set, it leads to a NULL
pointer derefence and a segfault.

Check for xwl_seat->focus_window in both pointer_handle_frame() and
relative_pointer_handle_relative_motion() prior to calling
dispatch_pointer_motion_event()  like it's done in
pointer_handle_motion().

Bugzilla: https://bugzilla.redhat.com/1410804
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 8c9909a992)
2017-03-02 14:54:12 -05:00
Matthieu Herrb
94c3454d9f Brown bag commit to fix 957e8d (arc4random_buf() support)
- typo in #ifdef check
- also need to add AC_CHECK_FUNCS([arc4random_buf])

Reported-by Eric Engestrom. Thanks

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Matthieu Herrb <matthieu@herrb.eu>
(cherry picked from commit 386fbbe410)
2017-03-01 15:26:06 -05:00
Matthieu Herrb
b0298c02f0 auth: remove AuthToIDFunc and associated functions. Not used anymore.
And the current code for MitToId has a use-after-free() issue.

[Also remove the actual implementations - ajax]

Signed-off-by: Matthieu Herrb <matthieu@herrb.eu>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit 2855f759b1)
2017-02-28 14:18:26 -05:00
Matthieu Herrb
ab15f65fe5 Use arc4random_buf(3) if available to generate cookies.
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Matthieu Herrb <matthieu@herrb.eu>
(cherry picked from commit 957e8db38f)
2017-02-28 14:18:26 -05:00
Matthieu Herrb
3f61c7a09b Use timingsafe_memcmp() to compare MIT-MAGIC-COOKIES CVE-2017-2624
Provide the function definition for systems that don't have it.

Signed-off-by: Matthieu Herrb <matthieu@herrb.eu>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit d7ac755f0b)
2017-02-28 14:18:26 -05:00
Peter Hutterer
b5c98aa677 os: log a bug whenever WriteToClient is called from the input thread
The input thread should generate events, not send them. Make it easier to
find the instances where it's doing so.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit 1b12249fd6)
2017-02-28 13:02:20 -05:00
Michel Dänzer
04c72d3c30 damage: Validate source pictures bound to windows before unwrapping
The lower layers also do this, but no damage may be reported there,
since we unwrap before calling down.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99220
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 38696ea568)
2017-02-23 14:55:00 -05:00
Michel Dänzer
5c1dd4eba8 present: Allow flipping with PRIME slave outputs
Works fine now.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
(cherry picked from commit 542d9f6807)
2017-02-23 14:53:07 -05:00
Michel Dänzer
10f8cf3572 prime: Sync shared pixmap from root window instead of screen pixmap
The screen pixmap doesn't receive updates while there's a Present flip
window.

[1.19: Squashed in a6566f9e to avoid intermediate regression - ajax]

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
(cherry picked from commit b5b292896f)
(cherry picked from commit a6566f9e4d)
2017-02-23 14:50:20 -05:00
Olivier Fourdan
e2243e5b80 glamor: Two pass won't work on memory pixmaps
When selecting "CA_TWO_PASS" in glamor_composite_clipped_region() when
the hardware does not support "GL_ARB_blend_func_extended", we call
glamor_composite_choose_shader() twice in a row, which in turn calls
glamor_pixmap_ensure_fbo().

On memory pixmaps, the first call will set the FBO and the second one
will fail an assertion in glamor_upload_picture_to_texture() because
the FBO is already set.

Bail out earlier when the mask pixmap is in memory and the hardware
capabilities would require to use two pass, so that the assertion is not
failed and the rendering is correct.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99346
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 8646398136)
2017-02-23 14:27:16 -05:00
Svitozar Cherepii
ada5328290 xwayland: Add hack for FWXGA resolution #99574
For some applications (like fullscreen games) it matters for XRandr
resolution to be correctly set and equal to root window resolution.

In XServer there is already hack for this, adapted it for XWayland.

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

Signed-off-by: Svitozar Cherepii <razotivs@gmail.com>
Tested-by: Svitozar Cherepii <razotivs@gmail.com>
Acked-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit 1c78bec9ca)
2017-02-23 14:27:16 -05:00
Olivier Fourdan
abf3bc68db xwayland: CRTC should support all rotations
If the Wayland compositor sets a rotation on the output, Xwayland
translates the transformation as an xrandr rotation for the given
output.

However, if the rotation is not supported by the CRTC, this is not
a valid setup and xrandr queries will fail.

Pretend we support all rotations and reflections so that the
configuration remains a valid xrandr setup.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99663
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit afeace27d3)
2017-02-23 14:27:16 -05:00
Olivier Fourdan
fd74867b8b xwayland: Apply output rotation for screen size
Previously, we would swap the width/height of the Xwayland output based
on the output rotation, so that the overall screen size would match the
actual rotation of each output.

Problem is the RandR's ConstrainCursorHarder() handler will also apply
the output rotation, meaning that when the output is rotated, the
pointer will be constrained within the wrong dimension.

Moreover, XRandR assumes the original output width/height are unchanged
when the output is rotated, so by changing the Xwayland output width and
height based on rotation, Xwayland causes XRandr to report the wrong
output sizes (an output of size 1024x768 rotated left or right should
remain 1024x768, not 768x1024).

So to avoid this issue and keep things consistent between Wayland and
Xwayland outputs, leave the actual width/height unchanged but apply the
rotation when computing the screen size. This fixes both the output size
being wrong in "xrandr -q" and the pointer being constrained in the
wrong dimension with rotated with weston.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99663
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit 058809c43e)
2017-02-23 14:27:16 -05:00
Chris Wilson
9a9c6af22e xfree86: Take input_lock() for xf86ScreenCheckHWCursor
(cherry picked from commit 3eb964e252)
2017-02-17 10:14:03 +10:00
Chris Wilson
2a6904306f xfree86: Take input lock for xf86TransparentCursor
(cherry picked from commit cfddd919cc)
2017-02-17 10:14:02 +10:00
Chris Wilson
da85ab9dd8 xfree86: Take the input lock for xf86RecolorCursor
xf86RecolorCursor() may be called directly from XRecolorCursor as well
as from xf86ScreenSetCursor(). In the latter case, the input lock is
already held, but not for the former and so we need to add a wrapper
function that acquires the input lock before performing
xf86RecolorCursor()

References: https://bugs.freedesktop.org/show_bug.cgi?id=99358
(cherry picked from commit 7198a6d4e7)
2017-02-17 10:14:01 +10:00
Adam Jackson
ad2facda30 xserver 1.19.1
Signed-off-by: Adam Jackson <ajax@redhat.com>
2017-01-11 16:15:57 -05:00
Keith Packard
82dcb68a87 AttendClient of grab-pervious client must queue to saved_ready_clients [v2]
A client which is attended while a grab is blocking execution of its
requests needs to be placed in the saved_ready_clients list so that it
will get scheduled once the grab terminates. Otherwise, if the client
never sends another request, there is no way for it to be placed in
the ready_clients list.

v2: Wrap comment above mark_client_saved_ready.
    Remove test for OS_COMM_IGNORED which will always be true.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99333
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 785053d033)
2017-01-11 15:04:12 -05:00
Qiang Yu
14516988e0 randr: fix xserver crash when xrandr setprovideroutputsource
xrandr --setprovideroutputsource <screen> <gpu screen>
Xorg: ../../../xserver/dix/dispatch.c:4018: AttachOutputGPU:
Assertion `new->isGPU' failed.

GPUScreen is not allowed to be sink output.

Signed-off-by: Qiang Yu <Qiang.Yu@amd.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 555e0a42d1)
2017-01-11 15:04:12 -05:00
Qiang Yu
3381e2c26b xfree86: fix wrong usage of xf86optionListMerge
Signed-off-by: Qiang Yu <Qiang.Yu@amd.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 1012510620)
2017-01-11 15:04:12 -05:00
Michel Dänzer
27a2772cf3 present: Only call present_flip_notify if vblank->queued == FALSE
We are no longer using the present_flip_queue list only for presents
which have already been submitted to the driver for page flipping, but
also for those which we are queueing up to be flipped later, marked
with vblank->queued == TRUE. We were incorrectly calling
present_flip_notify for such entries, failing the assertion in
present_flip_notify (or presumably resulting in other undesirable
behaviour with assertions disabled).

Reproduction recipe: Run the JavaFX test case referenced by
https://bugs.freedesktop.org/show_bug.cgi?id=98831#c6 and alt-tab out
of it while it's fullscreen. May take a few attempts to hit the
assertion failure.

Fixes: bab0f450a7 ("present: Fix presentation of flips out of order")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98854
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit e473b2bc01)
2017-01-11 15:04:12 -05:00
Kai-Heng Feng
943e3cbeb0 edid: Add quirk for ADA 1024x600 7" display.
Detailed mode reports 108 mm x 68 mm which is for smaller display.
Maximum image size reports 15 cm x 10 cm which aligns with its physical
size, use this size instead.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 9874f73e88)
2017-01-11 15:04:12 -05:00
Peter Hutterer
cb3057da22 os: return 0 from check_timers if we touched any of them
Fixes a regression introduced in 0b2f30834b. If a driver posts input
events during a timer function (wacom and synaptics do this during tap
timeouts), ProcessInputEvents() is not called for these events. There are no
new events on any fds, so the events just sit in the queue waiting for
something else to happen.

Fix this by simply returning 0 from check_timers if we ran at least one of
them or reset them all. This way the callers ospoll_wait will exit and
continue with normal processing.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2017-01-11 15:04:12 -05:00
Michal Srb
db03742cd3 xinerama: Swap the response in RRXineramaWriteMonitor
Reviewed-by: Adam Jackson <ajax@redhat.com>
2017-01-11 15:04:12 -05:00
Hans De Goede
862c1c43c1 glamor: Trust eglGetPlatformDisplayEXT if it exists
If the libEGL we are using has eglGetPlatformDisplayEXT, yet it still
returns NULL, then this very likely means that it does not support the
type (e.g. EGL_PLATFORM_GBM_MESA) passed in, and then returning NULL is
the right thing to do.

This avoids falling back to an eglGetDisplay() implementation which does
not understands the passed in gbm handle, treats it as a pointer to
something else completely, followed by a crash sooner or later.

Specifically this fixes using the nvidia binary driver, with nvidia's
libEGL + the modesetting driver on a secondary GPU crashing inside
glamor_egl_init() sometimes.

[1.19: squash in typo fix from 29a4f3db - ajax]

Cc: Eric Anholt <eric@anholt.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit 05e1964425)
2017-01-11 15:03:34 -05:00
Mihail Konev
8790bd993a os,dix: Depend custom libs on libs, not objects
The custom os/os.O library reuses *.o files of os/libos.la.

The current rule assumes automake puts all the objects into per-target
am__*_la_OBJECTS variable.  At least with AC_REPLACE_FUNCS, this no
longer holds (as wanted objects are put into LTLIBOBJS instead).

Depend on automake's result, the *.la library instead, to express demand
of any its dependencies being built.

Should be fixing randomly occuring "undefined reference to `strlcpy'"
errors when linking Xvfb and other DDX-es that could use os.O.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Mihail Konev <k.mvc@ya.ru>
(cherry picked from commit 5b74e260e0)
2017-01-11 15:01:36 -05:00
Ben Crocker
8cf47472bf Fix a segfault that occurs if xorg.conf.d is absent:
In InitOutput, if xf86HandleConfigFile returns CONFIG_NOFILE
(which it does if no config file or directory is present), the
autoconfig flag is set, causing xf86AutoConfig to be called
later on.

xf86AutoConfig calls xf86OutputClassDriverList via the
call tree:

xf86AutoConfig =>
  listPossibleVideoDrivers =>
    xf86PlatformMatchDriver =>
      xf86OutputClassDriverList

and xf86OutputClassDriverList attempts to traverse a linked list
that is a member of the XF86ConfigRec struct pointed to by the
global xf86configptr, which is NULL at this point because the
XF86ConfigRec struct is only allocated (by xf86readConfigFile)
AFTER the config file and directory have been successfully
opened; the CONFIG_NOFILE return from xf86HandleConfigFile
occurs BEFORE the call to xf86readConfigFile which allocates
the XF86ConfigRec struct.

Rx: In read.c (for symmetry with xf86freeConfig, which already
appears in this file), add a new function xf86allocateConfig
which tests the value of xf86configptr and, if it's NULL,
allocates the XF86ConfigRec struct and deposits the pointer
in xf86configptr.  In xf86Parser.h, add a prototype for the
new xf86allocateConfig function.

Back in read.c, #include "xf86Config.h".  In xf86readConfigFile,
change the open-code call to calloc to a call to the new
xf86allocateConfig function.

In xf86AutoConfig.c, add a call to the new xf86allocateConfig function
to the beginning of xf86AutoConfig to make sure the XF86ConfigRec struct
is allocated.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Ben Crocker <bcrocker@redhat.com>
(cherry picked from commit 8b335d9068)
2017-01-11 15:00:58 -05:00
Pekka Paalanen
06a3e7ef3b test: fix distributing scripts
Fix the following error on 'make distcheck':

make[6]: *** No rule to make target 'scripts/xvfb-piglit.sh', needed by 'scripts/xvfb-piglit.sh.log'.  Stop.
make[6]: Leaving directory '/home/pq/git/xserver/xorg-server-1.19.99.1/_build/sub/test'
Makefile:1367: recipe for target 'check-TESTS' failed

The setup to trigger this is:
  $ ./configure --prefix=/home/pq/local --disable-docs
  --disable-devel-docs --enable-xwayland --disable-xorg --disable-xvfb
  --disable-xnest --disable-xquartz --disable-xwin --enable-debug

SCRIPT_TESTS is populated conditionally, but we should distribute the
scripts in any case.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
(cherry picked from commit b365c5d168)
2017-01-11 15:00:53 -05:00
Adam Jackson
543287e60a composite: Fix repaint of borders (v2)
When going from border width zero to a non-zero border width, the
Composite extension is informed via the ConfigNotify callback. The
call-chain looks like this: compConfigNotify -> compReallocPixmap ->
compSetPixmap -> TraverseTree -> compSetPixmapVisitWindow. However, at
this time, pWindow->borderWidth was not yet updated. Thus, HasBorder()
is false and the window border will not be repainted.

To fix this, thread the new bw through to the window visitor, and
inspect that rather than HasBorder(). For the other callers of
compSetPixmap the border does not change size, so we can pass
pWin->borderWidth instead.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98499
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit f31875510d)
2017-01-11 15:00:47 -05:00
Hans de Goede
c24c9cc956 randr: rrCheckPixmapBounding: do not shrink the screen_pixmap
The purpose of rrCheckPixmapBounding is to make sure that the
screen_pixmap is *large* enough for the slave-output which crtc is
being configured.

However until now rrCheckPixmapBounding would also shrink the
screen_pixmap in certain scenarios leading to various problems.

For example: Take a laptop with its internalscreen on a slave-output and
currently disabled and an external monitor at 1920x1080+0+0.
Now lets say that we want to drive the external monitor at its native
resolution of 2560x1440 and have the internal screen mirror the top left
part of the external monitor, so we run:

  $ xrandr --output eDP --mode 1920x1080 --pos 0x0 --output HDMI \
  --mode 2560x1440 --pos 0x0

Here xrandr utility first calls RRSetScreenSize to 2560x1440, then it
calls RRSetCrtc 1920x1080+0+0 on the eDP, since this is a slave output,
rrCheckPixmapBounding gets called and resizes the screen_pixmap to
1920x1080, undoing the RRSetScreenSize. Then RRSetCrtc 2560x1440+0+0
gets called on the HDMI, depending on crtc->transforms this will
either result in a BadValue error from ProcRRSetCrtcConfig; or
it will succeed, but the monitor ends up running at 2560x1440
while showing a 1920x1080 screen_pixmap + black borders on the right
and bottom. Neither of which is what we want.

This commit removes the troublesome shrinking behavior, fixing this.

Note:

1) One could argue that this will leave us with a too large screen_pixmap
in some cases, but rrCheckPixmapBounding only gets called for slave
outputs, so xrandr clients already must manually shrink the screen_pixmap
after disabling crtcs in normal setups.

2) An alternative approach would be to also call rrCheckPixmapBounding
on RRSetCrtc on normal (non-slave) outputs, but that would result in
2 unnecessary resizes of the screen_pixmap in the above example, which
seems undesirable.

Cc: Nikhil Mahale <nmahale@nvidia.com>
Cc: Dave Airlie <airlied@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit a46afee84d)
2017-01-11 14:59:53 -05:00
Hans de Goede
26132f57ee randr: rrCheckPixmapBounding: Do not substract crtc non 0 x,y from screen size
The purpose of rrCheckPixmapBounding is to make sure that the
screen_pixmap is large enough for the slave-output which crtc is
being configured.

This should include crtc->x and crtc->y, otherwise the crtc might
still end up scanning out an area outside of the screen-pixmap.

For example: Take a laptop with an external monitor on a slave-output at
1920x1080+0+0 and its internal-screen at 3840x2160+1920+0 and in
gnome-settings-daemon move the external monitor to be on the ri ght of
the internal screen rather then on the left. First g-s-d will do a
RRSetScreenSize to 5760*2160 (which is a nop), then it calls RRSetCrtc
to move the slave output to 1920x1080+3840+0, since this is a slave
output, rrCheckPixmapBounding gets called, since the 2 crtcs now overlap
the code before this commit would shrinks the screen_pixmap to 3180*2160.
Then g-s-d calls RRSetCrtc to move the internal screen to 3180*2160+0+0.

And we end up with the slave-output configured to scan-out an area
which completely falls outside of the screen-pixmap (and end up with
a black display on the external monitor).

This commit fixes this by not substracting the x1 and y1 coordinates
of the union-ed region when determining the new screen_pixmap size.

Cc: Nikhil Mahale <nmahale@nvidia.com>
Cc: Dave Airlie <airlied@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 3b624aa9a9)
2017-01-11 14:59:46 -05:00
Olivier Fourdan
6c51845e6b xwayland: Fix use after free of cursors
Sometimes, Xwayland will try to use a cursor that has just been freed,
leading to a crash when trying to access that cursor data either in
miPointerUpdateSprite() or AnimCurTimerNotify().

CheckMotion() updates the pointer's cursor based on which xwindow
XYToWindow() returns, and Xwayland implements its own xwl_xy_to_window()
to fake a crossing to the root window when the pointer has left the
Wayland surface but is still within the xwindow.

But after an xwindow is unrealized, the last xwindow used to match the
xwindows is cleared so two consecutive calls to xwl_xy_to_window() may
not return the same xwindow.

To avoid this issue, update the last_xwindow based on enter and leave
notifications instead of xwl_xy_to_window(), and check if the xwindow
found by the regular miXYToWindow() is a child of the known last
xwindow, so that multiple consecutive calls to xwl_xy_to_window()
return the same xwindow, being either the one found by miXYToWindow()
or the root window.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1385258
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Tested-by: Vít Ondruch <vondruch@redhat.com>
Tested-by: Satish Balay <balay@fastmail.fm>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
(cherry picked from commit 59ad0e6a41)
2017-01-11 14:59:11 -05:00
Olivier Fourdan
b711efb057 glamor: restore vfunc handlers on init failure
In glamor_init(), if the minimum requirements are not met, glamor may
fail after setting up its own CloseScreen() and DestroyPixmap()
routines, leading to a crash when either of the two routines is called
if glamor failed to complete its initialization, e.g:

  (EE) Backtrace:
  (EE) 0:  Xwayland (OsSigHandler+0x29)
  (EE) 1: /lib64/libpthread.so.0 (__restore_rt+0x0)
  (EE) 2: Xwayland (glamor_sync_close+0x2a)
  (EE) 3: Xwayland (glamor_close_screen+0x52)
  (EE) 4: Xwayland (CursorCloseScreen+0x88)
  (EE) 5: Xwayland (AnimCurCloseScreen+0xa4)
  (EE) 6: Xwayland (present_close_screen+0x42)
  (EE) 7: Xwayland (dix_main+0x4f9)
  (EE) 8: /lib64/libc.so.6 (__libc_start_main+0xf1)
  (EE) 9:  Xwayland (_start+0x2a)

Restore the previous CloseScreen() and DestroyPixmap() vfunc handlers in
case of failure when checking for the minimum requirements, so that if
any of the requirement is not met we don't leave the CloseScreen() and
DestroyPixmap() from glamor handlers in place.

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

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit f43207c1c4)
2017-01-11 14:59:03 -05:00
Peter Hutterer
201ff45c2d Xi: when creating a new master device, update barries for all clients
The previous code only worked when the barrier was created by the same client
as the one calling XIChangeDeviceHierarchy.

http://bugzilla.redhat.com/show_bug.cgi?id=1384432

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
(cherry picked from commit d6a6e1d6ab)
2017-01-11 14:58:51 -05:00
Rui Matos
738c17b7ef xwayland: Don't send KeyRelease events on wl_keyboard::leave
Commits 816015648f and
fee0827a9a made it so that
wl_keyboard::enter doesn't result in X clients getting KeyPress events
while still updating our internal xkb state to be in sync with the
host compositor.

wl_keyboard::leave needs to be handled in the same way as its
semantics from an X client POV should be the same as an X grab getting
triggered, i.e. X clients shouldn't get KeyRelease events for keys
that are still down at that point.

This patch uses LeaveNotify for these events on wl_keyboard::leave and
changes the current use of KeymapNotify to EnterNotify instead just to
keep some symmetry between both cases.

On ProcessDeviceEvent() we still need to deactivate X grabs if needed
for KeyReleases.

Signed-off-by: Rui Matos <tiagomatos@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 5611585b87)
2017-01-11 14:58:44 -05:00
Rhys Kidd
cd8f43e1b0 test: Fix stray Makefile reference to removed os test
Fixes the following warning:

test/Makefile.am:69: warning: variable 'os_LDADD' is defined but no program or
test/Makefile.am:69: library has 'os' as canonical name (possible typo)

Introduced upon the removal of test/os in:

commit 6a5a4e6037
Author: Keith Packard <keithp@keithp.com>
Date:   Tue Dec 8 14:39:46 2015 -0800

    Remove SIGIO support for input [v5]

    This removes all of the SIGIO handling support used for input
    throughout the X server, preparing the way for using threads for input
    handling instead.

    Places calling OsBlockSIGIO and OsReleaseSIGIO are marked with calls
    to stub functions input_lock/input_unlock so that we don't lose this
    information.

    xfree86 SIGIO support is reworked to use internal versions of
    OsBlockSIGIO and OsReleaseSIGIO.

    v2: Don't change locking order (Peter Hutterer)
    v3: Comment weird && FALSE in xf86Helper.c
        Leave errno save/restore in xf86ReadInput
        Squash with stub adding patch (Peter Hutterer)
    v4: Leave UseSIGIO config parameter so that
        existing config files don't break (Peter Hutterer)
    v5: Split a couple of independent patch bits out
        of kinput.c (Peter Hutterer)

    Signed-off-by: Keith Packard <keithp@keithp.com>
    Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit cf8860786c)
2017-01-11 14:56:26 -05:00
Adam Jackson
d6da208695 Revert "damage: Make damageRegionProcessPending take a damage not a drawable"
The commit message makes the assertion that the code below damage is not
allowed to change whether there's a damage monitor for the drawable.
That turns out not to be the case! exa's mixed code, at least, will
create and destroy a damage in PrepareAccess. The destroy path can then
be catastrophic, as damageRegionProcessPending will attempt to
RegionEmpty memory from the middle of a freed block.

I'd wanted that invariant for performance, but faster isn't worth
broken, so revert it. I think what exa's doing is reasonable, so the
better way to improve performance for the unmonitored case is to either
revisit dynamically wrapping into the GC, or inline damage into dix.

This reverts commit 4e124203f2.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1389886
Signed-off-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit 32e632e858)
2016-12-13 09:36:25 -05:00
1637 changed files with 223850 additions and 87607 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 +1 @@
((c-mode . ((c-basic-offset . 4) (indent-tabs-mode . nil))))
((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

82
.gitignore vendored
View file

@ -1,4 +1,82 @@
#
# 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
test-driver
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

View file

@ -16,7 +16,7 @@ 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

130
Makefile.am Normal file
View file

@ -0,0 +1,130 @@
AUTOMAKE_OPTIONS=nostdinc
# Required for automake < 1.14
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
if DRI3
DRI3_DIR=dri3
endif
if PRESENT
PRESENT_DIR=present
endif
if PSEUDORAMIX
PSEUDORAMIX_DIR=pseudoramiX
endif
if GLAMOR
GLAMOR_DIR=glamor
endif
SUBDIRS = \
doc \
man \
include \
dix \
fb \
mi \
Xext \
miext \
os \
randr \
render \
Xi \
xkb \
$(PSEUDORAMIX_DIR) \
$(DBE_DIR) \
$(RECORD_DIR) \
xfixes \
damageext \
$(COMPOSITE_DIR) \
$(GLX_DIR) \
$(PRESENT_DIR) \
$(DRI3_DIR) \
exa \
$(GLAMOR_DIR) \
config \
hw \
test
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 \
pseudoramiX \
randr \
render \
Xi \
xkb \
dbe \
record \
xfixes \
damageext \
composite \
glx \
exa \
glamor \
config \
dri3 \
present \
hw \
test
# gross hack
relink: all
$(AM_V_at)$(MAKE) -C hw relink
install-headers: Makefile
+find . -name Makefile | while read m; do \
if grep -q install-sdkHEADERS $$m; then \
(cd `dirname "$$m"` && make install-sdkHEADERS) \
fi \
done

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.

116
Xext/Makefile.am Normal file
View file

@ -0,0 +1,116 @@
noinst_LTLIBRARIES = libXext.la libXextdpmsstubs.la libXvidmode.la
AM_CFLAGS = $(DIX_CFLAGS)
if XORG
sdk_HEADERS = xvdix.h xvmcext.h geext.h geint.h shmint.h syncsdk.h
endif
# Sources always included in libXextbuiltin.la, libXext.la
BUILTIN_SRCS = \
bigreq.c \
geext.c \
shape.c \
sleepuntil.c \
sleepuntil.h \
sync.c \
syncsdk.h \
syncsrv.h \
xcmisc.c \
xtest.c
BUILTIN_LIBS =
# Optional sources included if extension enabled by configure.ac rules
# MIT Shared Memory extension
MITSHM_SRCS = shm.c shmint.h
if MITSHM
BUILTIN_SRCS += $(MITSHM_SRCS)
endif
# XVideo extension
XV_SRCS = xvmain.c xvdisp.c xvmc.c xvdix.h xvmcext.h xvdisp.h
if XV
BUILTIN_SRCS += $(XV_SRCS)
endif
# XResource extension: lets clients get data about per-client resource usage
RES_SRCS = hashtable.c hashtable.h xres.c
if RES
BUILTIN_SRCS += $(RES_SRCS)
endif
# MIT ScreenSaver extension
SCREENSAVER_SRCS = saver.c
if SCREENSAVER
BUILTIN_SRCS += $(SCREENSAVER_SRCS)
endif
# Xinerama extension: making multiple video devices act as one virtual screen
XINERAMA_SRCS = panoramiX.c panoramiX.h panoramiXh.h panoramiXsrv.h panoramiXprocs.c panoramiXSwap.c
if XINERAMA
BUILTIN_SRCS += $(XINERAMA_SRCS)
if XORG
sdk_HEADERS += panoramiXsrv.h panoramiX.h
endif
endif
# X-ACE extension: provides hooks for building security policy extensions
# like XC-Security, X-SELinux & XTSol
XACE_SRCS = xace.c xace.h xacestr.h
if XACE
BUILTIN_SRCS += $(XACE_SRCS)
if XORG
sdk_HEADERS += xace.h xacestr.h
endif
endif
# SELinux extension: provides SELinux policy support for X objects
# requires X-ACE extension
XSELINUX_SRCS = xselinux_ext.c xselinux_hooks.c xselinux_label.c xselinux.h xselinuxint.h
if XSELINUX
BUILTIN_SRCS += $(XSELINUX_SRCS)
BUILTIN_LIBS += $(SELINUX_LIBS)
endif
# Security extension: multi-level security to protect clients from each other
XCSECURITY_SRCS = security.c securitysrv.h
if XCSECURITY
BUILTIN_SRCS += $(XCSECURITY_SRCS)
endif
# XF86 Big Font extension
BIGFONT_SRCS = xf86bigfont.c xf86bigfontsrv.h
if XF86BIGFONT
BUILTIN_SRCS += $(BIGFONT_SRCS)
endif
# DPMS extension
DPMS_SRCS = dpms.c dpmsproc.h
if DPMSExtension
BUILTIN_SRCS += $(DPMS_SRCS)
endif
# Now take all of the above, mix well, bake for 10 minutes and get libXext*.la
libXext_la_SOURCES = $(BUILTIN_SRCS)
libXext_la_LIBADD = $(BUILTIN_LIBS)
libXextdpmsstubs_la_SOURCES = dpmsstubs.c
# XVidMode extension
libXvidmode_la_SOURCES = vidmode.c
EXTRA_DIST = \
$(MITSHM_SRCS) \
$(XV_SRCS) \
$(RES_SRCS) \
$(SCREENSAVER_SRCS) \
$(XACE_SRCS) \
$(XCSECURITY_SRCS) \
$(XSELINUX_SRCS) \
$(XINERAMA_SRCS) \
$(BIGFONT_SRCS) \
$(DPMS_SRCS) \
$(GE_SRCS)

View file

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

View file

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

View file

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

47
Xext/dpmsstubs.c Normal file
View file

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

View file

@ -23,36 +23,31 @@
* Author: Peter Hutterer, University of South Australia, NICTA
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "windowstr.h"
#include <X11/extensions/ge.h>
#include "geint.h"
#include "geext.h"
#include "protocol-versions.h"
#include "extinit_priv.h"
#include "extinit.h"
DevPrivateKeyRec GEClientPrivateKeyRec;
#define GEClientPrivateKey (&GEClientPrivateKeyRec)
GEExtension GEExtensions[MAXEXTENSIONS];
/** Struct to keep information about registered extensions */
typedef struct _GEExtension {
/** Event swapping routine */
void (*evswap) (xGenericEvent *from, xGenericEvent *to);
} GEExtension, *GEExtensionPtr;
static GEExtension GEExtensions[MAXEXTENSIONS];
typedef struct _GEClientInfo {
CARD32 major_version;
CARD32 minor_version;
} GEClientInfoRec, *GEClientInfoPtr;
#define GEGetClient(pClient) ((GEClientInfoPtr)(dixLookupPrivate(&((pClient)->devPrivates), GEClientPrivateKey)))
/* Major available requests */
static const int version_requests[] = {
X_GEQueryVersion, /* before client sends QueryVersion */
X_GEQueryVersion, /* must be set to last request in version 1 */
};
/* Forward declarations */
static void SGEGenericEvent(xEvent *from, xEvent *to);
#define NUM_VERSION_REQUESTS (sizeof (version_requests) / sizeof (version_requests[0]))
#define EXT_MASK(ext) ((ext) & 0x7F)
/************************************************************/
@ -95,19 +90,31 @@ ProcGEQueryVersion(ClientPtr client)
return Success;
}
static 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);
}
static int (*SProcGEVector[GENumberRequests]) (ClientPtr) = {
/* Version 1.0 */
SProcGEQueryVersion
};
/************************************************************/
/* callbacks */
/************************************************************/
@ -116,29 +123,26 @@ 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);
}
/* Reset extension. Called on server shutdown. */
@ -155,7 +159,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 +181,24 @@ 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 ((extEntry = AddExtension(GE_NAME,
0, GENumberErrors,
ProcGEDispatch, SProcGEDispatch,
GEResetProc, StandardMinorOpcode)) != 0) {
memset(GEExtensions, 0, sizeof(GEExtensions));
EventSwapVector[GenericEvent] = (EventSwapPtr) SGEGenericEvent;
}
else {
FatalError("GEInit: AddExtensions failed.\n");
}
memset(GEExtensions, 0, sizeof(GEExtensions));
EventSwapVector[GenericEvent] = (EventSwapPtr) SGEGenericEvent;
}
/************************************************************/

View file

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

View file

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

View file

@ -1,4 +1,6 @@
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <stdlib.h>
#include "misc.h"
@ -75,13 +77,10 @@ ht_destroy(HashTable ht)
for (c = 0; c < numBuckets; ++c) {
xorg_list_for_each_entry_safe(it, tmp, &ht->buckets[c], l) {
xorg_list_del(&it->l);
free(it->key);
free(it->data);
free(it);
}
}
free(ht->buckets);
free(ht);
}
static Bool
@ -238,7 +237,7 @@ unsigned
ht_generic_hash(void *cdata, const void *ptr, int numBits)
{
HtGenericHashSetupPtr setup = cdata;
return one_at_a_time_hash(ptr, setup->keySize) & ~((~0U) << numBits);
return one_at_a_time_hash(ptr, setup->keySize) & ~((~0) << numBits);
}
int

View file

@ -40,7 +40,7 @@ typedef struct {
int keySize;
} HtGenericHashSetupRec, *HtGenericHashSetupPtr;
/** @brief ht_create initializes a hash table for a certain hash table
/** @brief ht_create initalizes a hash table for a certain hash table
configuration
@param[out] ht The hash table structure to initialize

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,18 @@ 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"
#include "xfixesint.h"
#include "damageextint.h"
#ifdef COMPOSITE
#include "compint.h"
#endif
#include "extinit_priv.h"
#include "extinit.h"
#include "protocol-versions.h"
#ifdef GLXPROXY
@ -744,11 +747,15 @@ PanoramiXMaybeAddDepth(DepthPtr pDepth)
j = PanoramiXNumDepths;
PanoramiXNumDepths++;
PanoramiXDepths = XNFreallocarray(PanoramiXDepths,
PanoramiXNumDepths, sizeof(DepthRec));
PanoramiXDepths = reallocarray(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 = xallocarray(pDepth->numVids, sizeof(VisualID));
else
PanoramiXDepths[j].vids = NULL;
}
static void
@ -789,9 +796,6 @@ PanoramiXMaybeAddVisual(VisualPtr pVisual)
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,11 +821,11 @@ 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) {
@ -984,11 +988,10 @@ ProcPanoramiXGetScreenSize(ClientPtr client)
xPanoramiXGetScreenSizeReply rep;
int rc;
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
if (stuff->screen >= PanoramiXNumScreens)
return BadMatch;
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
return rc;

View file

@ -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"
@ -477,7 +475,7 @@ PanoramiXConfigureWindow(ClientPtr client)
/* because we need the parent */
result = dixLookupResourceByType((void **) &pWin, stuff->window,
X11_RESTYPE_WINDOW, client, DixWriteAccess);
RT_WINDOW, client, DixWriteAccess);
if (result != Success)
return result;
@ -1052,7 +1050,7 @@ PanoramiXClearToBackground(ClientPtr client)
int
PanoramiXCopyArea(ClientPtr client)
{
int j, result, srcx, srcy, dstx, dsty, width, height;
int j, result, srcx, srcy, dstx, dsty;
PanoramiXRes *gc, *src, *dst;
Bool srcIsRoot = FALSE;
Bool dstIsRoot = FALSE;
@ -1093,8 +1091,6 @@ PanoramiXCopyArea(ClientPtr client)
srcy = stuff->srcY;
dstx = stuff->dstX;
dsty = stuff->dstY;
width = stuff->width;
height = stuff->height;
if ((dst->type == XRT_PIXMAP) && (src->type == XRT_WINDOW)) {
DrawablePtr drawables[MAXSCREENS];
DrawablePtr pDst;
@ -1107,18 +1103,15 @@ PanoramiXCopyArea(ClientPtr client)
DixGetAttrAccess);
if (rc != Success)
return rc;
drawables[j]->pScreen->SourceValidate(drawables[j], 0, 0,
drawables[j]->width,
drawables[j]->height,
IncludeInferiors);
}
pitch = PixmapBytePad(width, drawables[0]->depth);
if (!(data = calloc(height, pitch)))
pitch = PixmapBytePad(stuff->width, drawables[0]->depth);
if (!(data = calloc(stuff->height, pitch)))
return BadAlloc;
XineramaGetImageData(drawables, srcx, srcy, width, height, ZPixmap, ~0,
data, pitch, srcIsRoot);
XineramaGetImageData(drawables, srcx, srcy,
stuff->width, stuff->height, ZPixmap, ~0, data,
pitch, srcIsRoot);
FOR_NSCREENS_BACKWARD(j) {
stuff->gc = gc->info[j].id;
@ -1130,63 +1123,14 @@ PanoramiXCopyArea(ClientPtr client)
}
(*pGC->ops->PutImage) (pDst, pGC, pDst->depth, dstx, dsty,
width, height, 0, ZPixmap, data);
stuff->width, stuff->height,
0, ZPixmap, data);
if (dstShared)
break;
}
free(data);
if (pGC->graphicsExposures) {
RegionRec rgn;
int dx, dy;
BoxRec sourceBox;
dx = drawables[0]->x;
dy = drawables[0]->y;
if (srcIsRoot) {
dx += screenInfo.screens[0]->x;
dy += screenInfo.screens[0]->y;
}
sourceBox.x1 = min(srcx + dx, 0);
sourceBox.y1 = min(srcy + dy, 0);
sourceBox.x2 = max(sourceBox.x1 + width, 32767);
sourceBox.y2 = max(sourceBox.y1 + height, 32767);
RegionInit(&rgn, &sourceBox, 1);
/* subtract the (screen-space) clips of the source drawables */
FOR_NSCREENS(j) {
ScreenPtr screen = screenInfo.screens[j];
RegionPtr sd;
if (pGC->subWindowMode == IncludeInferiors)
sd = NotClippedByChildren((WindowPtr)drawables[j]);
else
sd = &((WindowPtr)drawables[j])->clipList;
if (srcIsRoot)
RegionTranslate(&rgn, -screen->x, -screen->y);
RegionSubtract(&rgn, &rgn, sd);
if (srcIsRoot)
RegionTranslate(&rgn, screen->x, screen->y);
if (pGC->subWindowMode == IncludeInferiors)
RegionDestroy(sd);
}
/* -dx/-dy to get back to dest-relative, plus request offsets */
RegionTranslate(&rgn, -dx + dstx, -dy + dsty);
/* intersect with gc clip; just one screen is fine because pixmap */
RegionIntersect(&rgn, &rgn, pGC->pCompositeClip);
/* and expose */
SendGraphicsExpose(client, &rgn, dst->info[0].id, X_CopyArea, 0);
RegionUninit(&rgn);
}
}
else {
DrawablePtr pDst = NULL, pSrc = NULL;
@ -2013,12 +1957,6 @@ PanoramiXGetImage(ClientPtr client)
if (rc != Success)
return rc;
}
FOR_NSCREENS_FORWARD(i) {
drawables[i]->pScreen->SourceValidate(drawables[i], 0, 0,
drawables[i]->width,
drawables[i]->height,
IncludeInferiors);
}
xgi = (xGetImageReply) {
.type = X_Reply,

View file

@ -26,18 +26,12 @@ in this Software without prior written authorization from the X Consortium.
* Author: Keith Packard, MIT X Consortium
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <stdio.h>
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/extensions/saverproto.h>
#include "dix/colormap_priv.h"
#include "dix/dix_priv.h"
#include "os/osdep.h"
#include "os/screensaver.h"
#include "misc.h"
#include "os.h"
#include "windowstr.h"
@ -47,35 +41,51 @@ in this Software without prior written authorization from the X Consortium.
#include "dixstruct.h"
#include "resource.h"
#include "opaque.h"
#include <X11/extensions/saverproto.h>
#include "gcstruct.h"
#include "cursorstr.h"
#include "colormapst.h"
#include "xace.h"
#include "inputstr.h"
#ifdef XINERAMA
#ifdef PANORAMIX
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif /* XINERAMA */
#endif
#ifdef DPMSExtension
#include <X11/extensions/dpmsconst.h>
#include "dpmsproc.h"
#endif
#include "protocol-versions.h"
#include "extinit_priv.h"
// temporary workaround for win32/mingw32 name clash
// see: https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1355
#undef CreateWindow
#include <stdio.h>
#include "extinit.h"
static int ScreenSaverEventBase = 0;
static Bool ScreenSaverHandle(ScreenPtr pScreen, int xstate, Bool force);
static Bool CreateSaverWindow(ScreenPtr pScreen);
static Bool DestroySaverWindow(ScreenPtr pScreen);
static void UninstallSaverColormap(ScreenPtr pScreen);
static void CheckScreenPrivate(ScreenPtr pScreen);
static void SScreenSaverNotifyEvent(xScreenSaverNotifyEvent *from,
xScreenSaverNotifyEvent *to);
static Bool ScreenSaverHandle(ScreenPtr /* pScreen */ ,
int /* xstate */ ,
Bool /* force */
);
static Bool
CreateSaverWindow(ScreenPtr /* pScreen */
);
static Bool
DestroySaverWindow(ScreenPtr /* pScreen */
);
static void
UninstallSaverColormap(ScreenPtr /* pScreen */
);
static void
CheckScreenPrivate(ScreenPtr /* pScreen */
);
static void SScreenSaverNotifyEvent(xScreenSaverNotifyEvent * /* from */ ,
xScreenSaverNotifyEvent * /* to */
);
static RESTYPE SuspendType; /* resource type for suspension records */
@ -182,6 +192,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 +216,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 +266,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;
@ -353,7 +365,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;
@ -414,7 +426,7 @@ SendScreenSaverNotify(ScreenPtr pScreen, int state, Bool forced)
}
}
static void _X_COLD
static void
SScreenSaverNotifyEvent(xScreenSaverNotifyEvent * from,
xScreenSaverNotifyEvent * to)
{
@ -437,7 +449,7 @@ UninstallSaverColormap(ScreenPtr pScreen)
if (pPriv && pPriv->installedMap != None) {
rc = dixLookupResourceByType((void **) &pCmap, pPriv->installedMap,
X11_RESTYPE_COLORMAP, serverClient,
RT_COLORMAP, serverClient,
DixUninstallAccess);
if (rc == Success)
(*pCmap->pScreen->UninstallColormap) (pCmap);
@ -461,7 +473,7 @@ CreateSaverWindow(ScreenPtr pScreen)
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 +497,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;
@ -505,7 +517,7 @@ CreateSaverWindow(ScreenPtr pScreen)
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);
@ -533,7 +545,7 @@ CreateSaverWindow(ScreenPtr pScreen)
if (wantMap == None || IsMapInstalled(wantMap, pWin))
return TRUE;
result = dixLookupResourceByType((void **) &pCmap, wantMap, X11_RESTYPE_COLORMAP,
result = dixLookupResourceByType((void **) &pCmap, wantMap, RT_COLORMAP,
serverClient, DixInstallAccess);
if (result != Success)
return TRUE;
@ -557,7 +569,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 +600,9 @@ ScreenSaverHandle(ScreenPtr pScreen, int xstate, Bool force)
ret = TRUE;
}
#ifdef XINERAMA
#ifdef PANORAMIX
if (noPanoramiXExtension || !pScreen->myNum)
#endif /* XINERAMA */
#endif
SendScreenSaverNotify(pScreen, state, force);
return ret;
}
@ -611,8 +623,6 @@ ProcScreenSaverQueryVersion(ClientPtr client)
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.majorVersion);
swaps(&rep.minorVersion);
}
WriteToClient(client, sizeof(xScreenSaverQueryVersionReply), &rep);
return Success;
@ -634,7 +644,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;
@ -703,7 +714,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 +725,9 @@ ProcScreenSaverSelectInput(ClientPtr client)
}
static int
ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
ScreenSaverSetAttributes(ClientPtr client)
{
REQUEST(xScreenSaverSetAttributesReq);
DrawablePtr pDraw;
WindowPtr pParent;
ScreenPtr pScreen;
@ -737,6 +750,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 +758,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) {
@ -833,7 +847,7 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
if (!pPriv)
return FALSE;
}
pAttr = calloc(1, sizeof(ScreenSaverAttrRec));
pAttr = New(ScreenSaverAttrRec);
if (!pAttr) {
ret = BadAlloc;
goto bail;
@ -884,7 +898,7 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
else {
ret =
dixLookupResourceByType((void **) &pPixmap, pixID,
X11_RESTYPE_PIXMAP, client, DixReadAccess);
RT_PIXMAP, client, DixReadAccess);
if (ret == Success) {
if ((pPixmap->drawable.depth != depth) ||
(pPixmap->drawable.pScreen != pScreen)) {
@ -916,7 +930,7 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
else {
ret =
dixLookupResourceByType((void **) &pPixmap, pixID,
X11_RESTYPE_PIXMAP, client, DixReadAccess);
RT_PIXMAP, client, DixReadAccess);
if (ret == Success) {
if ((pPixmap->drawable.depth != depth) ||
(pPixmap->drawable.pScreen != pScreen)) {
@ -999,7 +1013,7 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
break;
case CWColormap:
cmap = (Colormap) * pVlist;
ret = dixLookupResourceByType((void **) &pCmap, cmap, X11_RESTYPE_COLORMAP,
ret = dixLookupResourceByType((void **) &pCmap, cmap, RT_COLORMAP,
client, DixUseAccess);
if (ret != Success) {
client->errorValue = cmap;
@ -1019,7 +1033,7 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
}
else {
ret = dixLookupResourceByType((void **) &pCursor, cursorID,
X11_RESTYPE_CURSOR, client, DixUseAccess);
RT_CURSOR, client, DixUseAccess);
if (ret != Success) {
client->errorValue = cursorID;
goto PatchUp;
@ -1036,7 +1050,7 @@ 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))
@ -1053,13 +1067,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 +1092,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 +1103,15 @@ ProcScreenSaverSetAttributes(ClientPtr client)
int pback_offset = 0, pbord_offset = 0, cmap_offset = 0;
XID orig_visual, tmp;
REQUEST_AT_LEAST_SIZE(xScreenSaverSetAttributesReq);
status = dixLookupResourceByClass((void **) &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;
@ -1149,83 +1166,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,
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));
@ -1253,47 +1259,59 @@ ProcScreenSaverSuspend(ClientPtr client)
}
static int (*NormalVector[]) (ClientPtr /* client */ ) = {
ProcScreenSaverQueryVersion,
ProcScreenSaverQueryVersion,
ProcScreenSaverQueryInfo,
ProcScreenSaverSelectInput,
ProcScreenSaverSetAttributes,
ProcScreenSaverUnsetAttributes,
ProcScreenSaverSuspend,
};
ProcScreenSaverUnsetAttributes, ProcScreenSaverSuspend,};
#define NUM_REQUESTS ((sizeof NormalVector) / (sizeof NormalVector[0]))
static int
ProcScreenSaverDispatch(ClientPtr client)
{
REQUEST(xReq);
if (stuff->data < ARRAY_SIZE(NormalVector))
if (stuff->data < NUM_REQUESTS)
return (*NormalVector[stuff->data]) (client);
return BadRequest;
}
static int _X_COLD
static int
SProcScreenSaverQueryVersion(ClientPtr client)
{
REQUEST(xScreenSaverQueryVersionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xScreenSaverQueryVersionReq);
return ProcScreenSaverQueryVersion(client);
}
static int
SProcScreenSaverQueryInfo(ClientPtr client)
{
REQUEST(xScreenSaverQueryInfoReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xScreenSaverQueryInfoReq);
swapl(&stuff->drawable);
return ProcScreenSaverQueryInfo(client);
}
static int _X_COLD
static int
SProcScreenSaverSelectInput(ClientPtr client)
{
REQUEST(xScreenSaverSelectInputReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xScreenSaverSelectInputReq);
swapl(&stuff->drawable);
swapl(&stuff->eventMask);
return ProcScreenSaverSelectInput(client);
}
static int _X_COLD
static int
SProcScreenSaverSetAttributes(ClientPtr client)
{
REQUEST(xScreenSaverSetAttributesReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xScreenSaverSetAttributesReq);
swapl(&stuff->drawable);
swaps(&stuff->x);
@ -1307,39 +1325,39 @@ SProcScreenSaverSetAttributes(ClientPtr client)
return ProcScreenSaverSetAttributes(client);
}
static int _X_COLD
static int
SProcScreenSaverUnsetAttributes(ClientPtr client)
{
REQUEST(xScreenSaverUnsetAttributesReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xScreenSaverUnsetAttributesReq);
swapl(&stuff->drawable);
return ProcScreenSaverUnsetAttributes(client);
}
static int _X_COLD
static int
SProcScreenSaverSuspend(ClientPtr client)
{
REQUEST(xScreenSaverSuspendReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xScreenSaverSuspendReq);
swapl(&stuff->suspend);
return ProcScreenSaverSuspend(client);
}
static int (*SwappedVector[]) (ClientPtr /* client */ ) = {
ProcScreenSaverQueryVersion,
SProcScreenSaverQueryVersion,
SProcScreenSaverQueryInfo,
SProcScreenSaverSelectInput,
SProcScreenSaverSetAttributes,
SProcScreenSaverUnsetAttributes,
SProcScreenSaverSuspend,
};
SProcScreenSaverUnsetAttributes, SProcScreenSaverSuspend,};
static int _X_COLD
static int
SProcScreenSaverDispatch(ClientPtr client)
{
REQUEST(xReq);
if (stuff->data < ARRAY_SIZE(NormalVector))
if (stuff->data < NUM_REQUESTS)
return (*SwappedVector[stuff->data]) (client);
return BadRequest;
}

View file

@ -24,19 +24,9 @@ in this Software without prior written authorization from The Open Group.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#include <X11/Xmd.h>
#include <X11/extensions/securproto.h>
#include <X11/Xfuncproto.h>
#include "dix/dix_priv.h"
#include "dix/registry_priv.h"
#include "include/extinit_priv.h"
#include "os/audit.h"
#include "os/auth.h"
#include "os/client_priv.h"
#include "os/osdep.h"
#endif
#include "scrnintstr.h"
#include "inputstr.h"
@ -44,8 +34,10 @@ in this Software without prior written authorization from The Open Group.
#include "propertyst.h"
#include "colormapst.h"
#include "privates.h"
#include "registry.h"
#include "xacestr.h"
#include "securitysrv.h"
#include <X11/extensions/securproto.h>
#include "extinit.h"
#include "protocol-versions.h"
@ -155,7 +147,7 @@ SecurityLabelInitial(void)
/*
* Looks up a request name
*/
static inline const char *
static _X_INLINE const char *
SecurityLookupRequestName(ClientPtr client)
{
return LookupRequestName(client->majorOp, client->minorOp);
@ -206,7 +198,7 @@ SecurityDeleteAuthorization(void *value, XID id)
.authId = pAuth->id
};
WriteEventsToClient(rClient(pEventClient), 1, (xEvent *) &are);
FreeResource(pEventClient->resource, X11_RESTYPE_NONE);
FreeResource(pEventClient->resource, RT_NONE);
}
/* kill all clients using this auth */
@ -312,7 +304,7 @@ SecurityAuthorizationExpired(OsTimerPtr timer, CARD32 time, void *pval)
pAuth->secondsRemaining);
}
else {
FreeResource(pAuth->id, X11_RESTYPE_NONE);
FreeResource(pAuth->id, RT_NONE);
return 0;
}
} /* SecurityAuthorizationExpired */
@ -376,7 +368,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;
@ -588,7 +580,7 @@ ProcSecurityRevokeAuthorization(ClientPtr client)
if (rc != Success)
return rc;
FreeResource(stuff->authId, X11_RESTYPE_NONE);
FreeResource(stuff->authId, RT_NONE);
return Success;
} /* ProcSecurityRevokeAuthorization */
@ -609,23 +601,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 +629,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 +665,7 @@ SProcSecurityDispatch(ClientPtr client)
}
} /* SProcSecurityDispatch */
static void _X_COLD
static void
SwapSecurityAuthorizationRevokedEvent(xSecurityAuthorizationRevokedEvent * from,
xSecurityAuthorizationRevokedEvent * to)
{
@ -749,12 +747,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 +761,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;

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,9 +41,10 @@ in this Software without prior written authorization from The Open Group.
#include "dixstruct.h"
#include "resource.h"
#include "opaque.h"
#include <X11/extensions/shapeproto.h>
#include "regionstr.h"
#include "gcstruct.h"
#include "extinit_priv.h"
#include "extinit.h"
#include "protocol-versions.h"
typedef RegionPtr (*CreateDftPtr) (WindowPtr /* pWin */
@ -65,10 +64,10 @@ static void SShapeNotifyEvent(xShapeNotifyEvent * /* from */ ,
* externally by the Xfixes extension and are now defined in window.h
*/
#ifdef XINERAMA
#ifdef PANORAMIX
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif /* XINERAMA */
#endif
static int ShapeEventBase = 0;
static RESTYPE ClientType, ShapeEventType; /* resource types for event masks */
@ -266,7 +265,7 @@ ProcShapeRectangles(ClientPtr client)
client->errorValue = stuff->ordering;
return BadValue;
}
nrects = ((client->req_len << 2) - sizeof(xShapeRectanglesReq));
nrects = ((stuff->length << 2) - sizeof(xShapeRectanglesReq));
if (nrects & 4)
return BadLength;
nrects >>= 3;
@ -297,7 +296,7 @@ ProcShapeRectangles(ClientPtr client)
stuff->xOff, stuff->yOff, createDefault);
}
#ifdef XINERAMA
#ifdef PANORAMIX
static int
ProcPanoramiXShapeRectangles(ClientPtr client)
{
@ -320,7 +319,7 @@ ProcPanoramiXShapeRectangles(ClientPtr client)
}
return result;
}
#endif /* XINERAMA */
#endif
/**************
* ProcShapeMask
@ -363,7 +362,7 @@ ProcShapeMask(ClientPtr client)
srcRgn = 0;
else {
rc = dixLookupResourceByType((void **) &pPixmap, stuff->src,
X11_RESTYPE_PIXMAP, client, DixReadAccess);
RT_PIXMAP, client, DixReadAccess);
if (rc != Success)
return rc;
if (pPixmap->drawable.pScreen != pScreen ||
@ -395,7 +394,7 @@ ProcShapeMask(ClientPtr client)
stuff->xOff, stuff->yOff, createDefault);
}
#ifdef XINERAMA
#ifdef PANORAMIX
static int
ProcPanoramiXShapeMask(ClientPtr client)
{
@ -429,7 +428,7 @@ ProcPanoramiXShapeMask(ClientPtr client)
}
return result;
}
#endif /* XINERAMA */
#endif
/************
* ProcShapeCombine
@ -523,7 +522,7 @@ ProcShapeCombine(ClientPtr client)
stuff->xOff, stuff->yOff, createDefault);
}
#ifdef XINERAMA
#ifdef PANORAMIX
static int
ProcPanoramiXShapeCombine(ClientPtr client)
{
@ -552,7 +551,7 @@ ProcPanoramiXShapeCombine(ClientPtr client)
}
return result;
}
#endif /* XINERAMA */
#endif
/*************
* ProcShapeOffset
@ -594,7 +593,7 @@ ProcShapeOffset(ClientPtr client)
return Success;
}
#ifdef XINERAMA
#ifdef PANORAMIX
static int
ProcPanoramiXShapeOffset(ClientPtr client)
{
@ -617,7 +616,7 @@ ProcPanoramiXShapeOffset(ClientPtr client)
}
return result;
}
#endif /* XINERAMA */
#endif
static int
ProcShapeQueryExtents(ClientPtr client)
@ -784,7 +783,7 @@ ProcShapeSelectInput(ClientPtr client)
if (!pHead ||
!AddResource(pWin->drawable.id, ShapeEventType,
(void *) pHead)) {
FreeResource(clientResource, X11_RESTYPE_NONE);
FreeResource(clientResource, RT_NONE);
return BadAlloc;
}
*pHead = 0;
@ -1035,32 +1034,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 +1074,7 @@ ProcShapeDispatch(ClientPtr client)
}
}
static void _X_COLD
static void
SShapeNotifyEvent(xShapeNotifyEvent * from, xShapeNotifyEvent * to)
{
to->type = from->type;
@ -1090,10 +1089,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 +1112,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 +1126,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 +1140,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 +1153,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,21 @@ 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,8 +52,11 @@ 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 <sys/mman.h>
#include "protocol-versions.h"
#include "busfault.h"
/* Needed for Solaris cross-zone shared memory extension */
#ifdef HAVE_SHMCTL64
@ -90,10 +85,12 @@ in this Software without prior written authorization from The Open Group.
#define SHMPERM_MODE(p) p->mode
#endif
#ifdef XINERAMA
#ifdef PANORAMIX
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif /* XINERAMA */
#endif
#include "extinit.h"
typedef struct _ShmScrPrivateRec {
CloseScreenProcPtr CloseScreen;
@ -210,7 +207,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;
@ -251,14 +248,13 @@ 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);
pScreen->DestroyPixmap = screen_priv->destroyPixmap;
if (pScreen->DestroyPixmap)
ret = pScreen->DestroyPixmap(pPixmap);
ret = (*pScreen->DestroyPixmap) (pPixmap);
screen_priv->destroyPixmap = pScreen->DestroyPixmap;
pScreen->DestroyPixmap = ShmDestroyPixmap;
@ -304,8 +300,8 @@ ProcShmQueryVersion(ClientPtr client)
}
/*
* Simulate the access() system call for a shared memory segment,
* using the credentials from the client if available.
* Simulate the access() system call for a shared memory segement,
* using the credentials from the client if available
*/
static int
shm_access(ClientPtr client, SHMPERM_TYPE * perm, int readonly)
@ -460,7 +456,7 @@ ProcShmDetach(ClientPtr client)
REQUEST_SIZE_MATCH(xShmDetachReq);
VERIFY_SHMSEG(stuff->shmseg, shmdesc, client);
FreeResource(stuff->shmseg, X11_RESTYPE_NONE);
FreeResource(stuff->shmseg, RT_NONE);
return Success;
}
@ -482,8 +478,8 @@ doShmPutImage(DrawablePtr dst, GCPtr pGC,
PixmapBytePad(w, depth), data);
if (!pPixmap)
return;
(void) pGC->ops->CopyArea((DrawablePtr) pPixmap, dst, pGC,
sx, sy, sw, sh, dx, dy);
pGC->ops->CopyArea((DrawablePtr) pPixmap, dst, pGC, sx, sy, sw, sh, dx,
dy);
FreeScratchPixmapHeader(pPixmap);
}
else {
@ -654,11 +650,9 @@ ProcShmGetImage(ClientPtr client)
wBorderWidth((WindowPtr) pDraw) + (int) pDraw->height)
return BadMatch;
visual = wVisual(((WindowPtr) pDraw));
if (pDraw->type == DRAWABLE_WINDOW)
pVisibleRegion = &((WindowPtr) pDraw)->borderClip;
pDraw->pScreen->SourceValidate(pDraw, stuff->x, stuff->y,
stuff->width, stuff->height,
IncludeInferiors);
pVisibleRegion = NotClippedByChildren((WindowPtr) pDraw);
if (pVisibleRegion)
RegionTranslate(pVisibleRegion, -pDraw->x, -pDraw->y);
}
else {
if (stuff->x < 0 ||
@ -721,6 +715,9 @@ ProcShmGetImage(ClientPtr client)
}
}
if (pVisibleRegion)
RegionDestroy(pVisibleRegion);
if (client->swapped) {
swaps(&xgi.sequenceNumber);
swapl(&xgi.length);
@ -732,7 +729,7 @@ ProcShmGetImage(ClientPtr client)
return Success;
}
#ifdef XINERAMA
#ifdef PANORAMIX
static int
ProcPanoramiXShmPutImage(ClientPtr client)
{
@ -841,19 +838,6 @@ ProcPanoramiXShmGetImage(ClientPtr client)
return BadMatch;
}
if (format == ZPixmap) {
widthBytesLine = PixmapBytePad(w, pDraw->depth);
length = widthBytesLine * h;
}
else {
widthBytesLine = PixmapBytePad(w, 1);
lenPer = widthBytesLine * h;
plane = ((Mask) 1) << (pDraw->depth - 1);
length = lenPer * Ones(planemask & (plane | (plane - 1)));
}
VERIFY_SHMSIZE(shmdesc, stuff->offset, length, client);
drawables = calloc(PanoramiXNumScreens, sizeof(DrawablePtr));
if (!drawables)
return BadAlloc;
@ -867,12 +851,6 @@ ProcPanoramiXShmGetImage(ClientPtr client)
return rc;
}
}
FOR_NSCREENS_FORWARD(i) {
drawables[i]->pScreen->SourceValidate(drawables[i], 0, 0,
drawables[i]->width,
drawables[i]->height,
IncludeInferiors);
}
xgi = (xShmGetImageReply) {
.type = X_Reply,
@ -882,6 +860,18 @@ ProcPanoramiXShmGetImage(ClientPtr client)
.depth = pDraw->depth
};
if (format == ZPixmap) {
widthBytesLine = PixmapBytePad(w, pDraw->depth);
length = widthBytesLine * h;
}
else {
widthBytesLine = PixmapBytePad(w, 1);
lenPer = widthBytesLine * h;
plane = ((Mask) 1) << (pDraw->depth - 1);
length = lenPer * Ones(planemask & (plane | (plane - 1)));
}
VERIFY_SHMSIZE(shmdesc, stuff->offset, length, client);
xgi.size = length;
if (length == 0) { /* nothing to do */
@ -997,8 +987,8 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
stuff->offset);
if (pMap) {
result = XaceHookResourceAccess(client, stuff->pid,
X11_RESTYPE_PIXMAP, pMap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
result = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid,
RT_PIXMAP, pMap, RT_NONE, NULL, DixCreateAccess);
if (result != Success) {
pDraw->pScreen->DestroyPixmap(pMap);
break;
@ -1007,7 +997,7 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
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, (void *) pMap)) {
result = BadAlloc;
break;
}
@ -1020,7 +1010,7 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
if (result != Success) {
while (j--)
FreeResource(newPix->info[j].id, X11_RESTYPE_NONE);
FreeResource(newPix->info[j].id, RT_NONE);
free(newPix);
}
else
@ -1028,7 +1018,7 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
return result;
}
#endif /* XINERAMA */
#endif
static PixmapPtr
fbShmCreatePixmap(ScreenPtr pScreen,
@ -1112,8 +1102,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,7 +1112,7 @@ 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, (void *) pMap)) {
return Success;
}
}
@ -1140,7 +1130,7 @@ ShmBusfaultNotify(void *context)
(unsigned int) shmdesc->resource);
busfault_unregister(shmdesc->busfault);
shmdesc->busfault = NULL;
FreeResource (shmdesc->resource, X11_RESTYPE_NONE);
FreeResource (shmdesc->resource, RT_NONE);
}
static int
@ -1207,55 +1197,31 @@ ProcShmAttachFd(ClientPtr client)
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 SHMDIR
int fd;
int flags;
char template[] = SHMDIR "/shmfd-XXXXXX";
#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");
fd = open(SHMDIR, O_TMPFILE|O_RDWR|O_CLOEXEC|O_EXCL, 0666);
if (fd >= 0) {
ErrorF ("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);
fd = mkstemp(template);
if (fd < 0)
return -1;
unlink(template);
flags = fcntl(fd, F_GETFD);
if (flags != -1) {
flags |= FD_CLOEXEC;
(void) fcntl(fd, F_SETFD, &flags);
}
return fd;
#else
fd = mkstemp(template);
return -1;
#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
@ -1272,7 +1238,6 @@ ProcShmCreateSegment(ClientPtr client)
};
REQUEST_SIZE_MATCH(xShmCreateSegmentReq);
LEGAL_NEW_RESOURCE(stuff->shmseg, client);
if ((stuff->readOnly != xTrue) && (stuff->readOnly != xFalse)) {
client->errorValue = stuff->readOnly;
return BadValue;
@ -1322,7 +1287,7 @@ ProcShmCreateSegment(ClientPtr client)
}
if (WriteFdToClient(client, fd, TRUE) < 0) {
FreeResource(stuff->shmseg, X11_RESTYPE_NONE);
FreeResource(stuff->shmseg, RT_NONE);
close(fd);
return BadAlloc;
}
@ -1335,35 +1300,30 @@ 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 */
#endif
return ProcShmCreatePixmap(client);
#ifdef SHM_FD_PASSING
case X_ShmAttachFd:
@ -1376,7 +1336,7 @@ ProcShmDispatch(ClientPtr client)
}
}
static void _X_COLD
static void
SShmCompletionEvent(xShmCompletionEvent * from, xShmCompletionEvent * to)
{
to->type = from->type;
@ -1388,29 +1348,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 +1399,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 +1416,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);
@ -1458,20 +1432,22 @@ SProcShmCreatePixmap(ClientPtr client)
}
#ifdef SHM_FD_PASSING
static int _X_COLD
static int
SProcShmAttachFd(ClientPtr client)
{
REQUEST(xShmAttachFdReq);
SetReqFds(client, 1);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShmAttachFdReq);
swapl(&stuff->shmseg);
return ProcShmAttachFd(client);
}
static int _X_COLD
static int
SProcShmCreateSegment(ClientPtr client)
{
REQUEST(xShmCreateSegmentReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShmCreateSegmentReq);
swapl(&stuff->shmseg);
swapl(&stuff->size);
@ -1479,18 +1455,13 @@ SProcShmCreateSegment(ClientPtr 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:

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>
@ -123,7 +125,8 @@ ClientSleepUntil(ClientPtr client,
static void
ClientAwaken(ClientPtr client, void *closure)
{
AttendClient(client);
if (!client->clientGone)
AttendClient(client);
}
static int
@ -164,7 +167,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
@ -193,7 +196,7 @@ 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,

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

@ -67,19 +67,19 @@ typedef enum {
} SyncCounterType;
typedef void (*SyncSystemCounterQueryValue)(void *counter,
int64_t *value_return
CARD64 *value_return
);
typedef void (*SyncSystemCounterBracketValues)(void *counter,
int64_t *pbracket_less,
int64_t *pbracket_greater
CARD64 *pbracket_less,
CARD64 *pbracket_greater
);
typedef struct _SysCounterInfo {
SyncCounter *pCounter;
char *name;
int64_t resolution;
int64_t bracket_greater;
int64_t bracket_less;
CARD64 resolution;
CARD64 bracket_greater;
CARD64 bracket_less;
SyncCounterType counterType; /* how can this counter change */
SyncSystemCounterQueryValue QueryValue;
SyncSystemCounterBracketValues BracketValues;
@ -97,7 +97,7 @@ typedef struct _SyncAlarm {
SyncTrigger trigger;
ClientPtr client;
XSyncAlarm alarm_id;
int64_t delta;
CARD64 delta;
int events;
int state;
SyncAlarmClientList *pEventClients;
@ -111,7 +111,7 @@ typedef struct {
typedef struct {
SyncTrigger trigger;
int64_t event_threshold;
CARD64 event_threshold;
SyncAwaitHeader *pHeader;
} SyncAwait;
@ -121,15 +121,16 @@ typedef union {
} SyncAwaitUnion;
extern SyncCounter* SyncCreateSystemCounter(const char *name,
int64_t initial_value,
int64_t resolution,
CARD64 initial_value,
CARD64 resolution,
SyncCounterType counterType,
SyncSystemCounterQueryValue QueryValue,
SyncSystemCounterBracketValues BracketValues
);
extern void SyncChangeCounter(SyncCounter *pCounter,
int64_t new_value);
CARD64 new_value
);
extern void SyncDestroySystemCounter(void *pCounter);

View file

@ -29,7 +29,9 @@ from Kaleb S. KEITHLEY
*/
/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifdef XF86VIDMODE
@ -275,8 +277,8 @@ ProcVidModeGetModeLine(ClientPtr client)
/*
* Older servers sometimes had server privates that the VidMode
* extension made available. So to be compatible pretend that
* there are no server privates to pass to the client.
* extention made available. So to be compatiable pretend that
* there are no server privates to pass to the client
*/
rep.privsize = 0;
@ -452,24 +454,10 @@ ProcVidModeAddModeLine(ClientPtr client)
DEBUG_P("XF86VidModeAddModeline");
ver = ClientMajorVersion(client);
if (ver < 2) {
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeAddModeLineReq);
len =
client->req_len -
bytes_to_int32(sizeof(xXF86OldVidModeAddModeLineReq));
}
else {
REQUEST_AT_LEAST_SIZE(xXF86VidModeAddModeLineReq);
len =
client->req_len -
bytes_to_int32(sizeof(xXF86VidModeAddModeLineReq));
}
if (ver < 2) {
/* convert from old format */
stuff = &newstuff;
stuff->length = client->req_len;
stuff->length = oldstuff->length;
stuff->screen = oldstuff->screen;
stuff->dotclock = oldstuff->dotclock;
stuff->hdisplay = oldstuff->hdisplay;
@ -513,6 +501,18 @@ ProcVidModeAddModeLine(ClientPtr client)
stuff->after_vsyncend, stuff->after_vtotal,
(unsigned long) stuff->after_flags);
if (ver < 2) {
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeAddModeLineReq);
len =
client->req_len -
bytes_to_int32(sizeof(xXF86OldVidModeAddModeLineReq));
}
else {
REQUEST_AT_LEAST_SIZE(xXF86VidModeAddModeLineReq);
len =
client->req_len -
bytes_to_int32(sizeof(xXF86VidModeAddModeLineReq));
}
if (len != stuff->privsize)
return BadLength;
@ -622,24 +622,10 @@ ProcVidModeDeleteModeLine(ClientPtr client)
DEBUG_P("XF86VidModeDeleteModeline");
ver = ClientMajorVersion(client);
if (ver < 2) {
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeDeleteModeLineReq);
len =
client->req_len -
bytes_to_int32(sizeof(xXF86OldVidModeDeleteModeLineReq));
}
else {
REQUEST_AT_LEAST_SIZE(xXF86VidModeDeleteModeLineReq);
len =
client->req_len -
bytes_to_int32(sizeof(xXF86VidModeDeleteModeLineReq));
}
if (ver < 2) {
/* convert from old format */
stuff = &newstuff;
stuff->length = client->req_len;
stuff->length = oldstuff->length;
stuff->screen = oldstuff->screen;
stuff->dotclock = oldstuff->dotclock;
stuff->hdisplay = oldstuff->hdisplay;
@ -663,12 +649,24 @@ ProcVidModeDeleteModeLine(ClientPtr client)
stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend, stuff->vtotal,
(unsigned long) stuff->flags);
if (ver < 2) {
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeDeleteModeLineReq);
len =
client->req_len -
bytes_to_int32(sizeof(xXF86OldVidModeDeleteModeLineReq));
}
else {
REQUEST_AT_LEAST_SIZE(xXF86VidModeDeleteModeLineReq);
len =
client->req_len -
bytes_to_int32(sizeof(xXF86VidModeDeleteModeLineReq));
}
if (len != stuff->privsize) {
DebugF("req_len = %ld, sizeof(Req) = %d, privsize = %ld, "
"len = %d, length = %d\n",
(unsigned long) client->req_len,
(int) sizeof(xXF86VidModeDeleteModeLineReq) >> 2,
(unsigned long) stuff->privsize, len, client->req_len);
(unsigned long) stuff->privsize, len, stuff->length);
return BadLength;
}
@ -746,24 +744,10 @@ ProcVidModeModModeLine(ClientPtr client)
DEBUG_P("XF86VidModeModModeline");
ver = ClientMajorVersion(client);
if (ver < 2) {
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeModModeLineReq);
len =
client->req_len -
bytes_to_int32(sizeof(xXF86OldVidModeModModeLineReq));
}
else {
REQUEST_AT_LEAST_SIZE(xXF86VidModeModModeLineReq);
len =
client->req_len -
bytes_to_int32(sizeof(xXF86VidModeModModeLineReq));
}
if (ver < 2) {
/* convert from old format */
stuff = &newstuff;
stuff->length = client->req_len;
stuff->length = oldstuff->length;
stuff->screen = oldstuff->screen;
stuff->hdisplay = oldstuff->hdisplay;
stuff->hsyncstart = oldstuff->hsyncstart;
@ -784,6 +768,18 @@ ProcVidModeModModeLine(ClientPtr client)
stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend,
stuff->vtotal, (unsigned long) stuff->flags);
if (ver < 2) {
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeModModeLineReq);
len =
client->req_len -
bytes_to_int32(sizeof(xXF86OldVidModeModModeLineReq));
}
else {
REQUEST_AT_LEAST_SIZE(xXF86VidModeModModeLineReq);
len =
client->req_len -
bytes_to_int32(sizeof(xXF86VidModeModModeLineReq));
}
if (len != stuff->privsize)
return BadLength;
@ -806,8 +802,6 @@ ProcVidModeModModeLine(ClientPtr client)
return BadValue;
modetmp = VidModeCreateMode();
if (modetmp == NULL)
return BadAlloc;
VidModeCopyMode(mode, modetmp);
VidModeSetModeValue(modetmp, VIDMODE_H_DISPLAY, stuff->hdisplay);
@ -883,23 +877,10 @@ ProcVidModeValidateModeLine(ClientPtr client)
DEBUG_P("XF86VidModeValidateModeline");
ver = ClientMajorVersion(client);
if (ver < 2) {
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeValidateModeLineReq);
len = client->req_len -
bytes_to_int32(sizeof(xXF86OldVidModeValidateModeLineReq));
}
else {
REQUEST_AT_LEAST_SIZE(xXF86VidModeValidateModeLineReq);
len =
client->req_len -
bytes_to_int32(sizeof(xXF86VidModeValidateModeLineReq));
}
if (ver < 2) {
/* convert from old format */
stuff = &newstuff;
stuff->length = client->req_len;
stuff->length = oldstuff->length;
stuff->screen = oldstuff->screen;
stuff->dotclock = oldstuff->dotclock;
stuff->hdisplay = oldstuff->hdisplay;
@ -924,6 +905,17 @@ ProcVidModeValidateModeLine(ClientPtr client)
stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend, stuff->vtotal,
(unsigned long) stuff->flags);
if (ver < 2) {
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeValidateModeLineReq);
len = client->req_len -
bytes_to_int32(sizeof(xXF86OldVidModeValidateModeLineReq));
}
else {
REQUEST_AT_LEAST_SIZE(xXF86VidModeValidateModeLineReq);
len =
client->req_len -
bytes_to_int32(sizeof(xXF86VidModeValidateModeLineReq));
}
if (len != stuff->privsize)
return BadLength;
@ -951,8 +943,6 @@ ProcVidModeValidateModeLine(ClientPtr client)
return BadValue;
modetmp = VidModeCreateMode();
if (modetmp == NULL)
return BadAlloc;
VidModeCopyMode(mode, modetmp);
VidModeSetModeValue(modetmp, VIDMODE_H_DISPLAY, stuff->hdisplay);
@ -1037,24 +1027,10 @@ ProcVidModeSwitchToMode(ClientPtr client)
DEBUG_P("XF86VidModeSwitchToMode");
ver = ClientMajorVersion(client);
if (ver < 2) {
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeSwitchToModeReq);
len =
client->req_len -
bytes_to_int32(sizeof(xXF86OldVidModeSwitchToModeReq));
}
else {
REQUEST_AT_LEAST_SIZE(xXF86VidModeSwitchToModeReq);
len =
client->req_len -
bytes_to_int32(sizeof(xXF86VidModeSwitchToModeReq));
}
if (ver < 2) {
/* convert from old format */
stuff = &newstuff;
stuff->length = client->req_len;
stuff->length = oldstuff->length;
stuff->screen = oldstuff->screen;
stuff->dotclock = oldstuff->dotclock;
stuff->hdisplay = oldstuff->hdisplay;
@ -1079,6 +1055,18 @@ ProcVidModeSwitchToMode(ClientPtr client)
stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend, stuff->vtotal,
(unsigned long) stuff->flags);
if (ver < 2) {
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeSwitchToModeReq);
len =
client->req_len -
bytes_to_int32(sizeof(xXF86OldVidModeSwitchToModeReq));
}
else {
REQUEST_AT_LEAST_SIZE(xXF86VidModeSwitchToModeReq);
len =
client->req_len -
bytes_to_int32(sizeof(xXF86VidModeSwitchToModeReq));
}
if (len != stuff->privsize)
return BadLength;
@ -1469,7 +1457,6 @@ ProcVidModeSetGammaRamp(ClientPtr client)
VidModePtr pVidMode;
REQUEST(xXF86VidModeSetGammaRampReq);
REQUEST_AT_LEAST_SIZE(xXF86VidModeSetGammaRampReq);
if (stuff->screen >= screenInfo.numScreens)
return BadValue;
@ -1705,25 +1692,35 @@ ProcVidModeDispatch(ClientPtr client)
}
}
static int _X_COLD
static int
SProcVidModeQueryVersion(ClientPtr client)
{
REQUEST(xXF86VidModeQueryVersionReq);
swaps(&stuff->length);
return ProcVidModeQueryVersion(client);
}
static int
SProcVidModeGetModeLine(ClientPtr client)
{
REQUEST(xXF86VidModeGetModeLineReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetModeLineReq);
swaps(&stuff->screen);
return ProcVidModeGetModeLine(client);
}
static int _X_COLD
static int
SProcVidModeGetAllModeLines(ClientPtr client)
{
REQUEST(xXF86VidModeGetAllModeLinesReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetAllModeLinesReq);
swaps(&stuff->screen);
return ProcVidModeGetAllModeLines(client);
}
static int _X_COLD
static int
SProcVidModeAddModeLine(ClientPtr client)
{
xXF86OldVidModeAddModeLineReq *oldstuff =
@ -1733,6 +1730,7 @@ SProcVidModeAddModeLine(ClientPtr client)
REQUEST(xXF86VidModeAddModeLineReq);
ver = ClientMajorVersion(client);
if (ver < 2) {
swaps(&oldstuff->length);
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeAddModeLineReq);
swapl(&oldstuff->screen);
swaps(&oldstuff->hdisplay);
@ -1748,6 +1746,7 @@ SProcVidModeAddModeLine(ClientPtr client)
SwapRestL(oldstuff);
}
else {
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xXF86VidModeAddModeLineReq);
swapl(&stuff->screen);
swaps(&stuff->hdisplay);
@ -1766,7 +1765,7 @@ SProcVidModeAddModeLine(ClientPtr client)
return ProcVidModeAddModeLine(client);
}
static int _X_COLD
static int
SProcVidModeDeleteModeLine(ClientPtr client)
{
xXF86OldVidModeDeleteModeLineReq *oldstuff =
@ -1776,6 +1775,7 @@ SProcVidModeDeleteModeLine(ClientPtr client)
REQUEST(xXF86VidModeDeleteModeLineReq);
ver = ClientMajorVersion(client);
if (ver < 2) {
swaps(&oldstuff->length);
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeDeleteModeLineReq);
swapl(&oldstuff->screen);
swaps(&oldstuff->hdisplay);
@ -1791,6 +1791,7 @@ SProcVidModeDeleteModeLine(ClientPtr client)
SwapRestL(oldstuff);
}
else {
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xXF86VidModeDeleteModeLineReq);
swapl(&stuff->screen);
swaps(&stuff->hdisplay);
@ -1809,7 +1810,7 @@ SProcVidModeDeleteModeLine(ClientPtr client)
return ProcVidModeDeleteModeLine(client);
}
static int _X_COLD
static int
SProcVidModeModModeLine(ClientPtr client)
{
xXF86OldVidModeModModeLineReq *oldstuff =
@ -1819,6 +1820,7 @@ SProcVidModeModModeLine(ClientPtr client)
REQUEST(xXF86VidModeModModeLineReq);
ver = ClientMajorVersion(client);
if (ver < 2) {
swaps(&oldstuff->length);
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeModModeLineReq);
swapl(&oldstuff->screen);
swaps(&oldstuff->hdisplay);
@ -1834,6 +1836,7 @@ SProcVidModeModModeLine(ClientPtr client)
SwapRestL(oldstuff);
}
else {
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xXF86VidModeModModeLineReq);
swapl(&stuff->screen);
swaps(&stuff->hdisplay);
@ -1852,7 +1855,7 @@ SProcVidModeModModeLine(ClientPtr client)
return ProcVidModeModModeLine(client);
}
static int _X_COLD
static int
SProcVidModeValidateModeLine(ClientPtr client)
{
xXF86OldVidModeValidateModeLineReq *oldstuff =
@ -1862,6 +1865,7 @@ SProcVidModeValidateModeLine(ClientPtr client)
REQUEST(xXF86VidModeValidateModeLineReq);
ver = ClientMajorVersion(client);
if (ver < 2) {
swaps(&oldstuff->length);
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeValidateModeLineReq);
swapl(&oldstuff->screen);
swaps(&oldstuff->hdisplay);
@ -1877,6 +1881,7 @@ SProcVidModeValidateModeLine(ClientPtr client)
SwapRestL(oldstuff);
}
else {
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xXF86VidModeValidateModeLineReq);
swapl(&stuff->screen);
swaps(&stuff->hdisplay);
@ -1895,57 +1900,63 @@ SProcVidModeValidateModeLine(ClientPtr client)
return ProcVidModeValidateModeLine(client);
}
static int _X_COLD
static int
SProcVidModeSwitchMode(ClientPtr client)
{
REQUEST(xXF86VidModeSwitchModeReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeSwitchModeReq);
swaps(&stuff->screen);
swaps(&stuff->zoom);
return ProcVidModeSwitchMode(client);
}
static int _X_COLD
static int
SProcVidModeSwitchToMode(ClientPtr client)
{
REQUEST(xXF86VidModeSwitchToModeReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeSwitchToModeReq);
swapl(&stuff->screen);
return ProcVidModeSwitchToMode(client);
}
static int _X_COLD
static int
SProcVidModeLockModeSwitch(ClientPtr client)
{
REQUEST(xXF86VidModeLockModeSwitchReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeLockModeSwitchReq);
swaps(&stuff->screen);
swaps(&stuff->lock);
return ProcVidModeLockModeSwitch(client);
}
static int _X_COLD
static int
SProcVidModeGetMonitor(ClientPtr client)
{
REQUEST(xXF86VidModeGetMonitorReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetMonitorReq);
swaps(&stuff->screen);
return ProcVidModeGetMonitor(client);
}
static int _X_COLD
static int
SProcVidModeGetViewPort(ClientPtr client)
{
REQUEST(xXF86VidModeGetViewPortReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetViewPortReq);
swaps(&stuff->screen);
return ProcVidModeGetViewPort(client);
}
static int _X_COLD
static int
SProcVidModeSetViewPort(ClientPtr client)
{
REQUEST(xXF86VidModeSetViewPortReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeSetViewPortReq);
swaps(&stuff->screen);
swapl(&stuff->x);
@ -1953,29 +1964,32 @@ SProcVidModeSetViewPort(ClientPtr client)
return ProcVidModeSetViewPort(client);
}
static int _X_COLD
static int
SProcVidModeGetDotClocks(ClientPtr client)
{
REQUEST(xXF86VidModeGetDotClocksReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetDotClocksReq);
swaps(&stuff->screen);
return ProcVidModeGetDotClocks(client);
}
static int _X_COLD
static int
SProcVidModeSetClientVersion(ClientPtr client)
{
REQUEST(xXF86VidModeSetClientVersionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeSetClientVersionReq);
swaps(&stuff->major);
swaps(&stuff->minor);
return ProcVidModeSetClientVersion(client);
}
static int _X_COLD
static int
SProcVidModeSetGamma(ClientPtr client)
{
REQUEST(xXF86VidModeSetGammaReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeSetGammaReq);
swaps(&stuff->screen);
swapl(&stuff->red);
@ -1984,21 +1998,23 @@ SProcVidModeSetGamma(ClientPtr client)
return ProcVidModeSetGamma(client);
}
static int _X_COLD
static int
SProcVidModeGetGamma(ClientPtr client)
{
REQUEST(xXF86VidModeGetGammaReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetGammaReq);
swaps(&stuff->screen);
return ProcVidModeGetGamma(client);
}
static int _X_COLD
static int
SProcVidModeSetGammaRamp(ClientPtr client)
{
int length;
REQUEST(xXF86VidModeSetGammaRampReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xXF86VidModeSetGammaRampReq);
swaps(&stuff->size);
swaps(&stuff->screen);
@ -2008,41 +2024,44 @@ SProcVidModeSetGammaRamp(ClientPtr client)
return ProcVidModeSetGammaRamp(client);
}
static int _X_COLD
static int
SProcVidModeGetGammaRamp(ClientPtr client)
{
REQUEST(xXF86VidModeGetGammaRampReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampReq);
swaps(&stuff->size);
swaps(&stuff->screen);
return ProcVidModeGetGammaRamp(client);
}
static int _X_COLD
static int
SProcVidModeGetGammaRampSize(ClientPtr client)
{
REQUEST(xXF86VidModeGetGammaRampSizeReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampSizeReq);
swaps(&stuff->screen);
return ProcVidModeGetGammaRampSize(client);
}
static int _X_COLD
static int
SProcVidModeGetPermissions(ClientPtr client)
{
REQUEST(xXF86VidModeGetPermissionsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetPermissionsReq);
swaps(&stuff->screen);
return ProcVidModeGetPermissions(client);
}
static int _X_COLD
static int
SProcVidModeDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
case X_XF86VidModeQueryVersion:
return ProcVidModeQueryVersion(client);
return SProcVidModeQueryVersion(client);
case X_XF86VidModeGetModeLine:
return SProcVidModeGetModeLine(client);
case X_XF86VidModeGetMonitor:

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,12 +29,13 @@ 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 };
_X_EXPORT CallbackListPtr XaceHooks[XACE_NUM_HOOKS] = { 0 };
/* Special-cased hook functions. Called by Xserver.
*/
#undef XaceHookDispatch
int
XaceHookDispatch0(ClientPtr client, int major)
XaceHookDispatch(ClientPtr client, int major)
{
/* Call the extension dispatch hook */
ExtensionEntry *ext = GetExtensionEntry(major);
@ -63,85 +63,130 @@ 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)
/* Entry point for hook functions. Called by Xserver.
*/
int
XaceHook(int hook, ...)
{
XaceResourceAccessRec rec = { client, id, rtype, res, ptype, parent,
access_mode, Success };
CallCallbacks(&XaceHooks[XACE_RESOURCE_ACCESS], &rec);
return rec.status;
}
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 */
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;
}
if (!XaceHooks[hook])
return Success;
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;
}
va_start(ap, hook);
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;
}
/* 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, void *);
u.res.ptype = va_arg(ap, RESTYPE);
u.res.parent = va_arg(ap, void *);
u.res.access_mode = va_arg(ap, Mask);
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;
}
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);
int XaceHookExtAccess(ClientPtr client, ExtensionEntry *ext)
{
XaceExtAccessRec rec = { client, ext, DixGetAttrAccess, Success };
CallCallbacks(&XaceHooks[XACE_EXT_ACCESS], &rec);
return rec.status;
}
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);
int XaceHookServerAccess(ClientPtr client, Mask access_mode)
{
XaceServerAccessRec rec = { client, access_mode, Success };
CallCallbacks(&XaceHooks[XACE_SERVER_ACCESS], &rec);
return rec.status;
}
u.send.events = va_arg(ap, xEventPtr);
u.send.count = va_arg(ap, int);
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;
}
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);
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;
}
u.recv.events = va_arg(ap, xEventPtr);
u.recv.count = va_arg(ap, int);
int XaceHookAuthAvail(ClientPtr client, XID authId)
{
XaceAuthAvailRec rec = { client, authId };
CallCallbacks(&XaceHooks[XACE_AUTH_AVAIL], &rec);
return Success;
}
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);
int XaceHookKeyAvail(xEventPtr ev, DeviceIntPtr dev, int count)
{
XaceKeyAvailRec rec = { ev, dev, count };
CallCallbacks(&XaceHooks[XACE_KEY_AVAIL], &rec);
return Success;
u.client.status = Success; /* default allow */
prv = &u.client.status;
break;
case XACE_EXT_ACCESS:
u.ext.client = va_arg(ap, ClientPtr);
u.ext.ext = va_arg(ap, ExtensionEntry *);
u.ext.access_mode = DixGetAttrAccess;
u.ext.status = Success; /* default allow */
prv = &u.ext.status;
break;
case XACE_SERVER_ACCESS:
u.server.client = va_arg(ap, ClientPtr);
u.server.access_mode = va_arg(ap, Mask);
u.server.status = Success; /* default allow */
prv = &u.server.status;
break;
case XACE_SCREEN_ACCESS:
case XACE_SCREENSAVER_ACCESS:
u.screen.client = va_arg(ap, ClientPtr);
u.screen.screen = va_arg(ap, ScreenPtr);
u.screen.access_mode = va_arg(ap, Mask);
u.screen.status = Success; /* default allow */
prv = &u.screen.status;
break;
case XACE_AUTH_AVAIL:
u.auth.client = va_arg(ap, ClientPtr);
u.auth.authId = va_arg(ap, XID);
break;
case XACE_KEY_AVAIL:
u.key.event = va_arg(ap, xEventPtr);
u.key.keybd = va_arg(ap, DeviceIntPtr);
u.key.count = va_arg(ap, int);
break;
default:
va_end(ap);
return 0; /* unimplemented hook number */
}
va_end(ap);
/* call callbacks and return result, if any. */
CallCallbacks(&XaceHooks[hook], &u);
return prv ? *prv : Success;
}
/* XaceHookIsSet

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"
@ -69,10 +68,10 @@ extern _X_EXPORT int XaceHookIsSet(int hook);
/* Special-cased hook functions
*/
int XaceHookDispatch0(ClientPtr client, int major);
extern _X_EXPORT int XaceHookDispatch(ClientPtr ptr, int major);
#define XaceHookDispatch(c, m) \
((XaceHooks[XACE_EXT_DISPATCH] && (m) >= EXTENSION_BASE) ? \
XaceHookDispatch0((c), (m)) : \
XaceHookDispatch((c), (m)) : \
Success)
extern _X_EXPORT int XaceHookPropertyAccess(ClientPtr ptr, WindowPtr pWin,
@ -81,24 +80,6 @@ extern _X_EXPORT int XaceHookPropertyAccess(ClientPtr ptr, WindowPtr pWin,
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);
/* Register a callback for a given hook.
*/
#define XaceRegisterCallback(hook,callback,data) \
@ -132,38 +113,18 @@ extern _X_EXPORT void XaceCensorImage(ClientPtr client,
/* Define calls away when XACE is not being built. */
#ifdef __GNUC__
#define XaceHook(args...) Success
#define XaceHookIsSet(args...) 0
#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 XaceCensorImage(args...) { ; }
#else
#define XaceHook(...) Success
#define XaceHookIsSet(...) 0
#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 XaceCensorImage(...) { ; }
#endif

View file

@ -26,7 +26,9 @@ from The Open Group.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#include <X11/Xproto.h>
@ -36,7 +38,7 @@ from The Open Group.
#include "extnsionst.h"
#include "swaprep.h"
#include <X11/extensions/xcmiscproto.h>
#include "extinit_priv.h"
#include "extinit.h"
#include <stdint.h>
@ -140,27 +142,39 @@ 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 +182,7 @@ SProcXCMiscDispatch(ClientPtr client)
case X_XCMiscGetVersion:
return SProcXCMiscGetVersion(client);
case X_XCMiscGetXIDRange:
return ProcXCMiscGetXIDRange(client);
return SProcXCMiscGetXIDRange(client);
case X_XCMiscGetXIDList:
return SProcXCMiscGetXIDList(client);
default:

View file

@ -34,10 +34,19 @@
* XLoadQueryFont).
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <sys/types.h>
#ifdef MITSHM
#ifdef HAS_SHM
#if defined(linux) && (!defined(__GNU_LIBRARY__) || __GNU_LIBRARY__ < 2)
/* libc4 does not define __GNU_LIBRARY__, libc5 defines __GNU_LIBRARY__ as 1 */
/* Linux libc4 and libc5 only (because glibc doesn't include kernel headers):
Linux 2.0.x and 2.2.x define SHMLBA as PAGE_SIZE, but forget to define
PAGE_SIZE. It is defined in <asm/page.h>. */
#include <asm/page.h>
#endif
#ifdef SVR4
#include <sys/sysmacros.h>
#endif
@ -56,24 +65,22 @@
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/extensions/xf86bigfproto.h>
#include <X11/fonts/fontstruct.h>
#include <X11/fonts/libxfont2.h>
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "gcstruct.h"
#include "dixfontstr.h"
#include "extnsionst.h"
#include "extinit_priv.h"
#include "extinit.h"
#include "protocol-versions.h"
#include <X11/extensions/xf86bigfproto.h>
#include "xf86bigfontsrv.h"
static void XF86BigfontResetProc(ExtensionEntry *extEntry );
static void XF86BigfontResetProc(ExtensionEntry * /* extEntry */
);
#ifdef MITSHM
#ifdef HAS_SHM
/* A random signature, transmitted to the clients so they can verify that the
shared memory segment they are attaching to was really established by the
@ -126,7 +133,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 +228,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 +247,7 @@ XF86BigfontFreeFontShm(FontPtr pFont)
void
XF86BigfontCleanup(void)
{
#ifdef MITSHM
#ifdef HAS_SHM
while (ShmList)
shmdealloc(ShmList);
#endif
@ -277,7 +284,7 @@ ProcXF86BigfontQueryVersion(ClientPtr client)
.minorVersion = SERVER_XF86BIGFONT_MINOR_VERSION,
.uid = geteuid(),
.gid = getegid(),
#ifdef MITSHM
#ifdef HAS_SHM
.signature = signature,
.capabilities = (client->local && !client->swapped)
? XF86Bigfont_CAP_LocalShm : 0
@ -329,7 +336,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
int nCharInfos;
int shmid;
#ifdef MITSHM
#ifdef HAS_SHM
ShmDescPtr pDesc = NULL;
#else
#define pDesc 0
@ -339,7 +346,9 @@ 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 &&
@ -351,7 +360,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 +381,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
nUniqCharInfos = 0;
if (nCharInfos > 0) {
#ifdef MITSHM
#ifdef HAS_SHM
if (!badSysCall)
pDesc = (ShmDescPtr) FontGetPrivate(pFont, FontShmdescIndex);
if (pDesc) {
@ -393,7 +402,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
pCI = xallocarray(nCharInfos, sizeof(xCharInfo));
if (!pCI)
return BadAlloc;
#ifdef MITSHM
#ifdef HAS_SHM
}
#endif
/* Fill nCharInfos starting at pCI. */
@ -425,7 +434,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
}
}
}
#ifdef MITSHM
#ifdef HAS_SHM
if (pDesc && !badSysCall) {
*(CARD32 *) (pCI + nCharInfos) = signature;
if (!xfont2_font_set_private(pFont, FontShmdescIndex, pDesc)) {
@ -648,23 +657,27 @@ ProcXF86BigfontDispatch(ClientPtr client)
}
}
static int _X_COLD
static int
SProcXF86BigfontQueryVersion(ClientPtr client)
{
/* REQUEST(xXF86BigfontQueryVersionReq); */
REQUEST(xXF86BigfontQueryVersionReq);
swaps(&stuff->length);
return ProcXF86BigfontQueryVersion(client);
}
static int _X_COLD
static int
SProcXF86BigfontQueryFont(ClientPtr client)
{
REQUEST(xXF86BigfontQueryFontReq);
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 +701,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

View file

@ -2,28 +2,28 @@
Copyright (c) 2002 XFree86 Inc
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/extensions/XResproto.h>
#include "dix/registry_priv.h"
#include "os/client_priv.h"
#include <assert.h>
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "extnsionst.h"
#include "swaprep.h"
#include "registry.h"
#include <X11/extensions/XResproto.h>
#include "pixmapstr.h"
#include "windowstr.h"
#include "gcstruct.h"
#include "extinit_priv.h"
#include "extinit.h"
#include "protocol-versions.h"
#include "client.h"
#include "list.h"
#include "misc.h"
#include <string.h>
@ -72,7 +72,7 @@ typedef struct {
HashTable visitedResources;
/* Used by AddSubResourceSizeSpec when AddResourceSizeValue is
handling cross-references */
handling crossreferences */
HashTable visitedSubResources;
/* used when ConstructResourceBytesCtx is passed to
@ -224,8 +224,6 @@ ProcXResQueryClients(ClientPtr client)
REQUEST_SIZE_MATCH(xXResQueryClientsReq);
current_clients = xallocarray(currentMaxClients, sizeof(int));
if (current_clients == NULL)
return BadAlloc;
num_clients = 0;
for (i = 0; i < currentMaxClients; i++) {
@ -276,24 +274,6 @@ ResFindAllRes(void *value, XID id, RESTYPE type, void *cdata)
counts[(type & TypeMask) - 1]++;
}
static CARD32
resourceTypeAtom(int i)
{
CARD32 ret;
const char *name = LookupResourceName(i);
if (strcmp(name, XREGISTRY_UNKNOWN))
ret = MakeAtom(name, strlen(name), TRUE);
else {
char buf[40];
snprintf(buf, sizeof(buf), "Unregistered resource %i", i + 1);
ret = MakeAtom(buf, strlen(buf), TRUE);
}
return ret;
}
static int
ProcXResQueryClientResources(ClientPtr client)
{
@ -338,12 +318,22 @@ ProcXResQueryClientResources(ClientPtr client)
if (num_types) {
xXResType scratch;
const char *name;
for (i = 0; i < lastResourceType; i++) {
if (!counts[i])
continue;
scratch.resource_type = resourceTypeAtom(i + 1);
name = LookupResourceName(i + 1);
if (strcmp(name, XREGISTRY_UNKNOWN))
scratch.resource_type = MakeAtom(name, strlen(name), TRUE);
else {
char buf[40];
snprintf(buf, sizeof(buf), "Unregistered resource %i", i + 1);
scratch.resource_type = MakeAtom(buf, strlen(buf), TRUE);
}
scratch.count = counts[i];
if (client->swapped) {
@ -444,7 +434,7 @@ WillConstructMask(ClientPtr client, CARD32 mask,
client id spec
@param sendClient Which client wishes to receive this answer. Used for
byte endianness.
byte endianess.
@param client Which client are we considering.
@param mask The client id spec mask indicating which information
we want about this client.
@ -611,7 +601,7 @@ ProcXResQueryClientIds (ClientPtr client)
return rc;
}
/** @brief Swaps xXResResourceIdSpec endianness */
/** @brief Swaps xXResResourceIdSpec endianess */
static void
SwapXResResourceIdSpec(xXResResourceIdSpec *spec)
{
@ -619,7 +609,7 @@ SwapXResResourceIdSpec(xXResResourceIdSpec *spec)
swapl(&spec->type);
}
/** @brief Swaps xXResResourceSizeSpec endianness */
/** @brief Swaps xXResResourceSizeSpec endianess */
static void
SwapXResResourceSizeSpec(xXResResourceSizeSpec *size)
{
@ -629,7 +619,7 @@ SwapXResResourceSizeSpec(xXResResourceSizeSpec *size)
swapl(&size->useCount);
}
/** @brief Swaps xXResResourceSizeValue endianness */
/** @brief Swaps xXResResourceSizeValue endianess */
static void
SwapXResResourceSizeValue(xXResResourceSizeValue *rep)
{
@ -703,7 +693,7 @@ AddSubResourceSizeSpec(void *value,
sizeFunc(value, id, &size);
crossRef->spec.resource = id;
crossRef->spec.type = resourceTypeAtom(type);
crossRef->spec.type = type;
crossRef->bytes = size.resourceSize;
crossRef->refCount = size.refCnt;
crossRef->useCount = 1;
@ -776,7 +766,7 @@ AddResourceSizeValue(void *ptr, XID id, RESTYPE type, void *cdata)
sizeFunc(ptr, id, &size);
value->size.spec.resource = id;
value->size.spec.type = resourceTypeAtom(type);
value->size.spec.type = type;
value->size.bytes = size.resourceSize;
value->size.refCount = size.refCnt;
value->size.useCount = 1;
@ -957,8 +947,6 @@ ProcXResQueryResourceBytes (ClientPtr client)
ConstructResourceBytesCtx ctx;
REQUEST_AT_LEAST_SIZE(xXResQueryResourceBytesReq);
if (stuff->numSpecs > UINT32_MAX / sizeof(ctx.specs[0]))
return BadLength;
REQUEST_FIXED_SIZE(xXResQueryResourceBytesReq,
stuff->numSpecs * sizeof(ctx.specs[0]));
@ -1019,14 +1007,14 @@ ProcResDispatch(ClientPtr client)
return BadRequest;
}
static int _X_COLD
static int
SProcXResQueryVersion(ClientPtr client)
{
REQUEST_SIZE_MATCH(xXResQueryVersionReq);
return ProcXResQueryVersion(client);
}
static int _X_COLD
static int
SProcXResQueryClientResources(ClientPtr client)
{
REQUEST(xXResQueryClientResourcesReq);
@ -1035,7 +1023,7 @@ SProcXResQueryClientResources(ClientPtr client)
return ProcXResQueryClientResources(client);
}
static int _X_COLD
static int
SProcXResQueryClientPixmapBytes(ClientPtr client)
{
REQUEST(xXResQueryClientPixmapBytesReq);
@ -1044,7 +1032,7 @@ SProcXResQueryClientPixmapBytes(ClientPtr client)
return ProcXResQueryClientPixmapBytes(client);
}
static int _X_COLD
static int
SProcXResQueryClientIds (ClientPtr client)
{
REQUEST(xXResQueryClientIdsReq);
@ -1057,15 +1045,15 @@ SProcXResQueryClientIds (ClientPtr client)
/** @brief Implements the XResQueryResourceBytes of XResProto v1.2.
This variant byteswaps request contents before issuing the
rest of the work to ProcXResQueryResourceBytes */
static int _X_COLD
static int
SProcXResQueryResourceBytes (ClientPtr client)
{
REQUEST(xXResQueryResourceBytesReq);
int c;
xXResResourceIdSpec *specs = (void*) ((char*) stuff + sizeof(*stuff));
REQUEST_AT_LEAST_SIZE(xXResQueryResourceBytesReq);
swapl(&stuff->numSpecs);
REQUEST_AT_LEAST_SIZE(xXResQueryResourceBytesReq);
REQUEST_FIXED_SIZE(xXResQueryResourceBytesReq,
stuff->numSpecs * sizeof(specs[0]));
@ -1076,10 +1064,11 @@ SProcXResQueryResourceBytes (ClientPtr client)
return ProcXResQueryResourceBytes(client);
}
static int _X_COLD
static int
SProcResDispatch (ClientPtr client)
{
REQUEST(xReq);
swaps(&stuff->length);
switch (stuff->data) {
case X_XResQueryVersion:

View file

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

View file

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

View file

@ -22,19 +22,17 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* All rights reserved.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <errno.h>
#include <sys/socket.h>
#include <stdio.h>
#include <stdarg.h>
#include <libaudit.h>
#include <X11/Xatom.h>
#include <X11/Xfuncproto.h>
#include "dix/registry_priv.h"
#include "os/client_priv.h"
#include "selection.h"
#include "inputstr.h"
#include "scrnintstr.h"
@ -42,6 +40,7 @@ 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"
#define _XSELINUX_NEED_FLASK_MAP
#include "xselinuxint.h"
@ -115,7 +114,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,7 +169,7 @@ SELinuxLabelInitial(void)
XaceScreenAccessRec srec;
SELinuxSubjectRec *subj;
SELinuxObjectRec *obj;
char *ctx;
security_context_t ctx;
void *unused;
/* Do the serverClient */
@ -200,7 +199,7 @@ SELinuxLabelInitial(void)
/* Do the default colormap */
dixLookupResourceByType(&unused, screenInfo.screens[i]->defColormap,
X11_RESTYPE_COLORMAP, serverClient, DixCreateAccess);
RT_COLORMAP, serverClient, DixCreateAccess);
}
}
@ -663,7 +662,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;
@ -765,7 +764,7 @@ SELinuxResourceState(CallbackListPtr *pcbl, void *unused, void *calldata)
SELinuxObjectRec *obj;
WindowPtr pWin;
if (rec->type != X11_RESTYPE_WINDOW)
if (rec->type != RT_WINDOW)
return;
if (rec->state != ResourceStateAdding)
return;
@ -774,7 +773,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 +791,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)
@ -848,7 +847,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) {

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 */
@ -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,21 @@
#include "mi.h"
#include "xkbsrv.h"
#include "xkbstr.h"
#include <X11/extensions/xtestproto.h>
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exglobals.h"
#include "mipointer.h"
#include "xserver-properties.h"
#include "exevents.h"
#include "eventstr.h"
#include "inpututils.h"
#include "extinit_priv.h"
/* XTest events are sent during request processing and may be interrupted by
#include "extinit.h"
/* 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 +74,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 */
@ -133,7 +128,7 @@ ProcXTestCompareCursor(ClientPtr client)
pCursor = GetSpriteCursor(ptr);
else {
rc = dixLookupResourceByType((void **) &pCursor, stuff->cursor,
X11_RESTYPE_CURSOR, client, DixReadAccess);
RT_CURSOR, client, DixReadAccess);
if (rc != Success) {
client->errorValue = stuff->cursor;
return rc;
@ -152,35 +147,6 @@ ProcXTestCompareCursor(ClientPtr client)
return Success;
}
void
XTestDeviceSendEvents(DeviceIntPtr dev,
int type,
int detail,
int flags,
const ValuatorMask *mask)
{
int nevents = 0;
int i;
switch (type) {
case MotionNotify:
nevents = GetPointerEvents(xtest_evlist, dev, type, 0, flags, mask);
break;
case ButtonPress:
case ButtonRelease:
nevents = GetPointerEvents(xtest_evlist, dev, type, detail, flags, mask);
break;
case KeyPress:
case KeyRelease:
nevents =
GetKeyboardEvents(xtest_evlist, dev, type, detail);
break;
}
for (i = 0; i < nevents; i++)
mieqProcessDeviceEvent(dev, &xtest_evlist[i], miPointerGetScreen(inputInfo.pointer));
}
static int
ProcXTestFakeInput(ClientPtr client)
{
@ -194,11 +160,13 @@ ProcXTestFakeInput(ClientPtr client)
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);
@ -350,10 +318,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 +342,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--;
@ -416,7 +381,7 @@ ProcXTestFakeInput(ClientPtr client)
if ((flags & POINTER_ABSOLUTE) && firstValuator <= 1 && numValuators > 0) {
if (firstValuator == 0)
valuators[0] += root->drawable.pScreen->x;
if (firstValuator + numValuators > 1)
if (firstValuator < 2 && firstValuator + numValuators > 1)
valuators[1 - firstValuator] += root->drawable.pScreen->y;
}
}
@ -442,10 +407,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);
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], miPointerGetScreen(inputInfo.pointer));
if (need_ptr_update)
miPointerUpdateSprite(dev);
@ -487,26 +468,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 +499,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 +514,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 +550,7 @@ SProcXTestDispatch(ClientPtr client)
case X_XTestFakeInput:
return SProcXTestFakeInput(client);
case X_XTestGrabControl:
return ProcXTestGrabControl(client);
return SProcXTestGrabControl(client);
default:
return BadRequest;
}

View file

@ -21,18 +21,14 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <string.h>
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/extensions/Xv.h>
#include <X11/extensions/Xvproto.h>
#include "dix/dix_priv.h"
#include "Xext/xvdix_priv.h"
#include "misc.h"
#include "scrnintstr.h"
#include "windowstr.h"
@ -41,6 +37,10 @@ SOFTWARE.
#include "dixstruct.h"
#include "resource.h"
#include "opaque.h"
#include <X11/extensions/Xv.h>
#include <X11/extensions/Xvproto.h>
#include "xvdix.h"
#ifdef MITSHM
#include <X11/extensions/shmproto.h>
#include "shmint.h"
@ -48,12 +48,12 @@ SOFTWARE.
#include "xvdisp.h"
#ifdef XINERAMA
#ifdef PANORAMIX
#include "panoramiX.h"
#include "panoramiXsrv.h"
unsigned long XvXRTPort;
#endif /* XINERAMA */
#endif
static int
SWriteQueryExtensionReply(ClientPtr client, xvQueryExtensionReply * rep)
@ -1115,49 +1115,63 @@ ProcXvDispatch(ClientPtr client)
/* Swapped Procs */
static int _X_COLD
static int
SProcXvQueryExtension(ClientPtr client)
{
REQUEST(xvQueryExtensionReq);
REQUEST_SIZE_MATCH(xvQueryExtensionReq);
swaps(&stuff->length);
return XvProcVector[xv_QueryExtension] (client);
}
static int
SProcXvQueryAdaptors(ClientPtr client)
{
REQUEST(xvQueryAdaptorsReq);
REQUEST_SIZE_MATCH(xvQueryAdaptorsReq);
swaps(&stuff->length);
swapl(&stuff->window);
return XvProcVector[xv_QueryAdaptors] (client);
}
static int _X_COLD
static int
SProcXvQueryEncodings(ClientPtr client)
{
REQUEST(xvQueryEncodingsReq);
REQUEST_SIZE_MATCH(xvQueryEncodingsReq);
swaps(&stuff->length);
swapl(&stuff->port);
return XvProcVector[xv_QueryEncodings] (client);
}
static int _X_COLD
static int
SProcXvGrabPort(ClientPtr client)
{
REQUEST(xvGrabPortReq);
REQUEST_SIZE_MATCH(xvGrabPortReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->time);
return XvProcVector[xv_GrabPort] (client);
}
static int _X_COLD
static int
SProcXvUngrabPort(ClientPtr client)
{
REQUEST(xvUngrabPortReq);
REQUEST_SIZE_MATCH(xvUngrabPortReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->time);
return XvProcVector[xv_UngrabPort] (client);
}
static int _X_COLD
static int
SProcXvPutVideo(ClientPtr client)
{
REQUEST(xvPutVideoReq);
REQUEST_SIZE_MATCH(xvPutVideoReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->drawable);
swapl(&stuff->gc);
@ -1172,11 +1186,12 @@ SProcXvPutVideo(ClientPtr client)
return XvProcVector[xv_PutVideo] (client);
}
static int _X_COLD
static int
SProcXvPutStill(ClientPtr client)
{
REQUEST(xvPutStillReq);
REQUEST_SIZE_MATCH(xvPutStillReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->drawable);
swapl(&stuff->gc);
@ -1191,11 +1206,12 @@ SProcXvPutStill(ClientPtr client)
return XvProcVector[xv_PutStill] (client);
}
static int _X_COLD
static int
SProcXvGetVideo(ClientPtr client)
{
REQUEST(xvGetVideoReq);
REQUEST_SIZE_MATCH(xvGetVideoReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->drawable);
swapl(&stuff->gc);
@ -1210,11 +1226,12 @@ SProcXvGetVideo(ClientPtr client)
return XvProcVector[xv_GetVideo] (client);
}
static int _X_COLD
static int
SProcXvGetStill(ClientPtr client)
{
REQUEST(xvGetStillReq);
REQUEST_SIZE_MATCH(xvGetStillReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->drawable);
swapl(&stuff->gc);
@ -1229,11 +1246,12 @@ SProcXvGetStill(ClientPtr client)
return XvProcVector[xv_GetStill] (client);
}
static int _X_COLD
static int
SProcXvPutImage(ClientPtr client)
{
REQUEST(xvPutImageReq);
REQUEST_AT_LEAST_SIZE(xvPutImageReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->drawable);
swapl(&stuff->gc);
@ -1252,11 +1270,12 @@ SProcXvPutImage(ClientPtr client)
}
#ifdef MITSHM
static int _X_COLD
static int
SProcXvShmPutImage(ClientPtr client)
{
REQUEST(xvShmPutImageReq);
REQUEST_SIZE_MATCH(xvShmPutImageReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->drawable);
swapl(&stuff->gc);
@ -1279,60 +1298,66 @@ SProcXvShmPutImage(ClientPtr client)
#define SProcXvShmPutImage ProcXvShmPutImage
#endif
static int _X_COLD
static int
SProcXvSelectVideoNotify(ClientPtr client)
{
REQUEST(xvSelectVideoNotifyReq);
REQUEST_SIZE_MATCH(xvSelectVideoNotifyReq);
swaps(&stuff->length);
swapl(&stuff->drawable);
return XvProcVector[xv_SelectVideoNotify] (client);
}
static int _X_COLD
static int
SProcXvSelectPortNotify(ClientPtr client)
{
REQUEST(xvSelectPortNotifyReq);
REQUEST_SIZE_MATCH(xvSelectPortNotifyReq);
swaps(&stuff->length);
swapl(&stuff->port);
return XvProcVector[xv_SelectPortNotify] (client);
}
static int _X_COLD
static int
SProcXvStopVideo(ClientPtr client)
{
REQUEST(xvStopVideoReq);
REQUEST_SIZE_MATCH(xvStopVideoReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->drawable);
return XvProcVector[xv_StopVideo] (client);
}
static int _X_COLD
static int
SProcXvSetPortAttribute(ClientPtr client)
{
REQUEST(xvSetPortAttributeReq);
REQUEST_SIZE_MATCH(xvSetPortAttributeReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->attribute);
swapl(&stuff->value);
return XvProcVector[xv_SetPortAttribute] (client);
}
static int _X_COLD
static int
SProcXvGetPortAttribute(ClientPtr client)
{
REQUEST(xvGetPortAttributeReq);
REQUEST_SIZE_MATCH(xvGetPortAttributeReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->attribute);
return XvProcVector[xv_GetPortAttribute] (client);
}
static int _X_COLD
static int
SProcXvQueryBestSize(ClientPtr client)
{
REQUEST(xvQueryBestSizeReq);
REQUEST_SIZE_MATCH(xvQueryBestSizeReq);
swaps(&stuff->length);
swapl(&stuff->port);
swaps(&stuff->vid_w);
swaps(&stuff->vid_h);
@ -1341,20 +1366,22 @@ SProcXvQueryBestSize(ClientPtr client)
return XvProcVector[xv_QueryBestSize] (client);
}
static int _X_COLD
static int
SProcXvQueryPortAttributes(ClientPtr client)
{
REQUEST(xvQueryPortAttributesReq);
REQUEST_SIZE_MATCH(xvQueryPortAttributesReq);
swaps(&stuff->length);
swapl(&stuff->port);
return XvProcVector[xv_QueryPortAttributes] (client);
}
static int _X_COLD
static int
SProcXvQueryImageAttributes(ClientPtr client)
{
REQUEST(xvQueryImageAttributesReq);
REQUEST_SIZE_MATCH(xvQueryImageAttributesReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->id);
swaps(&stuff->width);
@ -1362,17 +1389,18 @@ SProcXvQueryImageAttributes(ClientPtr client)
return XvProcVector[xv_QueryImageAttributes] (client);
}
static int _X_COLD
static int
SProcXvListImageFormats(ClientPtr client)
{
REQUEST(xvListImageFormatsReq);
REQUEST_SIZE_MATCH(xvListImageFormatsReq);
swaps(&stuff->length);
swapl(&stuff->port);
return XvProcVector[xv_ListImageFormats] (client);
}
static int (*SXvProcVector[xvNumRequests]) (ClientPtr) = {
ProcXvQueryExtension,
SProcXvQueryExtension,
SProcXvQueryAdaptors,
SProcXvQueryEncodings,
SProcXvGrabPort,
@ -1391,7 +1419,7 @@ static int (*SXvProcVector[xvNumRequests]) (ClientPtr) = {
SProcXvListImageFormats,
SProcXvQueryImageAttributes, SProcXvPutImage, SProcXvShmPutImage,};
int _X_COLD
int
SProcXvDispatch(ClientPtr client)
{
REQUEST(xReq);
@ -1405,7 +1433,7 @@ SProcXvDispatch(ClientPtr client)
return SXvProcVector[stuff->data] (client);
}
#ifdef XINERAMA
#ifdef PANORAMIX
static int
XineramaXvStopVideo(ClientPtr client)
{
@ -1465,14 +1493,12 @@ XineramaXvShmPutImage(ClientPtr client)
{
REQUEST(xvShmPutImageReq);
PanoramiXRes *draw, *gc, *port;
Bool send_event;
Bool send_event = stuff->send_event;
Bool isRoot;
int result, i, x, y;
REQUEST_SIZE_MATCH(xvShmPutImageReq);
send_event = stuff->send_event;
result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
XRC_DRAWABLE, client, DixWriteAccess);
if (result != Success)
@ -1513,7 +1539,7 @@ XineramaXvShmPutImage(ClientPtr client)
}
#else
#define XineramaXvShmPutImage ProcXvShmPutImage
#endif /* MITSHM */
#endif
static int
XineramaXvPutImage(ClientPtr client)
@ -1768,17 +1794,17 @@ XineramifyXv(void)
XvProcVector[xv_PutImage] = XineramaXvPutImage;
XvProcVector[xv_ShmPutImage] = XineramaXvShmPutImage;
}
#endif /* XINERAMA */
#endif /* PANORAMIX */
void
XvResetProcVector(void)
{
#ifdef XINERAMA
#ifdef PANORAMIX
XvProcVector[xv_PutVideo] = ProcXvPutVideo;
XvProcVector[xv_PutStill] = ProcXvPutStill;
XvProcVector[xv_StopVideo] = ProcXvStopVideo;
XvProcVector[xv_SetPortAttribute] = ProcXvSetPortAttribute;
XvProcVector[xv_PutImage] = ProcXvPutImage;
XvProcVector[xv_ShmPutImage] = ProcXvShmPutImage;
#endif /* XINERAMA */
#endif
}

View file

@ -55,6 +55,21 @@ SOFTWARE.
#include "scrnintstr.h"
#include <X11/extensions/Xvproto.h>
extern _X_EXPORT unsigned long XvExtensionGeneration;
extern _X_EXPORT unsigned long XvScreenGeneration;
extern _X_EXPORT unsigned long XvResourceGeneration;
extern _X_EXPORT int XvReqCode;
extern _X_EXPORT int XvEventBase;
extern _X_EXPORT int XvErrorBase;
extern _X_EXPORT RESTYPE XvRTPort;
extern _X_EXPORT RESTYPE XvRTEncoding;
extern _X_EXPORT RESTYPE XvRTGrab;
extern _X_EXPORT RESTYPE XvRTVideoNotify;
extern _X_EXPORT RESTYPE XvRTVideoNotifyList;
extern _X_EXPORT RESTYPE XvRTPortNotify;
typedef struct {
int numerator;
int denominator;
@ -70,7 +85,18 @@ typedef struct {
ClientPtr client;
} XvGrabRec, *XvGrabPtr;
typedef struct _XvPortNotifyRec *XvPortNotifyPtr;
typedef struct _XvVideoNotifyRec {
struct _XvVideoNotifyRec *next;
ClientPtr client;
unsigned long id;
unsigned long mask;
} XvVideoNotifyRec, *XvVideoNotifyPtr;
typedef struct _XvPortNotifyRec {
struct _XvPortNotifyRec *next;
ClientPtr client;
unsigned long id;
} XvPortNotifyRec, *XvPortNotifyPtr;
typedef struct {
int id;
@ -169,6 +195,14 @@ typedef struct _XvPortRec {
DevUnion devPriv;
} XvPortRec, *XvPortPtr;
#define VALIDATE_XV_PORT(portID, pPort, mode)\
{\
int rc = dixLookupResourceByType((void **)&(pPort), portID,\
XvRTPort, client, mode);\
if (rc != Success)\
return rc;\
}
typedef struct {
int version, revision;
int nAdaptors;
@ -178,8 +212,51 @@ typedef struct {
CloseScreenProcPtr CloseScreen;
} XvScreenRec, *XvScreenPtr;
#define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = ((XvScreenPtr) \
dixLookupPrivate(&(pScreen)->devPrivates, XvScreenKey))->field)
#define SCREEN_EPILOGUE(pScreen, field, wrapper)\
((pScreen)->field = wrapper)
/* Errors */
#define _XvBadPort (XvBadPort+XvErrorBase)
#define _XvBadEncoding (XvBadEncoding+XvErrorBase)
extern _X_EXPORT int ProcXvDispatch(ClientPtr);
extern _X_EXPORT int SProcXvDispatch(ClientPtr);
extern _X_EXPORT int XvScreenInit(ScreenPtr);
extern _X_EXPORT DevPrivateKey XvGetScreenKey(void);
extern _X_EXPORT unsigned long XvGetRTPort(void);
extern _X_EXPORT void XvFreeAdaptor(XvAdaptorPtr pAdaptor);
extern void _X_EXPORT XvFillColorKey(DrawablePtr pDraw, CARD32 key,
RegionPtr region);
extern _X_EXPORT int XvdiSendPortNotify(XvPortPtr, Atom, INT32);
extern _X_EXPORT int 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 XvdiMatchPort(XvPortPtr, DrawablePtr);
extern _X_EXPORT int XvdiGrabPort(ClientPtr, XvPortPtr, Time, int *);
extern _X_EXPORT int XvdiUngrabPort(ClientPtr, XvPortPtr, Time);
#endif /* XVDIX_H */

View file

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

View file

@ -73,16 +73,14 @@ 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"
@ -90,50 +88,41 @@ SOFTWARE.
#include "pixmapstr.h"
#include "gcstruct.h"
#include "extnsionst.h"
#include "extinit_priv.h"
#include "extinit.h"
#include "dixstruct.h"
#include "resource.h"
#include "opaque.h"
#include "input.h"
#ifdef XINERAMA
#define GLOBAL
#include <X11/extensions/Xv.h>
#include <X11/extensions/Xvproto.h>
#include "xvdix.h"
#ifdef PANORAMIX
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif /* XINERAMA */
#endif
#include "xvdisp.h"
#define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = ((XvScreenPtr) \
dixLookupPrivate(&(pScreen)->devPrivates, XvScreenKey))->field)
#define SCREEN_EPILOGUE(pScreen, field, wrapper)\
((pScreen)->field = wrapper)
typedef struct _XvVideoNotifyRec {
struct _XvVideoNotifyRec *next;
ClientPtr client;
unsigned long id;
unsigned long mask;
} XvVideoNotifyRec, *XvVideoNotifyPtr;
static DevPrivateKeyRec XvScreenKeyRec;
Bool noXvExtension = FALSE;
#define XvScreenKey (&XvScreenKeyRec)
static unsigned long XvExtensionGeneration = 0;
static unsigned long XvScreenGeneration = 0;
static unsigned long XvResourceGeneration = 0;
unsigned long XvExtensionGeneration = 0;
unsigned long XvScreenGeneration = 0;
unsigned long XvResourceGeneration = 0;
int XvReqCode;
static int XvEventBase;
int XvEventBase;
int XvErrorBase;
RESTYPE XvRTPort;
static RESTYPE XvRTEncoding;
static RESTYPE XvRTGrab;
static RESTYPE XvRTVideoNotify;
static RESTYPE XvRTVideoNotifyList;
static RESTYPE XvRTPortNotify;
RESTYPE XvRTEncoding;
RESTYPE XvRTGrab;
RESTYPE XvRTVideoNotify;
RESTYPE XvRTVideoNotifyList;
RESTYPE XvRTPortNotify;
/* EXTERNAL */
@ -174,9 +163,9 @@ XvExtensionInit(void)
ErrorF("XvExtensionInit: Unable to allocate resource types\n");
return;
}
#ifdef XINERAMA
#ifdef PANORAMIX
XineramaRegisterConnectionBlockCallback(XineramifyXv);
#endif /* XINERAMA */
#endif
XvScreenGeneration = serverGeneration;
}
@ -267,9 +256,9 @@ XvScreenInit(ScreenPtr pScreen)
ErrorF("XvScreenInit: Unable to allocate resource types\n");
return BadAlloc;
}
#ifdef XINERAMA
#ifdef PANORAMIX
XineramaRegisterConnectionBlockCallback(XineramifyXv);
#endif /* XINERAMA */
#endif
XvScreenGeneration = serverGeneration;
}
@ -371,14 +360,13 @@ static Bool
XvDestroyPixmap(PixmapPtr pPix)
{
ScreenPtr pScreen = pPix->drawable.pScreen;
Bool status = TRUE;
Bool status;
if (pPix->refcnt == 1)
XvStopAdaptors(&pPix->drawable);
SCREEN_PROLOGUE(pScreen, DestroyPixmap);
if (pScreen->DestroyPixmap)
status = pScreen->DestroyPixmap(pPix);
status = (*pScreen->DestroyPixmap) (pPix);
SCREEN_EPILOGUE(pScreen, DestroyPixmap, XvDestroyPixmap);
return status;
@ -437,7 +425,7 @@ XvdiDestroyVideoNotifyList(void *pn, XID id)
{
XvVideoNotifyPtr npn, cpn;
/* ACTUALLY DESTROY THE NOTIFY LIST */
/* ACTUALLY DESTROY THE NOTITY LIST */
cpn = (XvVideoNotifyPtr) pn;
@ -481,7 +469,7 @@ XvdiSendVideoNotify(XvPortPtr pPort, DrawablePtr pDraw, int reason)
}
static int
int
XvdiSendPortNotify(XvPortPtr pPort, Atom attribute, INT32 value)
{
XvPortNotifyPtr pn;
@ -823,10 +811,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 +820,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;
@ -998,7 +984,7 @@ XvdiGetPortAttribute(ClientPtr client,
}
static void _X_COLD
static void
WriteSwappedVideoNotifyEvent(xvEvent * from, xvEvent * to)
{
@ -1012,7 +998,7 @@ WriteSwappedVideoNotifyEvent(xvEvent * from, xvEvent * to)
}
static void _X_COLD
static void
WriteSwappedPortNotifyEvent(xvEvent * from, xvEvent * to)
{

View file

@ -1,21 +1,22 @@
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <string.h>
#include <X11/X.h>
#include <X11/Xproto.h>
#include "Xext/xvdix_priv.h"
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "resource.h"
#include "scrnintstr.h"
#include "extnsionst.h"
#include "extinit_priv.h"
#include "extinit.h"
#include "servermd.h"
#include <X11/Xfuncproto.h>
#include "xvdix.h"
#include <X11/extensions/XvMC.h>
#include <X11/extensions/Xvproto.h>
#include <X11/extensions/XvMCproto.h>
@ -43,6 +44,8 @@ static RESTYPE XvMCRTContext;
static RESTYPE XvMCRTSurface;
static RESTYPE XvMCRTSubpicture;
int (*XvMCScreenInitProc)(ScreenPtr, int, XvMCAdaptorPtr) = NULL;
typedef struct {
int num_adaptors;
XvMCAdaptorPtr adaptors;
@ -287,7 +290,7 @@ ProcXvMCDestroyContext(ClientPtr client)
if (rc != Success)
return rc;
FreeResource(stuff->context_id, X11_RESTYPE_NONE);
FreeResource(stuff->context_id, RT_NONE);
return Success;
}
@ -365,7 +368,7 @@ ProcXvMCDestroySurface(ClientPtr client)
if (rc != Success)
return rc;
FreeResource(stuff->surface_id, X11_RESTYPE_NONE);
FreeResource(stuff->surface_id, RT_NONE);
return Success;
}
@ -493,7 +496,7 @@ ProcXvMCDestroySubpicture(ClientPtr client)
if (rc != Success)
return rc;
FreeResource(stuff->subpicture_id, X11_RESTYPE_NONE);
FreeResource(stuff->subpicture_id, RT_NONE);
return Success;
}
@ -687,7 +690,7 @@ ProcXvMCDispatch(ClientPtr client)
return BadRequest;
}
static int _X_COLD
static int
SProcXvMCDispatch(ClientPtr client)
{
/* We only support local */

View file

@ -84,9 +84,13 @@ typedef struct {
XvMCDestroySubpictureProcPtr DestroySubpicture;
} XvMCAdaptorRec, *XvMCAdaptorPtr;
extern int (*XvMCScreenInitProc)(ScreenPtr, int, XvMCAdaptorPtr);
extern _X_EXPORT int XvMCScreenInit(ScreenPtr pScreen,
int num, XvMCAdaptorPtr adapt);
extern _X_EXPORT XvImagePtr XvMCFindXvImage(XvPortPtr pPort, CARD32 id);
extern _X_EXPORT int xf86XvMCRegisterDRInfo(ScreenPtr pScreen, const char *name,
const char *busID, int major, int minor,
int patchLevel);

111
Xi/Makefile.am Normal file
View file

@ -0,0 +1,111 @@
noinst_LTLIBRARIES = libXi.la libXistubs.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 \
xibarriers.c \
xibarriers.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
libXistubs_la_SOURCES = \
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,12 +71,13 @@ SOFTWARE.
*
*/
int _X_COLD
int
SProcXChangeDeviceControl(ClientPtr client)
{
xDeviceCtl *ctl;
REQUEST(xChangeDeviceControlReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_EXTRA_SIZE(xChangeDeviceControlReq, sizeof(xDeviceCtl));
swaps(&stuff->control);
ctl = (xDeviceCtl *) &stuff[1];
@ -115,7 +117,7 @@ ProcXChangeDeviceControl(ClientPtr client)
REQUEST(xChangeDeviceControlReq);
REQUEST_AT_LEAST_EXTRA_SIZE(xChangeDeviceControlReq, sizeof(xDeviceCtl));
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;
@ -245,7 +247,7 @@ ProcXChangeDeviceControl(ClientPtr client)
*
*/
void _X_COLD
void
SRepXChangeDeviceControl(ClientPtr client, int size,
xChangeDeviceControlReply * rep)
{

View file

@ -50,7 +50,9 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
@ -69,10 +71,11 @@ SOFTWARE.
*
*/
int _X_COLD
int
SProcXChangeFeedbackControl(ClientPtr client)
{
REQUEST(xChangeFeedbackControlReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xChangeFeedbackControlReq);
swapl(&stuff->mask);
return (ProcXChangeFeedbackControl(client));
@ -435,7 +438,7 @@ ProcXChangeFeedbackControl(ClientPtr client)
REQUEST(xChangeFeedbackControlReq);
REQUEST_AT_LEAST_SIZE(xChangeFeedbackControlReq);
len = client->req_len - bytes_to_int32(sizeof(xChangeFeedbackControlReq));
len = stuff->length - bytes_to_int32(sizeof(xChangeFeedbackControlReq));
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixManageAccess);
if (rc != Success)
return rc;
@ -461,11 +464,8 @@ 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;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -50,7 +50,9 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
@ -59,6 +61,21 @@ SOFTWARE.
#include "devbell.h"
/***********************************************************************
*
* This procedure is invoked to swap the request bytes if the server and
* client have a different byte order.
*
*/
int
SProcXDeviceBell(ClientPtr client)
{
REQUEST(xDeviceBellReq);
swaps(&stuff->length);
return (ProcXDeviceBell(client));
}
/***********************************************************************
*
* This procedure rings a bell on an extension device.

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 */
);

View file

@ -78,37 +78,35 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h"
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/extensions/geproto.h>
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include <X11/extensions/XI2proto.h>
#include <X11/extensions/XKBproto.h>
#include "dix/dix_priv.h"
#include "dix/dixgrabs_priv.h"
#include "dix/eventconvert.h"
#include "dix/exevents_priv.h"
#include "dix/input_priv.h"
#include "inputstr.h"
#include <X11/extensions/geproto.h>
#include "windowstr.h"
#include "miscstruct.h"
#include "region.h"
#include "exevents.h"
#include "extnsionst.h"
#include "exglobals.h"
#include "eventstr.h"
#include "dixevents.h" /* DeliverFocusedEvent */
#include "dixgrabs.h" /* CreateGrab() */
#include "scrnintstr.h"
#include "listdev.h" /* for CopySwapXXXClass */
#include "xace.h"
#include "xiquerydevice.h" /* For List*Info */
#include "eventconvert.h"
#include "eventstr.h"
#include "inpututils.h"
#include "mi.h"
#include <X11/extensions/XKBproto.h>
#include "xkbsrv.h"
#define WID(w) ((w) ? ((w)->drawable.id) : 0)
@ -170,49 +168,6 @@ IsTouchEvent(InternalEvent *event)
return FALSE;
}
Bool
IsGestureEvent(InternalEvent *event)
{
switch (event->any.type) {
case ET_GesturePinchBegin:
case ET_GesturePinchUpdate:
case ET_GesturePinchEnd:
case ET_GestureSwipeBegin:
case ET_GestureSwipeUpdate:
case ET_GestureSwipeEnd:
return TRUE;
default:
break;
}
return FALSE;
}
Bool
IsGestureBeginEvent(InternalEvent *event)
{
switch (event->any.type) {
case ET_GesturePinchBegin:
case ET_GestureSwipeBegin:
return TRUE;
default:
break;
}
return FALSE;
}
Bool
IsGestureEndEvent(InternalEvent *event)
{
switch (event->any.type) {
case ET_GesturePinchEnd:
case ET_GestureSwipeEnd:
return TRUE;
default:
break;
}
return FALSE;
}
/**
* @return the device matching the deviceid of the device set in the event, or
* NULL if the event is not an XInput event.
@ -606,25 +561,22 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
to->button = calloc(1, sizeof(ButtonClassRec));
if (!to->button)
FatalError("[Xi] no memory for class shift.\n");
to->button->numButtons = from->button->numButtons;
}
else
classes->button = NULL;
}
if (from->button->xkb_acts) {
size_t maxbuttons = max(to->button->numButtons, from->button->numButtons);
to->button->xkb_acts = XNFreallocarray(to->button->xkb_acts,
maxbuttons,
sizeof(XkbAction));
memset(to->button->xkb_acts, 0, maxbuttons * sizeof(XkbAction));
if (!to->button->xkb_acts) {
to->button->xkb_acts = calloc(1, sizeof(XkbAction));
if (!to->button->xkb_acts)
FatalError("[Xi] not enough memory for xkb_acts.\n");
}
memcpy(to->button->xkb_acts, from->button->xkb_acts,
from->button->numButtons * sizeof(XkbAction));
sizeof(XkbAction));
}
else {
else
free(to->button->xkb_acts);
to->button->xkb_acts = NULL;
}
memcpy(to->button->labels, from->button->labels,
from->button->numButtons * sizeof(Atom));
@ -695,32 +647,13 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
/* Don't remove touch class if from->touch is non-existent. The to device
* may have an active touch grab, so we need to keep the touch class record
* around. */
if (from->gesture) {
if (!to->gesture) {
classes = to->unused_classes;
to->gesture = classes->gesture;
if (!to->gesture) {
if (!InitGestureClassDeviceStruct(to, from->gesture->max_touches))
FatalError("[Xi] no memory for class shift.\n");
}
else
classes->gesture = NULL;
}
to->gesture->sourceid = from->gesture->sourceid;
/* to->gesture->gesture is separate on the master, don't copy */
}
/* Don't remove gesture class if from->gesture is non-existent. The to device
* may have an active gesture grab, so we need to keep the gesture class record
* around. */
}
/**
* Copies the CONTENT of the classes of device from into the classes in device
* to. From and to are identical after finishing.
*
* If to does not have classes from currently has, the classes are stored in
* If to does not have classes from currenly has, the classes are stored in
* to's devPrivates system. Later, we recover it again from there if needed.
* Saves a few memory allocations.
*/
@ -813,8 +746,9 @@ UpdateDeviceMotionMask(DeviceIntPtr device, unsigned short state,
{
Mask mask;
mask = PointerMotionMask | state | motion_mask;
mask = DevicePointerMotionMask | state | motion_mask;
SetMaskForEvent(device->id, mask, DeviceMotionNotify);
mask = PointerMotionMask | state | motion_mask;
SetMaskForEvent(device->id, mask, MotionNotify);
}
@ -1093,7 +1027,7 @@ DeliverOneTouchEvent(ClientPtr client, DeviceIntPtr dev, TouchPointInfoPtr ti,
FixUpEventFromWindow(&ti->sprite, xi2, win, child, FALSE);
filter = GetEventFilter(dev, xi2);
if (XaceHookReceiveAccess(client, win, xi2, 1) != Success)
if (XaceHook(XACE_RECEIVE_ACCESS, client, win, xi2, 1) != Success)
return FALSE;
err = TryClientEvents(client, dev, xi2, 1, filter, filter, NullGrab);
free(xi2);
@ -1110,8 +1044,8 @@ ActivateEarlyAccept(DeviceIntPtr dev, TouchPointInfoPtr ti)
XID error;
GrabPtr grab = ti->listeners[0].grab;
BUG_RETURN(ti->listeners[0].type != TOUCH_LISTENER_GRAB &&
ti->listeners[0].type != TOUCH_LISTENER_POINTER_GRAB);
BUG_RETURN(ti->listeners[0].type != LISTENER_GRAB &&
ti->listeners[0].type != LISTENER_POINTER_GRAB);
BUG_RETURN(!grab);
client = rClient(grab);
@ -1144,8 +1078,8 @@ FindOldestPointerEmulatedTouch(DeviceIntPtr dev)
continue;
for (j = 0; j < ti->num_listeners; j++) {
if (ti->listeners[j].type == TOUCH_LISTENER_POINTER_GRAB ||
ti->listeners[j].type == TOUCH_LISTENER_POINTER_REGULAR)
if (ti->listeners[j].type == LISTENER_POINTER_GRAB ||
ti->listeners[j].type == LISTENER_POINTER_REGULAR)
break;
}
if (j == ti->num_listeners)
@ -1172,17 +1106,17 @@ TouchPuntToNextOwner(DeviceIntPtr dev, TouchPointInfoPtr ti,
TouchOwnershipEvent *ev)
{
TouchListener *listener = &ti->listeners[0]; /* new owner */
int accepted_early = listener->state == TOUCH_LISTENER_EARLY_ACCEPT;
int accepted_early = listener->state == LISTENER_EARLY_ACCEPT;
/* Deliver the ownership */
if (listener->state == TOUCH_LISTENER_AWAITING_OWNER || accepted_early)
if (listener->state == LISTENER_AWAITING_OWNER || accepted_early)
DeliverTouchEvents(dev, ti, (InternalEvent *) ev,
listener->listener);
else if (listener->state == TOUCH_LISTENER_AWAITING_BEGIN) {
else if (listener->state == LISTENER_AWAITING_BEGIN) {
/* We can't punt to a pointer listener unless all older pointer
* emulated touches have been seen already. */
if ((listener->type == TOUCH_LISTENER_POINTER_GRAB ||
listener->type == TOUCH_LISTENER_POINTER_REGULAR) &&
if ((listener->type == LISTENER_POINTER_GRAB ||
listener->type == LISTENER_POINTER_REGULAR) &&
ti != FindOldestPointerEmulatedTouch(dev))
return;
@ -1225,7 +1159,7 @@ CheckOldestTouch(DeviceIntPtr dev)
{
TouchPointInfoPtr oldest = FindOldestPointerEmulatedTouch(dev);
if (oldest && oldest->listeners[0].state == TOUCH_LISTENER_AWAITING_BEGIN)
if (oldest && oldest->listeners[0].state == LISTENER_AWAITING_BEGIN)
TouchPuntToNextOwner(dev, oldest, NULL);
}
@ -1249,7 +1183,7 @@ TouchRejected(DeviceIntPtr sourcedev, TouchPointInfoPtr ti, XID resource,
* haven't received one yet already */
for (i = 0; i < ti->num_listeners; i++) {
if (ti->listeners[i].listener == resource) {
if (ti->listeners[i].state != TOUCH_LISTENER_HAS_END)
if (ti->listeners[i].state != LISTENER_HAS_END)
TouchEmitTouchEnd(sourcedev, ti, TOUCH_REJECT, resource);
break;
}
@ -1295,12 +1229,12 @@ ProcessTouchOwnershipEvent(TouchOwnershipEvent *ev,
/* For pointer-emulated listeners that ungrabbed the active grab,
* the state was forced to TOUCH_LISTENER_HAS_END. Still go
* the state was forced to LISTENER_HAS_END. Still go
* through the motions of ending the touch if the listener has
* already seen the end. This ensures that the touch record is ended in
* the server.
*/
if (ti->listeners[0].state == TOUCH_LISTENER_HAS_END)
if (ti->listeners[0].state == LISTENER_HAS_END)
TouchEmitTouchEnd(dev, ti, TOUCH_ACCEPT, ti->listeners[0].listener);
/* The touch owner has accepted the touch. Send TouchEnd events to
@ -1311,10 +1245,10 @@ ProcessTouchOwnershipEvent(TouchOwnershipEvent *ev,
while (ti->num_listeners > 1)
TouchRemoveListener(ti, ti->listeners[1].listener);
/* Owner accepted after receiving end */
if (ti->listeners[0].state == TOUCH_LISTENER_HAS_END)
if (ti->listeners[0].state == LISTENER_HAS_END)
TouchEndTouch(dev, ti);
else
ti->listeners[0].state = TOUCH_LISTENER_HAS_ACCEPTED;
ti->listeners[0].state = LISTENER_HAS_ACCEPTED;
}
else { /* this is the very first ownership event for a grab */
DeliverTouchEvents(dev, ti, (InternalEvent *) ev, ev->resource);
@ -1360,8 +1294,9 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
InputClients *iclients = NULL;
*mask = NULL;
if (listener->type == TOUCH_LISTENER_GRAB ||
listener->type == TOUCH_LISTENER_POINTER_GRAB) {
if (listener->type == LISTENER_GRAB ||
listener->type == LISTENER_POINTER_GRAB) {
*grab = listener->grab;
BUG_RETURN_VAL(!*grab, FALSE);
@ -1381,12 +1316,11 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
int evtype;
if (ti->emulate_pointer &&
listener->type == TOUCH_LISTENER_POINTER_REGULAR)
listener->type == LISTENER_POINTER_REGULAR)
evtype = GetXI2Type(TouchGetPointerEventType(ev));
else
evtype = GetXI2Type(ev->any.type);
BUG_RETURN_VAL(!wOtherInputMasks(*win), FALSE);
nt_list_for_each_entry(iclients,
wOtherInputMasks(*win)->inputClients, next)
if (xi2mask_isset(iclients->xi2mask, dev, evtype))
@ -1401,7 +1335,6 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
int xi_type = GetXIType(TouchGetPointerEventType(ev));
Mask xi_filter = event_get_filter_from_type(dev, xi_type);
BUG_RETURN_VAL(!wOtherInputMasks(*win), FALSE);
nt_list_for_each_entry(iclients,
wOtherInputMasks(*win)->inputClients, next)
if (iclients->mask[dev->id] & xi_filter)
@ -1442,16 +1375,6 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
int nevents;
DeviceIntPtr kbd;
/* There may be a pointer grab on the device */
if (!grab) {
grab = dev->deviceGrab.grab;
if (grab) {
win = grab->window;
xi2mask = grab->xi2mask;
client = rClient(grab);
}
}
/* We don't deliver pointer events to non-owners */
if (!TouchResourceIsOwner(ti, listener->listener))
return !Success;
@ -1462,12 +1385,6 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
nevents = TouchConvertToPointerEvent(ev, &motion, &button);
BUG_RETURN_VAL(nevents == 0, BadValue);
/* Note that here we deliver only part of the events that are generated by the touch event:
*
* TouchBegin results in ButtonPress (motion is handled in DeliverEmulatedMotionEvent)
* TouchUpdate results in Motion
* TouchEnd results in ButtonRelease (motion is handled in DeliverEmulatedMotionEvent)
*/
if (nevents > 1)
ptrev = &button;
@ -1530,7 +1447,7 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
g = AllocGrab(devgrab);
BUG_WARN(!g);
CopyPartialInternalEvent(dev->deviceGrab.sync.event, ev);
*dev->deviceGrab.sync.event = ev->device_event;
/* The listener array has a sequence of grabs and then one event
* selection. Implicit grab activation occurs through delivering an
@ -1539,19 +1456,19 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
l = &ti->listeners[ti->num_listeners - 1];
l->listener = g->resource;
l->grab = g;
//l->resource_type = X11_RESTYPE_NONE;
//l->resource_type = RT_NONE;
if (devgrab->grabtype != XI2 || devgrab->type != XI_TouchBegin)
l->type = TOUCH_LISTENER_POINTER_GRAB;
l->type = LISTENER_POINTER_GRAB;
else
l->type = TOUCH_LISTENER_GRAB;
l->type = LISTENER_GRAB;
}
}
if (ev->any.type == ET_TouchBegin)
listener->state = TOUCH_LISTENER_IS_OWNER;
listener->state = LISTENER_IS_OWNER;
else if (ev->any.type == ET_TouchEnd)
listener->state = TOUCH_LISTENER_HAS_END;
listener->state = LISTENER_HAS_END;
return Success;
}
@ -1568,8 +1485,8 @@ DeliverEmulatedMotionEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
GrabPtr grab;
XI2Mask *mask;
if (ti->listeners[0].type != TOUCH_LISTENER_POINTER_REGULAR &&
ti->listeners[0].type != TOUCH_LISTENER_POINTER_GRAB)
if (ti->listeners[0].type != LISTENER_POINTER_REGULAR &&
ti->listeners[0].type != LISTENER_POINTER_GRAB)
return;
motion = ev->device_event;
@ -1581,6 +1498,16 @@ DeliverEmulatedMotionEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
&mask))
return;
/* There may be a pointer grab on the device */
if (!grab) {
grab = dev->deviceGrab.grab;
if (grab) {
win = grab->window;
mask = grab->xi2mask;
client = rClient(grab);
}
}
DeliverTouchEmulatedEvent(dev, ti, (InternalEvent*)&motion, &ti->listeners[0], client,
win, grab, mask);
}
@ -1672,8 +1599,7 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
/* if emulate_pointer is set, emulate the motion event right
* here, so we can ignore it for button event emulation. TouchUpdate
* events which _only_ emulate motion just work normally */
if (emulate_pointer && (ev->any.type == ET_TouchBegin ||
(ev->any.type == ET_TouchEnd && ti->num_listeners > 0)))
if (emulate_pointer && ev->any.type != ET_TouchUpdate)
DeliverEmulatedMotionEvent(dev, ti, ev);
if (emulate_pointer && IsMaster(dev))
@ -1749,72 +1675,6 @@ ProcessBarrierEvent(InternalEvent *e, DeviceIntPtr dev)
free(ev);
}
static BOOL
IsAnotherGestureActiveOnMaster(DeviceIntPtr dev, InternalEvent* ev)
{
GestureClassPtr g = dev->gesture;
if (g->gesture.active && g->gesture.sourceid != ev->gesture_event.sourceid) {
return TRUE;
}
return FALSE;
}
/**
* Processes and delivers a Gesture{Pinch,Swipe}{Begin,Update,End}.
*
* Due to having rather different delivery semantics (see the Xi 2.4 protocol
* spec for more information), this implements its own grab and event-selection
* delivery logic.
*/
void
ProcessGestureEvent(InternalEvent *ev, DeviceIntPtr dev)
{
GestureInfoPtr gi;
DeviceIntPtr kbd;
Bool deactivateGestureGrab = FALSE;
Bool delivered = FALSE;
if (!dev->gesture)
return;
if (IsMaster(dev) && IsAnotherGestureActiveOnMaster(dev, ev))
return;
if (IsGestureBeginEvent(ev))
gi = GestureBeginGesture(dev, ev);
else
gi = GestureFindActiveByEventType(dev, ev->any.type);
if (!gi) {
/* This may happen if gesture is no longer active or was never started. */
return;
}
kbd = GetMaster(dev, KEYBOARD_OR_FLOAT);
event_set_state_gesture(kbd, &ev->gesture_event);
if (IsGestureBeginEvent(ev))
GestureSetupListener(dev, gi, ev);
if (IsGestureEndEvent(ev) &&
dev->deviceGrab.grab &&
dev->deviceGrab.fromPassiveGrab &&
GrabIsGestureGrab(dev->deviceGrab.grab))
deactivateGestureGrab = TRUE;
delivered = DeliverGestureEventToOwner(dev, gi, ev);
if (delivered && !deactivateGestureGrab &&
(IsGestureBeginEvent(ev) || IsGestureEndEvent(ev)))
FreezeThisEventIfNeededForSyncGrab(dev, ev);
if (IsGestureEndEvent(ev))
GestureEndGesture(gi);
if (deactivateGestureGrab)
(*dev->deviceGrab.DeactivateGrab) (dev);
}
/**
* Process DeviceEvents and DeviceChangedEvents.
*/
@ -1881,7 +1741,7 @@ ProcessDeviceEvent(InternalEvent *ev, DeviceIntPtr device)
int count;
if (EventToCore(ev, &core, &count) == Success && count > 0) {
XaceHookKeyAvail(core, device, 0);
XaceHook(XACE_KEY_AVAIL, core, device, 0);
free(core);
}
}
@ -1907,7 +1767,7 @@ ProcessDeviceEvent(InternalEvent *ev, DeviceIntPtr device)
* nested) to clients. */
if (event->source_type == EVENT_SOURCE_FOCUS)
return;
if (!grab && CheckDeviceGrabs(device, ev, 0))
if (!grab && CheckDeviceGrabs(device, event, 0))
return;
break;
case ET_KeyRelease:
@ -1920,7 +1780,7 @@ ProcessDeviceEvent(InternalEvent *ev, DeviceIntPtr device)
if (b->map[key] == 0) /* there's no button 0 */
return;
event->detail.button = b->map[key];
if (!grab && CheckDeviceGrabs(device, ev, 0)) {
if (!grab && CheckDeviceGrabs(device, event, 0)) {
/* if a passive grab was activated, the event has been sent
* already */
return;
@ -2009,14 +1869,6 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device)
case ET_BarrierLeave:
ProcessBarrierEvent(ev, device);
break;
case ET_GesturePinchBegin:
case ET_GesturePinchUpdate:
case ET_GesturePinchEnd:
case ET_GestureSwipeBegin:
case ET_GestureSwipeUpdate:
case ET_GestureSwipeEnd:
ProcessGestureEvent(ev, device);
break;
default:
ProcessDeviceEvent(ev, device);
break;
@ -2033,14 +1885,14 @@ DeliverTouchBeginEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
int rc = Success;
Bool has_ownershipmask;
if (listener->type == TOUCH_LISTENER_POINTER_REGULAR ||
listener->type == TOUCH_LISTENER_POINTER_GRAB) {
if (listener->type == LISTENER_POINTER_REGULAR ||
listener->type == LISTENER_POINTER_GRAB) {
rc = DeliverTouchEmulatedEvent(dev, ti, ev, listener, client, win,
grab, xi2mask);
if (rc == Success) {
listener->state = TOUCH_LISTENER_IS_OWNER;
listener->state = LISTENER_IS_OWNER;
/* async grabs cannot replay, so automatically accept this touch */
if (listener->type == TOUCH_LISTENER_POINTER_GRAB &&
if (listener->type == LISTENER_POINTER_GRAB &&
dev->deviceGrab.grab &&
dev->deviceGrab.fromPassiveGrab &&
dev->deviceGrab.grab->pointerMode == GrabModeAsync)
@ -2055,18 +1907,18 @@ DeliverTouchBeginEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
rc = DeliverOneTouchEvent(client, dev, ti, grab, win, ev);
if (!TouchResourceIsOwner(ti, listener->listener)) {
if (has_ownershipmask)
state = TOUCH_LISTENER_AWAITING_OWNER;
state = LISTENER_AWAITING_OWNER;
else
state = TOUCH_LISTENER_AWAITING_BEGIN;
state = LISTENER_AWAITING_BEGIN;
}
else {
if (has_ownershipmask)
TouchSendOwnershipEvent(dev, ti, 0, listener->listener);
if (listener->type == TOUCH_LISTENER_REGULAR)
state = TOUCH_LISTENER_HAS_ACCEPTED;
if (listener->type == LISTENER_REGULAR)
state = LISTENER_HAS_ACCEPTED;
else
state = TOUCH_LISTENER_IS_OWNER;
state = LISTENER_IS_OWNER;
}
listener->state = state;
@ -2081,14 +1933,14 @@ DeliverTouchEndEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev,
{
int rc = Success;
if (listener->type == TOUCH_LISTENER_POINTER_REGULAR ||
listener->type == TOUCH_LISTENER_POINTER_GRAB) {
if (listener->type == LISTENER_POINTER_REGULAR ||
listener->type == LISTENER_POINTER_GRAB) {
/* Note: If the active grab was ungrabbed, we already changed the
* state to TOUCH_LISTENER_HAS_END but still get here. So we mustn't
* state to LISTENER_HAS_END but still get here. So we mustn't
* actually send the event.
* This is part two of the hack in DeactivatePointerGrab
*/
if (listener->state != TOUCH_LISTENER_HAS_END) {
if (listener->state != LISTENER_HAS_END) {
rc = DeliverTouchEmulatedEvent(dev, ti, ev, listener, client, win,
grab, xi2mask);
@ -2098,14 +1950,14 @@ DeliverTouchEndEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev,
* and we can continue.
*/
if (rc == Success)
listener->state = TOUCH_LISTENER_HAS_END;
listener->state = LISTENER_HAS_END;
}
goto out;
}
/* A client is waiting for the begin, don't give it a TouchEnd */
if (listener->state == TOUCH_LISTENER_AWAITING_BEGIN) {
listener->state = TOUCH_LISTENER_HAS_END;
if (listener->state == LISTENER_AWAITING_BEGIN) {
listener->state = LISTENER_HAS_END;
goto out;
}
@ -2113,19 +1965,19 @@ DeliverTouchEndEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev,
if (ev->device_event.flags & TOUCH_REJECT ||
(ev->device_event.flags & TOUCH_ACCEPT && !TouchResourceIsOwner(ti, listener->listener))) {
/* Touch has been rejected, or accepted by its owner which is not this listener */
if (listener->state != TOUCH_LISTENER_HAS_END)
if (listener->state != LISTENER_HAS_END)
rc = DeliverOneTouchEvent(client, dev, ti, grab, win, ev);
listener->state = TOUCH_LISTENER_HAS_END;
listener->state = LISTENER_HAS_END;
}
else if (TouchResourceIsOwner(ti, listener->listener)) {
Bool normal_end = !(ev->device_event.flags & TOUCH_ACCEPT);
/* FIXME: what about early acceptance */
if (normal_end && listener->state != TOUCH_LISTENER_HAS_END)
if (normal_end && listener->state != LISTENER_HAS_END)
rc = DeliverOneTouchEvent(client, dev, ti, grab, win, ev);
if ((ti->num_listeners > 1 ||
(ti->num_grabs > 0 && listener->state != TOUCH_LISTENER_HAS_ACCEPTED)) &&
(ti->num_grabs > 0 && listener->state != LISTENER_HAS_ACCEPTED)) &&
(ev->device_event.flags & (TOUCH_ACCEPT | TOUCH_REJECT)) == 0) {
ev->any.type = ET_TouchUpdate;
ev->device_event.flags |= TOUCH_PENDING_END;
@ -2133,7 +1985,7 @@ DeliverTouchEndEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev,
}
if (normal_end)
listener->state = TOUCH_LISTENER_HAS_END;
listener->state = LISTENER_HAS_END;
}
out:
@ -2156,7 +2008,7 @@ DeliverTouchEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev,
if (!TouchResourceIsOwner(ti, listener->listener))
goto out;
rc = DeliverOneTouchEvent(client, dev, ti, grab, win, ev);
listener->state = TOUCH_LISTENER_IS_OWNER;
listener->state = LISTENER_IS_OWNER;
}
else
ev->device_event.deviceid = dev->id;
@ -2166,8 +2018,8 @@ DeliverTouchEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev,
xi2mask);
}
else if (ev->any.type == ET_TouchUpdate) {
if (listener->type == TOUCH_LISTENER_POINTER_REGULAR ||
listener->type == TOUCH_LISTENER_POINTER_GRAB)
if (listener->type == LISTENER_POINTER_REGULAR ||
listener->type == LISTENER_POINTER_GRAB)
DeliverTouchEmulatedEvent(dev, ti, ev, listener, client, win, grab,
xi2mask);
else if (TouchResourceIsOwner(ti, listener->listener) ||
@ -2221,112 +2073,6 @@ DeliverTouchEvents(DeviceIntPtr dev, TouchPointInfoPtr ti,
}
}
/**
* Attempts to deliver a gesture event to the given client.
*/
static Bool
DeliverOneGestureEvent(ClientPtr client, DeviceIntPtr dev, GestureInfoPtr gi,
GrabPtr grab, WindowPtr win, InternalEvent *ev)
{
int err;
xEvent *xi2;
Mask filter;
Window child = DeepestSpriteWin(&gi->sprite)->drawable.id;
/* If we fail here, we're going to leave a client hanging. */
err = EventToXI2(ev, &xi2);
if (err != Success)
FatalError("[Xi] %s: XI2 conversion failed in %s"
" (%d)\n", dev->name, __func__, err);
FixUpEventFromWindow(&gi->sprite, xi2, win, child, FALSE);
filter = GetEventFilter(dev, xi2);
if (XaceHookReceiveAccess(client, win, xi2, 1) != Success)
return FALSE;
err = TryClientEvents(client, dev, xi2, 1, filter, filter, NullGrab);
free(xi2);
/* Returning the value from TryClientEvents isn't useful, since all our
* resource-gone cleanups will update the delivery list anyway. */
return TRUE;
}
/**
* Given a gesture event and a potential listener, retrieve info needed for processing the event.
*
* @param dev The device generating the gesture event.
* @param ev The gesture event to process.
* @param listener The gesture event listener that may receive the gesture event.
* @param[out] client The client that should receive the gesture event.
* @param[out] win The window to deliver the event on.
* @param[out] grab The grab to deliver the event through, if any.
* @return TRUE if an event should be delivered to the listener, FALSE
* otherwise.
*/
static Bool
RetrieveGestureDeliveryData(DeviceIntPtr dev, InternalEvent *ev, GestureListener* listener,
ClientPtr *client, WindowPtr *win, GrabPtr *grab)
{
int rc;
int evtype;
InputClients *iclients = NULL;
*grab = NULL;
if (listener->type == GESTURE_LISTENER_GRAB ||
listener->type == GESTURE_LISTENER_NONGESTURE_GRAB) {
*grab = listener->grab;
BUG_RETURN_VAL(!*grab, FALSE);
*client = rClient(*grab);
*win = (*grab)->window;
}
else {
rc = dixLookupResourceByType((void **) win, listener->listener, listener->resource_type,
serverClient, DixSendAccess);
if (rc != Success)
return FALSE;
/* note that we only will have XI2 listeners as
listener->type == GESTURE_LISTENER_REGULAR */
evtype = GetXI2Type(ev->any.type);
BUG_RETURN_VAL(!wOtherInputMasks(*win), FALSE);
nt_list_for_each_entry(iclients, wOtherInputMasks(*win)->inputClients, next)
if (xi2mask_isset(iclients->xi2mask, dev, evtype))
break;
BUG_RETURN_VAL(!iclients, FALSE);
*client = rClient(iclients);
}
return TRUE;
}
/**
* Delivers a gesture to the owner, if possible and needed. Returns whether
* an event was delivered.
*/
Bool
DeliverGestureEventToOwner(DeviceIntPtr dev, GestureInfoPtr gi, InternalEvent *ev)
{
GrabPtr grab = NULL;
ClientPtr client;
WindowPtr win;
if (!gi->has_listener || gi->listener.type == GESTURE_LISTENER_NONGESTURE_GRAB) {
return 0;
}
if (!RetrieveGestureDeliveryData(dev, ev, &gi->listener, &client, &win, &grab))
return 0;
ev->gesture_event.deviceid = dev->id;
return DeliverOneGestureEvent(client, dev, gi, grab, win, ev);
}
int
InitProximityClassDeviceStruct(DeviceIntPtr dev)
{
@ -2506,7 +2252,7 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
cursor = NullCursor;
else {
rc = dixLookupResourceByType((void **) &cursor, param->cursor,
X11_RESTYPE_CURSOR, client, DixUseAccess);
RT_CURSOR, client, DixUseAccess);
if (rc != Success) {
client->errorValue = param->cursor;
return rc;
@ -2516,7 +2262,7 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
if (param->this_device_mode == GrabModeSync ||
param->other_devices_mode == GrabModeSync)
access_mode |= DixFreezeAccess;
rc = XaceHookDeviceAccess(client, dev, access_mode);
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, access_mode);
if (rc != Success)
return rc;
rc = dixLookupWindow(&pWin, param->grabWindow, client, DixSetAttrAccess);
@ -2572,7 +2318,7 @@ GrabKey(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
if (param->this_device_mode == GrabModeSync ||
param->other_devices_mode == GrabModeSync)
access_mode |= DixFreezeAccess;
rc = XaceHookDeviceAccess(client, dev, access_mode);
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, access_mode);
if (rc != Success)
return rc;
@ -2605,7 +2351,7 @@ GrabWindow(ClientPtr client, DeviceIntPtr dev, int type,
cursor = NullCursor;
else {
rc = dixLookupResourceByType((void **) &cursor, param->cursor,
X11_RESTYPE_CURSOR, client, DixUseAccess);
RT_CURSOR, client, DixUseAccess);
if (rc != Success) {
client->errorValue = param->cursor;
return rc;
@ -2615,7 +2361,7 @@ GrabWindow(ClientPtr client, DeviceIntPtr dev, int type,
if (param->this_device_mode == GrabModeSync ||
param->other_devices_mode == GrabModeSync)
access_mode |= DixFreezeAccess;
rc = XaceHookDeviceAccess(client, dev, access_mode);
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, access_mode);
if (rc != Success)
return rc;
@ -2632,8 +2378,8 @@ GrabWindow(ClientPtr client, DeviceIntPtr dev, int type,
/* Touch grab */
int
GrabTouchOrGesture(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr mod_dev,
int type, GrabParameters *param, GrabMask *mask)
GrabTouch(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr mod_dev,
GrabParameters *param, GrabMask *mask)
{
WindowPtr pWin;
GrabPtr grab;
@ -2646,12 +2392,12 @@ GrabTouchOrGesture(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr mod_dev,
rc = dixLookupWindow(&pWin, param->grabWindow, client, DixSetAttrAccess);
if (rc != Success)
return rc;
rc = XaceHookDeviceAccess(client, dev, DixGrabAccess);
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixGrabAccess);
if (rc != Success)
return rc;
grab = CreateGrab(client->index, dev, mod_dev, pWin, XI2,
mask, param, type, 0, NullWindow, NullCursor);
mask, param, XI_TouchBegin, 0, NullWindow, NullCursor);
if (!grab)
return BadAlloc;
@ -2693,7 +2439,7 @@ SelectForWindow(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client,
if (i == EMASKSIZE) {
RecalculateDeviceDeliverableEvents(pWin);
if (ShouldFreeInputMasks(pWin, FALSE))
FreeResource(others->resource, X11_RESTYPE_NONE);
FreeResource(others->resource, RT_NONE);
return Success;
}
}
@ -2781,12 +2527,6 @@ FreeInputMask(OtherInputMasks ** imask)
*imask = NULL;
}
#define XIPropagateMask (KeyPressMask | \
KeyReleaseMask | \
ButtonPressMask | \
ButtonReleaseMask | \
PointerMotionMask)
void
RecalculateDeviceDeliverableEvents(WindowPtr pWin)
{
@ -2813,7 +2553,7 @@ RecalculateDeviceDeliverableEvents(WindowPtr pWin)
inputMasks->deliverableEvents[i] |=
(wOtherInputMasks(tmp)->deliverableEvents[i]
& ~inputMasks->dontPropagateMask[i] &
XIPropagateMask);
PropagateMask[i]);
}
if (pChild->firstChild) {
pChild = pChild->firstChild;
@ -2927,7 +2667,7 @@ SendEvent(ClientPtr client, DeviceIntPtr d, Window dest, Bool propagate,
return Success;
/* If the input focus is PointerRootWin, send the event to where
* the pointer is if possible, then perhaps propagate up to root. */
* the pointer is if possible, then perhaps propogate up to root. */
if (inputFocus == PointerRootWin)
inputFocus = GetCurrentRootWindow(d);
@ -2959,7 +2699,7 @@ SendEvent(ClientPtr client, DeviceIntPtr d, Window dest, Bool propagate,
break;
}
}
else if (!XaceHookSendAccess(client, NULL, pWin, ev, count))
else if (!XaceHook(XACE_SEND_ACCESS, client, NULL, pWin, ev, count))
DeliverEventsToWindow(d, pWin, ev, count, mask, NullGrab);
return Success;
}
@ -3120,7 +2860,7 @@ DeleteWindowFromAnyExtEvents(WindowPtr pWin, Bool freeResources)
ic = inputMasks->inputClients;
for (i = 0; i < EMASKSIZE; i++)
inputMasks->dontPropagateMask[i] = 0;
FreeResource(ic->resource, X11_RESTYPE_NONE);
FreeResource(ic->resource, RT_NONE);
}
}
@ -3226,7 +2966,7 @@ DeviceEventSuppressForWindow(WindowPtr pWin, ClientPtr client, Mask mask,
{
struct _OtherInputMasks *inputMasks = wOtherInputMasks(pWin);
if (mask & ~XIPropagateMask) {
if (mask & ~PropagateMask[maskndx]) {
client->errorValue = mask;
return BadValue;
}
@ -3236,19 +2976,14 @@ DeviceEventSuppressForWindow(WindowPtr pWin, ClientPtr client, Mask mask,
inputMasks->dontPropagateMask[maskndx] = mask;
}
else {
if (!inputMasks) {
int ret = AddExtensionClient(pWin, client, 0, 0);
if (ret != Success)
return ret;
inputMasks = wOtherInputMasks(pWin);
BUG_RETURN_VAL(!inputMasks, BadAlloc);
}
if (!inputMasks)
AddExtensionClient(pWin, client, 0, 0);
inputMasks = wOtherInputMasks(pWin);
inputMasks->dontPropagateMask[maskndx] = mask;
}
RecalculateDeviceDeliverableEvents(pWin);
if (inputMasks && ShouldFreeInputMasks(pWin, FALSE))
FreeResource(inputMasks->inputClients->resource, X11_RESTYPE_NONE);
if (ShouldFreeInputMasks(pWin, FALSE))
FreeResource(inputMasks->inputClients->resource, RT_NONE);
return Success;
}
@ -3342,7 +3077,6 @@ XISetEventMask(DeviceIntPtr dev, WindowPtr win, ClientPtr client,
if (len && !others) {
if (AddExtensionClient(win, client, 0, 0) != Success)
return BadAlloc;
BUG_RETURN_VAL(!wOtherInputMasks(win), BadAlloc);
others = wOtherInputMasks(win)->inputClients;
}

View file

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

View file

@ -51,7 +51,9 @@ SOFTWARE.
*/
#define NUMTYPES 15
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h"
#include "gcstruct.h" /* pointer for extnsionst.h */
@ -60,17 +62,11 @@ SOFTWARE.
#include <X11/extensions/XIproto.h>
#include <X11/extensions/XI2proto.h>
#include <X11/extensions/geproto.h>
#include "dix/dix_priv.h"
#include "dix/exevents_priv.h"
#include "inputstr.h"
#include "gcstruct.h" /* pointer for extnsionst.h */
#include "extnsionst.h" /* extension entry */
#include "geext.h" /* extension interfaces for ge */
#include "dixevents.h"
#include "extinit_priv.h"
#include "exevents.h"
#include "extinit.h"
#include "exglobals.h"
#include "swaprep.h"
#include "privates.h"
@ -133,8 +129,13 @@ SOFTWARE.
* breaks down. The device needs the dev->button->motionMask. If DBMM is
* the same as BMM, we can ensure that both core and device events can be
* delivered, without the need for extra structures in the DeviceIntRec. */
const Mask DeviceKeyPressMask = KeyPressMask;
const Mask DeviceKeyReleaseMask = KeyReleaseMask;
const Mask DeviceButtonPressMask = ButtonPressMask;
const Mask DeviceButtonReleaseMask = ButtonReleaseMask;
const Mask DeviceProximityMask = (1L << 4);
const Mask DeviceStateNotifyMask = (1L << 5);
const Mask DevicePointerMotionMask = PointerMotionMask;
const Mask DevicePointerMotionHintMask = PointerMotionHintMask;
const Mask DeviceButton1MotionMask = Button1MotionMask;
const Mask DeviceButton2MotionMask = Button2MotionMask;
@ -152,6 +153,7 @@ const Mask DevicePropertyNotifyMask = (1L << 19);
const Mask XIAllMasks = (1L << 20) - 1;
int ExtEventIndex;
Mask ExtExclusiveMasks[EMASKSIZE];
static struct dev_type {
Atom type;
@ -256,19 +258,19 @@ static int (*ProcIVector[]) (ClientPtr) = {
/* 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 +278,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 */
@ -362,6 +364,8 @@ RESTYPE RT_INPUTCLIENT;
extern XExtensionVersion XIVersion;
Mask PropagateMask[EMASKSIZE];
/*****************************************************************
*
* Versioning support
@ -403,7 +407,7 @@ ProcIDispatch(ClientPtr client)
*
*/
static int _X_COLD
static int
SProcIDispatch(ClientPtr client)
{
REQUEST(xReq);
@ -421,7 +425,7 @@ SProcIDispatch(ClientPtr client)
*
*/
static void _X_COLD
static void
SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep)
{
/* All we look at is the type field */
@ -516,7 +520,7 @@ static void
SEventDeviceValuator(deviceValuator * from, deviceValuator * to)
{
int i;
INT32 *ip;
INT32 *ip B32;
*to = *from;
swaps(&to->sequenceNumber);
@ -540,7 +544,7 @@ static void
SDeviceStateNotifyEvent(deviceStateNotify * from, deviceStateNotify * to)
{
int i;
INT32 *ip;
INT32 *ip B32;
*to = *from;
swaps(&to->sequenceNumber);
@ -854,76 +858,8 @@ SBarrierEvent(xXIBarrierEvent * from,
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) {
@ -973,24 +909,28 @@ XI2EventSwap(xGenericEvent *from, xGenericEvent *to)
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 +951,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 +1029,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 +1050,8 @@ FixExtensionEvents(ExtensionEntry * extEntry)
SetMaskForExtEvent(DeviceStateNotifyMask, DeviceStateNotify);
SetMaskForExtEvent(PointerMotionMask, DeviceMotionNotify);
SetMaskForExtEvent(DevicePointerMotionMask, DeviceMotionNotify);
AllowPropagateSuppress(DevicePointerMotionMask);
SetCriticalEvent(DeviceMotionNotify);
SetEventInfo(DevicePointerMotionHintMask, _devicePointerMotionHint);
@ -1107,6 +1069,8 @@ FixExtensionEvents(ExtensionEntry * extEntry)
SetMaskForExtEvent(ChangeDeviceNotifyMask, ChangeDeviceNotify);
SetEventInfo(DeviceButtonGrabMask, _deviceButtonGrab);
SetExclusiveAccess(DeviceButtonGrabMask);
SetEventInfo(DeviceOwnerGrabButtonMask, _deviceOwnerGrabButton);
SetEventInfo(DevicePresenceNotifyMask, _devicePresence);
SetMaskForExtEvent(DevicePropertyNotifyMask, DevicePropertyNotify);
@ -1238,7 +1202,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;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -50,15 +50,16 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/exevents_priv.h"
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exevents.h"
#include "exglobals.h"
#include "gtmotion.h"
/***********************************************************************
@ -67,10 +68,11 @@ SOFTWARE.
*
*/
int _X_COLD
int
SProcXGetDeviceMotionEvents(ClientPtr client)
{
REQUEST(xGetDeviceMotionEventsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xGetDeviceMotionEventsReq);
swapl(&stuff->start);
swapl(&stuff->stop);
@ -160,7 +162,7 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
*
*/
void _X_COLD
void
SRepXGetDeviceMotionEvents(ClientPtr client, int size,
xGetDeviceMotionEventsReply * rep)
{

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -50,18 +50,32 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/input_priv.h"
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exevents.h"
#include "exglobals.h"
#include "setbmap.h"
/***********************************************************************
*
* This procedure changes the button mapping.
*
*/
int
SProcXSetDeviceButtonMapping(ClientPtr client)
{
REQUEST(xSetDeviceButtonMappingReq);
swaps(&stuff->length);
return (ProcXSetDeviceButtonMapping(client));
}
/***********************************************************************
*
* This procedure lists the input devices available to the server.
@ -78,7 +92,7 @@ ProcXSetDeviceButtonMapping(ClientPtr client)
REQUEST(xSetDeviceButtonMappingReq);
REQUEST_AT_LEAST_SIZE(xSetDeviceButtonMappingReq);
if (client->req_len !=
if (stuff->length !=
bytes_to_int32(sizeof(xSetDeviceButtonMappingReq) + stuff->map_length))
return BadLength;
@ -116,7 +130,7 @@ ProcXSetDeviceButtonMapping(ClientPtr client)
*
*/
void _X_COLD
void
SRepXSetDeviceButtonMapping(ClientPtr client, int size,
xSetDeviceButtonMappingReply * rep)
{

View file

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

View file

@ -50,18 +50,32 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/input_priv.h"
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "XIstubs.h"
#include "exglobals.h"
#include "setdval.h"
/***********************************************************************
*
* Handle a request from a client with a different byte order.
*
*/
int
SProcXSetDeviceValuators(ClientPtr client)
{
REQUEST(xSetDeviceValuatorsReq);
swaps(&stuff->length);
return (ProcXSetDeviceValuators(client));
}
/***********************************************************************
*
* This procedure sets the value of valuators on an extension input device.
@ -86,7 +100,7 @@ ProcXSetDeviceValuators(ClientPtr client)
.status = Success
};
if (client->req_len != bytes_to_int32(sizeof(xSetDeviceValuatorsReq)) +
if (stuff->length != bytes_to_int32(sizeof(xSetDeviceValuatorsReq)) +
stuff->num_valuators)
return BadLength;
@ -123,7 +137,7 @@ ProcXSetDeviceValuators(ClientPtr client)
*
*/
void _X_COLD
void
SRepXSetDeviceValuators(ClientPtr client, int size,
xSetDeviceValuatorsReply * rep)
{

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