Compare commits

..

154 commits

Author SHA1 Message Date
Olivier Fourdan
449b197e7e Bump version to 24.1.8
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2030>
2025-06-18 18:00:16 +02:00
Olivier Fourdan
d2a7903154 os: Check for integer overflow on BigRequest length
Check for another possible integer overflow once we get a complete xReq
with BigRequest.

Related to CVE-2025-49176

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Suggested-by: Peter Harris <pharris2@rocketsoftware.com>
(cherry picked from commit 4fc4d76b2c)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2030>
2025-06-18 17:59:36 +02:00
Olivier Fourdan
2c5e87e3df Bump version to 24.1.7
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2026>
2025-06-17 15:08:26 +02:00
Olivier Fourdan
fce91bcbe2 randr: Check for overflow in RRChangeProviderProperty()
A client might send a request causing an integer overflow when computing
the total size to allocate in RRChangeProviderProperty().

To avoid the issue, check that total length in bytes won't exceed the
maximum integer value.

CVE-2025-49180

This issue was discovered by Nils Emmerich <nemmerich@ernw.de> and
reported by Julian Suleder via ERNW Vulnerability Disclosure.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 3c3a4b767b)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2026>
2025-06-17 15:08:17 +02:00
Olivier Fourdan
9d20532389 record: Check for overflow in RecordSanityCheckRegisterClients()
The RecordSanityCheckRegisterClients() checks for the request length,
but does not check for integer overflow.

A client might send a very large value for either the number of clients
or the number of protocol ranges that will cause an integer overflow in
the request length computation, defeating the check for request length.

To avoid the issue, explicitly check the number of clients against the
limit of clients (which is much lower than an maximum integer value) and
the number of protocol ranges (multiplied by the record length) do not
exceed the maximum integer value.

This way, we ensure that the final computation for the request length
will not overflow the maximum integer limit.

CVE-2025-49179

This issue was discovered by Nils Emmerich <nemmerich@ernw.de> and
reported by Julian Suleder via ERNW Vulnerability Disclosure.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 2bde9ca49a)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2026>
2025-06-17 15:08:10 +02:00
Olivier Fourdan
41ae2e70ad os: Account for bytes to ignore when sharing input buffer
When reading requests from the clients, the input buffer might be shared
and used between different clients.

If a given client sends a full request with non-zero bytes to ignore,
the bytes to ignore may still be non-zero even though the request is
full, in which case the buffer could be shared with another client who's
request will not be processed because of those bytes to ignore, leading
to a possible hang of the other client request.

To avoid the issue, make sure we have zero bytes to ignore left in the
input request when sharing the input buffer with another client.

CVE-2025-49178

This issue was discovered by Nils Emmerich <nemmerich@ernw.de> and
reported by Julian Suleder via ERNW Vulnerability Disclosure.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit d55c54cecb)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2026>
2025-06-17 15:08:02 +02:00
Olivier Fourdan
b7c5685a26 xfixes: Check request length for SetClientDisconnectMode
The handler of XFixesSetClientDisconnectMode does not check the client
request length.

A client could send a shorter request and read data from a former
request.

Fix the issue by checking the request size matches.

CVE-2025-49177

This issue was discovered by Nils Emmerich <nemmerich@ernw.de> and
reported by Julian Suleder via ERNW Vulnerability Disclosure.

Fixes: e167299f6 - xfixes: Add ClientDisconnectMode
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit ab02fb96b1)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2026>
2025-06-17 15:07:52 +02:00
Olivier Fourdan
437a0cad0b os: Do not overflow the integer size with BigRequest
The BigRequest extension allows requests larger than the 16-bit length
limit.

It uses integers for the request length and checks for the size not to
exceed the maxBigRequestSize limit, but does so after translating the
length to integer by multiplying the given size in bytes by 4.

In doing so, it might overflow the integer size limit before actually
checking for the overflow, defeating the purpose of the test.

To avoid the issue, make sure to check that the request size does not
overflow the maxBigRequestSize limit prior to any conversion.

The caller Dispatch() function however expects the return value to be in
bytes, so we cannot just return the converted value in case of error, as
that would also overflow the integer size.

To preserve the existing API, we use a negative value for the X11 error
code BadLength as the function only return positive values, 0 or -1 and
update the caller Dispatch() function to take that case into account to
return the error code to the offending client.

CVE-2025-49176

This issue was discovered by Nils Emmerich <nemmerich@ernw.de> and
reported by Julian Suleder via ERNW Vulnerability Disclosure.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
(cherry picked from commit 03731b326a)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2026>
2025-06-17 15:07:43 +02:00
Olivier Fourdan
fa6b40037a render: Avoid 0 or less animated cursors
Animated cursors use a series of cursors that the client can set.

By default, the Xserver assumes at least one cursor is specified
while a client may actually pass no cursor at all.

That causes an out-of-bound read creating the animated cursor and a
crash of the Xserver:

 | Invalid read of size 8
 |    at 0x5323F4: AnimCursorCreate (animcur.c:325)
 |    by 0x52D4C5: ProcRenderCreateAnimCursor (render.c:1817)
 |    by 0x52DC80: ProcRenderDispatch (render.c:1999)
 |    by 0x4A1E9D: Dispatch (dispatch.c:560)
 |    by 0x4B0169: dix_main (main.c:284)
 |    by 0x4287F5: main (stubmain.c:34)
 |  Address 0x59aa010 is 0 bytes after a block of size 0 alloc'd
 |    at 0x48468D3: reallocarray (vg_replace_malloc.c:1803)
 |    by 0x52D3DA: ProcRenderCreateAnimCursor (render.c:1802)
 |    by 0x52DC80: ProcRenderDispatch (render.c:1999)
 |    by 0x4A1E9D: Dispatch (dispatch.c:560)
 |    by 0x4B0169: dix_main (main.c:284)
 |    by 0x4287F5: main (stubmain.c:34)
 |
 | Invalid read of size 2
 |    at 0x5323F7: AnimCursorCreate (animcur.c:325)
 |    by 0x52D4C5: ProcRenderCreateAnimCursor (render.c:1817)
 |    by 0x52DC80: ProcRenderDispatch (render.c:1999)
 |    by 0x4A1E9D: Dispatch (dispatch.c:560)
 |    by 0x4B0169: dix_main (main.c:284)
 |    by 0x4287F5: main (stubmain.c:34)
 |  Address 0x8 is not stack'd, malloc'd or (recently) free'd

To avoid the issue, check the number of cursors specified and return a
BadValue error in both the proc handler (early) and the animated cursor
creation (as this is a public function) if there is 0 or less cursor.

CVE-2025-49175

This issue was discovered by Nils Emmerich <nemmerich@ernw.de> and
reported by Julian Suleder via ERNW Vulnerability Disclosure.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: José Expósito <jexposit@redhat.com>
(cherry picked from commit 0885e0b262)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2026>
2025-06-17 15:07:32 +02:00
Peter Hutterer
34ef671aa5 dix: pick the right keyboard for focus FollowKeyboard
This fixes a crash when we try to send focus events and dereference
FollowKeyboardWin (0x3) as WindowPtr.

A device set to XSetDeviceFocus(FollowKeyboard) is supposed to follow
the focus of the corresponding master device. During ActivateKeyboard
a slave device is detached from the master for the duration for the grab
so we don't actually have a master to follow - leaving our oldWin set to
the FollowKeyboardWin constant. This later crashes when we try to
dereference it.

Fix this by getting the current master (if any), or the saved master (if
temporarily detached due to a grab). And if failing that, use the VCK
as fallback device - that is technically wrong but it's such a niche use
case that it shouldn't matter.

Reproducer:
     window = XCreateSimpleWindow(...)
     deviceid = any device that is IsXExtensionKeyboard device
     XSetDeviceFocus(deviceid, FollowKeyboard, ...)
     XGrabDevice(deviceid, window, ...)

Fixes: f01ee198ff ("dix: don't use inputInfo.keyboard to get the focus window in ActivateKbdGrab")

Found-by: Olivier Fourdan <ofourdan@redhat.com>
Acked-by: Olivier Fourdan <ofourdan@redhat.com>
Tested-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit cab9017485)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1895>
2025-04-08 10:06:12 +02:00
Peter Hutterer
a50e6a2e33 dix: fix erroneous BUG_RETURN check
Check was inverted, we want to complain if evcount exceeds our target
array.

Fixes: 219c54b8a3 ("dix: fix DeviceStateNotify event calculation")
(cherry picked from commit 2bca68f41b)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1895>
2025-04-08 10:06:02 +02:00
Alan Coopersmith
1119ea220a dix-config.h: define HAVE_STRUCT_SOCKADDR_STORAGE for xtrans 1.6
xtrans 1.6 will use struct sockaddr_storage if HAVE_STRUCT_SOCKADDR_STORAGE
is defined, even if IPv6 is disabled, unlike previous versions which tied
it to the IPv6 #define.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit 4b5d410591)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1895>
2025-04-08 10:05:49 +02:00
Alan Coopersmith
6f1acb0dff pkgconfig files: Add URL
https://github.com/pkgconf/pkgconf/blob/master/man/pc.5 says it's
a mandatory field in *.pc files.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit b73cd6066a)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1895>
2025-04-08 10:05:31 +02:00
Peter Hutterer
3a6d035aec Xi: disallow grabbing disabled devices
Grabbing a disabled (pointer) device will lead to a segfault later
in the myriad of places where we look at the device's spriteInfo - which
will be NULL.

As a workaround, disallow grabbing a disabled device by pretending it's
already grabbed. Since the point of a grab is to receive all events by
that device and disabled devices cannot send events, this should be Good
Enough.

Tested-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit 797f63b8be)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1895>
2025-04-08 10:04:53 +02:00
Alan Coopersmith
91e42e523c xkb: Add tbGetBufferString helper function
Handles common case of allocating & copying string to temporary buffer

(cherry picked from xorg/lib/libxkbfile@8a91517ca6ea77633476595b0eb5b213357c60e5)

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit 42a1f25faf)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1895>
2025-04-08 10:03:55 +02:00
Martin Burggraf
bd43d90cd1 xkb: correcting mathematical nonsense in XkbGeomFPText
Fixes formatting of negative numbers, so they don't show minus sign
after the decimal point.

(cherry picked from xorg/lib/libxkbfile@d2ec504fec2550f4fd046e801b34317ef4a4bab9)

Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit 7a23010232)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1895>
2025-04-08 10:03:50 +02:00
Alan Coopersmith
ed54cc2a03 xkb: Convert more sprintf calls to snprintf in xkbtext.c
Based on xorg/lib/libxkbfile@390acfe5bb88cdab509b5eaae4041f265e969d2b

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit 60419d8e4a)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1895>
2025-04-08 10:03:45 +02:00
José Expósito
b32d637f51 xkb: Check that needed is > 0 in XkbResizeKeyActions
Passing a negative value in `needed` to the `XkbResizeKeyActions()`
function can create a `newActs` array of an unespected size.
Check the value and return if it is invalid.

This error has been found by a static analysis tool. This is the report:

    Error: OVERRUN (CWE-119):
    libX11-1.8.7/src/xkb/XKBMAlloc.c:811: cond_const:
      Checking "xkb->server->size_acts == 0" implies that
      "xkb->server->size_acts" is 0 on the true branch.
    libX11-1.8.7/src/xkb/XKBMAlloc.c:811: buffer_alloc:
      "calloc" allocates 8 bytes dictated by parameters
      "(size_t)((xkb->server->size_acts == 0) ? 1 : xkb->server->size_acts)"
      and "8UL".
    libX11-1.8.7/src/xkb/XKBMAlloc.c:811: var_assign:
      Assigning: "newActs" = "calloc((size_t)((xkb->server->size_acts == 0) ? 1 : xkb->server->size_acts), 8UL)".
    libX11-1.8.7/src/xkb/XKBMAlloc.c:815: assignment:
      Assigning: "nActs" = "1".
    libX11-1.8.7/src/xkb/XKBMAlloc.c:829: cond_at_least:
      Checking "nCopy > 0" implies that "nCopy" is at least 1 on the
      true branch.
    libX11-1.8.7/src/xkb/XKBMAlloc.c:830: overrun-buffer-arg:
      Overrunning buffer pointed to by "&newActs[nActs]" of 8 bytes by
      passing it to a function which accesses it at byte offset 15
      using argument "nCopy * 8UL" (which evaluates to 8).
    #  828|
    #  829|           if (nCopy > 0)
    #  830|->             memcpy(&newActs[nActs], XkbKeyActionsPtr(xkb, i),
    #  831|                      nCopy * sizeof(XkbAction));
    #  832|           if (nCopy < nKeyActs)

(cherry picked from xorg/lib/libx11@af1312d2873d2ce49b18708a5029895aed477392)

Signed-off-by: José Expósito <jexposit@redhat.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit 6d33834186)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1895>
2025-04-08 10:03:40 +02:00
Alan Coopersmith
852595a51d xkb: ensure XkbAllocNames sets num_rg to 0 on allocation failure
If there was a previous radio_groups array which we failed to realloc
and freed instead, clear the array size in the XkbNamesRec.

Taken from xorg/lib/libx11@258a8ced681dc1bc50396be7439fce23f9807e2a

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit 09c6f09eb7)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1895>
2025-04-08 10:03:35 +02:00
Peter Hutterer
15075baac2 mi: guard miPointer functions against NULL dereferences
Already in place for some functions, let's add it to most others.
The only function missing is miPointerSetPosition() which needs to
return the ScreenPtr and that one is unclear if we don't have a screen -
returning NULL will crash the caller(s) so let's wait for something to
trigger this bug before we try to fix it wrongly.

Related to #1782

(cherry picked from commit 68c17477d2)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1895>
2025-04-08 10:03:30 +02:00
Peter Hutterer
6d33c347ea mi: don't crash on miPointerGetPosition for disabled devices
If a device is disabled, its master device is forcibly reset to NULL but
unlike a floating device it doesn't have a sprite allocated. Calling
miPointerGetPosition for a disabled device thus crashes.

Avoid this by returning 0/0 for any device without a miPointer.
This is a quick fix only, a proper fix for this issue is rather more
involved.

Closes #1782

(cherry picked from commit acbdd0ecdd)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1895>
2025-04-08 10:03:25 +02:00
Olivier Fourdan
5b1d9da00f Bump version to 24.1.6
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1831>
2025-02-25 19:38:11 +01:00
Olivier Fourdan
9dbe93ebee sync: Apply changes last in SyncChangeAlarmAttributes()
SyncChangeAlarmAttributes() would apply the various changes while
checking for errors.

If one of the changes triggers an error, the changes for the trigger,
counter or delta value would remain, possibly leading to inconsistent
changes.

Postpone the actual changes until we're sure nothing else can go wrong.

Related to CVE-2025-26601, ZDI-CAN-25870

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit c285798984)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1831>
2025-02-25 19:38:11 +01:00
Olivier Fourdan
6f567221a6 sync: Do not fail SyncAddTriggerToSyncObject()
We do not want to return a failure at the very last step in
SyncInitTrigger() after having all changes applied.

SyncAddTriggerToSyncObject() must not fail on memory allocation, if the
allocation of the SyncTriggerList fails, trigger a FatalError() instead.

Related to CVE-2025-26601, ZDI-CAN-25870

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 8cbc90c881)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1831>
2025-02-25 19:38:11 +01:00
Olivier Fourdan
fb6df2a68c sync: Check values before applying changes
In SyncInitTrigger(), we would set the CheckTrigger function before
validating the counter value.

As a result, if the counter value overflowed, we would leave the
function SyncInitTrigger() with the CheckTrigger applied but without
updating the trigger object.

To avoid that issue, move the portion of code checking for the trigger
check value before updating the CheckTrigger function.

Related to CVE-2025-26601, ZDI-CAN-25870

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit f52cea2f93)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1831>
2025-02-25 19:38:11 +01:00
Olivier Fourdan
1932abe3d0 sync: Do not let sync objects uninitialized
When changing an alarm, the change mask values are evaluated one after
the other, changing the trigger values as requested and eventually,
SyncInitTrigger() is called.

SyncInitTrigger() will evaluate the XSyncCACounter first and may free
the existing sync object.

Other changes are then evaluated and may trigger an error and an early
return, not adding the new sync object.

This can be used to cause a use after free when the alarm eventually
triggers.

To avoid the issue, delete the existing sync object as late as possible
only once we are sure that no further error will cause an early exit.

CVE-2025-26601, ZDI-CAN-25870

This vulnerability was discovered by:
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 16a1242d0f)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1831>
2025-02-25 19:38:11 +01:00
Olivier Fourdan
842f4abde4 dix: Dequeue pending events on frozen device on removal
When a device is removed while still frozen, the events queued for that
device remain while the device itself is freed.

As a result, replaying the events will cause a use after free.

To avoid the issue, make sure to dequeue and free any pending events on
a frozen device when removed.

CVE-2025-26600, ZDI-CAN-25871

This vulnerability was discovered by:
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 6e0f332ba4)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1831>
2025-02-25 19:38:11 +01:00
Olivier Fourdan
318085a6f5 composite: initialize border clip even when pixmap alloc fails
If it fails to allocate the pixmap, the function compAllocPixmap() would
return early and leave the borderClip region uninitialized, which may
lead to the use of uninitialized value as reported by valgrind:

 Conditional jump or move depends on uninitialised value(s)
    at 0x4F9B33: compClipNotify (compwindow.c:317)
    by 0x484FC9: miComputeClips (mivaltree.c:476)
    by 0x48559A: miValidateTree (mivaltree.c:679)
    by 0x4F0685: MapWindow (window.c:2693)
    by 0x4A344A: ProcMapWindow (dispatch.c:922)
    by 0x4A25B5: Dispatch (dispatch.c:560)
    by 0x4B082A: dix_main (main.c:282)
    by 0x429233: main (stubmain.c:34)
  Uninitialised value was created by a heap allocation
    at 0x4841866: malloc (vg_replace_malloc.c:446)
    by 0x4F47BC: compRedirectWindow (compalloc.c:171)
    by 0x4FA8AD: compCreateWindow (compwindow.c:592)
    by 0x4EBB89: CreateWindow (window.c:925)
    by 0x4A2E6E: ProcCreateWindow (dispatch.c:768)
    by 0x4A25B5: Dispatch (dispatch.c:560)
    by 0x4B082A: dix_main (main.c:282)
    by 0x429233: main (stubmain.c:34)

 Conditional jump or move depends on uninitialised value(s)
    at 0x48EEDBC: pixman_region_translate (pixman-region.c:2233)
    by 0x4F9255: RegionTranslate (regionstr.h:312)
    by 0x4F9B7E: compClipNotify (compwindow.c:319)
    by 0x484FC9: miComputeClips (mivaltree.c:476)
    by 0x48559A: miValidateTree (mivaltree.c:679)
    by 0x4F0685: MapWindow (window.c:2693)
    by 0x4A344A: ProcMapWindow (dispatch.c:922)
    by 0x4A25B5: Dispatch (dispatch.c:560)
    by 0x4B082A: dix_main (main.c:282)
    by 0x429233: main (stubmain.c:34)
  Uninitialised value was created by a heap allocation
    at 0x4841866: malloc (vg_replace_malloc.c:446)
    by 0x4F47BC: compRedirectWindow (compalloc.c:171)
    by 0x4FA8AD: compCreateWindow (compwindow.c:592)
    by 0x4EBB89: CreateWindow (window.c:925)
    by 0x4A2E6E: ProcCreateWindow (dispatch.c:768)
    by 0x4A25B5: Dispatch (dispatch.c:560)
    by 0x4B082A: dix_main (main.c:282)
    by 0x429233: main (stubmain.c:34)

 Conditional jump or move depends on uninitialised value(s)
    at 0x48EEE33: UnknownInlinedFun (pixman-region.c:2241)
    by 0x48EEE33: pixman_region_translate (pixman-region.c:2225)
    by 0x4F9255: RegionTranslate (regionstr.h:312)
    by 0x4F9B7E: compClipNotify (compwindow.c:319)
    by 0x484FC9: miComputeClips (mivaltree.c:476)
    by 0x48559A: miValidateTree (mivaltree.c:679)
    by 0x4F0685: MapWindow (window.c:2693)
    by 0x4A344A: ProcMapWindow (dispatch.c:922)
    by 0x4A25B5: Dispatch (dispatch.c:560)
    by 0x4B082A: dix_main (main.c:282)
    by 0x429233: main (stubmain.c:34)
  Uninitialised value was created by a heap allocation
    at 0x4841866: malloc (vg_replace_malloc.c:446)
    by 0x4F47BC: compRedirectWindow (compalloc.c:171)
    by 0x4FA8AD: compCreateWindow (compwindow.c:592)
    by 0x4EBB89: CreateWindow (window.c:925)
    by 0x4A2E6E: ProcCreateWindow (dispatch.c:768)
    by 0x4A25B5: Dispatch (dispatch.c:560)
    by 0x4B082A: dix_main (main.c:282)
    by 0x429233: main (stubmain.c:34)

Fix compAllocPixmap() to initialize the border clip even if the creation
of the backing pixmap has failed, to avoid depending later on
uninitialized border clip values.

Related to CVE-2025-26599, ZDI-CAN-25851

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit b07192a8be)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1831>
2025-02-25 19:38:11 +01:00
Olivier Fourdan
40efa6359c composite: Handle failure to redirect in compRedirectWindow()
The function compCheckRedirect() may fail if it cannot allocate the
backing pixmap.

In that case, compRedirectWindow() will return a BadAlloc error.

However that failure code path will shortcut the validation of the
window tree marked just before, which leaves the validate data partly
initialized.

That causes a use of uninitialized pointer later.

The fix is to not shortcut the call to compHandleMarkedWindows() even in
the case of compCheckRedirect() returning an error.

CVE-2025-26599, ZDI-CAN-25851

This vulnerability was discovered by:
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit c1ff84bef2)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1831>
2025-02-25 19:38:11 +01:00
Olivier Fourdan
cc15c9fa40 Xi: Fix barrier device search
The function GetBarrierDevice() would search for the pointer device
based on its device id and return the matching value, or supposedly NULL
if no match was found.

Unfortunately, as written, it would return the last element of the list
if no matching device id was found which can lead to out of bounds
memory access.

Fix the search function to return NULL if not matching device is found,
and adjust the callers to handle the case where the device cannot be
found.

