Commit Graph

1229 Commits

Author SHA1 Message Date
stefan11111
be7784fce2 kdrive: add fd notification machinery
This will be needed by Xfbdev's keyboard driver, which cannot work
with input threads yet.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-06 19:48:15 +02:00
Enrico Weigelt, metux IT consult
205c07979b kdrive: export some variables
Allow them to be used by other places, eg. upcoming Xfbdev.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-06 16:20:36 +02:00
Enrico Weigelt, metux IT consult
0eac1a0ce1 kdrive: export KdRingBell()
Allow it to be used by other places, eg. upcoming Xfbdev.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-06 16:20:36 +02:00
Enrico Weigelt, metux IT consult
50a5e0b8b4 kdrive: export KdSetLed()
Allow it to be used by other places, eg. upcoming Xfbdev.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-06 16:20:36 +02:00
Enrico Weigelt, metux IT consult
7213249f14 kdrive: export _KdEnqueuePointerEvent()
Allow it to be used by other places, eg. upcoming Xfbdev.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-06 16:20:36 +02:00
Enrico Weigelt, metux IT consult
9ce9eb9e42 kdrive: export KdScreenInit()
Allow it to be used by other places, eg. upcoming Xfbdev.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-06 16:20:36 +02:00
Enrico Weigelt, metux IT consult
0160aee88d kdrive: export KdSaveScreen()
Allow it to be used by other places, eg. upcoming Xfbdev.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-06 16:20:36 +02:00
Enrico Weigelt, metux IT consult
9c9aa173f1 kdrive: export KdCreateScreenResources()
Allow it to be used by other places, eg. upcoming Xfbdev.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-06 16:20:36 +02:00
Enrico Weigelt, metux IT consult
4d79e2e73d kdrive: export KdAllocatePrivates()
Allow it to be used by other places, eg. upcoming Xfbdev.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-06 16:20:36 +02:00
Enrico Weigelt, metux IT consult
d7dbd86045 kdrive: export KdParseRgba()
Allow it to be used by other places, eg. upcoming Xfbdev.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-06 16:20:36 +02:00
Enrico Weigelt, metux IT consult
cb4eec13ab kdrive: export KdParseKeyboard()
Allow it to be used by other places, eg. upcoming Xfbdev.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-06 16:20:36 +02:00
Enrico Weigelt, metux IT consult
e85363dfcc kdrive: export KdParsePointer()
Allow it to be used by other places, eg. upcoming Xfbdev.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-06 16:20:36 +02:00
Enrico Weigelt, metux IT consult
f4d455b684 kdrive: export KdDisableScreens()
Allow it to be used by other places, eg. upcoming Xfbdev.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-06 16:20:36 +02:00
Enrico Weigelt, metux IT consult
81fbad5115 kdrive: export KdInitScreen()
Allow it to be used by other places, eg. upcoming Xfbdev.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-06 16:20:36 +02:00
Enrico Weigelt, metux IT consult
2c91c8ad1d kdrive: export KdSetSuspend()
Allow it to be used by other places, eg. upcoming Xfbdev.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-06 16:20:36 +02:00
Enrico Weigelt, metux IT consult
d30b04499d kdrive: export KdSetColormap()
Allow it to be used by other places, eg. upcoming Xfbdev.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-06 16:20:36 +02:00
Enrico Weigelt, metux IT consult
ead8331996 kdrive: move ephyr build option check into kdrive's meson.build
As more kdrive-based servers are coming, it's time to refactor the meson
structure a little bit, so all kdrive specific logic is in its own subdir.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-04 12:57:16 +02:00
Enrico Weigelt, metux IT consult
967ae609b6 dix: drop DDXBEFORERESET symbol
Reduce complexity for things that really don't matter much:

The ddxBeforeReset() function is called when the Xserver going to reset
(new server generation). Right now, the only DDX really needing that is
Xwin, on all the others it's just no-op.

We've got an extra complicated build logic, which ifdef's out this all when
Xwin isn't built at all. The saving is extremely minimal - just skipping
few stub functions, which in most sessions aren't even called.

