Commit Graph

294 Commits

Author SHA1 Message Date
Enrico Weigelt, metux IT consult ee302a1ac0 (submit/drop-obsolete-have-dix-config.h) drop obsolete HAVE_DIX_CONFIG_H
The symbol controls whether to include dix-config.h, and it's always set,
thus we don't need it (and dozens of ifdef's) anymore.

This commit only removes them from our own source files, where we can
guarantee that dix-config.h is present - leaving the (potentially exported)
headers untouched.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 20:51:21 +02:00
Enrico Weigelt, metux IT consult e99a1b5d99 (submit/cursor-api) dix: unexport cursor allocation functions
These functions aren't used by external modules, so no need to export them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 20:51:21 +02:00
Enrico Weigelt, metux IT consult 0bc252a068 (submit/split-input.h) include: move private definitions out of input.h
It's not good having the public server api headers clobbered with private
definitions, so cleaning them up.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 20:51:21 +02:00
Enrico Weigelt, metux IT consult fd77dbfa68 (submit/split-client.h) os: split off internal definitions from client.h
The client.h file is part of the public module API, but it also contains
definitions that aren't useful for being used in modules. Splitting them
out into their own client_priv.h file, which isn't part of the API.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 20:51:21 +02:00
Enrico Weigelt, metux IT consult 9673318434 (submit/selection.h) dix: rename selection.h to selection_priv.h
rename it in order to reflects it's private nature (not exported).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 20:51:21 +02:00
Enrico Weigelt, metux IT consult 4006ab3249 (submit/colormap.h) dix: move colormap flags into colormap_priv.h and rename them
These aren't used by any drivers/modules, so no need to keep them exported.
As already touching them, give them a proper name prefix for clarity.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 20:51:21 +02:00
Enrico Weigelt, metux IT consult 96918ddbec (submit/colormap.h) dix: unexport CreateColormap()
Not used by any driver/module, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 20:51:20 +02:00
Enrico Weigelt, metux IT consult 11fe7c5654 (submit/miext-extinit) miext: move over extinit_priv.h from include
Since most of the extension init logic (and on/off switches for them)
is driven from miext, this seems the appropriate place for the header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 20:51:20 +02:00
Enrico Weigelt, metux IT consult 1a557186dd (submit/recv-fds) os: read file descriptors into client struct at once
Instead of having the request handler ask for fd's one by one, just read them
all into a little array in ClientRec struct. And also automatically clean up
after request had been handled.

Request handlers need to set the entries to -1 if they shouldn't be closed
automatically.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-29 20:51:20 +02:00
Enrico Weigelt, metux IT consult 34662f15af os: unexport fields from opaque.h not used by modules / drivers
There're lots of field that aren't used by any modules or drivers,
thus no need to keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1351>
2024-06-23 21:19:27 +00:00
Enrico Weigelt, metux IT consult 305f2d59d8 xace: typesafe hook function for XACE_SCREENSAVER_ACCESS
he generic XaceHook() call isn't typesafe (und unnecessarily slow).
Better add an explicit function, just like we already have for others.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1556>
2024-06-23 21:07:48 +00:00
Enrico Weigelt, metux IT consult 51d8bcfc0d xace: typesafe hook function for XACE_SCREEN_ACCESS
he generic XaceHook() call isn't typesafe (und unnecessarily slow).
Better add an explicit function, just like we already have for others.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1556>
2024-06-23 21:07:48 +00:00
Enrico Weigelt, metux IT consult 47d6c3ad75 xace: typesafe hook function for XACE_SERVER_ACCESS
he generic XaceHook() call isn't typesafe (und unnecessarily slow).
Better add an explicit function, just like we already have for others.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1556>
2024-06-23 21:07:48 +00:00
Enrico Weigelt, metux IT consult 922b7685dc xace: typesafe hook function for XACE_CLIENT_ACCESS
The generic XaceHook() call isn't typesafe (und unnecessarily slow).
Better add an explicit function, just like we already have for others.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1556>
2024-06-23 21:07:48 +00:00
Enrico Weigelt, metux IT consult ae3c573337 xace: typesafe hook function for XACE_RESOURCE_ACCESS
The generic XaceHook() call isn't typesafe (und unnecessarily slow).
Better add an explicit function, just like we already have for others.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1556>
2024-06-23 21:07:48 +00:00
Enrico Weigelt, metux IT consult e5c8b664d3 os: unexport ddx callbacks
The DDX callbacks (where core/DIX calls into DDX) aren't supposed to be
called by drivers directly, so unexport them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1332>
2024-05-08 09:37:35 +02:00
Enrico Weigelt, metux IT consult bae6cbc8ca include: move private defs to dixstruct_priv.h
Public server module API shouldn't be clobbered with private definitions,
thus move them out to dixstruct_priv.h

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1289>
2024-04-30 00:47:38 +00:00
Enrico Weigelt, metux IT consult d18ef33099 os: unexport OnlyListenToOneClient()
Not used by any drivers, so no need to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1385>
2024-04-16 18:13:11 -07:00
Enrico Weigelt, metux IT consult 85d4bd0dba rename remaining RT_* defines to X11_RESTYPE_*
Since we already had to rename some of them, in order to fix name clashes
on win32, it's now time to rename all the remaining ones.