CVE-2025-26598, ZDI-CAN-25740

This vulnerability was discovered by:
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit bba9df1a9d)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1831>
2025-02-25 19:38:11 +01:00
Olivier Fourdan
39c7ed837b xkb: Fix buffer overflow in XkbChangeTypesOfKey()
If XkbChangeTypesOfKey() is called with nGroups == 0, it will resize the
key syms to 0 but leave the key actions unchanged.

If later, the same function is called with a non-zero value for nGroups,
this will cause a buffer overflow because the key actions are of the wrong
size.

To avoid the issue, make sure to resize both the key syms and key actions
when nGroups is 0.

CVE-2025-26597, ZDI-CAN-25683

This vulnerability was discovered by:
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 0e4ed94952)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1831>
2025-02-25 19:38:11 +01:00
Olivier Fourdan
60df821467 xkb: Fix computation of XkbSizeKeySyms
The computation of the length in XkbSizeKeySyms() differs from what is
actually written in XkbWriteKeySyms(), leading to a heap overflow.

Fix the calculation in XkbSizeKeySyms() to match what kbWriteKeySyms()
does.

CVE-2025-26596, ZDI-CAN-25543

This vulnerability was discovered by:
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 80d69f0142)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1831>
2025-02-25 19:38:11 +01:00
Olivier Fourdan
bfbb53e0b9 xkb: Fix buffer overflow in XkbVModMaskText()
The code in XkbVModMaskText() allocates a fixed sized buffer on the
stack and copies the virtual mod name.

There's actually two issues in the code that can lead to a buffer
overflow.

First, the bound check mixes pointers and integers using misplaced
parenthesis, defeating the bound check.

But even though, if the check fails, the data is still copied, so the
stack overflow will occur regardless.

Change the logic to skip the copy entirely if the bound check fails.

CVE-2025-26595, ZDI-CAN-25545

This vulnerability was discovered by:
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 11fcda8753)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1831>
2025-02-25 19:38:11 +01:00
Peter Hutterer
80f8d0b8e2 dix: keep a ref to the rootCursor
CreateCursor returns a cursor with refcount 1 - that refcount is used by
the resource system, any caller needs to call RefCursor to get their own
reference. That happens correctly for normal cursors but for our
rootCursor we keep a variable to the cursor despite not having a ref for
ourselves.

Fix this by reffing/unreffing the rootCursor to ensure our pointer is
valid.

Related to CVE-2025-26594, ZDI-CAN-25544

Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit b0a09ba602)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1831>
2025-02-25 19:38:11 +01:00
Olivier Fourdan
543708ae93 Cursor: Refuse to free the root cursor
If a cursor reference count drops to 0, the cursor is freed.

The root cursor however is referenced with a specific global variable,
and when the root cursor is freed, the global variable may still point
to freed memory.

Make sure to prevent the rootCursor from being explicitly freed by a
client.

CVE-2025-26594, ZDI-CAN-25544

This vulnerability was discovered by:
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative

v2: Explicitly forbid XFreeCursor() on the root cursor (Peter Hutterer
<peter.hutterer@who-t.net>)
v3: Return BadCursor instead of BadValue (Michel Dänzer
<michel@daenzer.net>)

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Suggested-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 01642f263f)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1831>
2025-02-25 19:38:11 +01:00
Olivier Fourdan
69f1580140 test: Fix xsync test
The xsync test is relying on the values being changed even in the case
of a BadMatch value.

Typically, it updates the delta but does not update the test type
comparison, so when passing a negative value, it generates a BadMatch.

That's actually not correct, and that will fail with the new fixes that
check the validity of the values prior to apply the changes.

Fix the test by updating the test type as needed.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit 05e54fefaf)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1831>
2025-02-25 19:38:08 +01:00
Olivier Fourdan
f04096af3c Revert "xwayland: Don't run key behaviors and actions"
Due to a bug in gamescope who does not send the Wayland modifiers
events, this is causing a regression in X11 clients running on Xwayland
in gamescope, where the modifiers are not applied anymore.

This reverts commit cea92a3e09.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1790
See-also: https://github.com/ValveSoftware/gamescope/issues/1740
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1781>
2025-02-10 15:43:41 +01:00
Olivier Fourdan
ffc3aa63d3 Bump version to 24.1.5
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1769>
2025-02-05 13:51:33 +01:00
Olivier Fourdan
f18a83d6f1 xwayland/glamor: Disable GLAMOR after GBM cleanup
The cleanup function for GBM is called on the various error paths.

Once xwl_glamor_gbm_cleanup() has been called, GBM support is no longer
usable (and the corresponding data structures are freed), so there is
no way we can keep using GLAMOR after that point.

Make sure to explicitly disable GLAMOR support in that case, so we do
not crash later on trying to use GBM.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit e8784b7d89)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1766>
2025-02-04 18:14:06 +01:00
Michel Dänzer
f7e3397e4d xwayland/glamor: Clean-up GBM's screen private on failure
If we bail out initializing GBM glamor backend, the screen private for
the GBM backend may remain, pointing at freed memory.

To avoid that issue, make sure to clear up the screen's private for the
GBM backend.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1785
Signed-off-by: Michel Dänzer <michel@daenzer.net>
(cherry picked from commit b27b5cd5f3)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1766>
2025-02-04 18:14:06 +01:00
Julian Orth
cea92a3e09 xwayland: Don't run key behaviors and actions
Consider the following keymap:

```xkb
xkb_keymap {
    xkb_keycodes {
        <compose> = 135;
    };
    xkb_symbols {
        key <compose> {
            [ SetGroup(group = +1) ]
        };
    };
};
```

When the user presses the compose key, the following happens:

1. The compositor forwards the key to Xwayland.
2. Xwayland executes the SetGroup action and sets the base_group to 1
   and the effective group to 1.
3. The compositor updates its own state and sends the effective group,
   1, to Xwayland.
4. Xwayland sets the locked group to 1 and the effective group to
   1 + 1 = 2.

This is wrong since pressing compose should set the effective group to 1
but to X applications the effective group appears to be 2.

This commit makes it so that Xwayland completely ignores the key
behaviors and actions of the keymap and only updates the modifier and
group components in response to the wayland modifiers events.

Signed-off-by: Julian Orth <ju.orth@gmail.com>
(cherry picked from commit 45c1d22ff6)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1766>
2025-02-04 18:14:06 +01:00
Julian Orth
1a8f0cb007 xwayland: copy repeat settings from the compositor map
Previously the repeat settings sent by the compositor were completely
ignored.

Signed-off-by: Julian Orth <ju.orth@gmail.com>
(cherry picked from commit 8d9184db5f)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1766>
2025-02-04 18:14:06 +01:00
Pierre-Eric Pelloux-Prayer
e6a5d545ce glamor: reject configs using unsupported rgbBits size
The supported color depths is a hardcoded list for now, so we
need to honor the value exposed there otherwise we'll get
inconsistencies between what glXGetFBConfigs and XListDepths
report to applications.

Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
(cherry picked from commit 5397854877)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1766>
2025-02-04 18:14:06 +01:00
Pierre-Eric Pelloux-Prayer
e1b6193a9d glamor: use gbm_format_for_depth instead of open-coding it
This way glamor_back_pixmap_from_fd deals with the same depth
values as glamor_pixmap_from_fds.

Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
(cherry picked from commit 83b13387ab)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1766>
2025-02-04 18:14:05 +01:00
Pierre-Eric Pelloux-Prayer
f8e32cba6e glamor: return the result of gbm_format_for_depth
This way the caller knows if the conversion failed.
While at it, check for width/height at the same time.

Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
(cherry picked from commit 87afcc7699)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1766>
2025-02-04 18:14:05 +01:00
Olivier Fourdan
1ae92b8f63 os/connection: Make sure partial is initialized
Following the change in Xtrans 1.5 that allows for partial connections
to succeed, we need to make sure partial is properly initialized at
first, otherwise we rely on an uninitialized variable.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Suggested-by: Twaik Yont <twaikyont@gmail.com>
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1783
(cherry picked from commit 080fb49eff)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1766>
2025-02-04 09:21:13 +01:00
Olivier Fourdan
ffd4d2a268 xkb: Always use MAP_LENGTH keymap size
Generating the modifier modmap, the helper function generate_modkeymap()
would check the entire range up to the MAP_LENGTH.

However, the given keymap might have less keycodes than MAP_LENGTH, in
which case we would go beyond the size of the modmap, as reported by
ASAN:

==ERROR: AddressSanitizer: heap-buffer-overflow
READ of size 1 at 0x5110001c225b thread T0
    #0 0x5e7369393873 in generate_modkeymap ../dix/inpututils.c:309
    #1 0x5e736930dcce in ProcGetModifierMapping ../dix/devices.c:1794
    #2 0x5e7369336489 in Dispatch ../dix/dispatch.c:550
    #3 0x5e736934407d in dix_main ../dix/main.c:275
    #5 0x7e46d47b2ecb in __libc_start_main
    #6 0x5e73691be324 in _start (xserver/build/hw/xwayland/Xwayland)

Address is located 0 bytes after 219-byte region
allocated by thread T0 here:
    #0 0x7e46d4cfc542 in realloc
    #1 0x5e73695aa90e in _XkbCopyClientMap ../xkb/xkbUtils.c:1142
    #2 0x5e73695aa90e in XkbCopyKeymap ../xkb/xkbUtils.c:1966
    #3 0x5e73695b1b2f in XkbDeviceApplyKeymap ../xkb/xkbUtils.c:2023
    #4 0x5e73691c6c18 in keyboard_handle_keymap ../hw/xwayland/xwayland-input.c:1194

As MAP_LENGTH is used in various code paths where the max keycode might
not be easily available, best is to always use MAP_LENGTH to allocate the
keymaps so that the code never run past the buffer size.

If the max key code is smaller than the MAP_LENGTH limit, fill-in the gap
with zeros.

That also simplifies the code slightly as we do not constantly need to
reallocate the keymap to adjust to the max key code size.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1780
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit 92bcebfd7e)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1766>
2025-02-04 09:21:04 +01:00
Olivier Fourdan
efd3e1ca3d xwayland: Do not keep the cursor's pixmap around
Currently, Xwayland creates a pixmap backed by shared memory buffer as
soon as an X11 cursor is realized, which is destroyed when the cursor is
eventually unrealized.

If an X11 client is leaking cursors, Xwayland will be creating new
pixmaps continuously, which will eventually cause an error once the
limit is reached, and get Xwayland killed.

However, we do not need the shared memory buffer to stay around, we
already have the buffer retention mechanism which will take care of
keeping the buffer around until the Wayland compositor is done with it,
so we could just create and destroy the pixmap as needed when setting
the cursor.

That would not fix the leak in the X11 application, yet that would
mitigate the risk of Xwayland being killed by reaching the shared memory
limits, until the client itself reaches the limit of X11 resources.

v2: Don't increase the pixmap refcnt to destroy it just after (Michel)

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Suggested-by: Michel Dänzer <michel@daenzer.net>
See-also: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1773
(cherry picked from commit 8707d2835c)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1766>
2025-02-04 09:20:54 +01:00
Michel Dänzer
5294c436ac xwayland: Always decrement expecting_event in xwl_output_create
If we bail without decrementing it, xwl_screen_init will keep waiting
indefinitely for an event which never arrives.

(cherry picked from commit 8c4b137237)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1766>
2025-02-04 09:19:58 +01:00
Michel Dänzer
15a169cd1a xwayland/glamor: Drop expecting_event bailing from xwl_drm_handle_device
If we bail without decrementing xwl_screen->expecting_event,
xwl_screen_init will keep waiting indefinitely for an event which never
arrives.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1648
Fixes: 2f113d68f6 ("xwayland: Add glamor and DRI3 support")
(cherry picked from commit 375c35a5e4)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1766>
2025-02-04 09:19:48 +01:00
Alan Coopersmith
f221e9f903 dix-config.h: add HAVE_SOCKLEN_T definition
Needed to build with IPv6 disabled using gcc 14 on some platforms to avoid:

In file included from /usr/X11/include/X11/Xtrans/transport.c:67,
                 from xstrans.c:17:
/usr/X11/include/X11/Xtrans/Xtranssock.c: In function ‘_XSERVTransSocketOpen’:
/usr/X11/include/X11/Xtrans/Xtranssock.c:467:28: error: passing argument 5
 of ‘getsockopt’ from incompatible pointer type [-Wincompatible-pointer-types]
  467 |             (char *) &val, &len) == 0 && val < 64 * 1024)
      |                            ^~~~
      |                            |
      |                            size_t * {aka long unsigned int *}

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit a1b5aa5a7f)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1766>
2025-02-04 09:19:33 +01:00
Michel Dänzer
7c25024879 xwayland/present: Check allow_commits in xwl_present_flip
We're not supposed to call wl_surface_commit while
xwl_window->allow_commits is false. Bailing results in falling back to
a copy.

Noticed by inspection while looking into an issue which turned out to be
due to something else.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1764
(cherry picked from commit 56ba0b2a5f)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1766>
2025-02-04 09:19:14 +01:00
Alan Coopersmith
f340f082b8 dix: limit checks to MAX_VALUATORS when generating Xi events
Previously, it was looping through sizeof(ev->valuators.mask) * 8
valuators, where valuators.mask is defined as an array of
(MAX_VALUATORS + 7) / 8 entries.  Since MAX_VALUATORS is defined as 36,
this made it actually loop through 40 entries.  The last 4 bits in this
array should never be set, so we should never access memory outside the
bounds of the arrays defined to be exactly MAX_VALUATORS in length, but
we can make the static analyzer happier and not waste time checking bits
that should never be set.

Found by Oracle Parfait 13.3 static analyzer:

   Read outside array bounds [read-outside-array-bounds]:
      In array dereference of ev->valuators.data[i] with index i
      Array size is 36 elements (of 8 bytes each), index >= 0 and index <= 39
        at line 741 of dix/eventconvert.c in function 'eventToDeviceEvent'.

   Read outside array bounds [read-outside-array-bounds]:
      In array dereference of ev->valuators.data[i] with index i
      Array size is 36 elements (of 8 bytes each), index >= 0 and index <= 39
        at line 808 of dix/eventconvert.c in function 'eventToRawEvent'.

   Read outside array bounds [read-outside-array-bounds]:
      In array dereference of ev->valuators.data_raw[i] with index i
      Array size is 36 elements (of 8 bytes each), index >= 0 and index <= 39
        at line 809 of dix/eventconvert.c in function 'eventToRawEvent'.

Fixes: b2ba77bac ("dix: add EventToXI2 and GetXI2Type.")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit b65eea43dd)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1766>
2025-02-04 09:18:51 +01:00
Alan Coopersmith
30427d3ddc dix: fix button offset when generating DeviceButtonStateNotify events
Found by Oracle Parfait 13.3 static analyzer:
   Buffer Overflow in STD C function [buffer-overflow-call-stdc]:
      Buffer overflow in call to memcpy. Buffer &bev->buttons[4] of
       size 24 is written at an offset of 28
      Array size is 28 bytes, index is 32
        at line 743 of dix/enterleave.c in function
	 'DeliverStateNotifyEvent'.

Fixes: a85f0d6b9 ("Xi: fix use of button->down - bitflags instead of int arrays.")
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit 4b073d65bb)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1766>
2025-02-04 09:18:43 +01:00
Alan Coopersmith
5e320e1193 render: avoid NULL pointer dereference if PictureFindVisual returns NULL
Found by Oracle Parfait 13.3:
   Null pointer dereference [null-pointer-deref]:
      Read from null pointer pVisual
        at line 257 of dix/colormap.c in function 'CreateColormap'.
          Null pointer introduced at line 412 of render/picture.c in
	   function 'PictureFindVisual'.
          Constant 'NULL' passed into function CreateColormap, argument
	   pVisual, from call at line 431 in function
	   'PictureInitIndexedFormat'.
          Function PictureFindVisual may return constant 'NULL' at
	   line 412, called at line 429.

Fixes: d4a101d4e ("Integration of DAMAGE-XFIXES branch to trunk")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit 7af077dd2f)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1766>
2025-02-04 09:18:34 +01:00
Alan Coopersmith
cec5c7c3b2 Xi: avoid NULL pointer dereference if GetXTestDevice returns NULL
The comments in that function say "This only happens if master is a
slave device. don't do that" but static analysis doesn't respect that.

Found by Oracle Parfait 13.3:
   Null pointer dereference [null-pointer-deref]:
      Read from null pointer XTestptr
        at line 274 of Xi/xichangehierarchy.c in function 'remove_master'.
          Null pointer introduced at line 691 of Xext/xtest.c in function
	   'GetXTestDevice'.
          Function GetXTestDevice may return constant 'NULL' at line 691,
	   called at line 273 of Xi/xichangehierarchy.c in function
	   'remove_master'.
   Null pointer dereference [null-pointer-deref]:
      Read from null pointer XTestkeybd
        at line 279 of Xi/xichangehierarchy.c in function 'remove_master'.
          Null pointer introduced at line 691 of Xext/xtest.c in function
	   'GetXTestDevice'.
          Function GetXTestDevice may return constant 'NULL' at line 691,
	   called at line 278 of Xi/xichangehierarchy.c in function
	   'remove_master'.

Fixes: 0814f511d ("input: store the master device's ID in the devPrivate for XTest devices.")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit d10589cc09)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1766>
2025-02-04 09:18:26 +01:00
Michel Dänzer
a939e47c13 xwayland/glamor/gbm: Don't close fence_fd after xwl_glamor_wait_fence
eglCreateSyncKHR takes ownership of the file descriptor. Noticed by
inspection.

While we're at it, move the fence_fd declaration to the scope where
it's used.

Last but not least, close the fd in xwl_glamor_wait_fence when bailing
before calling eglCreateSyncKHR, and document that it takes ownership.

(cherry picked from commit 91b5a003a5)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1766>
2025-02-04 09:17:46 +01:00
Alan Coopersmith
ce9d187101 os: NextDPMSTimeout: mark intentional fallthroughs in switch
The comment at the top of the function tells humans the fallthroughs
are intentional, but gcc doesn't parse that.

Clears 3 -Wimplicit-fallthrough warnings from gcc 14.1

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit b306df5a60)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1766>
2025-02-04 09:17:35 +01:00
YaoBing Xiao
ca0799e7f2 xwayland: prevent potential null pointer dereference
Signed-off-by: YaoBing Xiao <xiaoyaobing@uniontech.com>
(cherry picked from commit e12d9863fd)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1766>
2025-02-04 09:16:51 +01:00
José Expósito
3bfef8d7c0 Bump version to 24.1.4
Signed-off-by: José Expósito <jexposit@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1735>
2024-10-29 16:27:04 +01:00
Matthieu Herrb
26120df7aa xkb: Fix buffer overflow in _XkbSetCompatMap()
The _XkbSetCompatMap() function attempts to resize the `sym_interpret`
buffer.

However, It didn't update its size properly. It updated `num_si` only,
without updating `size_si`.

This may lead to local privilege escalation if the server is run as root
or remote code execution (e.g. x11 over ssh).

CVE-2024-9632, ZDI-CAN-24756

This vulnerability was discovered by:
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: José Expósito <jexposit@redhat.com>
(cherry picked from commit 85b7765714)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1735>
2024-10-29 16:26:59 +01:00
Olivier Fourdan
113245b1ab Bump version to 24.1.3
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1708>
2024-10-02 10:02:15 +02:00
Mike Blumenkrantz
0713e7e382 xwayland: connect to the wl display before calling into EGL
using EGL (e.g., eglQueryString, epoxy_has_egl_extension)
before establishing this connection
enables the GBM/EGL implementation to potentially consume the
WAYLAND_SOCKET fd, which, if closed, will cause the compositor
to kill this xserver

(cherry picked from commit ff8ec59c97)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
2024-09-24 11:33:13 +02:00
Olivier Fourdan
8d9b8249a7 os: Fix NULL pointer dereference
RemoveHost() can be called from DisableLocalHost() with a NULL client,
but doesn't actually check whether the given client pointer is valid on
error and assigns the error value unconditionally, leading to a possible
NULL pointer dereference and a crash of the Xserver.

To avoid the issue, simply check whether the client pointer is not NULL
prior to assign the errorValue.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1752
See-also: https://bugzilla.redhat.com/2313799
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit 57a446c0f9)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
2024-09-24 11:33:13 +02:00
Alan Coopersmith
02546fa66a CI: update libdecor from 0.1.0 to 0.1.1
The install_demo meson_option was added in
libdecor/libdecor@7106f5e329
which is in the 0.1.1 tag, but not 0.1.0.

If we upgrade the version of meson used in the CI to 1.0.0, then it fails
to build libdecor 0.1.0 with: ERROR: Unknown options: "install_demo"

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit 32adf434b7)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
2024-09-24 11:33:02 +02:00
Alan Coopersmith
e4d9cbf0e9 CI: clone libdecor from fd.o instead of gnome.org
https://gitlab.gnome.org/jadahl/libdecor is archived and the README
says to use  https://gitlab.freedesktop.org/libdecor/libdecor instead.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit fc8ba24413)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
2024-09-24 11:31:46 +02:00
Alan Coopersmith
5d84e4779b dix: FindBestPixel: fix implicit fallthrough warning
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit 9c9e1afeb2)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
2024-09-24 10:51:08 +02:00
Alan Coopersmith
2d5494ebbb dix: GetPairedDevice: check if GetMaster returned NULL
Clears warning from gcc 14.1:

../dix/devices.c: In function ‘GetPairedDevice’:
../dix/devices.c:2734:15: warning: dereference of NULL ‘dev’
 [CWE-476] [-Wanalyzer-null-dereference]
 2734 |     return dev->spriteInfo? dev->spriteInfo->paired: NULL;
      |            ~~~^~~~~~~~~~~~

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit e6fc0861d8)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
2024-09-24 10:51:04 +02:00
Alan Coopersmith
cfda3969a1 dix: HashResourceID: use unsigned integers for bit shifting
Clears warning from gcc 14.1:

../dix/resource.c: In function ‘HashResourceID’:
../dix/resource.c:691:44: warning: left shift of negative value
 [-Wshift-negative-value]
  691 |     return (id ^ (id >> numBits)) & ~((~0) << numBits);
      |                                            ^~

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit 26a7ab09ea)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
2024-09-24 10:51:00 +02:00
Alan Coopersmith
4335bdeb01 dix: ProcListProperties: skip unneeded work if numProps is 0
No real harm, but clears warning from gcc 14.1:

