我的问题是关于是否可以将窗口内容(例如终端模拟器、浏览器、游戏或任何其他 X org 应用程序)嵌入到 GTK3 应用程序中。这意味着用户仍然可以与应用程序交互并查看其中的内容。我正在运行 Debian 11 64 位,我想使用 C 语言制作该应用程序。
最佳答案
我见过的最接近的是使用 GtkPlug
and a GtkSocket
:
Together with GtkSocket, GtkPlug provides the ability to embed widgets from one process into another process in a fashion that is transparent to the user. One process creates a GtkSocket widget and passes the ID of that widget’s window to the other process, which then creates a GtkPlug with that window ID. Any widgets contained in the GtkPlug then will appear inside the first application’s window.
The communication between a GtkSocket and a GtkPlug follows the XEmbed Protocol. This protocol has also been implemented in other toolkits, e.g. Qt, allowing the same level of integration when embedding a Qt widget in GTK+ or vice versa.
一个例子是 xfce-settings-manager
,你可以学习here (在存储库中搜索“socket-id”)。
注释:
GtkPlug
和GtkSocket
是 X11 特定的。如果您正在寻找跨平台的东西,这可能不是您的选择。- 似乎两者都是 no longer exist in Gtk4 .
关于c - 是否可以在 GTK 中的另一个应用程序中运行一个应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70524688/