c - 是否可以在 GTK 中的另一个应用程序中运行一个应用程序?

标签 c linux gtk gtk3

我的问题是关于是否可以将窗口内容(例如终端模拟器、浏览器、游戏或任何其他 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”)。

注释:

  1. GtkPlugGtkSocket 是 X11 特定的。如果您正在寻找跨平台的东西,这可能不是您的选择。
  2. 似乎两者都是 no longer exist in Gtk4 .

关于c - 是否可以在 GTK 中的另一个应用程序中运行一个应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70524688/

相关文章:

使用 -std=c11 标志编译部分代码

Java 字节缓冲区到 C

c - 在 C 中传递变量值

c - 如何在不安装的情况下使用 kplot(Cairo 绘图库)

C 段错误链表

linux - 在 Bash 脚本中逐行读取

linux - 无法关闭已建立的数据库连接

Linux:死锁进程如何在顶部显示?

c - GtkLabel 不显示文件中的换行符

c++ - 垂直和水平缩放 Gtkmm 小部件