../dix/property.c: In function ‘ProcListProperties’:
..//dix/property.c:605:27: warning: dereference of NULL ‘temppAtoms’
 [CWE-476] [-Wanalyzer-null-dereference]
  605 |             *temppAtoms++ = pProp->propertyName;
      |             ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit 39f337fd49)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
2024-09-24 10:50:57 +02:00
Alan Coopersmith
6d384ab8bf dix: dixChangeWindowProperty: don't call memcpy if malloc failed
It shouldn't matter, since it would have a length of 0, but it
clears warnings from gcc 14.1:

../dix/property.c: In function ‘dixChangeWindowProperty’:
../dix/property.c:287:9: warning: use of possibly-NULL ‘data’ where
 non-null expected [CWE-690] [-Wanalyzer-possible-null-argument]
  287 |         memcpy(data, value, totalSize);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../dix/property.c:324:13: warning: use of possibly-NULL ‘data’ where
 non-null expected [CWE-690] [-Wanalyzer-possible-null-argument]
  324 |             memcpy(data, value, totalSize);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit 10cafd0bbe)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
2024-09-24 10:50:53 +02:00
Alan Coopersmith
fc7b6c7549 dix: InitPredictableAccelerationScheme: avoid memory leak on failure
Clears warning from gcc 14.1:

../dix/ptrveloc.c: In function ‘InitPredictableAccelerationScheme’:
../dix/ptrveloc.c:149:9: warning: leak of ‘<unknown>’
 [CWE-401] [-Wanalyzer-malloc-leak]
  149 |         free(vel);
      |         ^~~~~~~~~

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit 462d13c2f6)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
2024-09-24 10:50:50 +02:00
Alan Coopersmith
83033ce108 dix: CreateScratchGC: avoid dereference of pointer we just set to NULL
Clears warning from gcc 14.1:

../dix/gc.c: In function ‘CreateScratchGC’:
../dix/gc.c:818:28: warning: dereference of NULL ‘pGC’
 [CWE-476] [-Wanalyzer-null-dereference]
  818 |     pGC->graphicsExposures = FALSE;

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit 7ee3a52018)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
2024-09-24 10:50:47 +02:00
Alan Coopersmith
44d1b7e4c1 dix: enterleave.c: fix implicit fallthrough warnings
Clears 7 -Wimplicit-fallthrough warnings from gcc 14.1

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit 0cb826e3d0)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
2024-09-24 10:50:43 +02:00
Alan Coopersmith
013311852d dix: SetFontPath: don't set errorValue on Success
Clears warning from gcc 14.1:

../dix/dixfonts.c: In function ‘SetFontPath’:
../dix/dixfonts.c:1697:28: warning: use of uninitialized value ‘bad’
 [CWE-457] [-Wanalyzer-use-of-uninitialized-value]
 1697 |         client->errorValue = bad;
      |         ~~~~~~~~~~~~~~~~~~~^~~~~

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit 1a86fba0d9)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
2024-09-24 10:50:40 +02:00
Alan Coopersmith
2f1ea65b6d dix: PolyText: fully initialize local_closure
Clears warning from gcc 14.1:

../dix/dixfonts.c:1352:15: warning: use of uninitialized value ‘*c.data’
 [CWE-457] [-Wanalyzer-use-of-uninitialized-value]
 1352 |         free(c->data);
      |              ~^~~~~~

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit d78836a3a6)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
2024-09-24 10:50:36 +02:00
Alan Coopersmith
0d1b7672e7 dix: check for calloc() failure in Xi event conversion routines
Clears up 12 -Wanalyzer-possible-null-dereference warnings from gcc 14.1

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit 25762834c9)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
2024-09-24 10:50:33 +02:00
Olivier Fourdan
a73fb98dc3 build: Fix DRI3 on DragonFly and OpenBSD
Commit 96bdc156 added a check for <sys/eventfd.h> to enable DRI3.

DragonFly and OpenBSD however rely on epoll-shim for <sys/eventfd.h>,
so that must be added as a dependency for the <sys/eventfd.h> check.

Fixes: commit 96bdc156 - xwayland: Do not enable DRI3 without eventfd
Suggested-by: Jan Beich <jbeich@freebsd.org>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit 8fe15a60c5)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
2024-09-24 10:50:29 +02:00
Olivier Fourdan
98fb1d48c4 build: Add epoll to Xwayland for DragonFly and OpenBSD
DragonFly and OpenBSD rely on epoll-shim for <sys/eventfd>, add a
optional dependency to build Xwayland.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit 7bcf2bcafc)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
2024-09-24 10:50:25 +02:00
Olivier Fourdan
b701969331 build: Move epoll dependency check
DragonFly and OpenBSD rely on epoll-shim to provide eventfd.

Move the check for epoll dependency to the root meson.build script so
that we can use that for the <sys/evenfd.h> check as well.

This is preparation work for the following commits, no functional change
intended at this point.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit 673b56e61c)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
2024-09-24 10:49:33 +02:00
Peter Hutterer
16645b410d Xi: when removing a master search for a disabled paired device
If either the master pointer or keyboard was disabled, the respective
GetMaster() call returns NULL, causing a segfault later accessing the
deviceid.

Fix this by looking in the off_devices list for any master
device of the type we're looking for. Master devices lose the pairing
when disabled (on enabling a keyboard we simply pair with the first
available unpaired pointer).

And for readability, split the device we get from the protocol request
into a new "dev" variable instead of re-using ptr.

Fixes #1611

(cherry picked from commit e7c876ab0b)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
2024-09-24 10:48:02 +02:00
Peter Hutterer
13cfe2ec85 dix: don't push the XKB state to a non-existing master keyboard
If our master keyboard is disabled, GetMaster() returns NULL and
we segfault in XkbPushLockedStateToSlaves().

Fixes 45fb3a934d
Fixes #1611

(cherry picked from commit 9b983fecf9)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
2024-09-24 10:47:58 +02:00
Matthieu Herrb
11d0f4f19d Return NULL in *cmdname if the client argv or argv[0] is NULL
(cherry picked from commit 59f5445a7f)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
2024-09-24 10:47:54 +02:00
Matthieu Herrb
e50ea9181a Don't crash if the client argv or argv[0] is NULL.
Report from  bauerm at pestilenz dot org.

(cherry picked from commit a8512146ba)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
2024-09-24 10:47:51 +02:00
Olivier Fourdan
fa70fdf961 xwayland: Report correct mode size when rootful
The vidmode extension emulation in Xwayland reports the modeline based
on the current mode.

To do so, it searches for the mode using `xwl_output_find_mode(-1, -1)`
which is supposed to return the current mode, whatever that mode is.

With XRandR emulation, in rootless mode, the default value is the mode
at index 0. That assumption, however is not true when running rootful.

That means that the vidmode extension will always return the highest
mode available, which is 5120x2880, with Xwayland running rootful:

  $ xwayland-run -geometry 1024x768 -- xvidtune -show
  "5120x2880"   1276.50   5120 5560 6128 7136   2880 2883 2888 2982 -hsync +vsync

Luckily, when Xwayland is running rootful, we have the current mode size
conveniently stored in dedicated fields of the xwayland output struct,
so we can use that to search for the right mode being used and report
that through the vidmode extension:

  $ xwayland-run -geometry 1024x768 -- xvidtune -show
  "1024x768"     63.50   1024 1064 1176 1328    768  771  775  798 -hsync +vsync

That fixes legacy games using the vidmode extension and rendering at the
wrong size when running within Xwayland rootful.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit e2e5842444)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
2024-09-24 10:47:47 +02:00
Olivier Fourdan
05a3a4068b Bump version to 24.1.2
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1638>
2024-08-07 11:22:21 +02:00
Ian Douglas Scott
4262fb182b xwayland: Release keys on keyboard enter event if leave wasn't received
The code here assumed a `leave` event always occurs between two `enter`
events. On Sway (and presumably other compositors) this happens even if
the client has destroyed the `wl_surface`, but the client gets a null
`surface` here. (Which presumably on on the wire is the id of the
destroyed surface.)

This seems like a bad thing to rely on, and is easy to avoid. But if
this is correct to assume, the Wayland protocol should be explicit about
this.

(cherry picked from commit 386b54fbe9)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1635>
2024-08-06 10:00:59 +02:00
Olivier Fourdan
54a591b9b8 xwayland: Do not include sys/eventfd.h without DRI3
Now that we won't enable DRI3 if <sys/eventfd.h> is not available, there
is not point in trying to include that header without DRI3.

That allows to build Xwayland with GLAMOR enabled (without DRI3) on
platforms which do not support eventfd.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit 23c295ea8b)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1635>
2024-08-06 10:00:59 +02:00
Olivier Fourdan
4d88af2228 xwayland: Do not enable DRI3 without eventfd
DRI3 version 1.4 which supports explicit buffers synchronization relies
on the eventfd interface.

As result, building would fail with DRI3 enabled on platforms without
the eventfd interface.

Check for the availability of the sys/eventfd.h header and disable DRI3
support if missing.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit 96bdc156a1)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1635>
2024-08-06 10:00:59 +02:00
Olivier Fourdan
2a360e5c0f xwayland: Fix build without DRI3 enabled
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1668
(cherry picked from commit a58352b985)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1635>
2024-08-06 10:00:59 +02:00
Nicolas Dufresne
a2446275c9 glamor: xv: Rewrite UYVY shader to match NV12/I420 CSC
This rewrites the shader so that we use the same (more flexible) CSC as
we have for I420 and NV12. This also fixes the reverse of odd/even which
caused chroma shift.

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
(cherry picked from commit 39c8a6f367)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1635>
2024-08-06 10:00:59 +02:00
Konstantin
978093d1a5 glamor: xv: fix UYVY alignment
UYVY videos should be aligned by 2 to avoid breakups in the shader

Fixes: 832b392f7 - glamor: xv: enable UYVY acceleration
Suggested-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Konstantin <ria.freelander@gmail.com>
(cherry picked from commit eb26f32368)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1635>
2024-08-06 10:00:59 +02:00
Konstantin
4543d4a25a glamor: check BPP by render_format.
Check actual BPP by render_format in upload_boxes, not by drawable BPP.

It is required when we used different BPP formats for storing and
rendering (for example, in the case of UYVY).

The problem of UYVY size lies inside method of glamor downloading boxes.

When we set GLAMOR_CREATE_FORMAT_CBCR, it actually uses 16-bit GL and
Pixman formats, but before this change in glamor_download_boxes, that
function deduces GL and Pixman formats from BPP, which is wrong in this
case (will be deduced to 32).

When GL and Pixman format BPP is identical to drawable BPP, this change
does nothing, but when it is different - it will prioritize Pixman
format, not the format deduced from BPP.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1730
Signed-off-by: Konstantin Pugin <ria.freelander@gmail.com>
(cherry picked from commit 75f56b7923)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1635>
2024-08-06 10:00:59 +02:00
Olivier Fourdan
8937d47d08 xwayland/ei: Dequeue events when all caps are available
Currently, we would start dequeuing events as soon as a device is
resumed, regardless of its capabilities.

If the capabilities are not available, we would just fallback to the
regular XTEST code path and not use input emulation.

As a result, it is very likely that we shall lose the first events until
the compositor resumes first a device with the requested capabilities.

To avoid that issue, start emulating only once we have the requested
capabilities, if they match the seat capabilities.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1732
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit 0525b9a5b9)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1635>
2024-08-06 10:00:59 +02:00
Olivier Fourdan
a1651d41e7 xwayland/ei: Move code to helper function
This is a small code refactoring to help with clarity, simply move the
code from the switch case for device resume to a dedicated function.

No functional change.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit 68ec297ee9)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1635>
2024-08-06 10:00:59 +02:00
Olivier Fourdan
b3635ba69e glamor: Fix possible double-free
If glamor_link_glsl_prog() fails, we may jump to the failed code path
which frees the variable vs_prog_string and fs_prog_string.

But those variables were already freed just before, so in that case we
end up freeing the memory twice.

Simply move the free at the end of the success code path so we are sure
to free the values only once, either in the successful of failed code
paths.

Fixes: 2906ee5e4 - glamor: Fix leak in glamor_build_program()
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit 34ea020344)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1635>
2024-08-06 10:00:59 +02:00
Olivier Fourdan
fac3486a66 xwayland/ei: Log the type name of unhandled events
Currently, we would log only the event type, use the libei API to also
log the name in plain text, so we can quickly identify the events we're
missing out.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit 1a42fe40d0)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1635>
2024-08-06 10:00:59 +02:00
Olivier Fourdan
ce7fb8139a xwayland/ei: Handle EI_EVENT_KEYBOARD_MODIFIERS
Although we do not do anything with that event, handle it so we don't
end up in the "Unhandled event" territory.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1722
Fixes: a133334270 - xwayland: Add XTEST support using EIS
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit bfabd3bdab)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1635>
2024-08-06 10:00:59 +02:00
Olivier Fourdan
98326b8c9f xwayland: Make sure output is suitable for fullscreen
Since commit d370f1e58, Xwayland can optionally be started rootful and
fullscreen.

To do so, it will setup a viewport to scale the root window to match the
size of the output.

However, if the rootful Xwayland window receives an xdg-surface configure
event before the output definition is complete, as with e.g. the labwc
Wayland compositor, we might end up trying to setup a viewport with a
destination size of 0x0 which is a protocol violation, and that kills
Xwayland.

To avoid that issue, only setup the viewport if the output size is
meaningful.

Also, please note that once the output definition is complete, i.e. when
the "done" event is eventually received, we shall recompute the size for
fullscreen again, hence achieving the desired fullscreen state.

Fixes: d370f1e58 - xwayland: add fullscreen mode for rootful
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1717
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit 66f5e7e96a)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1635>
2024-08-06 10:00:59 +02:00
Alan Coopersmith
ca52da8cba Move sizeof to second argument in calloc calls
Clears -Wcalloc-transposed-args warnings from gcc 14.1, such as:

../dix/main.c:165:42: warning: ‘calloc’ sizes specified with ‘sizeof’ in the
 earlier argument and not in the later argument [-Wcalloc-transposed-args]
  165 |             serverClient = calloc(sizeof(ClientRec), 1);
      |                                          ^~~~~~~~~
../dix/main.c:165:42: note: earlier argument should specify number of
 elements, later size of each element

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit 522f469fe9)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1635>
2024-08-06 10:00:59 +02:00
Joaquim Monteiro
c0bd91f49e os: Fix assignment with incompatible pointer type
struct hostent->h_addr_list is of type char**, not const char**.
GCC considers this an error when in C99 mode or later.

Signed-off-by: Joaquim Monteiro <joaquim.monteiro@protonmail.com>
(cherry picked from commit 0ddcd87851)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1635>
2024-08-06 09:54:01 +02:00
Olivier Fourdan
cec99a3811 Bump version to 24.1.1
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1602>
2024-07-10 13:40:59 +02:00
Olivier Fourdan
8130fa083c xwayland: Check for pointer in xwl_seat_leave_ptr()
Since commit 792758fa ("xwayland: Update lost focus on deactivation"),
in rootful mode, if we receive an "activated" state from xdg-shell
indicating that the surface is no longer active, we shall end up calling
xwl_seat_leave_ptr().

But xwl_seat_leave_ptr() does not actually check whether the seat has
pointer capabilities, and if not, get_pointer_device() will return NULL.

As a result, we would crash using a NULL pointer in GetMaster(). This
typically can happen when using Xwayland rootful on headless compositors
such as "cage" which do not advertise any capabilities for the seat.

To avoid the issue, simply check whether get_pointer_device() returns a
valid non-null device and bail out early otherwise.

Fixes: 792758fa - xwayland: Update lost focus on deactivation
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1700
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit 7203626173)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1592>
2024-07-09 11:35:49 +02:00
Olivier Fourdan
38060228c1 xwayland: Force disposal of windows buffers for root on destroy
With explicit buffer synchronization in use, the window buffers use a
file descriptor for event notification to keep the buffer alive for
synchronization purpose.

When running rootful, the root window (which is visible) is destroyed
directly from the resource manager on server reset, and the window
buffer's eventfd will trigger after the window is destroyed, leading to
a use after free and a crash of the xserver.

To avoid the issue, check whether the window being destroyed is the root
window in rootless mode, and make sure to force the disposal of the
window buffers in that case.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1699
(cherry picked from commit a5e863963e)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1569>
2024-07-04 08:36:40 +00:00
Olivier Fourdan
4942b7c137 xwayland/window-buffers: optionally force disposal
For cases (to come) where we would want to force the disposal of the
window buffers, add a parameter to force the disposal by calling
dispose() directly instead of maybe_dispose().

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit fa04e15afc)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1569>
2024-07-04 08:36:40 +00:00
Olivier Fourdan
f834e104aa xwayland/window-buffers: Move buffer disposal to its own function
No functional change, this is just preparation work for the next commit.

v2: Reshuffle functions (Michel)

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit 571cb13342)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1569>
2024-07-04 08:36:40 +00:00
Olivier Fourdan
aa0ea88e13 xwayland: Make sure we do not leak xwl_window on destroy
Right now, we would dispose the xwl_window and all the data associated
with it on unrealize.

But not all window destruction go through the unrealize code path, for
example when the root window (running rootful) is destroyed from the
resource manager on server reset, we do not get to the unrealize window
step, but straight to destroy window.

As a result, we are leaking the xwl_window and all the data associated
with it, for example:

| 65,536 bytes in 1 blocks are possibly lost in loss record 12,462 of 12,488
|    at 0x484A0FC: calloc (vg_replace_malloc.c:1675)
|    by 0x48B661C: UnknownInlinedFun (pixman-bits-image.c:1273)
|    by 0x48B661C: _pixman_bits_image_init (pixman-bits-image.c:1296)
|    by 0x48B6754: create_bits_image_internal (pixman-bits-image.c:1349)
|    by 0x64180DE: UnknownInlinedFun (cairo-image-surface.c:380)
|    by 0x64180DE: UnknownInlinedFun (cairo-image-surface.c:366)
|    by 0x64180DE: cairo_image_surface_create (cairo-image-surface.c:432)
|    by 0x6346B44: UnknownInlinedFun (libdecor-gtk.c:467)
|    by 0x6346B44: libdecor_plugin_gtk_frame_new (libdecor-gtk.c:546)
|    by 0x4B7F297: libdecor_decorate (libdecor.c:559)
|    by 0x42C6F3: xwl_create_root_surface (xwayland-window.c:1266)
|    by 0x42CD97: ensure_surface_for_window (xwayland-window.c:1466)
|    by 0x42D0D1: xwl_realize_window (xwayland-window.c:1560)
|    by 0x50858F: compRealizeWindow (compwindow.c:279)
|    by 0x4FF2A2: MapWindow (window.c:2706)
|    by 0x4F9E7F: InitRootWindow (window.c:697)

To avoid that issue, check whether there is still an xwl_window
associated with the X11 window on destroy, and if that's the case,
dispose the xwl_window.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit 0e1a98f52f)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1569>
2024-07-04 08:36:40 +00:00
Olivier Fourdan
6a916c9658 xwayland: Move xwl_window disposal to its own function
No functional change intended, this is just preparation work for the
next commit.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit 74be7a7f36)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1569>
2024-07-04 08:36:40 +00:00
Olivier Fourdan
8f611b0f22 xwayland/window-buffers: Set syncpnts for all pixmaps
The wp_linux_drm_syncobj_v1 protocol states that :

| If at surface commit time there is a pending buffer attached but no
| pending release timeline point set, the no_release_point protocol
| error is raised.

So we need to set a release timeline point in any case from the swap
pixmap routine, even for the early out code paths.

Failing to do so may cause a Wayland protocol error that is fatal to the
Wayland client, in this case Xwayland:

| wp_linux_drm_syncobj_surface_v1: error 4: No Acquire point provided
| (EE) failed to dispatch Wayland events: Protocol error

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1688
Fixes: 87bf2cafcc - xwayland: add support for wp_linux_drm_syncobj_v1
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit bc9bf56360)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1569>
2024-07-04 08:36:40 +00:00
Olivier Fourdan
33486519dc xwayland/window-buffers: Move code to submit pixmaps
Move the code which takes care of submitting pixmaps and the
synchronization points to its own function.

This will allow to reuse that code from different code path.

No functional change intended.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit 33330f0dc9)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1569>
2024-07-04 08:36:40 +00:00
Olivier Fourdan
6636b7c003 xwayland/window-buffers: Do not always set syncpnts
The function xwl_window_swap_pixmap() can be called from two places,
either from xwl_window_attach_buffer() or from damage_report().

When called from xwl_window_attach_buffer(), the new buffer is attached
and the surface committed.

However, when called from damage_report(), a new buffer might not be
attached before the surface is committed.

That's fine with implicit synchronization, but if we use explicit
synchronization, committing a surface without a new buffer attached but
with a release timeline point set is a protocol error:

| If at surface commit time there is a pending release timeline point
| set but no pending buffer attached, a no_buffer error is raised.

To avoid such an issue, add a new parameter to xwl_window_swap_pixmap()
to hint whether it should set the synchronization points, and have the
synchronization points set only from xwl_window_attach_buffer().

v2: Rename param to handle_sync (Michel)

Suggested-by: Michel Dänzer <mdaenzer@redhat.com>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit aab01c7391)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1569>
2024-07-04 08:36:40 +00:00
Olivier Fourdan
4382a4f84e xwayland/window-buffers: Use synchronization from GLAMOR/GBM
Now that we have the buffer synchronization implemented in the
GLAMOR/GBM code, switch to use that code.

At this point, there is still not functional change intended, this is
still preparation work for a fix that is still to come.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit 256cef8b20)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1569>
2024-07-04 08:36:40 +00:00
Olivier Fourdan
1539f208e2 xwayland/glamor/gbm: Copy explicit sync code to GLAMOR/GBM
Copy the code to deal with synchronization objects from the window
buffers to the GLAMOR/GBM code.

The idea is to deal with synchronizations for all pixmaps, even when
there is no window buffer involved.

This is still preparation work for the following commits, no functional
change intended at this point.