Therefore, get rid of this extra complexity that isn't giving us any
notable gain.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-04 11:41:48 +02:00
Enrico Weigelt, metux IT consult
66e8a5aff3 kdrive: xephyr: link pthread on mingw for nanosleep()
For strange reaons, nanosleep() is in libpthread on mingw platform,
so we have to link it here.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-04 10:59:52 +02:00
Enrico Weigelt, metux IT consult
5102b5d9e9 kdrive: ephyr: include glamor_priv.h only when glamor is enabled
Necessary for building on platforms without any GL at all.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-04 10:59:52 +02:00
Enrico Weigelt, metux IT consult
520ae4fb3f kdrive: ephyr: don't use %hhu in error messages
The win32/mingw libc doesn't support this conversion type.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-04 10:59:52 +02:00
Enrico Weigelt, metux IT consult
eccbd65c75 kdrive: allow win32 build w/o sysv ipc
Win32 doesn't have SysV IPC, so we need to build it w/o this here.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-04 10:59:52 +02:00
Enrico Weigelt, metux IT consult
a1bafe0a06 kdrive: ephyr: don't try to install handler for SIGUSR1 on win32
Windows has no Unix-type signals.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-01 17:18:09 +02:00
Enrico Weigelt, metux IT consult
0a705ae42c kdrive: don't include <err.h> anymore
We don't need it at all (and even shouldn't use it), and this breaks
the win32/mingw build.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-01 17:00:54 +02:00
Enrico Weigelt, metux IT consult
193ed3d1f3 kdrive: fix build on win32/mingw
Yet one more clash between <windows.h> and Xserver on `CreateWindow` symbol:
The windows header has a `#define CreateWindow CreateWindowA`, so we need
to #undef it everywhere we're using `CreateWindow` - until we've got that
ugly header out of the way completely.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-01 16:39:08 +02:00
stefan11111
bd1e299837 kdrive: add OS/platform callback for event polling
And OS/platform callback by which individual server implementations
can extra event polling, eg. device IO.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-23 16:41:33 +02:00
stefan11111
b75dfe3d58 kdrive: add OS/platform callback for screen enable/disable
New OS/platform callbacks that are called when screens are enabled
or disabled. This allows individual Kdrive implementations to take
specific action, eg. configure/reset graphics hardware.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-23 16:41:33 +02:00
stefan11111
889dc612cf kdrive: add OS/platform specific bell callback
Allow OS/platform specific bell implementation.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-23 16:41:33 +02:00
Enrico Weigelt, metux IT consult
1975ae8a5f kdrive: use NULL instead of NullClient
No need to have another name for NULL, we can use NULL directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 22:24:55 +02:00
Enrico Weigelt, metux IT consult
030745a0e7 dix: move inpututils.h and rename it to inpututil_privs.h
it's a private header, thus should not be in public include directory.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 04:51:30 +02:00
stefan11111
e89fd17340 kdrive: constitfy kdOsFuncs & document KdOsInit()
Not supposed to be written to (once the pointer is assigned),
so should be marked const. Also document KdOsInit()

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 04:51:30 +02:00
stefan11111
512fd49def kdrive: ephyr: initialize OS specific callback vectors
These will be used by subsequent commits for generic Kdrive
functions calling back into the OS specific parts

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-07-18 04:51:30 +02:00
stefan11111
d0a7d42090 kdrive: add KdOsInit
Kdrive X servers used to do the OS-speciffic init part using KdOsInit.
This was changed in modern Xorg because Xephyr is the only kdrive
X server there, so there was no need to keep this generic.
Since we want to eventually add Xfbdev, we need to add this back.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-07-18 04:51:30 +02:00
stefan11111
c4df9ecdc5 kdrive: add documenation for mouse arguments
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-07-08 13:13:20 +02:00
stefan11111
d0c507d9e7 kdrive: const-qualify KdAddConfig{Keyboard,Pointer}'s argument
The passed name buffer isn't changed by those functions ever
(it would be a bug if they did so), therefore it should be const.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-08 13:13:20 +02:00
stefan11111
836013edca kdrive: move a local variable declaration to the top of the scope
Makes the code more consistent with the rest of the codebase

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-07-08 13:13:20 +02:00
stefan11111
2884ede393 kdrive: fix incorrect NULL-check
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-07-08 13:13:20 +02:00
stefan11111
3d266528a9 kdrive: ephyr: use c99 struct initialization
For better readability and robustness against future changes, it's
better to use named struct initializers instead of array-like lists.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-01 16:50:01 +02:00
Mike Gelfand
c06a2a3ed7 hw: add/fix include guards where missing/broken
Skipped headers designed for multiple or non-trivial inclusion:
* hw/xfree86/dri2/pci_ids/i810_pci_ids.h
* hw/xfree86/dri2/pci_ids/i915_pci_ids.h
* hw/xfree86/dri2/pci_ids/i965_pci_ids.h
* hw/xfree86/dri2/pci_ids/r200_pci_ids.h
* hw/xfree86/dri2/pci_ids/r300_pci_ids.h
* hw/xfree86/dri2/pci_ids/r600_pci_ids.h
* hw/xfree86/dri2/pci_ids/radeon_pci_ids.h
* hw/xfree86/dri2/pci_ids/radeonsi_pci_ids.h
* hw/xfree86/dri2/pci_ids/virtio_gpu_pci_ids.h
* hw/xfree86/dri2/pci_ids/vmwgfx_pci_ids.h