The old ones are still present as define's to the new ones, just for
backwards compatibility.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1355>
2024-04-15 19:00:47 -07:00
Enrico Weigelt, metux IT consult 1ca48d0a48 dix: workaround for win32 name clash on CreateWindow()
The problem is, ming32 headers unconditionally define CreateWindow() to
alias CreateWindowA() in winuser.h, which is included by windows.h, which
is included by *a lot* common headers. So it highly depends on the exact
include order, whether it works. (also weird things could happen, e.g.
the Xserver's CreateWindow() ending up renamed to CreateWindowA(), ...)

Until we've found a really clean solution to this problem (which might
involve fixing mingw32 first), just add a little workaround by undef'ing
CreateWindow symbol whereever necessary.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1355>
2024-04-15 18:59:23 -07:00
Enrico Weigelt, metux IT consult 232cad9ec3 prevent name clash on Windows w/ RT_* defines
Windows' native headers using some our RT_* define's names for other things.
Since the naming isn't very nice anyways, introducing some new ones
(X11_RESTYPE_NONE, X11_RESTYPE_FONT, X11_RESTYPE_CURSOR) and define the old
ones as an alias to them, in case some out-of-tree code still uses them.

With thins change, we don't need to be so extremely careful about include
ordering and have explicit #undef's in order to prevent name clashes on
Win32 targets.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1355>
2024-04-15 18:59:23 -07:00
Enrico Weigelt, metux IT consult 1999785fa9 os: move over osLookupColor to dix
This function is only used by DIX and not os-specific at all.
So move it over to DIX and give it a more fitting name.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1373>
2024-04-15 16:19:30 -07:00
Enrico Weigelt, metux IT consult 6cb599f59c os: unexport OsLookupColor()
It's an internal function, only used by DIX, not by drivers and shouldn't
have been exported in the first place.

Fixes: 49f77fff14
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1373>
2024-04-15 16:19:06 -07:00
Enrico Weigelt, metux IT consult 46c0ac8c70 dix: unexport ChangeGCXIDs()
Move non-exported gc functions to private header
No need to clutter public headers with non-exported stuff.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1365>
2024-04-15 23:10:31 +00:00
Enrico Weigelt, metux IT consult 3f00c1b6cf os: unexport host control functions
these aren't used by modules/drivers, so no need to export them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1344>
2024-04-15 14:55:22 -07:00
Enrico Weigelt, metux IT consult d84fd3bf19 dix: drop now obsolete cursorScreenDevPriv
Since the two DDX'es which had used this key (xnest and xfree86) now using
their own ones, this global key is obsolete and can be removed.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1342>
2024-03-12 15:24:35 +00:00
Enrico Weigelt, metux IT consult 040e41c7e9 dix: unexport global variables
Those aren't used by drivers, so no need to export them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1375>
2024-03-09 17:23:43 +00:00
Enrico Weigelt, metux IT consult 27b83c4cd0 dix: unexport AddScreen() and AddGPUScreen()
These aren't used by any drivers/modules, just DDX'es, so no need to export.

