Commit Graph

19494 Commits

Author SHA1 Message Date
Enrico Weigelt, metux IT consult
773538613c Xnest: add test case for xnest_parse_geometry()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:57:24 +01:00
Enrico Weigelt, metux IT consult
c1e1d5e5e2 Xnest: move out xnest_parse_geometry to separate .c file
Making it easier to let link it to test cases.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:57:24 +01:00
Enrico Weigelt, metux IT consult
3d304209cf Xnest: dont use VLA
Replace VLA usage by calloc()

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:13 +01:00
Enrico Weigelt, metux IT consult
9948782641 Xnest: use xcb_window_t instead of Window
Since we're now using xcb for upstream X11 connection, it's cleaner to
use it's type for the window IDs.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:13 +01:00
Enrico Weigelt, metux IT consult
f26f15cb0d Xnest: dont link Xlib anymore
Now that we completely ported from Xlib to XCB, we can finally stop
importing Xlib :)

FIN.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:13 +01:00
Enrico Weigelt, metux IT consult
398fdb65da Xnest: use XCB for upstream connection
Now that no Xlib operations (besides opening and closing connection)
aren't used anymore, we can move over the last pieces and use XCB
instead of Xlib for connecting the upstream Xserver.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:13 +01:00
Enrico Weigelt, metux IT consult
6bd9678613 Xnest: use XCB for event loop
Now that no X11 calls are being done via Xlib anymore, we're free to
also move over event receiving, leaving Xlib pretty much unused.

Also need to add a simple event queue mechanism, because we've go a
screen operation (see xnestBitBlitHelper) that needs to collect up
certain events for it's return value.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:13 +01:00
Enrico Weigelt, metux IT consult
bd88409012 Xnest: drop xnestWindowExposures micro-optimization
xnestWindowExposures() is a micro-optimization for the specific case that
a newly created window receives exposure events (from our upstream server)
inside the region we're already exposing on our own (miWindowExposures()):
it peeks the Xlib event queue for all expose events, checks whether their
areas are inside our exposure region and requeue's those that aren't.