Signed-off-by: Mike Gelfand <mikedld@mikedld.com>
2025-06-27 13:58:05 +02:00
Steven Van Dorp
2ef1e7728e ephyr: fix checking the same expression twice
Probably was a copy-paste error.
Intention is to check if the string is valid
(i.e. not null and length isn't 0).

fixes: #179

Signed-off-by: Steven Van Dorp <steven@vandorp.lu>
2025-06-19 13:57:57 +02:00
Steven Van Dorp
b393d5fc02 ephyr: Add -host-grab to set custom grab shortcut
Allows for calling Xephyr with `-host-grab [keys]` to customize the
keyboard shortcut for grabbing/releasing keyboard and mouse input.
Fully backwards compatible:
Omitting `-host-grab` defaults to ctrl+shift.
`-no-host-grab` acts the same as before.

Closes: #134

Signed-off-by: Steven Van Dorp <steven@vandorp.lu>
2025-06-18 13:23:58 +02:00
Steven Van Dorp
9acf6a4b63 ephyr: explicitly zero-initialize ephyrCursorScreen
Signed-off-by: Steven Van Dorp <steven@vandorp.lu>
2025-06-14 17:28:13 +02:00
Steven Van Dorp
c5f63fa138 ephyr: fix possible segfault if eyphrCursorScreen is 0
Fixes: #38

Signed-off-by: Steven Van Dorp <steven@vandorp.lu>
2025-06-14 17:28:13 +02:00
Enrico Weigelt, metux IT consult
e6467895f9 dix: add dixAllocServerXID()
Adding a separate function for allocating server-client's XIDs.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult
ae7c32abf6 os: directly set console verbosity level, instead of using LogSetParameter()
No need for extra call to some demuxer function for nothing but setting a
simple int variable. Setting verbosity level really is nothing more than just
writing some value into a variable, so it's trivial to just to do that, instead
of having an unncessarily complex "universal setter" for that.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:46 +02:00
Enrico Weigelt, metux IT consult
7c51bcb093 os: unexport internal logging functions
Lots of logging functions, especially init and teardown aren't called
by any drivers/modules, so no need to keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:46 +02:00
Enrico Weigelt, metux IT consult
9741f0a256 move systemd-logind.h to hw/xfree86/os-support/linux
systemd is linux specific and the actual implementation is under the
os-support layer of xfree86 ddx. Thus no need to keep it in global
include directory, putting it onto the linux specific os-support instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:46 +02:00
Enrico Weigelt, metux IT consult
b6c72bc9f5 treewide: clean up remaining consumers of extinit.h
Several sources including it without need. For consistency, those who still
need someting from there should include exitinit_priv.h (which also pulls
in extinit.h)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:46 +02:00
Enrico Weigelt, metux IT consult
5a003a7663 kdrive: replace xallocarray() by calloc()
Only key difference that calloc(), in contrast to rellocarray(),
is zero-initializing. The overhead is hard to measure on today's
machines, and it's safer programming practise to always allocate
zero-initialized, so one can't forget to do it explicitly.

Cocci rule:

    @@
    expression COUNT;
    expression LEN;
    @@
    - xallocarray(COUNT,LEN)
    + calloc(COUNT,LEN)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:44 +02:00
Enrico Weigelt, metux IT consult
adc27c5220 dix: move ColormapRec declaration out of public header
Not used by any external module/driver, so no need to keep it in
public header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:43 +02:00