logoalt Hacker News

hobo123 • yesterday at 9:08 AM • 1 reply • view on HN

Exactly. Any GUI element is a "window" and composed of other sub-areas, also windows. You could create windows in the "root window", then the WM would manage then and draw window decorations, but in theory you could also just render a window in a certain area within another window (e.g. a full application, or even just a single view or editor of an application).

I'm not too familiar with higher level frameworks like Qt or gtk, but I suspect since they just draw the whole thing, that they only use single X windows and don't compose them, so you wouldn't be able to render a subview of them inside a different context.


Replies

cowlevel • yesterday at 12:04 PM

It's actually unusual for X11 apps to create a window per widget as it comes with a bunch of overhead. Only very old ones do that. However, it does work - windows can be used as widgets and they can cross-embed from other processes. This is very cool but rarely used. It allows you to run a casually sandboxed subprocess with GUI I/O.

They can also just draw on each other's windows and get input events on each other's windows. The connection between a window and its creator process is very weak: the window is automatically destroyed when the creator disconnects. And that's all. You can even turn that off, too. For every request that includes a window (or other resource) ID, nothing says that it has to be your window.

➕ show 1 reply