Note: tigervnc does use it, but it has it's own DDX, therefore directly
linked in, just like the in-tree DDX'es which doesn't need exporting.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1349>
2024-03-03 23:24:28 +00:00
Enrico Weigelt, metux IT consult dc84331f5d include: drop obsolete registry.h
Now that there's no actual consumer of it left, it can be dropped.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1348>
2024-03-03 23:20:06 +00:00
Enrico Weigelt, metux IT consult 4ebb02cdda dix: unexport extension registry functions
These aren't used by (known) external modules, thus no need to export them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1348>
2024-03-03 23:20:06 +00:00
Enrico Weigelt, metux IT consult fe1e2b7b3d dix: unexport and move maxBigRequestSize
* this symbol is a server configuration flag (can be passed via cmdline)
  for limiting the max size of big-requests. there shouldn't be any need
  to use it outside the core X server (in server modules like drivers
  or external extension) - therefore unexport it
* in order to reduce namespace pollution of public (server module API)
  headers, create a new internal header for those tings (more to come)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1275>
2024-02-23 23:19:32 +00:00
Alan Coopersmith d6b20f5e36 Remove "All rights reserved" from Oracle copyright notices
Oracle no longer includes this term in our copyright & license notices.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2023-02-25 09:40:41 -08:00
Jeremy Huddleston Sequoia 16e7cdba48 rootless: Use screen_x and screen_y instead of pixmap pointer hacks
This updates rootless to treat pixmaps consistently with COMPOSITE,
using the screen_x and screen_y values rather than doing hacky math.

This will allow for proper bounds checking on a given PixmapRec.

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2023-01-20 17:10:54 +00:00
Peter Hutterer 412777664a Disallow byte-swapped clients by default
The X server swapping code is a huge attack surface, much of this code
is untested and prone to security issues. The use-case of byte-swapped
clients is very niche, so let's disable this by default and allow it
only when the respective config option or commandline flag is given.

For Xorg, this adds the ServerFlag "AllowByteSwappedClients" "on".
For all DDX, this adds the commandline options +byteswappedclients and
-byteswappedclients to enable or disable, respectively.

Fixes #1201

https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1029

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-01-06 11:59:37 +10:00
Peter Hutterer f69280ddcd dix: localize two variables
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-01-06 11:59:37 +10:00
Peter Hutterer a8c2e60d8d dix: remove unused PANORAMIX_DEBUG ifdef
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-01-06 11:59:37 +10:00
Peter Hutterer 73d6e888c6 Fix some indentation issues
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-01-06 11:59:37 +10:00
Alan Coopersmith 5cc24dbb4c dix: Use memcpy() instead of memmove() when buffers are known not to overlap
Most of these came from a mass bcopy() -> memmove() substitution in 1993
with a commit comment of "Ansification (changed bfuncs -> mfuncs)"

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-08-29 21:10:51 +00:00
Olivier Fourdan 6b47321bc6 dix: Add optional terminate delay
When the command line option "-terminate" is used, it could be
interesting to give it an optional grace period to let the Xserver
running for a little longer in case a new connection occurs.

This adds an optional parameter to the "-terminate" command line option
for this purpose.

v2: Use a delay in seconds instead of milliseconds
    (Martin Peres <martin.peres@mupuf.org>)
v3: Clarify man page entry, ensure terminateDelay is always >= 0,
    simplify TimerFree(). (Peter Hutterer <peter.hutterer@who-t.net>)

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-06-07 17:28:05 +02:00
Olivier Fourdan e167299f60 xfixes: Add ClientDisconnectMode
With Wayland compositors now being able to start Xwayland on demand, the
next logical step is to be able to stop Xwayland when there is no more
need for it.

The Xserver itself is capable of terminating itself once all X11 clients
are gone, yet in a typical full session, there are a number of X11
clients running continuously (e.g. the Xsettings daemon, IBus, etc.).

Those always-running clients will prevent the Xserver from terminating,
because the actual number of X11 clients will never drop to 0. Worse,
the X11 window manager of a Wayland compositor also counts as an X11
client, hence also preventing Xwayland from stopping.

Some compositors such as mutter use the XRes extension to query the X11
clients connected, match their PID with the actual executable name and
compare those with a list of executables that can be ignored when
deciding to kill the Xserver.

But that's not just clumsy, it is also racy, because a new X11 client
might initiate a connection the X11 server right when the compositor is
about to kill it.

To solve this issue directly at the Xserver level, this add new entries
to the XFixes extension to let the X11 clients themselves specify the
disconnect mode they expect.