v2: Use a "xwl_window_buffer *" instead of a "void *data" (Michel)
v3: Bail early if there's no xwl_window_buffer (Michel)
v4: Rename xwl_window_submit_pixmap() to
    xwl_glamor_gbm_wait_release_fence() (Michel)

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit cc021aca99)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1569>
2024-07-04 08:36:40 +00:00
Olivier Fourdan
b1734ae737 xwayland/window-buffers: Add xwl_window_buffer_release()
We want to decorrelate the explicit buffer synchronization from the
window buffers, and move that to the GLAMOR/GBM code instead.

To do that, we need to be able to invoke the xwl_window_buffer's
release_callback() routine from outside the window buffer code.

For that purpose, introduce xwl_window_buffer_release() which calls
xwl_window_buffer_release_callback() for us.

This is preparation work for the following changes, no functional change
intended at this point.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit b5082073b0)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1569>
2024-07-04 08:36:40 +00:00
Olivier Fourdan
23400afb72 xwayland/window-buffers: Promote xwl_window_buffer
Make the (opaque) definition of the xwl_window_buffer generally
available.

No functional change.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit 0e0472a005)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1569>
2024-07-04 08:36:40 +00:00
Olivier Fourdan
05f4411523 xwayland: Stop on first unmapped child
If a child window of the same size is unmapped, we should stop walking
the tree looking for the surface window to use.

Whatever lies beneath is not visible anyway.

This also fixes an issue with the Damage list becoming corrupted when
destroying a window, because the first thing that DeleteWindow() does
is to unmap the window and crush the window tree underneath it.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Fixes: 3a0fc268 - xwayland: Add xwl_window::surface_window
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1680
(cherry picked from commit 32e16082c5)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1569>
2024-07-04 08:36:40 +00:00
Olivier Fourdan
fbd40e878b xwayland: Do not use manual redirect windows as surface window
While walking the window tree looking for the surface window to use, we
should ignore windows using manual redirection.

If a client manually redirects a window, it has control over how the
contents of that window are presented. It's not safe to present them
directly to the Wayland compositor.

v2: break instead of continue, reword commit message (Michel)

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Fixes: 3a0fc268 - xwayland: Add xwl_window::surface_window
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1677
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1679
(cherry picked from commit 0509b13fa2)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1569>
2024-07-04 08:36:40 +00:00
Chenx Dust
526dcbe120 xwayland: fix segment fault in xwl_glamor_gbm_init_main_dev
Function `xwl_glamor_gbm_init_main_dev` does not check whether
`xwl_screen->default_feedback.main_dev` a.k.a. `main_dev` is a
valid pointer. This result in some special situation where main
linux-dmabuf device is not accessible, such as KWin nested desktop,
raising segment fault.

This commit add a null pointer check to prevent crashing.

Signed-off-by: Chenx Dust <chenx_dust@outlook.com>
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1683
Fixes: d7f1909e - xwayland/glamor/gbm: make wl_drm optional
See-also: https://bugzilla.redhat.com/2284141
(cherry picked from commit 7605833315)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1569>
2024-07-04 08:36:40 +00:00
Fotios Valasiadis
1d21f8db26 os: Explicitly include X11/Xmd.h for CARD32 definition to fix building on i686
Noticed this after trying to update to xorg-server-xwayland-24.1.0 in void linux https://github.com/void-linux/void-packages/pull/50457

Signed-off-by: Fotios Valasiadis <fvalasiad@gmail.com>
(cherry picked from commit af6180b2c9)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1569>
2024-07-04 08:36:40 +00:00
Rouven Czerwinski
59bf93c770 xwayland: remove includedir from pkgconfig
Before this change, the xwayland pkgconfig file will always contain an
includedir directive, even though xwayland is not a linkable shared
library:

  prefix=/nix/store/3spcjqp5zcyg8arz6dnsj59fal5yk3jy-xwayland-23.2.6
  includedir=${prefix}/include

  exec_prefix=${prefix}
  xwayland=/nix/store/3spcjqp5zcyg8arz6dnsj59fal5yk3jy-xwayland-23.2.6/bin/Xwayland
  […]
  Cflags: -I${includedir}

According to a bug reporter this trips up cmake [1], which expects that
the include directory exists, which it does not since xwayland does not
install any header files.

Add the dataonly directive to pkgsconfig.generate() which will remove
the default "." subdir and ensures that includedir is not set inside the
pkgconfig file. Additionally enforce the install directory to
$libdir/pkgconfig, since it otherwise will be installed to
$datadir/pkgconfig, which precludes programs from finding the pkgconfig
because share/pkgconfig is usually not included in the search path.

The resulting pkgconfig does not contain an includedir:

  prefix=/nix/store/p7xhdzl65hfhzf36vxykzp2i9cyy7y6c-xwayland-23.2.6

  exec_prefix=${prefix}
  xwayland=/nix/store/p7xhdzl65hfhzf36vxykzp2i9cyy7y6c-xwayland-23.2.6/bin/Xwayland
  have_glamor=true
  have_eglstream=true
  have_initfd=true
  have_listenfd=true
  have_verbose=true
  have_terminate_delay=true
  have_no_touch_pointer_emulation=true
  have_force_xrandr_emulation=true
  have_geometry=true
  have_fullscreen=true
  have_host_grab=true
  have_decorate=false
  have_enable_ei_portal=true
  have_byteswappedclients=true

  Name: Xwayland
  Description: X Server for Wayland
  Version: 23.2.6

[1]: https://github.com/NixOS/nixpkgs/pull/309075#issuecomment-2108381428

Signed-off-by: Rouven Czerwinski <rouven@czerwinskis.de>
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit 9df084c8d1)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1569>
2024-07-04 08:36:40 +00:00
Matthieu Herrb
dc2e34aa0e present: On *BSD, epoll-shim is needed to emulate eventfd()
Signed-off-by: Matthieu Herrb <matthieu@herrb.eu>
(cherry picked from commit 89c3f35d92)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1569>
2024-07-04 08:36:40 +00:00
Olivier Fourdan
1126d55f80 Bump version to 24.1.0
Xwayland 24.1.0 final release

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1545>
2024-05-15 08:21:39 +02:00
Olivier Fourdan
ce0e52dd0b xwayland: Move XRandR emulation to the ResizeWindow hook
This restores the handling of the XRandR emulation for Xwayland rootless
where it was before commit fa7b1c20.

Some compositors may trigger a protocol error if the viewport source is
larger than the actual window size, having that handled in the window
resize hook makes sure we do not regress.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit 702a419c39)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1535>
2024-05-13 13:43:31 +02:00
Olivier Fourdan
2d0dabbe10 xwayland: Handle rootful resize in ResizeWindow
Commit fa7b1c20 ("xwayland: Use ConfigNotify screen hook instead of
ResizeWindow") replaced the WindowResize hook with ConfigNotify.

However, that's breaking rootful Xwayland with libdecor because the root
window size is already set so the libdecor size is not updated, and the
root size will be reverted back as soon as the focus changes.

Reinstate the rootful size change in ResizeWindow to avoid that issue.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1669
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1671
Fixes: fa7b1c20 - xwayland: Use ConfigNotify screen hook instead of ResizeWindow
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit 31d6f9998d)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1535>
2024-05-13 13:43:24 +02:00
Olivier Fourdan
ce6c665e77 xwayland: Restore the ResizeWindow handler
For now it just chains to ResizeWindow hook.

This is preparation work for the next commit, no functional change.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit 539859bde0)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1535>
2024-05-13 13:43:21 +02:00
Joshua Ashton
3f4745cc4a xwayland: Send ei_device_frame on device_scroll_discrete
This fixes the scroll action in Steam Input in SteamOS/Gamescope when using the new libeis backend.

Fixes: a133334270 ("xwayland: Add XTEST support using EIS")
Signed-off-by: Joshua Ashton <joshua@froggi.es>
(cherry picked from commit 7745fde24e)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1535>
2024-05-13 13:43:07 +02:00
Vlad Zahorodnii
88ab664fab xwayland: Use correct xwl_window lookup function in xwl_set_shape
In xwl_set_shape(), xwl_window_set_input_region() should be called only
when the input shape of the toplevel window changes.

However, given that xwl_window_from_window() is going to walk the
ancestor tree until it finds an xwl_window, that lookup function cannot
be used. Instead, xwl_window_get() should be used. It's going to return
a valid xwl_window object iff the specified window has one associated
with it.

Fixes: a4ed100c0 - xwayland: Set wl_surface input region
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1672
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Signed-off-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
(cherry picked from commit 8c2b9f4e71)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1535>
2024-05-13 13:42:41 +02:00
Olivier Fourdan
5a4b654334 Bump version to 24.0.99.902
Xwayland 24.1.0 release candidate 2.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1513>
2024-05-02 14:14:39 +02:00
Michel Dänzer
9f28e2a85d xwayland/present: Skip queued flip when a new one becomes ready
If multiple flips become ready for the same MSC, we would previously
execute them all sequentially, one per MSC for sync flips. This could
result in an unbounded flip queue and corresponding memory consumption.

With implicit sync, leave the mailbox handling to the compositor for
async flips though.

v2:
* Use present_vblank_rec::sync_flip.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1664
Fixes: e1f16fb1ac ("xwayland: don't scrap pending present requests")
(cherry picked from commit 0d9a54aa97)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1494>
2024-05-02 10:50:04 +02:00
Erik Kurzinger
07470d2ca2 present: signal explicit sync release point in present_vblank_scrap
If a present request using explicit sync is scrapped, instead of sending
a PresentIdleNotify event we should signal the release point.

Signed-off-by: Erik Kurzinger <ekurzinger@nvidia.com>
(cherry picked from commit 80f74b0e44)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1494>
2024-05-02 10:50:00 +02:00
Erik Kurzinger
f10354d16a xwayland: use write fence in xwl_glamor_dmabuf_import_sync_file
The functions xwl_glamor_dmabuf_import_sync_file and
xwl_glamor_dmabuf_export_sync_file are used to ensure proper
synchronization between clients using PresentPixmapSynced and
compositors that do not support the wp_linux_drm_syncobj_v1 protocol
when presenting by flipping. The acquire point's fence will be imported
as the DMA-BUF's implicit fence before handing it off to the compositor,
and then, after the DMA-BUF has been released, its new implicit fence
will be exported and become the release point's fence which the client
is expected to wait for before re-using the buffer.

Both functions currently set the flags arguments of their respective
ioctls to DMA_BUF_SYNC_READ. When importing a sync file, this means that
any subsequent implicitly synchronized reads from the buffer will not
wait for the fence, and when exporting a sync file it means that the
returned fence may be signaled before preceeding reads from the buffer
have completed.

While this is correct for xwl_glamor_dmabuf_export_sync_file since the
compositor will never write to the buffer, it is incorrect for
xwl_glamor_dmabuf_import_sync_file. To avoid corruption, we need any
reads from the buffer by the compositor to wait on the acquire point's
fence.

As a fix, instead of setting the DMA_BUF_SYNC_READ flag in
xwl_glamor_dmabuf_import_sync_file, we set the DMA_BUF_SYNC_WRITE flag.
This *does* provide the necessary guarantees.

Signed-off-by: Erik Kurzinger <ekurzinger@nvidia.com>
(cherry picked from commit d5192ba8eb)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1494>
2024-05-02 10:18:51 +02:00
Vlad Zahorodnii
de65e7df4d xwayland: Set wl_surface input region
Some applications that use client side decorations usually set custom
input shape in order to prevent drop shadows stealing pointer events
from windows below. Currently, the only way to get it is to use some
XFixes APIs.

On the other hand, plenty of wayland compositors use solely the
wl_surface input region to decide what view can receive pointer input,
which results in some pointer input issues around client side drop
shadows because Xwayland doesn't set wl_surface.input_region.

See-also: https://bugs.kde.org/show_bug.cgi?id=448119
Signed-off-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit a4ed100c0c)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1494>
2024-05-02 10:17:45 +02:00
Olivier Fourdan
eec66b819d xwayland: Do not remove output on withdraw if leased
On DRM lease connector withdrawn event, Xwayland would free the
corresponding xwl_output offered for lease.

However, the pointer is still referenced from the rrLease->outputs[],
meaning that trying to clean up the RANDR DRM leases as done with commit
ef181265 (xwayland: Clean up drm lease when terminating) would cause a
use after free and random crashes.

To avoid that issue, on the connector withdraw event, set the connector
withdrawn flag but do not to remove (i.e. free) the xwayland output if
its is offered for lease.

Then, once the lease is terminated, check for the xwl_outputs with a
withdrawn connector and remove them (once we have no use for them
anymore.

Note that we cannot do that cleanup from xwl_randr_terminate_lease() as
removing the xwl_output will free the RRcrtc resources, which checks for
leases in XRANDR, and calls RRTerminateLease(), which chains back to
xwl_randr_terminate_lease().

v2: Use a "withdrawn_connector" flag to mark outputs to remove (Xaver)

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Xaver Hugl <xaver.hugl@kde.org>
fixes: ef181265 - xwayland: Clean up drm lease when terminating

See-also: https://gitlab.freedesktop.org/xorg/xserver/-/issues/946
See-also: https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1130
(cherry picked from commit 4053782443)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1494>
2024-05-02 10:17:42 +02:00
Olivier Fourdan
cb6c7256ab xwayland: Check for outputs before lease devices
In xwl_randr_request_lease(), the code checks first for leased device,
and then checks for existing output for lease.

The former assumes there are outputs for lease whereas the latter checks
for the output, connector and lease.

So if there is any existing rrLease->outputs[]->devPrivate unset, the
code would crash on a NULL pointer dereference on the first sanity check
before having a chance to reach the second check that would have caught
the problem.

Invert the sanity checks so that we would catch this first and return a
BadValue instead of possibly segfaulting.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Xaver Hugl <xaver.hugl@kde.org>
(cherry picked from commit 21916ae148)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1494>
2024-05-02 10:17:39 +02:00
Michel Dänzer
34832a182c xwayland/glamor: Handle depth 15 in gbm_format_for_depth
Prevents Xwayland with glamor from logging

 unexpected depth: 15

to stderr many times when running

 rendercheck -t blend -o clear

(cherry picked from commit 08113b8923)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1494>
2024-05-02 10:17:36 +02:00
Olivier Fourdan
74d02b98ab xwayland: Use the connector name for XRANDR leases
Use the connector name as basis for the Xwayland output name in XRANDR,
similar to what we do for regular outputs, instead of the generic
"XWAYLAND<n>" name which changes every time the output is leased.

Prefix the actual name with "lease-" to distinguish from duplicate names
from the regular outputs.

v2: avoid duplicate names (Simon)
v3: Move the check for duplicates to xwl_output_set_name() (Simon)

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit 49b8f131f7)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1494>
2024-05-02 10:17:32 +02:00
Olivier Fourdan
aa17d7eba6 xwayland: Check for duplicate output names
Even though the name provided by either xdg-output or wl_output are
guaranteed to be unique, that might not be the case with output names
between different protocols, such as the one offered for DRM lease.

To avoid running into name conflicts, check that no other existing
output of the same name exists prior to changing the output name.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit d36f66f15d)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1494>
2024-05-02 10:16:44 +02:00
Olivier Fourdan
158246a0af xwayland: Make xwl_output_set_name() public
No functional change, this is preparation work for the next commit.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit 0cb4ec4dbd)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1494>
2024-05-02 10:16:41 +02:00
Olivier Fourdan
80af615ea9 xwayland: Define MAX_OUTPUT_NAME in the header
So that other parts of the Xwayland code can use it.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit 12265aaa1c)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1494>
2024-05-02 10:16:37 +02:00
Olivier Fourdan
4725674a23 xwayland: Use the path to Xwayland as installed
Otherwise the executable cannot be found where specified.

v2: Use 'xwayland_path' (Simon)

Fixes: fbf5e26b5 - xwayland: Use full path for Xwayland exec
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit 8ff88ffec9)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1494>
2024-04-18 14:00:03 +02:00
Enrico Weigelt, metux IT consult
9f4d612e7e m4: drop autoconf leftovers
these m4 macros had been used for autotools-based build system. But since this
had been replaced by meson, these files are obsolete now.

Fixes: c97397dc47
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
(cherry picked from commit 887fc7121b)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1487>
2024-04-18 07:17:07 +00:00
Olivier Fourdan
84b6d7e2c5 Bump version to 24.0.99.901
Xwayland 24.1.0 release candidate 1.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1489>
2024-04-17 08:56:13 +02:00
Olivier Fourdan
596db5424d Bump version to 24.0.99.1
In preparation for a 24.1 release.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1483>
2024-04-12 10:40:05 +02:00
Michel Dänzer
751af1243e meson: Change project name to xwayland
(cherry picked from commit 001f0c8938)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1483>
2024-04-12 10:40:05 +02:00
Michel Dänzer
3d5eb2df23 Don't install Xvfb
We're keeping it for unit tests, but we don't want to ship it from this
branch.

Also disable Xvfb in CI for ninja test. It's still built and used for
unit tests as part of ninja dist, but we don't want to run XTS on Xvfb.

(cherry picked from commit 0408fcb329)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1483>
2024-04-12 10:40:05 +02:00
Michel Dänzer
9cd94d3976 meson: Build Xwayland unconditionally
And simplify build_glamor logic, we don't need the separate
glamor_option variable anymore.

(cherry picked from commit fdc61c5a3c)
(cherry picked from commit 274d54d1c3)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1483>
2024-04-12 10:40:05 +02:00
Michel Dänzer
6b100681d6 Drop miext/shadow directory
Not used on this branch.

(cherry picked from commit be7257c5d1)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1483>
2024-04-12 10:40:05 +02:00
Michel Dänzer
7f3a9a4059 Drop EXA code
Not used on this branch.

(cherry picked from commit aa49cd5ab7)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1483>
2024-04-12 10:40:05 +02:00
Michel Dänzer
94228264a7 Drop config directory
Not used anymore on this branch.

(cherry picked from commit 23296633bb)
(cherry picked from commit d07af46a67bc8e68fa050c605bb556bc25886f16)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1483>
2024-04-12 10:40:05 +02:00
Michel Dänzer
1f80c795e0 Drop Xephyr / kdrive DDX
(cherry picked from commit 9335ee7994)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1483>
2024-04-12 10:40:05 +02:00
Michel Dänzer
dfea734656 Drop Xorg DDX
v2: Change the FDO_DISTRIBUTION_TAG (Michel)

(cherry picked from commit 4f4b8e00fc)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1483>
2024-04-12 10:40:05 +02:00
Michel Dänzer
34fac2d7df Drop Xwin DDX and x86 MinGW-w64 cross build
(cherry picked from commit 8f480147f6)

This partly reverts commit d3933a24d1.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1483>
2024-04-12 10:40:05 +02:00
Michel Dänzer
735009cda3 Drop Xnest DDX
(cherry picked from commit 69cc6a6caa)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1483>
2024-04-12 10:40:05 +02:00
Michel Dänzer
700cdeeee4 Drop Xquartz DDX
(cherry picked from commit 6cae4b397d)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1483>
2024-04-12 10:40:05 +02:00
1303 changed files with 8084 additions and 266670 deletions

View file

@ -73,7 +73,7 @@ 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 setup --prefix=/usr -Dxv=false -Dxf86bigfont=true -Dxvfb=true -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"'

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

View file