Unfortunately, this depends on Xlib's internal queue mechamism, thus standing
in the way of moving to XCB (which doesn't have that).

Removing this doens't seem to make any practical difference, even with
demanding applications like GIMP. The only cost is potentially having some
initial window content painted twice, *if* the application really draws
something complicated right after creating the window.

*If* there'll really be a demand for such an optimization some day, it can
be reimplemented without any message queue: just redirecting all expose events
into recording them in a region, which is flushed out later. But for now,
there really doesn't seem to be any practical need for that.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:13 +01:00
Enrico Weigelt, metux IT consult
2b908bae9d Xnest: replace XConnectionNumber() by xcb_get_file_descriptor()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:13 +01:00
Enrico Weigelt, metux IT consult
2b40a33bc0 Xnest: replace XReparentWindow() by xcb_reparent_window()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:13 +01:00
Enrico Weigelt, metux IT consult
4f6be67d94 Xnest: drop using XLoadQueryFont()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:13 +01:00
Enrico Weigelt, metux IT consult
1ec93906f9 Xnest: replace XTextWidth[16]() by own implementation
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:13 +01:00
Enrico Weigelt, metux IT consult
ca6665d43e Xnest: load fonts via xcb
FIXME: support xf86bigfont extension
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:13 +01:00
Enrico Weigelt, metux IT consult
895480ea5d Xnest: replace XQueryBestSize() by xcb_query_best_size()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:12 +01:00
Enrico Weigelt, metux IT consult
94138e86cc Xnest: replace X(Un)InstallColormap() by xcb_(un)install_colormap()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:12 +01:00
Enrico Weigelt, metux IT consult
25ba04ac03 Xnest: drop obsolete XGetVisualInfo() call and reundant colormaps
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:12 +01:00
Enrico Weigelt, metux IT consult
c87e4881ed Xnest: use new lookup table for visuals and cmaps mappings
Use the visuals lookup table introduced by previous commit for
looking up local vs upstream visuals and their colormaps.
Replacing the the old Xlib visuals table.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:12 +01:00
Enrico Weigelt, metux IT consult
5c3a16ef56 Xnest: screen: record visuals and cmaps in separate table
Record the associations between host's and our visuals as well their
corresponding cmaps in a global table, which's used later for lookups.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:12 +01:00
Enrico Weigelt, metux IT consult
90cfdf7703 Xnest: fetch visuals from XCB setup data instead of Xlib
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:12 +01:00
Enrico Weigelt, metux IT consult
edb1d93ff8 Xnest: screen move assigment between depths & visual assignment to own function
Preparational cleanup to make upcoming changes easier to digest.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:12 +01:00
Enrico Weigelt, metux IT consult
ea4462516d Xnest: replace XParseGeometry() by own implementation
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:12 +01:00
Enrico Weigelt, metux IT consult
1383c0c30f Xnest: replace XGetWindowAttributes() by xcb_get_geometry()
Use xcb function instead of Xlib, and also spare one additional
(unused) request.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:12 +01:00
Enrico Weigelt, metux IT consult
7825824545 Xnest: collect upstream window geometry in one xRectangle struct
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:12 +01:00
Enrico Weigelt, metux IT consult
88302b0914 Xnest: replace XGetKeyboardControl() by xcb_get_keyboard_control()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:12 +01:00
Enrico Weigelt, metux IT consult
3bbf623fa5 Xnest: replace XGetPointerMapping() by xcb_get_pointer_mapping()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:12 +01:00
Enrico Weigelt, metux IT consult
e510326942 Xnest: replace XGetPointerControl() by xcb_get_pointer_control()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:12 +01:00
Enrico Weigelt, metux IT consult
050efcfe9e Xnest: replace XGetModifierMapping() by xcb_get_modifier_mapping()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:12 +01:00
Enrico Weigelt, metux IT consult
222693fc03 Xnest: fetch keyboard mapping via xcb
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:12 +01:00
Enrico Weigelt, metux IT consult
19dcfbabd3 Xnest: add own copy of fixed xcb_xkb_get_kbd_by_name()
This is a temporary measure, until xcbproto / libxcb is fixed:
keep an own copy of the fixed xcb_xkb_get_kbd_by_name(), renamed
as xcb_xkb_get_kbd_by_name_1().

Once xcbproto/libxcb is fixed (and new xcb release is out), this
commit can be reverted.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:12 +01:00
Enrico Weigelt, metux IT consult
44bf982359 Xnest: use xcb for retrieving keymap controls
This needs fix in xcbproto:

https://gitlab.freedesktop.org/xorg/proto/xcbproto/-/merge_requests/49

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:12 +01:00
Enrico Weigelt, metux IT consult
74cb0db13b Xnest: replace XSelectInput() by xcb_change_window_attributes()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:12 +01:00
Enrico Weigelt, metux IT consult
59401f05de Xnest: replace XSetStandardProperties() by xcb functions
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:12 +01:00
Enrico Weigelt, metux IT consult
125ebff25e Xnest: fetch supported pixmap formats from xcb setup data
There's even no need to keep our own copies, since we can ask XCB's
copy any time.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:12 +01:00
Enrico Weigelt, metux IT consult
b9370be9f9 Xnest: fetch allowed screen depths from xcb screen info
There's even no need to keep our own copies, since we can ask XCB's
copy any time.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:12 +01:00
Enrico Weigelt, metux IT consult
7f24f640c3 Xnest: Pixmap: replace XGetImage() by xcb_get_image()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:12 +01:00
Enrico Weigelt, metux IT consult
c730e34604 Xnest: GC: replace XGetImage() by xcb_get_image()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:12 +01:00
Enrico Weigelt, metux IT consult
57c9af9d18 Xnest: replace XDestroyWindow() by xnest_destroy_window()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:12 +01:00
Enrico Weigelt, metux IT consult
afb56e7e33 Xnest: replace XCreatePixmapFromBitmapData() by xcb_put_image()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:12 +01:00
Enrico Weigelt, metux IT consult
f055159a47 Xnest: replace XCreateBitmapFromData() by xcb_put_image()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:12 +01:00
Enrico Weigelt, metux IT consult
6fdb080b58 Xnest: replace XDefineCursor() by xcb_change_window_attributes()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:12 +01:00
Enrico Weigelt, metux IT consult
45b33250e1 Xnest: replace xnestRecolorCursor() by xcb_recolor_cursor()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:12 +01:00
Enrico Weigelt, metux IT consult
d06fc96f9e Xnest: replace XFreeCursor() by xcb_free_cursor()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:12 +01:00
Enrico Weigelt, metux IT consult
fa201e9e94 Xnest: replace XStoreColors() by xcb_store_colors()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:12 +01:00
Enrico Weigelt, metux IT consult
e0bf989ffe Xnest: replace XQueryColors() by xcb_query_colors()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:12 +01:00
Enrico Weigelt, metux IT consult
3c50719fab Xnest: replace XSetWindowColormap() by xcb_change_window_attributes()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:12 +01:00
Enrico Weigelt, metux IT consult
c0ae198917 Xnest: replace XSetWMColormapWindows()
replacing XSetWMColormapWindows by xcb_icccm_set_wm_colormap_windows_checked

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:12 +01:00
Enrico Weigelt, metux IT consult
d200b25006 Xnest: use XIDs directly, instead of Xlib's GC
Now that no Xlib drawing functions used anymore, we can finally switch over
to using GC XID's directly, instead of Xlib's GC struct.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:12 +01:00
Enrico Weigelt, metux IT consult
ef66925e1c Xnest: GC: set stipple filling via xcb_change_gc
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:12 +01:00
Enrico Weigelt, metux IT consult
0ef986058c Xnest: replace XSetClipMask() by xcb_change_gc()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:12 +01:00
Enrico Weigelt, metux IT consult
91ffcfa526 Xnest: replace XSetClipRectangles() by xnset_set_clip_rectangles()
Use XCB for setting clip rectangles.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-28 19:56:12 +01:00