Xcb基础知识入门学习
一,参考资料
https://jichu4n.com/posts/how-x-window-managers-work-and-how-to-write-one-part-i/
1,A window manager is a regular X client.
2,A window manager communicates with the windows it manages through two X mechanisms: properties and events.
3,Windows are organized into a tree hierarchy.
4,A window manager manages top level windows – that is, direct children of the root window.
5,The mechanism that allows a window manager to intercept such requests is called substructure redirection.
6,Redirection means that an event is sent to the client selecting redirection (usually the window manager), and the original structure−changing request is not executed.
7,The Composite extension provides a mechanism to request the X server not to render a specific window and its descendants directly to hardware, but to a special buffer maintained by the X server, and do so without the normal clipping and overlap computations. This buffer can then be read and used by the client that made the request.
二,参考资料
https://jichu4n.com/posts/how-x-window-managers-work-and-how-to-write-one-part-ii/
1,窗口管理器示例:https://github.com/jichu4n/basic_wm
2,http://www.xfree86.org/current/manindex3.html
3,There are two official C libraries for X: Xlib and XCB.
4,Xlib, hailing from 1985, was the original X client library, and was the only official X client library until the introduction of XCB in 2001.
5,The two libraries have very different philosophies: whereas Xlib tries to hide the X protocol behind a friendly C API with lots of bells and whistles, XCB directly exposes the plumbing beneath. Xlib attempts to hide the asynchronous X protocol behind a mixed synchronous and asynchronous API, whereas XCB exposes a fully asynchronous API.
简言之:Xlib做了封装,XCB暴露更多,所以显得更底层。Xlib同步调用,而XCB异步调用。
实测xcb_get_image性能比XGetImage高3-4倍。
6,However, it is important to note that Xlib isn’t fully synchronous. Rather, Xlib has a mixture of synchronous and asynchronous APIs. In general, functions that do not return values (e.g., XResizeWindow, which changes the size of a window) are asynchronous, while functions that return values (e.g., XGetGeometry, which return the size and position of a window) are synchronous
Xlib并非完全同步,没有返回值的函数调用为异步,有返回值的函数调用为同步。
三,参考资料
https://www.x.org/releases/X11R7.7/doc/libxcb/tutorial/index.html
四,xcb编程入门
https://www.codeproject.com/articles/1089819/an-introduction-to-xcb-programming
https://x.org/releases/X11R7.5/doc/libxcb/tutorial/
https://xcb.freedesktop.org/tutorial/
https://xcb.freedesktop.org/
五,问题
1,列出当前所有display-names
https://askubuntu.com/questions/230835/list-existing-x-display-names
https://askubuntu.com/questions/181419/how-to-reverse-colors-for-the-current-window-in-gnome-shell
xrandr –query This lists the display names and detected available resolutions.
https://askubuntu.com/questions/121014/how-do-i-list-connected-displays-using-the-command-line
https://askubuntu.com/questions/186288/how-to-detect-and-configure-an-output-with-xrandr
2,检查当前桌面使用的是wayland还是X11
echo $XDG_SESSION_TYPE
转载请保留地址:http://www.lenky.info/archives/2022/11/3236 或 http://lenky.info/?p=3236
备注:如无特殊说明,文章内容均出自Lenky个人的真实理解而并非存心妄自揣测来故意愚人耳目。由于个人水平有限,虽力求内容正确无误,但仍然难免出错,请勿见怪,如果可以则请留言告之,并欢迎来信讨论。另外值得说明的是,Lenky的部分文章以及部分内容参考借鉴了网络上各位网友的热心分享,特别是一些带有完全参考的文章,其后附带的链接内容也许更直接、更丰富,而我只是做了一下归纳&转述,在此也一并表示感谢。关于本站的所有技术文章,欢迎转载,但请遵从CC创作共享协议,而一些私人性质较强的心情随笔,建议不要转载。
法律:根据最新颁布的《信息网络传播权保护条例》,如果您认为本文章的任何内容侵犯了您的权利,请以Email或书面等方式告知,本站将及时删除相关内容或链接。