@ -4,7 +4,7 @@
# Please see the ci-templates documentation for details:
# https://freedesktop.pages.freedesktop.org/ci-templates/
.templates_sha: &template_sha ef5e4669b7500834a17ffe9277e15fbb6d977fff # see https://docs.gitlab.com/ee/ci/yaml/#includefile
.templates_sha: &template_sha c5626190ec14b475271288dda7a7dae8dbe0cd76 # see https://docs.gitlab.com/ee/ci/yaml/#includefile
# FDO_DISTRIBUTION_TAG is the tag of the docker image used for the build jobs.
# If the image doesn't exist yet, the docker-image stage generates it.
@ -16,29 +16,24 @@
# gcc/clang or other packages, which might break the build with older commits
# using the same tag.
variables:
FDO_UPSTREAM_REPO: 'xorg/xserver'
MESON_BUILDDIR: 'build'
REPO_URL_XORGPROTO: 'https://gitlab.freedesktop.org/xorg/proto/xorgproto.git'
XORG_DEBIAN_VERSION: 'bullseye-slim'
XORG_DEBIAN_EXEC: 'env FDO_CI_CONCURRENT=${FDO_CI_CONCURRENT} bash .gitlab-ci/debian-install.sh'
XORG_DEBIAN_TAG: '2025-02-26-xcb-deps'
XORG_FREEBSD_VERSION: '14.2'
XORG_FREEBSD_EXEC: ''
XORG_FREEBSD_TAG: '2025-02-18-vm-image'
FDO_UPSTREAM_REPO: xorg/xserver
FDO_DISTRIBUTION_VERSION: bullseye-slim
FDO_DISTRIBUTION_EXEC: 'env FDO_CI_CONCURRENT=${FDO_CI_CONCURRENT} bash .gitlab-ci/debian-install.sh'
FDO_DISTRIBUTION_TAG: "2024-09-24-no-xorg"
MESON_BUILDDIR: "build"
include:
- project: 'freedesktop/ci-templates'
ref: *template_sha
file:
- '/templates/debian.yml'
- '/templates/freebsd.yml'
- '/templates/ci-fairy.yml'
file: '/templates/debian.yml'
- project: 'freedesktop/ci-templates'
ref: *template_sha
file: '/templates/ci-fairy.yml'
- template: Security/SAST.gitlab-ci.yml
stages:
- docker-image
- build-and-test
- drivers
- test
.ci-run-policy:
@ -50,103 +45,17 @@ stages:
# Cancel CI run if a newer commit is pushed to the same branch
interruptible: true
# This is everything but the DDXen
.dix_paths: &dix_paths
# Directories
- .gitlab-ci/**/*
- composite/**/*
- config/**/*
- damageext/**/*
- dbe/**/*
- dix/**/*
- doc/**/*
- dri3/**/*
- exa/**/*
- fb/**/*
- glamor/**/*
- glx/**/*
- include/**/*
- m4/**/*
- man/**/*
- mi/**/*
- miext/**/*
- os/**/*
- present/**/*
- pseudoramiX/**/*
- randr/**/*
- record/**/*
- render/**/*
- test/**/*
- Xext/**/*
- xfixes/**/*
- Xi/**/*
- xkb/**/*
# Files
- hw/meson.build
- .gitlab-ci.yml
- meson*
- xorg-server.m4
- xorg-server.pc.in
- xserver.ent.in
.xorg_paths: &xorg_paths
- hw/xfree86/**/*
.xwayland_paths: &xwayland_paths
- hw/xwayland/**/*
.all_ddx_paths:
- hw/**/*
.debian:
variables:
FDO_DISTRIBUTION_VERSION: '$XORG_DEBIAN_VERSION'
FDO_DISTRIBUTION_EXEC: '$XORG_DEBIAN_EXEC'
FDO_DISTRIBUTION_TAG: '$XORG_DEBIAN_TAG'
.freebsd:
tags:
- kvm
variables:
FDO_DISTRIBUTION_TAG: '$XORG_FREEBSD_TAG'
FDO_DISTRIBUTION_VERSION: '$XORG_FREEBSD_VERSION'
FDO_DISTRIBUTION_EXEC: ''
FDO_DISTRIBUTION_PACKAGES: 'git gcc pkgconf autoconf automake libtool xorg-macros xorgproto bash meson ninja pixman xtrans libXau libXdmcp libXfont2 libxkbfile libxcvt libpciaccess font-util libepoll-shim'
FDO_IMAGE_SIZE: '30G'
debian-bullseye:
extends:
- .fdo.container-build@debian
- .ci-run-policy
- .debian
stage: docker-image
variables:
GIT_STRATEGY: none
freebsd-image:
extends:
- .fdo.qemu-build@freebsd@x86_64
- .freebsd
stage: docker-image
variables:
GIT_STRATEGY: none
.xorg-image@debian:
extends:
- .fdo.distribution-image@debian
- .debian
.xorg-image@freebsd:
extends:
- .fdo.distribution-image@freebsd
- .freebsd
variables:
GIT_DEPTH: 1
PKG_CONFIG_PATH: /usr/share/pkgconfig:/usr/lib/pkgconfig:/usr/pkg/share/pkgconfig:/usr/pkg/lib/pkgconfig:/usr/local/libdata/pkgconfig
.common-build-and-test:
extends:
- .xorg-image@debian
- .fdo.distribution-image@debian
- .ci-run-policy
stage: build-and-test
artifacts:
@ -155,7 +64,7 @@ freebsd-image:
- $MESON_BUILDDIR/meson-logs/
- $MESON_BUILDDIR/test/piglit-results/
variables:
MESON_ARGS: -Dc_args="-fno-common" -Dprefix=/usr -Dxephyr=true -Dwerror=true -Dxcsecurity=true
MESON_ARGS: -Dc_args="-fno-common" -Dprefix=/usr -Dxephyr=true -Dwerror=true
CCACHE_COMPILERCHECK: content
CCACHE_DIR: /cache/xserver/cache
LC_ALL: C.UTF-8
@ -172,73 +81,22 @@ meson:
- .gitlab-ci/meson-build.sh --run-test
- .gitlab-ci/check-piglit-results.sh
- .gitlab-ci/manpages-check
- .gitlab-ci/check-ddx-build.sh
variables:
XTEST_DIR: /root/xts
PIGLIT_DIR: /root/piglit
LP_NUM_THREADS: 0
MESON_DDX_BUILD_ARGS: >
-Dxwayland=${BUILD_XWAYLAND} -Dxorg=${BUILD_XORG} -Dxephyr=${BUILD_XEPHYR} -Dxvfb=${BUILD_XVFB} -Dxnest=${BUILD_XNEST}
BUILD_XEPHYR: true
BUILD_XNEST: true
BUILD_XORG: true
BUILD_XVFB: true
BUILD_XWAYLAND: true
MESON_EXTRA_ARGS: ${MESON_DDX_BUILD_ARGS}
meson-enable-options:
extends: meson
variables:
MESON_EXTRA_ARGS: --auto-features=enabled -Dlisten_tcp=true -Dsuid_wrapper=true -Dxf86bigfont=true -Dxcsecurity=true -Dxpbproxy=true -Ddri1=true -Ddri2=true -Ddri3=true -Dlibunwind=true ${MESON_DDX_BUILD_ARGS}
meson-disable-options:
extends: meson
variables:
MESON_EXTRA_ARGS: --auto-features=disabled -Dglamor=false -Dglx=false -Dxdmcp=false -Dxdm-auth-1=false -Dint10=false -Dpciaccess=false -Dudev=false -Dudev_kms=false -Dvgahw=false -Dxace=false -Dxcsecurity=false -Dxinerama=false -Dxv=false -Dxvmc=false -Ddrm=false -Ddri1=false -Ddri2=false -Ddri3=false ${MESON_DDX_BUILD_ARGS}
meson-noglamor:
extends: meson
variables:
MESON_EXTRA_ARGS: -Dglamor=false ${MESON_DDX_BUILD_ARGS}
MESON_EXTRA_ARGS: >
-Dglamor=false
xwayland-nolibdecor:
meson-nolibdecor:
extends: meson
variables:
BUILD_XEPHYR: false
BUILD_XNEST: false
BUILD_XORG: false
BUILD_XVFB: false
MESON_EXTRA_ARGS: -Dlibdecor=false ${MESON_DDX_BUILD_ARGS}
mingw-cross-build:
extends: .common-build-and-test
script:
- .gitlab-ci/meson-build.sh --run-install
variables:
MESON_ARGS: --cross-file=.gitlab-ci/cross-i686-w64-mingw32.txt -Dglx=false -Dlisten_tcp=true
freebsd:
stage: build-and-test
extends:
- .xorg-image@freebsd
variables:
MESON_ARGS: -Dglx=false -Dglamor=false -Dudev=false -Dudev_kms=false
script:
# running of of disk space without this
# needed until https://gitlab.freedesktop.org/freedesktop/ci-templates/-/issues/67 is fixed
- git gc
- git clone --depth=1 $REPO_URL_XORGPROTO dep.xorgproto
- /app/vmctl start
- set +e
- scp -r $PWD "vm:"
# need to install newer xorgproto
- /app/vmctl exec "cd $CI_PROJECT_NAME/dep.xorgproto && ./autogen.sh --prefix=/usr && make && make install"
- /app/vmctl exec "cd $CI_PROJECT_NAME && PKG_CONFIG_PATH=\"$PKG_CONFIG_PATH\" MESON_ARGS=\"$MESON_ARGS\" MESON_BUILDDIR=\"$MESON_BUILDDIR\" .gitlab-ci/meson-build.sh --skip-test" && touch .success
# test not working yet, so skipped
# - scp -r vm:$CI_PROJECT_NAME/test-results.xml .
- /app/vmctl stop
- set -e
- test -e .success || exit 1
MESON_EXTRA_ARGS: >
-Dlibdecor=false
meson-dist:
extends: .common-build-and-test
@ -246,74 +104,15 @@ meson-dist:
when: always
paths:
- $MESON_BUILDDIR/meson-logs/
- $MESON_BUILDDIR/xserver-*/$MESON_BUILDDIR/meson-logs/
- xserver-tarball/install/
- $MESON_BUILDDIR/xwayland-*/$MESON_BUILDDIR/meson-logs/
script:
- .gitlab-ci/meson-build.sh --run-dist
- mkdir xserver-tarball
- tar xf $MESON_BUILDDIR/meson-dist/xserver-*.tar.xz -C xserver-tarball --strip-components=1
- .gitlab-ci/meson-build.sh -C xserver-tarball --skip-test --skip-dist --run-install
- mkdir xwayland-tarball
- tar xf $MESON_BUILDDIR/meson-dist/xwayland-*.tar.xz -C xwayland-tarball --strip-components=1
- .gitlab-ci/meson-build.sh -C xwayland-tarball --skip-test --skip-dist --run-install
variables:
MESON_DIST_ARGS: --no-tests
MESON_EXTRA_ARGS: -Dprefix=$CI_PROJECT_DIR/xserver-tarball/install/
xf86-driver-build-test:
extends:
- .xorg-image@debian
- .ci-run-policy
stage: drivers
parallel:
matrix:
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-input-evdev
SHA: xf86-input-evdev-2.10.6
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-input-libinput
SHA: xf86-input-libinput-1.4.0
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-input-mouse
SHA: xf86-input-mouse-1.9.5
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-input-synaptics
SHA: xf86-input-synaptics-1.9.2
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-amdgpu
SHA: xf86-video-amdgpu-23.0.0
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-ati
SHA: xf86-video-ati-22.0.0
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-intel
SHA: e6a4c4740c15ace9dd79dc7c18955f2eb413a6a5 # no release yet
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-qxl
SHA: 989ff620220e8d0555cec38c1508b57dfbcfb0c6 # no release yet
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-vesa
SHA: xf86-video-vesa-2.6.0
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-vmware
SHA: xf86-video-vmware-13.4.0
script:
# built xserver is taken from meson-dist job
- export PKG_CONFIG_PATH=$(pwd)/xserver-tarball/install/lib/x86_64-linux-gnu/pkgconfig
- export ACLOCAL_PATH=$(pwd)/xserver-tarball/install/share/aclocal/
- unset MESON_EXTRA_ARGS
- DRIVER=$(basename $REPO)
- git clone "$REPO" "$DRIVER"
- git -C "$DRIVER" checkout "$SHA"
- |
if [[ -e "$DRIVER/meson.build" ]] && [[ "$DRIVER" != "xf86-video-intel" ]]; then
.gitlab-ci/meson-build.sh -C "$DRIVER" --skip-test
else
pushd "$DRIVER" || exit 1
./autogen.sh && make
fi
needs:
- meson-dist
dependencies:
- meson-dist
variables:
GIT_DEPTH: 1
MESON_ARGS: -Dprefix=/usr/
MESON_EXTRA_ARGS: -Dxwayland=false -Dxnest=false -Dxvfb=false -Dxquartz=false -Ddocs=false
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
changes:
*dix_paths
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
changes:
*xorg_paths
DESTDIR: xwayland-tarball/install/
#
# Verify that commit messages are as expected

View file

@ -1,25 +0,0 @@
#!/bin/bash
set -e
set -o xtrace
check_executable () {
if [[ ! -x $MESON_BUILDDIR/$1 ]]; then
echo "$1 not found after build"
exit 1
fi
return 0
}
if [[ -z "$MESON_BUILDDIR" ]]; then
echo "\$MESON_BUILDDIR not set"
exit 1
fi
[[ "$BUILD_XEPHYR" == true ]] && check_executable "hw/kdrive/ephyr/Xephyr"
[[ "$BUILD_XNEST" == true ]] && check_executable "hw/xnest/Xnest"
[[ "$BUILD_XORG" == true ]] && check_executable "hw/xfree86/Xorg"
[[ "$BUILD_XVFB" == true ]] && check_executable "hw/vfb/Xvfb"
[[ "$BUILD_XWAYLAND" == true ]] && check_executable "hw/xwayland/Xwayland"
exit 0

View file

@ -1,20 +0,0 @@
[binaries]
c = 'i686-w64-mingw32-gcc'
cpp = 'i686-w64-mingw32-g++'
ar = 'i686-w64-mingw32-ar'
strip = 'i686-w64-mingw32-strip'
pkgconfig = '/usr/local/bin/i686-w64-mingw32-pkg-config'
windres = 'i686-w64-mingw32-windres'
exe_wrapper = 'wine'
[properties]
# Directory that contains 'bin', 'lib', etc for the toolchain
root = '/usr/i686-w64-mingw32'
# Directory that contains 'bin', 'lib', etc which have been cross-compiled
sys_root = '/usr/i686-w64-mingw32'
[host_machine]
system = 'windows'
cpu_family = 'x86'
cpu = 'i686'
endian = 'little'

View file

@ -1,81 +0,0 @@
#!/bin/bash
set -e
set -o xtrace
HOST=$1
# Debian's cross-pkg-config wrappers are broken for MinGW targets, since
# dpkg-architecture doesn't know about MinGW target triplets.
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=930492
cat >/usr/local/bin/${HOST}-pkg-config <<EOF
#!/bin/sh
PKG_CONFIG_SYSROOT_DIR=/usr/${HOST} PKG_CONFIG_LIBDIR=/usr/${HOST}/lib/pkgconfig:/usr/${HOST}/share/pkgconfig pkg-config \$@
EOF
chmod +x /usr/local/bin/${HOST}-pkg-config
# when cross-compiling, some autoconf tests cannot be run:
# --enable-malloc0returnsnull
export xorg_cv_malloc0_returns_null=yes
build() {
url=$1
commit=$2
config=$3
name=$(basename ${url} .git)
if [[ $commit =~ ^[[:xdigit:]]{1,}$ ]]
then
git clone ${url} ${name}
git -C ${name} checkout ${commit}
else
git clone --depth 1 --branch ${commit:-master} --recurse-submodules -c advice.detachedHead=false ${url} ${name}
fi
pushd ${name}
NOCONFIGURE=1 ./autogen.sh || ./.bootstrap
./configure ${config} --host=${HOST} --prefix= --with-sysroot=/usr/${HOST}/
make -j$(nproc)
DESTDIR=/usr/${HOST} make install
popd
rm -rf ${OLDPWD}
}
build 'https://gitlab.freedesktop.org/pixman/pixman.git' 'pixman-0.38.4'
build 'https://gitlab.freedesktop.org/xorg/lib/pthread-stubs.git' '0.4'
# we can't use the xorgproto pkgconfig files from /usr/share/pkgconfig, because
# these would add -I/usr/include to CFLAGS, which breaks cross-compilation
build 'https://gitlab.freedesktop.org/xorg/proto/xorgproto.git' 'xorgproto-2024.1' '--datadir=/lib'
build 'https://gitlab.freedesktop.org/xorg/lib/libXau.git' 'libXau-1.0.9'
build 'https://gitlab.freedesktop.org/xorg/proto/xcbproto.git' 'xcb-proto-1.14.1'
build 'https://gitlab.freedesktop.org/xorg/lib/libxcb.git' 'libxcb-1.14'
build 'https://gitlab.freedesktop.org/xorg/lib/libxtrans.git' 'xtrans-1.4.0'
# the default value of keysymdefdir is taken from the includedir variable for
# xproto, which isn't adjusted by pkg-config for the sysroot
# Using -fcommon to address build failure when cross-compiling for windows.
# See discussion at https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/913
CFLAGS="-fcommon" build 'https://gitlab.freedesktop.org/xorg/lib/libX11.git' 'libX11-1.6.9' "--with-keysymdefdir=/usr/${HOST}/include/X11"
build 'https://gitlab.freedesktop.org/xorg/lib/libxkbfile.git' 'libxkbfile-1.1.0'
# freetype needs an explicit --build to know it's cross-compiling
# disable png as freetype tries to use libpng-config, even when cross-compiling
build 'git://git.savannah.gnu.org/freetype/freetype2.git' 'VER-2-10-1' "--build=$(cc -dumpmachine) --with-png=no"
build 'https://gitlab.freedesktop.org/xorg//font/util.git' 'font-util-1.3.2'
build 'https://gitlab.freedesktop.org/xorg/lib/libfontenc.git' 'libfontenc-1.1.4'
build 'https://gitlab.freedesktop.org/xorg/lib/libXfont.git' 'libXfont2-2.0.3'
build 'https://gitlab.freedesktop.org/xorg/lib/libXdmcp.git' 'libXdmcp-1.1.3'
build 'https://gitlab.freedesktop.org/xorg/lib/libXfixes.git' 'libXfixes-5.0.3'
build 'https://gitlab.freedesktop.org/xorg/lib/libxcb-util.git' 'xcb-util-0.4.1-gitlab'
build 'https://gitlab.freedesktop.org/xorg/lib/libxcb-image.git' 'xcb-util-image-0.4.1-gitlab'
build 'https://gitlab.freedesktop.org/xorg/lib/libxcb-wm.git' 'xcb-util-wm-0.4.2'
# workaround xcb_windefs.h leaking all Windows API types into X server build
# (some of which clash which types defined by Xmd.h) XXX: This is a bit of a
# hack, as it makes this header depend on xorgproto. Maybe an upstreamable
# fix would involve a macro defined in the X server (XFree86Server?
# XCB_NO_WINAPI?), which makes xcb_windefs.h wrap things like XWinsock.h
# does???
sed -i s#winsock2#X11/Xwinsock# /usr/${HOST}/include/xcb/xcb_windefs.h

View file

@ -6,8 +6,10 @@ set -o xtrace
# Packages which are needed by this script, but not for the xserver build
EPHEMERAL="
libcairo2-dev
libevdev-dev
libexpat-dev
libgles2-mesa-dev
libinput-dev
libxkbcommon-dev
x11-utils
x11-xserver-utils
@ -15,7 +17,7 @@ EPHEMERAL="
xvfb
"
# Add bullseye-backports for the newer linux-libc-dev & meson packages
# Add bullseye-backports for the newer linux-libc-dev package
echo 'deb http://deb.debian.org/debian bullseye-backports main' >> /etc/apt/sources.list
apt update
@ -27,9 +29,7 @@ apt-get install -y \
build-essential \
ca-certificates \
ccache \
dpkg-dev \
flex \
gcc-mingw-w64-i686 \
git \
libaudit-dev \
libbsd-dev \
@ -48,14 +48,12 @@ apt-get install -y \
libgles2 \
libglx-mesa0 \
libinput10 \
libinput-dev \
libnvidia-egl-wayland-dev \
libpango1.0-0 \
libpango1.0-dev \
libpciaccess-dev \
libpixman-1-dev \
libselinux1-dev \
libspice-protocol-dev \
libsystemd-dev \
libtool \
libudev-dev \
@ -65,9 +63,6 @@ apt-get install -y \
libx11-xcb-dev \
libxau-dev \
libxaw7-dev \
libxcb-damage0-dev \
libxcb-dri2-0-dev \
libxcb-dri3-dev \
libxcb-glx0-dev \
libxcb-icccm4-dev \
libxcb-image0-dev \
@ -77,15 +72,11 @@ apt-get install -y \
libxcb-render0-dev \
libxcb-shape0-dev \
libxcb-shm0-dev \
libxcb-sync-dev \
libxcb-util0-dev \
libxcb-xf86dri0-dev \
libxcb-xinput-dev \
libxcb-xkb-dev \
libxcb-xv0-dev \
libxcb1-dev \
libxcursor-dev \
libxdamage-dev \
libxdmcp-dev \
libxext-dev \
libxfixes-dev \
@ -97,21 +88,15 @@ apt-get install -y \
libxmu-dev \
libxmuu-dev \
libxpm-dev \
libxrandr-dev \
libxrender-dev \
libxres-dev \
libxshmfence-dev \
libxss-dev \
libxt-dev \
libxtst-dev \
libxv-dev \
libxvmc-dev \
libxxf86vm-dev \
libz-mingw-w64-dev \
linux-libc-dev/bullseye-backports \
mesa-common-dev \
meson/bullseye-backports \
mingw-w64-tools \
meson \
nettle-dev \
pkg-config \
python3-attr \
@ -119,7 +104,6 @@ apt-get install -y \
python3-mako \
python3-numpy \
python3-six \
valgrind \
weston \
x11-xkb-utils \
xfonts-utils \
@ -127,8 +111,6 @@ apt-get install -y \
xtrans-dev \
xutils-dev
.gitlab-ci/cross-prereqs-build.sh i686-w64-mingw32
cd /root
# Xwayland requires drm 2.4.116 for drmSyncobjEventfd
@ -163,8 +145,8 @@ ninja -C _build -j${FDO_CI_CONCURRENT:-4} install
cd ..
rm -rf wayland
# Xwayland requires wayland-protocols >= 1.38, but Debian bullseye has 1.20 only
git clone https://gitlab.freedesktop.org/wayland/wayland-protocols.git --depth 1 --branch=1.38
# Xwayland requires wayland-protocols >= 1.34, but Debian bullseye has 1.20 only
git clone https://gitlab.freedesktop.org/wayland/wayland-protocols.git --depth 1 --branch=1.34
cd wayland-protocols
meson _build
ninja -C _build -j${FDO_CI_CONCURRENT:-4} install
@ -194,8 +176,10 @@ cd ..
git clone https://gitlab.freedesktop.org/xorg/test/xts
cd xts
git checkout 12a887c2c72c4258962b56ced7b0aec782f1ffed
./autogen.sh
git checkout dbbfa96c036e596346147081cbceda136e7c86c1
# Using -fcommon until we get a proper fix into xtst.
# See discussion at https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/913
CFLAGS=-fcommon ./autogen.sh
xvfb-run make -j${FDO_CI_CONCURRENT:-4}
cd ..

View file

@ -277,8 +277,7 @@ Paulo Zanoni <paulo.r.zanoni@intel.com> Paulo Ricardo Zanoni <pzanoni@mandriva.c
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 Harris <pharris@opentext.com> <peter.harris@hummingbird.com>
Peter Hutterer <peter.hutterer@who-t.net> <peter.hutterer@redhat.com>
Peter Hutterer <peter.hutterer@who-t.net> <peter@cs.unisa.edu.au>

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

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.

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>
@ -39,7 +41,7 @@ from The Open Group.
#include "dixstruct.h"
#include "extnsionst.h"
#include "opaque.h"
#include "extinit_priv.h"
#include "extinit.h"
static int
ProcBigReqDispatch(ClientPtr client)
@ -47,6 +49,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,7 +39,7 @@ Equipment Corporation.
#include "opaque.h"
#include <X11/extensions/dpmsproto.h>
#include "dpmsproc.h"
#include "extinit_priv.h"
#include "extinit.h"
#include "scrnintstr.h"
#include "windowstr.h"
#include "protocol-versions.h"
@ -165,7 +163,7 @@ ProcDPMSSelectInput(register ClientPtr client)
pHead = (DPMSEventPtr *)malloc(sizeof(DPMSEventPtr));
if (!pHead ||
!AddResource(eventResource, DPMSEventType, (void *)pHead)) {
FreeResource(clientResource, X11_RESTYPE_NONE);
FreeResource(clientResource, RT_NONE);
return BadAlloc;
}
*pHead = 0;
@ -494,16 +492,42 @@ static int _X_COLD
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
SProcDPMSCapable(ClientPtr client)
{
REQUEST(xDPMSCapableReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSCapableReq);
return ProcDPMSCapable(client);
}
static int _X_COLD
SProcDPMSGetTimeouts(ClientPtr client)
{
REQUEST(xDPMSGetTimeoutsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSGetTimeoutsReq);
return ProcDPMSGetTimeouts(client);
}
static int _X_COLD
SProcDPMSSetTimeouts(ClientPtr client)
{
REQUEST(xDPMSSetTimeoutsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSSetTimeoutsReq);
swaps(&stuff->standby);
@ -512,10 +536,34 @@ SProcDPMSSetTimeouts(ClientPtr client)
return ProcDPMSSetTimeouts(client);
}
static int _X_COLD
SProcDPMSEnable(ClientPtr client)
{
REQUEST(xDPMSEnableReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSEnableReq);
return ProcDPMSEnable(client);
}
static int _X_COLD
SProcDPMSDisable(ClientPtr client)
{
REQUEST(xDPMSDisableReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSDisableReq);
return ProcDPMSDisable(client);
}
static int _X_COLD
SProcDPMSForceLevel(ClientPtr client)
{
REQUEST(xDPMSForceLevelReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSForceLevelReq);
swaps(&stuff->level);
@ -523,10 +571,22 @@ SProcDPMSForceLevel(ClientPtr client)
return ProcDPMSForceLevel(client);
}
static int _X_COLD
SProcDPMSInfo(ClientPtr client)
{
REQUEST(xDPMSInfoReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSInfoReq);
return ProcDPMSInfo(client);
}
static int _X_COLD
SProcDPMSSelectInput(ClientPtr client)
{
REQUEST(xDPMSSelectInputReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSSelectInputReq);
swapl(&stuff->eventMask);
return ProcDPMSSelectInput(client);
@ -542,19 +602,19 @@ 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);
return SProcDPMSInfo(client);
case X_DPMSSelectInput:
return SProcDPMSSelectInput(client);
default:

