Commit Graph

331 Commits

Author SHA1 Message Date
Enrico Weigelt, metux IT consult b51dd9e492 Xnest: replace X(Un)InstallColormap() by xcb_(un)install_colormap()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:39:18 +02:00
Enrico Weigelt, metux IT consult a8410a0670 Xnest: drop obsolete XGetVisualInfo() call and reundant colormaps
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:39:18 +02:00
Enrico Weigelt, metux IT consult 825397cbfc Xnest: drop obsolete Visual.c
The whole file now has become obsolete, so drop it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:39:18 +02:00
Enrico Weigelt, metux IT consult 143c1e0648 Xnest: use new lookup table for visuals and cmaps mappings
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:39:18 +02:00
Enrico Weigelt, metux IT consult 0913ee24d0 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>
2024-08-26 14:39:18 +02:00
Enrico Weigelt, metux IT consult 23d541fbba Xnest: screen: use xcb setup data for retrieving upstream visuals
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:39:18 +02:00
Enrico Weigelt, metux IT consult c6ca7b64f2 Xnest: fix memleak on user specified depth
Buffer overflow may happen on user specificed different depth/class:

xnestOpenScreen() looks into the wrong table: it's local visuals[] array,
instead of the global (non-dedup'ed) list fetched by xlib. The visuals[]
array is *much* smaller (deduplicated) than the xnestVisuals[] array,
and xnestDefaultVisualIndex is likely to point outside of visual[]'s bounds.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:39:18 +02:00
Enrico Weigelt, metux IT consult ecb8ca56b5 Xnest: screen move assigment between depths and visual assignment to own function
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:39:18 +02:00
Enrico Weigelt, metux IT consult 0042894dfb Xnest: replace XParseGeometry() by own implementation
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:39:18 +02:00
Enrico Weigelt, metux IT consult 7603a5d6c1 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>
2024-08-26 14:39:18 +02:00
Enrico Weigelt, metux IT consult 1730573423 Xnest: collect upstream window geometry in one xRectangle struct
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:39:18 +02:00
Enrico Weigelt, metux IT consult 8e2614fe8a Xnest: replace XGetKeyboardControl() by xcb_get_keyboard_control()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:39:18 +02:00
Enrico Weigelt, metux IT consult 9e0615e54f Xnest: replace XGetPointerMapping() by xcb_get_pointer_mapping()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:39:18 +02:00
Enrico Weigelt, metux IT consult cfcea4ef79 Xnest: replace XGetPointerControl() by xcb_get_pointer_control()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:39:18 +02:00
Enrico Weigelt, metux IT consult bc1d6fe9de Xnest: replace XGetModifierMapping() by xcb_get_modifier_mapping()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:39:17 +02:00
Enrico Weigelt, metux IT consult 90b30fef64 Xnest: fetch keyboard mapping via xcb
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:39:17 +02:00
Enrico Weigelt, metux IT consult a1d0ad2155 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>
2024-08-26 14:39:13 +02:00
Enrico Weigelt, metux IT consult ebe499b2c4 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>
2024-08-26 14:21:54 +02:00
Enrico Weigelt, metux IT consult f702a02931 Xnest: replace XSelectInput() by xcb_change_window_attributes()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:21:54 +02:00
Enrico Weigelt, metux IT consult 801716a695 Xnest: replace XSetStandardProperties() by xcb functions
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:21:54 +02:00
Enrico Weigelt, metux IT consult 73953d49f9 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>
2024-08-26 14:21:54 +02:00
Enrico Weigelt, metux IT consult 92a52d0190 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>
2024-08-26 14:21:54 +02:00
Enrico Weigelt, metux IT consult 8eddaa62ce Xnest: Pixmap: replace XGetImage() by xcb_get_image()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:21:54 +02:00
Enrico Weigelt, metux IT consult ac34412efd Xnest: GC: replace XGetImage() by xcb_get_image()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:21:54 +02:00
Enrico Weigelt, metux IT consult d3bafdf49f Xnest: replace XDestroyWindow() by xnest_destroy_window()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:21:54 +02:00
Enrico Weigelt, metux IT consult 2cd8b6c285 Xnest: replace XCreatePixmapFromBitmapData() by xcb_put_image()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:21:54 +02:00
Enrico Weigelt, metux IT consult 4a7a6cfb8d Xnest: replace XCreateBitmapFromData() by xcb_put_image()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:21:54 +02:00
Enrico Weigelt, metux IT consult cce1ef3b95 Xnest: replace XDefineCursor() by xcb_change_window_attributes()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:21:54 +02:00
Enrico Weigelt, metux IT consult 072ac1ffdc Xnest: replace xnestRecolorCursor() by xcb_recolor_cursor()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:21:54 +02:00
Enrico Weigelt, metux IT consult d059954952 Xnest: replace XFreeCursor() by xcb_free_cursor()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:21:54 +02:00
Enrico Weigelt, metux IT consult edc514e2bd Xnest: replace XStoreColors() by xcb_store_colors()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:21:54 +02:00
Enrico Weigelt, metux IT consult fd607858da Xnest: replace XQueryColors() by xcb_query_colors()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:21:54 +02:00
Enrico Weigelt, metux IT consult 4d24903dfb Xnest: replace XSetWindowColormap() by xcb_change_window_attributes()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:21:54 +02:00
Enrico Weigelt, metux IT consult cde9d848d6 Xnest: replace XSetWMColormapWindows() by xcb_icccm_set_wm_colormap_windows_checked()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:21:54 +02:00
Enrico Weigelt, metux IT consult 3aa6daef7e 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>
2024-08-26 14:21:54 +02:00
Enrico Weigelt, metux IT consult aee6eefbd4 Xnest: GC: set stipple filling via xcb_change_gc
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:21:54 +02:00
Enrico Weigelt, metux IT consult 710a60406c Xnest: replace XSetClipMask() by xcb_change_gc()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:21:54 +02:00
Enrico Weigelt, metux IT consult c2215260a8 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>
2024-08-26 14:21:54 +02:00
Enrico Weigelt, metux IT consult a26ca8e9bb Xnest: replace XSetDashes() by xnest_set_dashes()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:21:54 +02:00
Enrico Weigelt, metux IT consult 8a068eb15a Xnest: replace XChangeGC() by xcb_change_gc()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:21:54 +02:00
Enrico Weigelt, metux IT consult db2743387b Xnest: replace XChangeKeyboardControl() by xcb_change_keyboard_control()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:21:54 +02:00
Enrico Weigelt, metux IT consult 1795698202 Xnest: replace XChangePointerControl() by xcb_change_pointer_control
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:21:54 +02:00
Enrico Weigelt, metux IT consult 315469160c Xnest: replace XSetWindowAttributes struct by own type
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:21:54 +02:00
Enrico Weigelt, metux IT consult 70acda3fba Xnest: replace XChangeWindowAttributes() by xcb_change_window_attributes()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:21:54 +02:00
Enrico Weigelt, metux IT consult 6d12f08fb2 Xnest: replace XDrawImageString() by xcb_image_text_8()
Replace XDrawImageString() by xcb_image_text_8(), as well as their 16-bit
counterparts.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:21:54 +02:00
Enrico Weigelt, metux IT consult 463dd69d9b Xnest: replace XDrawString[8|16]() by xcb_poly_text_[8|16]()
Replace XDrawString8() by xcb_poly_text_8(), as well as XDrawString16()
by xcb_poly_text_16(). Some care needs to be taken to prepend the xTextElt
header before sending the request out.

GC operation handlers don't need to care about poly-strings or length
above 254, as this is already handled by their caller, doPolyText().

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:21:54 +02:00
Enrico Weigelt, metux IT consult 0fdcadba09 Xnest: replace XFillRectangles() by xcb_poly_fill_rectangle()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:21:54 +02:00
Enrico Weigelt, metux IT consult 37d6d3ae98 Xnest: directly pass ClearArea request to upstream server
Instead of going through mi machinery, just pass the ClearArea
request to the upstream window.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:21:54 +02:00
Enrico Weigelt, metux IT consult 6aef795cc3 Xnest: replace XFillArcs() by xcb_poly_fill_arc()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:21:54 +02:00
Enrico Weigelt, metux IT consult 4156c3ed2b Xnest: replace XFillPolygon() by xcb_fill_poly()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-08-26 14:21:54 +02:00