Typically, those X11 daemon clients would specify the disconnect mode
XFixesClientDisconnectFlagTerminate to let the Xserver know that they
should not be accounted for when checking the remaining clients prior
to terminate.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-06-07 17:28:05 +02:00
Povilas Kanapickas 5163fc8bc2 Implement gesture processing logic 2021-05-30 13:26:42 +03:00
Dave Airlie ea47af87f6 xserver/output: rename some badly named variables/APIs.
This is an API and ABI break

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-10 06:17:44 +10:00
Alan Coopersmith 23e83724df Fix spelling/wording issues
Most (but not all) of these were found by using
  codespell --builtin clear,rare,usage,informal,code,names
but not everything reported by that was fixed.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2020-07-05 13:07:33 -07:00
Adam Jackson 516e75dbb6 dix: Call SourceValidate before GetImage
This ensures that any prep work for the drawable we're about to read
from is already done before we call down to GetImage. This should be no
functional change as most of the callers with a non-trivial
SourceValidate are already wrapping GetImage and doing the equivalent
thing, but we'll be simplifying that shortly.

More importantly this ensures that if any of that prep work would
generate events - like automatic compositing flushing rendering to a
parent pixmap which then triggers damage - then it happens entirely
before we start writing the GetImage reply header.

Note that we do not do the same for GetSpans, but that's okay. The only
way to get to GetSpans is through miCopyArea or miCopyPlane - where the
callers must already call SourceValidate - or miGetImage - which this
commit now protects with SourceValidate.

Fixes: xorg/xserver#902
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
2019-10-30 16:26:01 +00:00
Adam Jackson 89a9927b1e include: Remove now-empty site.h 2019-10-30 16:17:04 +00:00
Adam Jackson ec659f021e dix: Remove now-unused SetVendorString 2019-10-30 16:17:04 +00:00
Hans de Goede 834a467af9 dix: Add GetCurrentClient helper
Request-handlers as registered in the requestVector array, always get
passed the clientPtr for the client which sent the request.
But the implementation of many request-handlers typically consists of
a generic handler calling implementation specific callbacks and / or
various helpers often multiple levels deep and in many cases the clientPtr
does not get passed to the callbacks / helpers.

This means that in some places where we would like to have access to the
current-client, we cannot easily access it and fixing this would require
a lot of work and often would involve ABI breakage.

This commit adds a GetCurrentClient helper which can be used as a
shortcut to get access to the clienPtr for the currently being processed
request without needing a lot of refactoring and ABI breakage.

Note using this new GetCurrentClient helper is only safe for code
which only runs from the main thread, this new variable MUST NOT be used
by code which runs from signal handlers or from the input-thread.

The specific use-case which resulted in the creation of this patch is adding
support for emulation of randr / vidmode resolution changes to Xwayland.
This emulation will not actually change the monitor resolution instead it
will scale any window with a size which exactly matches the requested
resolution to fill the entire monitor. The main use-case for this is
games which are hard-coded to render at a specific resolution and have
sofar relied on randr / vidmode to change the monitor resolution when going
fullscreen.

To make this emulation as robust as possible (e.g. avoid accidentally scaling
windows from other apps) we want to make the emulated resolution a per client
state. But e.g. the RRSetCrtc function does not take a client pointer; and is
a (used) part of the Xorg server ABI (note the problem is not just limited
to RRSetCrtc).

Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-10-12 12:19:14 +02:00
Nathan Kidd b747da5e25 Unvalidated extra length in ProcEstablishConnection (CVE-2017-12176)
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Nathan Kidd <nkidd@opentext.com>
Signed-off-by: Julien Cristau <jcristau@debian.org>
2017-10-10 23:33:44 +02:00
Keith Packard d9e23ea422 dix: Remove clients from input and output ready queues after closing
Delay removing the client from these two queues until all potential
I/O has completed in case we mark the client as ready for reading or
with pending output during the close operation.

Bugzilla: https://bugs.freedesktop.org/100957
Signed-off-by: Keith Packard <keithp@keithp.com>
Tested-by: Nick Sarnie <commendsarnex@gmail.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2017-05-12 00:21:16 -07:00
Eric Anholt ace6bfd590 dix: Remove a redundant #define
Found when the meson conversion set the symbol to defined, instead of
defined to 1.

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2017-04-26 17:29:44 -04:00