分类: LINUX
2007-10-08 13:47:53
XEmbed is a protocol that uses basic X mechanisms such as client messages and reparenting windows to provide embedding of a control from one application into another application. Some of the goals of the XEmbed design are:
Support for out-of process controls, written in any toolkit or even plain Xlib.
Support for in-process-controls when mixing different toolkits in one process.
Smooth integration of the embedding application and embedded client in areas such as input device handling and visual feedback.
Easy implementation. A full implementation supporting all details correctly may require minor toolkit modifications, but it should be possible to get basic functionality going in less than 1000 lines of code.
Goal 1 is the most urgent one. A embedding specification allows developers to write applets for whatever desktop the user is using in whatever toolkit they prefer. Goal 2 is more of something to keep in mind than a immediate requirement. While there are other ways to mix two or more toolkits, using XEmbed might be the easiest and thus most comfortable way. Goal 3 describes the targeted level of integration. The users should not necessarily notice that they work with embedded controls; devices like the keyboard and the mouse should work as expected, inactive windows should look like they are inactive, and so forth. The level of integration may, however, be limited by goal 4. In order for the protocol to be successful, it's crucial to get implementations for the most important toolkits. Thus, the implementation should not require too much coding and no or only few modifications to the toolkit's kernel.
At the time of writing, an implementation of XEmbed is included in GTK+-2.0 that mostly conforms to this version of the specification. The main area of divergence is in the area of accelerators, where a simpler scheme is implemented than the XEMBED_REGISTER_ACCELERATOR, XEMBED_UNREGISTER_ACCELERATOR accelerator scheme described here. The KDE libraries (libkdeui) include QXEmbed, a mostly-complete implementation for Qt of an earlier version of the protocol.
A toplevel window is active if it currently is receiving keyboard events. (The window or a descendant has the X keyboard focus.) A widget within the toplevel is active if the toplevel is active, regardless of whether that widget has the input focus within the toplevel.
In an embedding situation, the client is the window that is embedded into an embedder. Sometimes also called a plug. (Note that the usage here should not be confused with the typical X usage of "client" to mean an application connecting to the X server. That is always referred to as an application in this document)
[ Should we replace client by some other term in this document to avoid the confusion? ]In an embedding situation, the embedder is the graphical location that embeds an external client. Sometimes also called a socket or site.
A widget is focused if it receives keyboard events within its toplevel. This is without regard to whether the toplevel is active, and has nothing to do with the X keyboard focus.