View file

@ -23,32 +23,26 @@
* 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);
@ -95,6 +89,11 @@ ProcGEQueryVersion(ClientPtr client)
return Success;
}
static int (*ProcGEVector[GENumberRequests]) (ClientPtr) = {
/* Version 1.0 */
ProcGEQueryVersion,
};
/************************************************************/
/* swapped request handlers */
/************************************************************/
@ -102,12 +101,19 @@ static int _X_COLD
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 +122,32 @@ 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 >= ARRAY_SIZE(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
SProcGEDispatch(ClientPtr client)
{
REQUEST(xReq);
swaps(&stuff->length);
GEClientInfoPtr pGEClient = GEGetClient(client);
switch (stuff->data) {
case X_GEQueryVersion:
return SProcGEQueryVersion(client);
default:
REQUEST(xGEReq);
if (pGEClient->major_version >= ARRAY_SIZE(version_requests))
return BadRequest;
}
if (stuff->ReqType > version_requests[pGEClient->major_version])
return BadRequest;
return (*SProcGEVector[stuff->ReqType]) (client);
}
/* Reset extension. Called on server shutdown. */
@ -177,16 +186,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 © 2006-2007 Daniel Stone
* Copyright 2007-2008 Peter Hutterer
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@ -20,27 +20,32 @@
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Author: Daniel Stone <daniel@fooishbar.org>
* Author: Peter Hutterer, University of South Australia, NICTA
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "input.h"
#include "list.h"
void remove_devices(const char *backend, const char *config_info);
BOOL device_is_duplicate(const char *config_info);
#ifndef _GEINT_H_
#define _GEINT_H_
#ifdef CONFIG_UDEV
int config_udev_pre_init(void);
int config_udev_init(void);
void config_udev_fini(void);
void config_udev_odev_probe(config_odev_probe_proc_ptr probe_callback);
#elif defined(CONFIG_HAL)
int config_hal_init(void);
void config_hal_fini(void);
#elif defined(CONFIG_WSCONS)
int config_wscons_init(void);
void config_wscons_fini(void);
#endif
#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"

View file

@ -10,6 +10,7 @@ srcs_xext = [
hdrs_xext = [
'geext.h',
'geint.h',
'syncsdk.h',
]
@ -36,6 +37,7 @@ endif
if build_xace
srcs_xext += 'xace.c'
hdrs_xext += ['xace.h', 'xacestr.h']
endif
if build_xf86bigfont
@ -71,7 +73,3 @@ libxserver_xext_vidmode = static_library('libxserver_xext_vidmode',
include_directories: inc,
dependencies: common_dep,
)
if build_xorg
install_data(hdrs_xext, install_dir: xorgsdkdir)
endif

View file

@ -23,16 +23,14 @@ 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>
#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,6 +43,7 @@ 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"
@ -55,7 +54,7 @@ Equipment Corporation.
#ifdef COMPOSITE
#include "compint.h"
#endif
#include "extinit_priv.h"
#include "extinit.h"
#include "protocol-versions.h"
#ifdef GLXPROXY
@ -744,8 +743,8 @@ 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;
@ -817,11 +816,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) {

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,10 +47,22 @@ Equipment Corporation.
#include "globals.h"
#include "panoramiXh.h"
static int _X_COLD
SProcPanoramiXQueryVersion(ClientPtr client)
{
REQUEST(xPanoramiXQueryVersionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq);
return ProcPanoramiXQueryVersion(client);
}
static int _X_COLD
SProcPanoramiXGetState(ClientPtr client)
{
REQUEST(xPanoramiXGetStateReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
swapl(&stuff->window);
return ProcPanoramiXGetState(client);
@ -58,6 +72,8 @@ static int _X_COLD
SProcPanoramiXGetScreenCount(ClientPtr client)
{
REQUEST(xPanoramiXGetScreenCountReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
swapl(&stuff->window);
return ProcPanoramiXGetScreenCount(client);
@ -67,19 +83,41 @@ static int _X_COLD
SProcPanoramiXGetScreenSize(ClientPtr client)
{
REQUEST(xPanoramiXGetScreenSizeReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
swapl(&stuff->window);
swapl(&stuff->screen);
return ProcPanoramiXGetScreenSize(client);
}
static int _X_COLD
SProcXineramaIsActive(ClientPtr client)
{
REQUEST(xXineramaIsActiveReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
return ProcXineramaIsActive(client);
}
static int _X_COLD
SProcXineramaQueryScreens(ClientPtr client)
{
REQUEST(xXineramaQueryScreensReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
return ProcXineramaQueryScreens(client);
}
int _X_COLD
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;

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"
@ -46,35 +40,53 @@ in this Software without prior written authorization from the X Consortium.
#include "extnsionst.h"
#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 */
@ -181,6 +193,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)
{
@ -203,7 +217,7 @@ MakeScreenPrivate(ScreenPtr pScreen)
if (pPriv)
return pPriv;
pPriv = calloc(1, sizeof(ScreenSaverScreenPrivateRec));
pPriv = New(ScreenSaverScreenPrivateRec);
if (!pPriv)
return 0;
pPriv->events = 0;
@ -253,7 +267,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;
@ -436,7 +450,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);
@ -460,7 +474,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;
@ -484,7 +498,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;
@ -504,7 +518,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);
@ -532,7 +546,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;
@ -556,7 +570,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);
@ -587,9 +601,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;
}
@ -610,8 +624,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;
@ -633,7 +645,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;
@ -702,7 +715,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;
@ -712,8 +726,9 @@ ProcScreenSaverSelectInput(ClientPtr client)
}
static int
ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
ScreenSaverSetAttributes(ClientPtr client)
{
REQUEST(xScreenSaverSetAttributesReq);
DrawablePtr pDraw;
WindowPtr pParent;
ScreenPtr pScreen;
@ -736,6 +751,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)
@ -743,11 +759,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) {
@ -832,7 +848,7 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
if (!pPriv)
return FALSE;
}
pAttr = calloc(1, sizeof(ScreenSaverAttrRec));
pAttr = New(ScreenSaverAttrRec);
if (!pAttr) {
ret = BadAlloc;
goto bail;
@ -883,7 +899,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)) {
@ -915,7 +931,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)) {
@ -998,7 +1014,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;
@ -1018,7 +1034,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;
@ -1052,13 +1068,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);
@ -1074,11 +1093,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;
@ -1087,13 +1104,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;
@ -1148,27 +1167,26 @@ 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;
REQUEST_SIZE_MATCH(xScreenSaverUnsetAttributesReq);
rc = dixLookupResourceByClass((void **) &draw, stuff->drawable,
XRC_DRAWABLE, client, DixWriteAccess);
@ -1176,14 +1194,15 @@ ProcScreenSaverUnsetAttributes(ClientPtr client)
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
@ -1212,7 +1231,7 @@ ProcScreenSaverSuspend(ClientPtr client)
if (suspend == TRUE)
this->count++;
else if (--this->count == 0)
FreeResource(this->clientResource, X11_RESTYPE_NONE);
FreeResource(this->clientResource, RT_NONE);
return Success;
}
@ -1252,13 +1271,11 @@ ProcScreenSaverSuspend(ClientPtr client)
}
static int (*NormalVector[]) (ClientPtr /* client */ ) = {
ProcScreenSaverQueryVersion,
ProcScreenSaverQueryVersion,
ProcScreenSaverQueryInfo,
ProcScreenSaverSelectInput,
ProcScreenSaverSetAttributes,
ProcScreenSaverUnsetAttributes,
ProcScreenSaverSuspend,
};
ProcScreenSaverUnsetAttributes, ProcScreenSaverSuspend,};
static int
ProcScreenSaverDispatch(ClientPtr client)
@ -1270,10 +1287,20 @@ ProcScreenSaverDispatch(ClientPtr client)
return BadRequest;
}
static int _X_COLD
SProcScreenSaverQueryVersion(ClientPtr client)
{
REQUEST(xScreenSaverQueryVersionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xScreenSaverQueryVersionReq);
return ProcScreenSaverQueryVersion(client);
}
static int _X_COLD
SProcScreenSaverQueryInfo(ClientPtr client)
{
REQUEST(xScreenSaverQueryInfoReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xScreenSaverQueryInfoReq);
swapl(&stuff->drawable);
return ProcScreenSaverQueryInfo(client);
@ -1283,6 +1310,7 @@ static int _X_COLD
SProcScreenSaverSelectInput(ClientPtr client)
{
REQUEST(xScreenSaverSelectInputReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xScreenSaverSelectInputReq);
swapl(&stuff->drawable);
swapl(&stuff->eventMask);
@ -1293,6 +1321,7 @@ static int _X_COLD
SProcScreenSaverSetAttributes(ClientPtr client)
{
REQUEST(xScreenSaverSetAttributesReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xScreenSaverSetAttributesReq);
swapl(&stuff->drawable);
swaps(&stuff->x);
@ -1310,6 +1339,7 @@ static int _X_COLD
SProcScreenSaverUnsetAttributes(ClientPtr client)
{
REQUEST(xScreenSaverUnsetAttributesReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xScreenSaverUnsetAttributesReq);
swapl(&stuff->drawable);
return ProcScreenSaverUnsetAttributes(client);
@ -1319,19 +1349,19 @@ static int _X_COLD
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
SProcScreenSaverDispatch(ClientPtr client)

View file

@ -24,19 +24,12 @@ 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>
#endif
#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"
#include "scrnintstr.h"
#include "inputstr.h"
@ -46,6 +39,7 @@ in this Software without prior written authorization from The Open Group.
#include "privates.h"
#include "xacestr.h"
#include "securitysrv.h"
#include <X11/extensions/securproto.h>
#include "extinit.h"
#include "protocol-versions.h"
@ -206,7 +200,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 +306,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 +370,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 +582,7 @@ ProcSecurityRevokeAuthorization(ClientPtr client)
if (rc != Success)
return rc;
FreeResource(stuff->authId, X11_RESTYPE_NONE);
FreeResource(stuff->authId, RT_NONE);
return Success;
} /* ProcSecurityRevokeAuthorization */
@ -613,6 +607,8 @@ static int _X_COLD
SProcSecurityQueryVersion(ClientPtr client)
{
REQUEST(xSecurityQueryVersionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSecurityQueryVersionReq);
swaps(&stuff->majorVersion);
swaps(&stuff->minorVersion);
@ -626,6 +622,8 @@ SProcSecurityGenerateAuthorization(ClientPtr client)
CARD32 *values;
unsigned long nvalues;
int values_offset;
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xSecurityGenerateAuthorizationReq);
swaps(&stuff->nbytesAuthProto);
swaps(&stuff->nbytesAuthData);
@ -633,10 +631,10 @@ 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 */
@ -645,6 +643,8 @@ static int _X_COLD
SProcSecurityRevokeAuthorization(ClientPtr client)
{
REQUEST(xSecurityRevokeAuthorizationReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSecurityRevokeAuthorizationReq);
swapl(&stuff->authId);
return ProcSecurityRevokeAuthorization(client);
@ -749,12 +749,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 +763,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);
@ -1090,10 +1089,21 @@ SShapeNotifyEvent(xShapeNotifyEvent * from, xShapeNotifyEvent * to)
to->shaped = from->shaped;
}
static int _X_COLD
SProcShapeQueryVersion(ClientPtr client)
{
REQUEST(xShapeQueryVersionReq);
swaps(&stuff->length);
return ProcShapeQueryVersion(client);
}
static int _X_COLD
SProcShapeRectangles(ClientPtr client)
{
REQUEST(xShapeRectanglesReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xShapeRectanglesReq);
swapl(&stuff->dest);
swaps(&stuff->xOff);
@ -1106,6 +1116,8 @@ static int _X_COLD
SProcShapeMask(ClientPtr client)
{
REQUEST(xShapeMaskReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShapeMaskReq);
swapl(&stuff->dest);
swaps(&stuff->xOff);
@ -1118,6 +1130,8 @@ static int _X_COLD
SProcShapeCombine(ClientPtr client)
{
REQUEST(xShapeCombineReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShapeCombineReq);
swapl(&stuff->dest);
swaps(&stuff->xOff);
@ -1130,6 +1144,8 @@ static int _X_COLD
SProcShapeOffset(ClientPtr client)
{
REQUEST(xShapeOffsetReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShapeOffsetReq);
swapl(&stuff->dest);
swaps(&stuff->xOff);
@ -1141,6 +1157,8 @@ static int _X_COLD
SProcShapeQueryExtents(ClientPtr client)
{
REQUEST(xShapeQueryExtentsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShapeQueryExtentsReq);
swapl(&stuff->window);
return ProcShapeQueryExtents(client);
@ -1150,6 +1168,8 @@ static int _X_COLD
SProcShapeSelectInput(ClientPtr client)
{
REQUEST(xShapeSelectInputReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShapeSelectInputReq);
swapl(&stuff->window);
return ProcShapeSelectInput(client);
@ -1159,6 +1179,8 @@ static int _X_COLD
SProcShapeInputSelected(ClientPtr client)
{
REQUEST(xShapeInputSelectedReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShapeInputSelectedReq);
swapl(&stuff->window);
return ProcShapeInputSelected(client);
@ -1168,6 +1190,7 @@ static int _X_COLD
SProcShapeGetRectangles(ClientPtr client)
{
REQUEST(xShapeGetRectanglesReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShapeGetRectanglesReq);
swapl(&stuff->window);
return ProcShapeGetRectangles(client);
@ -1179,7 +1202,7 @@ 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,24 @@ 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>
#ifdef HAVE_MEMFD_CREATE
#include <sys/mman.h>
#endif
#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 +55,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 +88,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 +210,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 +251,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;
@ -460,7 +459,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 +481,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 {
@ -732,7 +731,7 @@ ProcShmGetImage(ClientPtr client)
return Success;
}
#ifdef XINERAMA
#ifdef PANORAMIX
static int
ProcPanoramiXShmPutImage(ClientPtr client)
{
@ -997,8 +996,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 +1006,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 +1019,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 +1027,7 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
return result;
}
#endif /* XINERAMA */
#endif
static PixmapPtr
fbShmCreatePixmap(ScreenPtr pScreen,
@ -1112,8 +1111,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 +1121,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 +1139,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
@ -1322,7 +1321,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;
}
@ -1348,22 +1347,22 @@ ProcShmDispatch(ClientPtr 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:
@ -1388,10 +1387,20 @@ SShmCompletionEvent(xShmCompletionEvent * from, xShmCompletionEvent * to)
cpswapl(from->offset, to->offset);
}
static int _X_COLD
SProcShmQueryVersion(ClientPtr client)
{
REQUEST(xShmQueryVersionReq);
swaps(&stuff->length);
return ProcShmQueryVersion(client);
}
static int _X_COLD
SProcShmAttach(ClientPtr client)
{
REQUEST(xShmAttachReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShmAttachReq);
swapl(&stuff->shmseg);
swapl(&stuff->shmid);
@ -1402,6 +1411,7 @@ static int _X_COLD
SProcShmDetach(ClientPtr client)
{
REQUEST(xShmDetachReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShmDetachReq);
swapl(&stuff->shmseg);
return ProcShmDetach(client);
@ -1411,6 +1421,7 @@ static int _X_COLD
SProcShmPutImage(ClientPtr client)
{
REQUEST(xShmPutImageReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShmPutImageReq);
swapl(&stuff->drawable);
swapl(&stuff->gc);
@ -1431,6 +1442,7 @@ static int _X_COLD
SProcShmGetImage(ClientPtr client)
{
REQUEST(xShmGetImageReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShmGetImageReq);
swapl(&stuff->drawable);
swaps(&stuff->x);
@ -1447,6 +1459,7 @@ static int _X_COLD
SProcShmCreatePixmap(ClientPtr client)
{
REQUEST(xShmCreatePixmapReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShmCreatePixmapReq);
swapl(&stuff->pid);
swapl(&stuff->drawable);
@ -1463,6 +1476,7 @@ SProcShmAttachFd(ClientPtr client)
{
REQUEST(xShmAttachFdReq);
SetReqFds(client, 1);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShmAttachFdReq);
swapl(&stuff->shmseg);
return ProcShmAttachFd(client);
@ -1472,6 +1486,7 @@ static int _X_COLD
SProcShmCreateSegment(ClientPtr client)
{
REQUEST(xShmCreateSegmentReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShmCreateSegmentReq);
swapl(&stuff->shmseg);
swapl(&stuff->size);
@ -1485,7 +1500,7 @@ SProcShmDispatch(ClientPtr client)
REQUEST(xReq);
if (stuff->data == X_ShmQueryVersion)
return ProcShmQueryVersion(client);
return SProcShmQueryVersion(client);
if (!client->local)
return BadRequest;

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>
@ -164,7 +166,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 +195,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,

View file

@ -49,35 +49,35 @@ PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <string.h>
#include <stdio.h>
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/Xmd.h>
#include <X11/extensions/syncproto.h>
#include "dix/dix_priv.h"
#include "os/osdep.h"
#include "scrnintstr.h"
#include "os.h"
#include "extnsionst.h"
#include "dixstruct.h"
#include "pixmapstr.h"
#include "resource.h"
#include "opaque.h"
#include <X11/extensions/syncproto.h>
#include "syncsrv.h"
#include "syncsdk.h"
#include "protocol-versions.h"
#include "inputstr.h"
#include "misync_priv.h"
#include <stdio.h>
#if !defined(WIN32)
#include <sys/time.h>
#endif
#include "extinit_priv.h"
#include "extinit.h"
/*
* Local Global Variables
@ -696,7 +696,7 @@ SyncAwaitTriggerFired(SyncTrigger * pTrigger)
/* unblock the client */
AttendClient(pAwaitUnion->header.client);
/* delete the await */
FreeResource(pAwaitUnion->header.delete_id, X11_RESTYPE_NONE);
FreeResource(pAwaitUnion->header.delete_id, RT_NONE);
}
static int64_t
@ -751,7 +751,7 @@ SyncEventSelectForAlarm(SyncAlarm * pAlarm, ClientPtr client, Bool wantevents)
* nothing, since it's already got them.
*/
if (!wantevents) {
FreeResource(pClients->delete_id, X11_RESTYPE_NONE);
FreeResource(pClients->delete_id, RT_NONE);
}
return Success;
}
@ -946,7 +946,7 @@ SyncCreateFenceFromFD(ClientPtr client, DrawablePtr pDraw, XID id, int fd, BOOL
status = miSyncInitFenceFromFD(pDraw, pFence, fd, initially_triggered);
if (status != Success) {
FreeResource(pFence->sync.id, X11_RESTYPE_NONE);
FreeResource(pFence->sync.id, RT_NONE);
return status;
}
@ -1004,8 +1004,8 @@ SyncCreateSystemCounter(const char *name,
psci = malloc(sizeof(SysCounterInfo));
if (!psci) {
FreeResource(pCounter->sync.id, X11_RESTYPE_NONE);
return NULL;
FreeResource(pCounter->sync.id, RT_NONE);
return pCounter;
}
pCounter->pSysCounterInfo = psci;
psci->pCounter = pCounter;
@ -1027,7 +1027,7 @@ SyncDestroySystemCounter(void *pSysCounter)
{
SyncCounter *pCounter = (SyncCounter *) pSysCounter;
FreeResource(pCounter->sync.id, X11_RESTYPE_NONE);
FreeResource(pCounter->sync.id, RT_NONE);
}
static void
@ -1140,7 +1140,7 @@ FreeAlarm(void *addr, XID id)
/* delete event selections */
while (pAlarm->pEventClients)
FreeResource(pAlarm->pEventClients->delete_id, X11_RESTYPE_NONE);
FreeResource(pAlarm->pEventClients->delete_id, RT_NONE);
SyncDeleteTriggerFromSyncObject(&pAlarm->trigger);
@ -1505,7 +1505,7 @@ ProcSyncDestroyCounter(ClientPtr client)
client->errorValue = stuff->counter;
return BadAccess;
}
FreeResource(pCounter->sync.id, X11_RESTYPE_NONE);
FreeResource(pCounter->sync.id, RT_NONE);
return Success;
}
@ -1606,7 +1606,7 @@ ProcSyncAwait(ClientPtr client)
/* this should take care of removing any triggers created by
* this request that have already been registered on sync objects
*/
FreeResource(pAwaitUnion->header.delete_id, X11_RESTYPE_NONE);
FreeResource(pAwaitUnion->header.delete_id, RT_NONE);
client->errorValue = pProtocolWaitConds->counter;
return SyncErrorBase + XSyncBadCounter;
}
@ -1626,7 +1626,7 @@ ProcSyncAwait(ClientPtr client)
/* this should take care of removing any triggers created by
* this request that have already been registered on sync objects
*/
FreeResource(pAwaitUnion->header.delete_id, X11_RESTYPE_NONE);
FreeResource(pAwaitUnion->header.delete_id, RT_NONE);
return status;
}
/* this is not a mistake -- same function works for both cases */
@ -1757,7 +1757,7 @@ ProcSyncCreateAlarm(ClientPtr client)
if (!SyncCheckWarnIsCounter(pTrigger->pSync,
WARN_INVALID_COUNTER_ALARM)) {
FreeResource(stuff->id, X11_RESTYPE_NONE);
FreeResource(stuff->id, RT_NONE);
return BadAlloc;
}
@ -1888,7 +1888,7 @@ ProcSyncDestroyAlarm(ClientPtr client)
if (rc != Success)
return rc;
FreeResource(stuff->alarm, X11_RESTYPE_NONE);
FreeResource(stuff->alarm, RT_NONE);
return Success;
}
@ -1993,7 +1993,7 @@ ProcSyncDestroyFence(ClientPtr client)
if (rc != Success)
return rc;
FreeResource(stuff->fid, X11_RESTYPE_NONE);
FreeResource(stuff->fid, RT_NONE);
return Success;
}
@ -2071,7 +2071,7 @@ ProcSyncAwaitFence(ClientPtr client)
/* this should take care of removing any triggers created by
* this request that have already been registered on sync objects
*/
FreeResource(pAwaitUnion->header.delete_id, X11_RESTYPE_NONE);
FreeResource(pAwaitUnion->header.delete_id, RT_NONE);
client->errorValue = *pProtocolFences;
return SyncErrorBase + XSyncBadFence;
}
@ -2090,7 +2090,7 @@ ProcSyncAwaitFence(ClientPtr client)
/* this should take care of removing any triggers created by
* this request that have already been registered on sync objects
*/
FreeResource(pAwaitUnion->header.delete_id, X11_RESTYPE_NONE);
FreeResource(pAwaitUnion->header.delete_id, RT_NONE);
return status;
}
/* this is not a mistake -- same function works for both cases */
@ -2165,10 +2165,31 @@ ProcSyncDispatch(ClientPtr client)
* Boring Swapping stuff ...
*/
static int _X_COLD
SProcSyncInitialize(ClientPtr client)
{
REQUEST(xSyncInitializeReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncInitializeReq);
return ProcSyncInitialize(client);
}
static int _X_COLD
SProcSyncListSystemCounters(ClientPtr client)
{
REQUEST(xSyncListSystemCountersReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncListSystemCountersReq);
return ProcSyncListSystemCounters(client);
}
static int _X_COLD
SProcSyncCreateCounter(ClientPtr client)
{
REQUEST(xSyncCreateCounterReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncCreateCounterReq);
swapl(&stuff->cid);
swapl(&stuff->initial_value_lo);
@ -2181,6 +2202,7 @@ static int _X_COLD
SProcSyncSetCounter(ClientPtr client)
{
REQUEST(xSyncSetCounterReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncSetCounterReq);
swapl(&stuff->cid);
swapl(&stuff->value_lo);
@ -2193,6 +2215,7 @@ static int _X_COLD
SProcSyncChangeCounter(ClientPtr client)
{
REQUEST(xSyncChangeCounterReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncChangeCounterReq);
swapl(&stuff->cid);
swapl(&stuff->value_lo);
@ -2205,6 +2228,7 @@ static int _X_COLD
SProcSyncQueryCounter(ClientPtr client)
{
REQUEST(xSyncQueryCounterReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncQueryCounterReq);
swapl(&stuff->counter);
@ -2215,6 +2239,7 @@ static int _X_COLD
SProcSyncDestroyCounter(ClientPtr client)
{
REQUEST(xSyncDestroyCounterReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncDestroyCounterReq);
swapl(&stuff->counter);
@ -2225,6 +2250,7 @@ static int _X_COLD
SProcSyncAwait(ClientPtr client)
{
REQUEST(xSyncAwaitReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xSyncAwaitReq);
SwapRestL(stuff);
@ -2235,6 +2261,7 @@ static int _X_COLD
SProcSyncCreateAlarm(ClientPtr client)
{
REQUEST(xSyncCreateAlarmReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xSyncCreateAlarmReq);
swapl(&stuff->id);
swapl(&stuff->valueMask);
@ -2247,6 +2274,7 @@ static int _X_COLD
SProcSyncChangeAlarm(ClientPtr client)
{
REQUEST(xSyncChangeAlarmReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xSyncChangeAlarmReq);
swapl(&stuff->alarm);
swapl(&stuff->valueMask);
@ -2258,6 +2286,7 @@ static int _X_COLD
SProcSyncQueryAlarm(ClientPtr client)
{
REQUEST(xSyncQueryAlarmReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncQueryAlarmReq);
swapl(&stuff->alarm);
@ -2268,6 +2297,7 @@ static int _X_COLD
SProcSyncDestroyAlarm(ClientPtr client)
{
REQUEST(xSyncDestroyAlarmReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncDestroyAlarmReq);
swapl(&stuff->alarm);
@ -2278,6 +2308,7 @@ static int _X_COLD
SProcSyncSetPriority(ClientPtr client)
{
REQUEST(xSyncSetPriorityReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncSetPriorityReq);
swapl(&stuff->id);
swapl(&stuff->priority);
@ -2289,6 +2320,7 @@ static int _X_COLD
SProcSyncGetPriority(ClientPtr client)
{
REQUEST(xSyncGetPriorityReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncGetPriorityReq);
swapl(&stuff->id);
@ -2299,6 +2331,7 @@ static int _X_COLD
SProcSyncCreateFence(ClientPtr client)
{
REQUEST(xSyncCreateFenceReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncCreateFenceReq);
swapl(&stuff->d);
swapl(&stuff->fid);
@ -2310,6 +2343,7 @@ static int _X_COLD
SProcSyncTriggerFence(ClientPtr client)
{
REQUEST(xSyncTriggerFenceReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncTriggerFenceReq);
swapl(&stuff->fid);
@ -2320,6 +2354,7 @@ static int _X_COLD
SProcSyncResetFence(ClientPtr client)
{
REQUEST(xSyncResetFenceReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncResetFenceReq);
swapl(&stuff->fid);
@ -2330,6 +2365,7 @@ static int _X_COLD
SProcSyncDestroyFence(ClientPtr client)
{
REQUEST(xSyncDestroyFenceReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncDestroyFenceReq);
swapl(&stuff->fid);
@ -2340,6 +2376,7 @@ static int _X_COLD
SProcSyncQueryFence(ClientPtr client)
{
REQUEST(xSyncQueryFenceReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSyncQueryFenceReq);
swapl(&stuff->fid);
@ -2350,6 +2387,7 @@ static int _X_COLD
SProcSyncAwaitFence(ClientPtr client)
{
REQUEST(xSyncAwaitFenceReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xSyncAwaitFenceReq);
SwapRestL(stuff);
@ -2363,9 +2401,9 @@ SProcSyncDispatch(ClientPtr client)
switch (stuff->data) {
case X_SyncInitialize:
return ProcSyncInitialize(client);
return SProcSyncInitialize(client);
case X_SyncListSystemCounters:
return ProcSyncListSystemCounters(client);
return SProcSyncListSystemCounters(client);
case X_SyncCreateCounter:
return SProcSyncCreateCounter(client);
case X_SyncSetCounter:
@ -2620,11 +2658,9 @@ IdleTimeQueryValue(void *pCounter, int64_t *pValue_return)
int deviceid;
CARD32 idle;
*pValue_return = 0;
if (pCounter) {
SyncCounter *counter = pCounter;
IdleCounterPriv *priv = SysCounterGetPrivate(counter);
BUG_RETURN(priv == NULL);
deviceid = priv->deviceid;
}
else
@ -2638,7 +2674,6 @@ IdleTimeBlockHandler(void *pCounter, void *wt)
{
SyncCounter *counter = pCounter;
IdleCounterPriv *priv = SysCounterGetPrivate(counter);
BUG_RETURN(priv == NULL);
int64_t *less = priv->value_less;
int64_t *greater = priv->value_greater;
int64_t idle, old_idle;
@ -2729,7 +2764,6 @@ IdleTimeWakeupHandler(void *pCounter, int rc)
{
SyncCounter *counter = pCounter;
IdleCounterPriv *priv = SysCounterGetPrivate(counter);
BUG_RETURN(priv == NULL);
int64_t *less = priv->value_less;
int64_t *greater = priv->value_greater;
int64_t idle;
@ -2763,7 +2797,6 @@ IdleTimeBracketValues(void *pCounter, int64_t *pbracket_less,
{
SyncCounter *counter = pCounter;
IdleCounterPriv *priv = SysCounterGetPrivate(counter);
BUG_RETURN(priv == NULL);
int64_t *less = priv->value_less;
int64_t *greater = priv->value_greater;
Bool registered = (less || greater);
@ -2801,10 +2834,8 @@ init_system_idle_counter(const char *name, int deviceid)
if (idle_time_counter != NULL) {
IdleCounterPriv *priv = malloc(sizeof(IdleCounterPriv));
if (priv) {
priv->value_less = priv->value_greater = NULL;
priv->deviceid = deviceid;
}
priv->value_less = priv->value_greater = NULL;
priv->deviceid = deviceid;
idle_time_counter->pSysCounterInfo->private = priv;
}

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
@ -469,7 +471,7 @@ ProcVidModeAddModeLine(ClientPtr client)
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;
@ -639,7 +641,7 @@ ProcVidModeDeleteModeLine(ClientPtr client)
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;
@ -668,7 +670,7 @@ ProcVidModeDeleteModeLine(ClientPtr client)
"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;
}
@ -763,7 +765,7 @@ ProcVidModeModModeLine(ClientPtr client)
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;
@ -806,8 +808,6 @@ ProcVidModeModModeLine(ClientPtr client)
return BadValue;
modetmp = VidModeCreateMode();
if (modetmp == NULL)
return BadAlloc;
VidModeCopyMode(mode, modetmp);
VidModeSetModeValue(modetmp, VIDMODE_H_DISPLAY, stuff->hdisplay);
@ -899,7 +899,7 @@ ProcVidModeValidateModeLine(ClientPtr client)
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;
@ -951,8 +951,6 @@ ProcVidModeValidateModeLine(ClientPtr client)
return BadValue;
modetmp = VidModeCreateMode();
if (modetmp == NULL)
return BadAlloc;
VidModeCopyMode(mode, modetmp);
VidModeSetModeValue(modetmp, VIDMODE_H_DISPLAY, stuff->hdisplay);
@ -1054,7 +1052,7 @@ ProcVidModeSwitchToMode(ClientPtr client)
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;
@ -1705,10 +1703,19 @@ ProcVidModeDispatch(ClientPtr client)
}
}
static int _X_COLD
SProcVidModeQueryVersion(ClientPtr client)
{
REQUEST(xXF86VidModeQueryVersionReq);
swaps(&stuff->length);
return ProcVidModeQueryVersion(client);
}
static int _X_COLD
SProcVidModeGetModeLine(ClientPtr client)
{
REQUEST(xXF86VidModeGetModeLineReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetModeLineReq);
swaps(&stuff->screen);
return ProcVidModeGetModeLine(client);
@ -1718,6 +1725,7 @@ static int _X_COLD
SProcVidModeGetAllModeLines(ClientPtr client)
{
REQUEST(xXF86VidModeGetAllModeLinesReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetAllModeLinesReq);
swaps(&stuff->screen);
return ProcVidModeGetAllModeLines(client);
@ -1733,6 +1741,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 +1757,7 @@ SProcVidModeAddModeLine(ClientPtr client)
SwapRestL(oldstuff);
}
else {
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xXF86VidModeAddModeLineReq);
swapl(&stuff->screen);
swaps(&stuff->hdisplay);
@ -1776,6 +1786,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 +1802,7 @@ SProcVidModeDeleteModeLine(ClientPtr client)
SwapRestL(oldstuff);
}
else {
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xXF86VidModeDeleteModeLineReq);
swapl(&stuff->screen);
swaps(&stuff->hdisplay);
@ -1819,6 +1831,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 +1847,7 @@ SProcVidModeModModeLine(ClientPtr client)
SwapRestL(oldstuff);
}
else {
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xXF86VidModeModModeLineReq);
swapl(&stuff->screen);
swaps(&stuff->hdisplay);
@ -1862,6 +1876,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 +1892,7 @@ SProcVidModeValidateModeLine(ClientPtr client)
SwapRestL(oldstuff);
}
else {
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xXF86VidModeValidateModeLineReq);
swapl(&stuff->screen);
swaps(&stuff->hdisplay);
@ -1899,6 +1915,7 @@ static int _X_COLD
SProcVidModeSwitchMode(ClientPtr client)
{
REQUEST(xXF86VidModeSwitchModeReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeSwitchModeReq);
swaps(&stuff->screen);
swaps(&stuff->zoom);
@ -1909,6 +1926,7 @@ static int _X_COLD
SProcVidModeSwitchToMode(ClientPtr client)
{
REQUEST(xXF86VidModeSwitchToModeReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeSwitchToModeReq);
swapl(&stuff->screen);
return ProcVidModeSwitchToMode(client);
@ -1918,6 +1936,7 @@ static int _X_COLD
SProcVidModeLockModeSwitch(ClientPtr client)
{
REQUEST(xXF86VidModeLockModeSwitchReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeLockModeSwitchReq);
swaps(&stuff->screen);
swaps(&stuff->lock);
@ -1928,6 +1947,7 @@ static int _X_COLD
SProcVidModeGetMonitor(ClientPtr client)
{
REQUEST(xXF86VidModeGetMonitorReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetMonitorReq);
swaps(&stuff->screen);
return ProcVidModeGetMonitor(client);
@ -1937,6 +1957,7 @@ static int _X_COLD
SProcVidModeGetViewPort(ClientPtr client)
{
REQUEST(xXF86VidModeGetViewPortReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetViewPortReq);
swaps(&stuff->screen);
return ProcVidModeGetViewPort(client);
@ -1946,6 +1967,7 @@ static int _X_COLD
SProcVidModeSetViewPort(ClientPtr client)
{
REQUEST(xXF86VidModeSetViewPortReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeSetViewPortReq);
swaps(&stuff->screen);
swapl(&stuff->x);
@ -1957,6 +1979,7 @@ static int _X_COLD
SProcVidModeGetDotClocks(ClientPtr client)
{
REQUEST(xXF86VidModeGetDotClocksReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetDotClocksReq);
swaps(&stuff->screen);
return ProcVidModeGetDotClocks(client);
@ -1966,6 +1989,7 @@ static int _X_COLD
SProcVidModeSetClientVersion(ClientPtr client)
{
REQUEST(xXF86VidModeSetClientVersionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeSetClientVersionReq);
swaps(&stuff->major);
swaps(&stuff->minor);
@ -1976,6 +2000,7 @@ static int _X_COLD
SProcVidModeSetGamma(ClientPtr client)
{
REQUEST(xXF86VidModeSetGammaReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeSetGammaReq);
swaps(&stuff->screen);
swapl(&stuff->red);
@ -1988,6 +2013,7 @@ static int _X_COLD
SProcVidModeGetGamma(ClientPtr client)
{
REQUEST(xXF86VidModeGetGammaReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetGammaReq);
swaps(&stuff->screen);
return ProcVidModeGetGamma(client);
@ -1999,6 +2025,7 @@ SProcVidModeSetGammaRamp(ClientPtr client)
int length;
REQUEST(xXF86VidModeSetGammaRampReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xXF86VidModeSetGammaRampReq);
swaps(&stuff->size);
swaps(&stuff->screen);
@ -2012,6 +2039,7 @@ static int _X_COLD
SProcVidModeGetGammaRamp(ClientPtr client)
{
REQUEST(xXF86VidModeGetGammaRampReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampReq);
swaps(&stuff->size);
swaps(&stuff->screen);
@ -2022,6 +2050,7 @@ static int _X_COLD
SProcVidModeGetGammaRampSize(ClientPtr client)
{
REQUEST(xXF86VidModeGetGammaRampSizeReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampSizeReq);
swaps(&stuff->screen);
return ProcVidModeGetGammaRampSize(client);
@ -2031,6 +2060,7 @@ static int _X_COLD
SProcVidModeGetPermissions(ClientPtr client)
{
REQUEST(xXF86VidModeGetPermissionsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetPermissionsReq);
swaps(&stuff->screen);
return ProcVidModeGetPermissions(client);
@ -2042,7 +2072,7 @@ 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"
@ -34,8 +33,9 @@ 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"
@ -55,47 +54,31 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define XACE_KEY_AVAIL 14
#define XACE_NUM_HOOKS 15
extern CallbackListPtr XaceHooks[XACE_NUM_HOOKS];
extern _X_EXPORT CallbackListPtr XaceHooks[XACE_NUM_HOOKS];
/* Entry point for hook functions. Called by Xserver.
* Required by libdbe and libextmod
*/
/* needs to be exported for in-tree modsetting driver, but not part
of public API for external modules */
_X_EXPORT int XaceHook(int hook, ... /* appropriate args for hook */);
extern _X_EXPORT int XaceHook(int /*hook */ ,
... /*appropriate args for hook */
);
/* determine whether any callbacks are present for the XACE hook */
int XaceHookIsSet(int hook);
extern _X_EXPORT int XaceHookIsSet(int hook);
/* Special-cased hook functions
*/
int XaceHookDispatch0(ClientPtr ptr, 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)
int XaceHookPropertyAccess(ClientPtr ptr, WindowPtr pWin, PropertyPtr *ppProp,
Mask access_mode);
int XaceHookSelectionAccess(ClientPtr ptr, Selection ** ppSel, Mask access_mode);
/* needs to be exported for in-tree modsetting, but not part of public API */
_X_EXPORT int XaceHookResourceAccess(ClientPtr client, XID id, RESTYPE rtype, void *res,
RESTYPE ptype, void *parent, Mask access_mode);
int XaceHookDeviceAccess(ClientPtr client, DeviceIntPtr dev, Mask access_mode);
int XaceHookSendAccess(ClientPtr client, DeviceIntPtr dev, WindowPtr win,
xEventPtr ev, int count);
int XaceHookReceiveAccess(ClientPtr client, WindowPtr win, xEventPtr ev, int count);
int XaceHookClientAccess(ClientPtr client, ClientPtr target, Mask access_mode);
int XaceHookExtAccess(ClientPtr client, ExtensionEntry *ext);
int XaceHookServerAccess(ClientPtr client, Mask access_mode);
int XaceHookScreenAccess(ClientPtr client, ScreenPtr screen, Mask access_mode);
int XaceHookScreensaverAccess(ClientPtr client, ScreenPtr screen, Mask access_mode);
int XaceHookAuthAvail(ClientPtr client, XID authId);
int XaceHookKeyAvail(xEventPtr ev, DeviceIntPtr dev, int count);
extern _X_EXPORT int XaceHookPropertyAccess(ClientPtr ptr, WindowPtr pWin,
PropertyPtr *ppProp,
Mask access_mode);
extern _X_EXPORT int XaceHookSelectionAccess(ClientPtr ptr, Selection ** ppSel,
Mask access_mode);
/* Register a callback for a given hook.
*/
@ -109,18 +92,18 @@ int XaceHookKeyAvail(xEventPtr ev, DeviceIntPtr dev, int count);
/* XTrans wrappers for use by security modules
*/
int XaceGetConnectionNumber(ClientPtr ptr);
int XaceIsLocal(ClientPtr ptr);
extern _X_EXPORT int XaceGetConnectionNumber(ClientPtr ptr);
extern _X_EXPORT int XaceIsLocal(ClientPtr ptr);
/* From the original Security extension...
*/
void XaceCensorImage(ClientPtr client,
RegionPtr pVisibleRegion,
long widthBytesLine,
DrawablePtr pDraw,
int x, int y, int w, int h,
unsigned int format, char *pBuf);
extern _X_EXPORT void XaceCensorImage(ClientPtr client,
RegionPtr pVisibleRegion,
long widthBytesLine,
DrawablePtr pDraw,
int x, int y, int w, int h,
unsigned int format, char *pBuf);
#else /* XACE */
@ -130,38 +113,18 @@ 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>
@ -144,18 +146,30 @@ static int _X_COLD
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
SProcXCMiscGetXIDRange(ClientPtr client)
{
REQUEST(xReq);
swaps(&stuff->length);
return ProcXCMiscGetXIDRange(client);
}
static int _X_COLD
SProcXCMiscGetXIDList(ClientPtr client)
{
REQUEST(xXCMiscGetXIDListReq);
REQUEST_SIZE_MATCH(xXCMiscGetXIDListReq);
swaps(&stuff->length);
swapl(&stuff->count);
return ProcXCMiscGetXIDList(client);
}
@ -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,7 +34,9 @@
* XLoadQueryFont).
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <sys/types.h>
#ifdef MITSHM
@ -56,22 +58,20 @@
#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
@ -339,7 +339,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 +353,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 */
@ -651,7 +653,9 @@ ProcXF86BigfontDispatch(ClientPtr client)
static int _X_COLD
SProcXF86BigfontQueryVersion(ClientPtr client)
{
/* REQUEST(xXF86BigfontQueryVersionReq); */
REQUEST(xXF86BigfontQueryVersionReq);
swaps(&stuff->length);
return ProcXF86BigfontQueryVersion(client);
}
@ -659,6 +663,8 @@ static int _X_COLD
SProcXF86BigfontQueryFont(ClientPtr client)
{
REQUEST(xXF86BigfontQueryFontReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86BigfontQueryFontReq);
swapl(&stuff->id);
return ProcXF86BigfontQueryFont(client);

View file

@ -2,28 +2,30 @@
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 <assert.h>
#include "dix/registry_priv.h"
#include "os/client_priv.h"
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "extnsionst.h"
#include "swaprep.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>
@ -224,8 +226,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++) {
@ -1080,6 +1080,7 @@ static int _X_COLD
SProcResDispatch (ClientPtr client)
{
REQUEST(xReq);
swaps(&stuff->length);
switch (stuff->data) {
case X_XResQueryVersion:

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)
@ -69,6 +69,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,6 +86,7 @@ ProcSELinuxQueryVersion(ClientPtr client)
static int
SELinuxSendContextReply(ClientPtr client, security_id_t sid)
{
SELinuxGetContextReply rep;
char *ctx = NULL;
int len = 0;
@ -94,7 +96,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),
@ -341,9 +343,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 +377,7 @@ SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec * items,
}
/* Send reply to client */
SELinuxListItemsReply rep = {
rep = (SELinuxListItemsReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = size,
@ -449,10 +455,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 */
@ -620,6 +624,8 @@ SProcSELinuxDispatch(ClientPtr client)
{
REQUEST(xReq);
swaps(&stuff->length);
switch (stuff->data) {
case X_SELinuxQueryVersion:
return SProcSELinuxQueryVersion(client);

View file

@ -22,7 +22,9 @@ 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>
@ -30,10 +32,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#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"
@ -42,6 +42,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"
@ -200,7 +201,7 @@ SELinuxLabelInitial(void)
/* Do the default colormap */
dixLookupResourceByType(&unused, screenInfo.screens[i]->defColormap,
X11_RESTYPE_COLORMAP, serverClient, DixCreateAccess);
RT_COLORMAP, serverClient, DixCreateAccess);
}
}
@ -663,7 +664,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 +766,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;

View file

@ -17,7 +17,9 @@ 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>
@ -137,12 +139,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) {
@ -325,13 +323,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 */

View file

@ -26,23 +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/mi_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"
@ -52,14 +42,20 @@
#include "scrnintstr.h"
#include "dixevents.h"
#include "sleepuntil.h"
#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"
#include "extinit.h"
/* XTest events are sent during request processing and may be interrupted by
* a SIGIO. We need a separate event list to avoid events overwriting each
@ -79,10 +75,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 +129,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;
@ -198,7 +194,7 @@ ProcXTestFakeInput(ClientPtr client)
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 +346,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 +370,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--;
@ -491,6 +484,8 @@ static int _X_COLD
SProcXTestGetVersion(ClientPtr client)
{
REQUEST(xXTestGetVersionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXTestGetVersionReq);
swaps(&stuff->minorVersion);
return ProcXTestGetVersion(client);
@ -500,6 +495,8 @@ static int _X_COLD
SProcXTestCompareCursor(ClientPtr client)
{
REQUEST(xXTestCompareCursorReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXTestCompareCursorReq);
swapl(&stuff->window);
swapl(&stuff->cursor);
@ -514,7 +511,7 @@ 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 */
@ -537,12 +534,23 @@ SProcXTestFakeInput(ClientPtr client)
REQUEST(xReq);
swaps(&stuff->length);
n = XTestSwapFakeInput(client, stuff);
if (n != Success)
return n;
return ProcXTestFakeInput(client);
}
static int _X_COLD
SProcXTestGrabControl(ClientPtr client)
{
REQUEST(xXTestGrabControlReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXTestGrabControlReq);
return ProcXTestGrabControl(client);
}
static int _X_COLD
SProcXTestDispatch(ClientPtr client)
{
@ -555,7 +563,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,11 +1115,21 @@ ProcXvDispatch(ClientPtr client)
/* Swapped Procs */
static int _X_COLD
SProcXvQueryExtension(ClientPtr client)
{
REQUEST(xvQueryExtensionReq);
REQUEST_SIZE_MATCH(xvQueryExtensionReq);
swaps(&stuff->length);
return XvProcVector[xv_QueryExtension] (client);
}
static int _X_COLD
SProcXvQueryAdaptors(ClientPtr client)
{
REQUEST(xvQueryAdaptorsReq);
REQUEST_SIZE_MATCH(xvQueryAdaptorsReq);
swaps(&stuff->length);
swapl(&stuff->window);
return XvProcVector[xv_QueryAdaptors] (client);
}
@ -1129,6 +1139,7 @@ SProcXvQueryEncodings(ClientPtr client)
{
REQUEST(xvQueryEncodingsReq);
REQUEST_SIZE_MATCH(xvQueryEncodingsReq);
swaps(&stuff->length);
swapl(&stuff->port);
return XvProcVector[xv_QueryEncodings] (client);
}
@ -1138,6 +1149,7 @@ SProcXvGrabPort(ClientPtr client)
{
REQUEST(xvGrabPortReq);
REQUEST_SIZE_MATCH(xvGrabPortReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->time);
return XvProcVector[xv_GrabPort] (client);
@ -1148,6 +1160,7 @@ SProcXvUngrabPort(ClientPtr client)
{
REQUEST(xvUngrabPortReq);
REQUEST_SIZE_MATCH(xvUngrabPortReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->time);
return XvProcVector[xv_UngrabPort] (client);
@ -1158,6 +1171,7 @@ SProcXvPutVideo(ClientPtr client)
{
REQUEST(xvPutVideoReq);
REQUEST_SIZE_MATCH(xvPutVideoReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->drawable);
swapl(&stuff->gc);
@ -1177,6 +1191,7 @@ SProcXvPutStill(ClientPtr client)
{
REQUEST(xvPutStillReq);
REQUEST_SIZE_MATCH(xvPutStillReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->drawable);
swapl(&stuff->gc);
@ -1196,6 +1211,7 @@ SProcXvGetVideo(ClientPtr client)
{
REQUEST(xvGetVideoReq);
REQUEST_SIZE_MATCH(xvGetVideoReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->drawable);
swapl(&stuff->gc);
@ -1215,6 +1231,7 @@ SProcXvGetStill(ClientPtr client)
{
REQUEST(xvGetStillReq);
REQUEST_SIZE_MATCH(xvGetStillReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->drawable);
swapl(&stuff->gc);
@ -1234,6 +1251,7 @@ SProcXvPutImage(ClientPtr client)
{
REQUEST(xvPutImageReq);
REQUEST_AT_LEAST_SIZE(xvPutImageReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->drawable);
swapl(&stuff->gc);
@ -1257,6 +1275,7 @@ SProcXvShmPutImage(ClientPtr client)
{
REQUEST(xvShmPutImageReq);
REQUEST_SIZE_MATCH(xvShmPutImageReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->drawable);
swapl(&stuff->gc);
@ -1284,6 +1303,7 @@ SProcXvSelectVideoNotify(ClientPtr client)
{
REQUEST(xvSelectVideoNotifyReq);
REQUEST_SIZE_MATCH(xvSelectVideoNotifyReq);
swaps(&stuff->length);
swapl(&stuff->drawable);
return XvProcVector[xv_SelectVideoNotify] (client);
}
@ -1293,6 +1313,7 @@ SProcXvSelectPortNotify(ClientPtr client)
{
REQUEST(xvSelectPortNotifyReq);
REQUEST_SIZE_MATCH(xvSelectPortNotifyReq);
swaps(&stuff->length);
swapl(&stuff->port);
return XvProcVector[xv_SelectPortNotify] (client);
}
@ -1302,6 +1323,7 @@ SProcXvStopVideo(ClientPtr client)
{
REQUEST(xvStopVideoReq);
REQUEST_SIZE_MATCH(xvStopVideoReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->drawable);
return XvProcVector[xv_StopVideo] (client);
@ -1312,6 +1334,7 @@ SProcXvSetPortAttribute(ClientPtr client)
{
REQUEST(xvSetPortAttributeReq);
REQUEST_SIZE_MATCH(xvSetPortAttributeReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->attribute);
swapl(&stuff->value);
@ -1323,6 +1346,7 @@ SProcXvGetPortAttribute(ClientPtr client)
{
REQUEST(xvGetPortAttributeReq);
REQUEST_SIZE_MATCH(xvGetPortAttributeReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->attribute);
return XvProcVector[xv_GetPortAttribute] (client);
@ -1333,6 +1357,7 @@ SProcXvQueryBestSize(ClientPtr client)
{
REQUEST(xvQueryBestSizeReq);
REQUEST_SIZE_MATCH(xvQueryBestSizeReq);
swaps(&stuff->length);
swapl(&stuff->port);
swaps(&stuff->vid_w);
swaps(&stuff->vid_h);
@ -1346,6 +1371,7 @@ SProcXvQueryPortAttributes(ClientPtr client)
{
REQUEST(xvQueryPortAttributesReq);
REQUEST_SIZE_MATCH(xvQueryPortAttributesReq);
swaps(&stuff->length);
swapl(&stuff->port);
return XvProcVector[xv_QueryPortAttributes] (client);
}
@ -1355,6 +1381,7 @@ SProcXvQueryImageAttributes(ClientPtr client)
{
REQUEST(xvQueryImageAttributesReq);
REQUEST_SIZE_MATCH(xvQueryImageAttributesReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->id);
swaps(&stuff->width);
@ -1367,12 +1394,13 @@ 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,
@ -1405,7 +1433,7 @@ SProcXvDispatch(ClientPtr client)
return SXvProcVector[stuff->data] (client);
}
#ifdef XINERAMA
#ifdef PANORAMIX
static int
XineramaXvStopVideo(ClientPtr client)
{
@ -1513,7 +1541,7 @@ XineramaXvShmPutImage(ClientPtr client)
}
#else
#define XineramaXvShmPutImage ProcXvShmPutImage
#endif /* MITSHM */
#endif
static int
XineramaXvPutImage(ClientPtr client)
@ -1768,17 +1796,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;
@ -481,7 +469,7 @@ XvdiSendVideoNotify(XvPortPtr pPort, DrawablePtr pDraw, int reason)
}
static int
int
XvdiSendPortNotify(XvPortPtr pPort, Atom attribute, INT32 value)
{
XvPortNotifyPtr pn;

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

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

View file

@ -50,16 +50,16 @@ 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"
#include "dixevents.h"
@ -73,6 +73,7 @@ int _X_COLD
SProcXAllowDeviceEvents(ClientPtr client)
{
REQUEST(xAllowDeviceEventsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xAllowDeviceEventsReq);
swapl(&stuff->time);
return (ProcXAllowDeviceEvents(client));
@ -101,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"
/***********************************************************************
@ -76,6 +77,7 @@ 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;

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>
@ -73,6 +75,7 @@ int _X_COLD
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;

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 _X_COLD
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"
@ -75,6 +75,7 @@ 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"
@ -75,6 +75,7 @@ int _X_COLD
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 _X_COLD
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 _X_COLD
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,7 +102,7 @@ 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);
}
}

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 _X_COLD
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,38 @@ 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 <X11/extensions/geproto.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 "mi/mi_priv.h"
#include "inputstr.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 "eventstr.h"
#include "inpututils.h"
#include "mi.h"
#include <X11/extensions/XKBproto.h>
#include "xkbsrv.h"
#define WID(w) ((w) ? ((w)->drawable.id) : 0)
@ -614,7 +615,7 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
if (from->button->xkb_acts) {
size_t maxbuttons = max(to->button->numButtons, from->button->numButtons);
to->button->xkb_acts = XNFreallocarray(to->button->xkb_acts,
to->button->xkb_acts = xnfreallocarray(to->button->xkb_acts,
maxbuttons,
sizeof(XkbAction));
memset(to->button->xkb_acts, 0, maxbuttons * sizeof(XkbAction));
@ -1093,7 +1094,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);
@ -1386,7 +1387,6 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
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 +1401,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)
@ -1539,7 +1538,7 @@ 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;
@ -1881,7 +1880,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);
}
}
@ -2241,7 +2240,7 @@ DeliverOneGestureEvent(ClientPtr client, DeviceIntPtr dev, GestureInfoPtr gi,
FixUpEventFromWindow(&gi->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);
@ -2291,7 +2290,6 @@ RetrieveGestureDeliveryData(DeviceIntPtr dev, InternalEvent *ev, GestureListener
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;
@ -2506,7 +2504,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 +2514,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 +2570,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 +2603,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 +2613,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;
@ -2646,7 +2644,7 @@ 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;
@ -2693,7 +2691,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;
}
}
@ -2959,7 +2957,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 +3118,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);
}
}
@ -3236,19 +3234,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 +3335,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

@ -51,22 +51,22 @@ SOFTWARE.
*/
#define NUMTYPES 15
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#include <X11/extensions/XI.h>
#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"
#endif
#include "inputstr.h"
#include "gcstruct.h" /* pointer for extnsionst.h */
#include "extnsionst.h" /* extension entry */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include <X11/extensions/XI2proto.h>
#include <X11/extensions/geproto.h>
#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"
@ -252,19 +252,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 */
@ -272,30 +272,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 */

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 _X_COLD
SProcXGetDeviceButtonMapping(ClientPtr client)
{
REQUEST(xGetDeviceButtonMappingReq);
swaps(&stuff->length);
return (ProcXGetDeviceButtonMapping(client));
}
/***********************************************************************
*
* This procedure gets the button mapping for the specified device.

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>
@ -70,6 +72,7 @@ int _X_COLD
SProcXGetDeviceControl(ClientPtr client)
{
REQUEST(xGetDeviceControlReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xGetDeviceControlReq);
swaps(&stuff->control);
return (ProcXGetDeviceControl(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 "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 _X_COLD
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];

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 _X_COLD
SProcXGetDeviceFocus(ClientPtr client)
{
REQUEST(xGetDeviceFocusReq);
swaps(&stuff->length);
return (ProcXGetDeviceFocus(client));
}
/***********************************************************************
*
* This procedure gets the focus for a device.

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 _X_COLD
SProcXGetDeviceKeyMapping(ClientPtr client)
{
REQUEST(xGetDeviceKeyMappingReq);
swaps(&stuff->length);
return (ProcXGetDeviceKeyMapping(client));
}
/***********************************************************************
*
* Get the device key mapping.

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 _X_COLD
SProcXGetDeviceModifierMapping(ClientPtr client)
{
REQUEST(xGetDeviceModifierMappingReq);
swaps(&stuff->length);
return (ProcXGetDeviceModifierMapping(client));
}
/***********************************************************************
*
* Get the device Modifier mapping.

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[];
@ -76,6 +76,7 @@ int _X_COLD
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;

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"
@ -74,6 +74,7 @@ int _X_COLD
SProcXGetSelectedExtensionEvents(ClientPtr client)
{
REQUEST(xGetSelectedExtensionEventsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xGetSelectedExtensionEventsReq);
swapl(&stuff->window);
return (ProcXGetSelectedExtensionEvents(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>
@ -72,6 +74,7 @@ int _X_COLD
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;

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 structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exglobals.h"
#include "dixevents.h" /* GrabDevice */
#include "grabdev.h"
extern XExtEventInfo EventInfo[];
@ -76,13 +76,13 @@ int _X_COLD
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;
@ -109,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;

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"
@ -74,6 +75,7 @@ int _X_COLD
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"
@ -74,6 +75,7 @@ int _X_COLD
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"
/***********************************************************************
@ -71,6 +72,7 @@ int _X_COLD
SProcXGetDeviceMotionEvents(ClientPtr client)
{
REQUEST(xGetDeviceMotionEventsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xGetDeviceMotionEventsReq);
swapl(&stuff->start);
swapl(&stuff->stop);

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 _X_COLD
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;
@ -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;

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

@ -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 _X_COLD
SProcXOpenDevice(ClientPtr client)
{
REQUEST(xOpenDeviceReq);
swaps(&stuff->length);
return (ProcXOpenDevice(client));
}
/***********************************************************************
*
* This procedure causes the server to open an input device.

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 _X_COLD
SProcXQueryDeviceState(ClientPtr client)
{
REQUEST(xQueryDeviceStateReq);
swaps(&stuff->length);
return (ProcXQueryDeviceState(client));
}
/***********************************************************************
*
* This procedure allows frozen events to be routed.

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,18 +50,18 @@ 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"
@ -121,6 +121,7 @@ int _X_COLD
SProcXSelectExtensionEvent(ClientPtr client)
{
REQUEST(xSelectExtensionEventReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xSelectExtensionEventReq);
swapl(&stuff->window);
swaps(&stuff->count);
@ -147,7 +148,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;

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"
@ -82,11 +83,12 @@ SProcXSendExtensionEvent(ClientPtr client)
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;
@ -132,7 +134,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;

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

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

View file

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

View file

@ -50,18 +50,19 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#endif
#include "windowstr.h" /* focus struct */
#include "inputstr.h" /* DeviceIntPtr */
#include "dix/dix_priv.h"
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dixevents.h"
#include "exglobals.h"
#include "setfocus.h"
/***********************************************************************
@ -74,6 +75,7 @@ int _X_COLD
SProcXSetDeviceFocus(ClientPtr client)
{
REQUEST(xSetDeviceFocusReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSetDeviceFocusReq);
swapl(&stuff->focus);
swapl(&stuff->time);

View file

@ -50,19 +50,34 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XI2.h>
#include <X11/extensions/XIproto.h>
#include "dix/input_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "exevents.h"
#include "exglobals.h"
#include "setmmap.h"
/***********************************************************************
*
* This procedure sets the modifier mapping for an extension device,
* for clients on machines with a different byte ordering than the server.
*
*/
int _X_COLD
SProcXSetDeviceModifierMapping(ClientPtr client)
{
REQUEST(xSetDeviceModifierMappingReq);
swaps(&stuff->length);
return (ProcXSetDeviceModifierMapping(client));
}
/***********************************************************************
*
* Set the device Modifier mapping.
@ -79,7 +94,7 @@ ProcXSetDeviceModifierMapping(ClientPtr client)
REQUEST(xSetDeviceModifierMappingReq);
REQUEST_AT_LEAST_SIZE(xSetDeviceModifierMappingReq);
if (client->req_len != bytes_to_int32(sizeof(xSetDeviceModifierMappingReq)) +
if (stuff->length != bytes_to_int32(sizeof(xSetDeviceModifierMappingReq)) +
(stuff->numKeyPerModifier << 1))
return BadLength;

View file

@ -30,6 +30,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef SETMMAP_H
#define SETMMAP_H 1
int SProcXSetDeviceModifierMapping(ClientPtr /* client */
);
int ProcXSetDeviceModifierMapping(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 "setmode.h"
/***********************************************************************
*
* Handle a request from a client with a different byte order.
*
*/
int _X_COLD
SProcXSetDeviceMode(ClientPtr client)
{
REQUEST(xSetDeviceModeReq);
swaps(&stuff->length);
return (ProcXSetDeviceMode(client));
}
/***********************************************************************
*
* This procedure sets the mode of a device.

View file

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

View file

@ -54,7 +54,9 @@ SOFTWARE.
* Xnest could do the same thing.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#include <X11/Xproto.h>

View file

@ -50,7 +50,9 @@ SOFTWARE.
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
@ -69,6 +71,7 @@ int _X_COLD
SProcXUngrabDevice(ClientPtr client)
{
REQUEST(xUngrabDeviceReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xUngrabDeviceReq);
swapl(&stuff->time);
return (ProcXUngrabDevice(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"
#include "dix/dixgrabs_priv.h"
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exglobals.h"
#include "dixgrabs.h"
#include "ungrdevb.h"
#define AllModifiersMask ( \
@ -77,6 +77,7 @@ int _X_COLD
SProcXUngrabDeviceButton(ClientPtr client)
{
REQUEST(xUngrabDeviceButtonReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xUngrabDeviceButtonReq);
swapl(&stuff->grabWindow);
swaps(&stuff->modifiers);

View file

@ -50,19 +50,19 @@ 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/dixgrabs_priv.h"
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exglobals.h"
#include "dixgrabs.h"
#include "xkbsrv.h"
#include "xkbstr.h"
#include "ungrdevk.h"
#define AllModifiersMask ( \
@ -79,6 +79,7 @@ int _X_COLD
SProcXUngrabDeviceKey(ClientPtr client)
{
REQUEST(xUngrabDeviceKeyReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xUngrabDeviceKeyReq);
swapl(&stuff->grabWindow);
swaps(&stuff->modifiers);

View file

@ -29,21 +29,19 @@
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#include <X11/extensions/XI2.h>
#include <X11/extensions/XI2proto.h>
#include "dix/dix_priv.h"
#include "dix/exevents_priv.h"
#include "dix/input_priv.h"
#include "os/fmt.h"
#endif
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include "mi.h"
#include "eventstr.h"
#include <X11/extensions/XI2.h>
#include <X11/extensions/XI2proto.h>
#include "exglobals.h" /* BadDevice */
#include "exevents.h"
#include "xiallowev.h"
int _X_COLD
@ -52,9 +50,10 @@ SProcXIAllowEvents(ClientPtr client)
REQUEST(xXIAllowEventsReq);
REQUEST_AT_LEAST_SIZE(xXIAllowEventsReq);
swaps(&stuff->length);
swaps(&stuff->deviceid);
swapl(&stuff->time);
if (client->req_len > 3) {
if (stuff->length > 3) {
xXI2_2AllowEventsReq *req_xi22 = (xXI2_2AllowEventsReq *) stuff;
REQUEST_AT_LEAST_SIZE(xXI2_2AllowEventsReq);
@ -95,25 +94,25 @@ ProcXIAllowEvents(ClientPtr client)
switch (stuff->mode) {
case XIReplayDevice:
AllowSome(client, time, dev, GRAB_STATE_NOT_GRABBED);
AllowSome(client, time, dev, NOT_GRABBED);
break;
case XISyncDevice:
AllowSome(client, time, dev, GRAB_STATE_FREEZE_NEXT_EVENT);
AllowSome(client, time, dev, FREEZE_NEXT_EVENT);
break;
case XIAsyncDevice:
AllowSome(client, time, dev, GRAB_STATE_THAWED);
AllowSome(client, time, dev, THAWED);
break;
case XIAsyncPairedDevice:
if (IsMaster(dev))
AllowSome(client, time, dev, GRAB_STATE_THAW_OTHERS);
AllowSome(client, time, dev, THAW_OTHERS);
break;
case XISyncPair:
if (IsMaster(dev))
AllowSome(client, time, dev, GRAB_STATE_FREEZE_BOTH_NEXT_EVENT);
AllowSome(client, time, dev, FREEZE_BOTH_NEXT_EVENT);
break;
case XIAsyncPair:
if (IsMaster(dev))
AllowSome(client, time, dev, GRAB_STATE_THAWED_BOTH);
AllowSome(client, time, dev, THAWED_BOTH);
break;
case XIRejectTouch:
case XIAcceptTouch:

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