是否有可能 运行 一个应用程序在 GTK 中的另一个应用程序中?
is it possible run an app inside another app in GTK?
我的问题是关于是否可以将 window 的内容(例如终端仿真器、浏览器、游戏或任何其他 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
, which you can study here(在 repo 中搜索“socket-id”)。
备注:
GtkPlug
s 和 GtkSocket
s 是特定于 X11 的。如果您正在寻找跨平台的东西,这可能不是。
- 这两个好像都no longer exist in Gtk4.
我的问题是关于是否可以将 window 的内容(例如终端仿真器、浏览器、游戏或任何其他 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
, which you can study here(在 repo 中搜索“socket-id”)。
备注:
GtkPlug
s 和GtkSocket
s 是特定于 X11 的。如果您正在寻找跨平台的东西,这可能不是。- 这两个好像都no longer exist in Gtk4.