关于Gtk应用程序中模态对话框的问题

发布于 2024-08-29 06:51:52 字数 264 浏览 2 评论 0原文

在 Gtk 应用程序中,有 1 个主循环用于监听事件(例如鼠标单击、键盘等)。当弹出模式对话框时,主循环将被阻止,直到用户在对话框中单击“确定”,对吧? (即当用户单击主窗口时不会发生任何事情)。这是正确的吗?

我的问题是 Firefox 如何实现它的模式对话框,以便它可以: 1. 当 1 有 2 个 Firefox 窗口时 2.其中之一有模式对话框 3. 另一个窗口仍然是交互式的

如果两个窗口共享同一个 gtk 主循环,这怎么可能?请帮助我理解这一点。

谢谢。

In Gtk application, there is 1 main loop which listens for events (e.g. mouse click, keyboard, etc). And when a modal dialog popup, the main loop is blocked until user clicks 'OK' in the dialog, right? (i.e. nothing will happen when user clicks on the main window). Is that correct?

My question is how can firefox did its modal dialog so that it can:
1. when 1 have 2 Firefox windows
2. one of them has a modal dialog
3. other one is still interactive

If both window shares the same gtk main loop, how is that possible? Please help me understanding this.

Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

握住我的手 2024-09-05 06:51:52

Firefox 的警报窗口是模态的。当您在 Firefox 中打开一个新窗口时,它会生成另一个 Firefox 进程,因此您有两个进程、两个窗口、两个独立的主循环。

The alert window of firefox is modal. When you open a new window in firefox, it spawns another firefox process so you have two processes, two windows, two independent main loops.

︶ ̄淡然 2024-09-05 06:51:52

如果两个窗口共享相同的 GTK 主循环,则这是不可能的。所以他们不这样做。它们要么有两个主循环,要么通过每次单击一个主窗口时都会弹出对话框来伪造一个模式对话框。

If both windows share the same GTK main loop, then it's not possible. So they don't. Either they have two main loops, or they fake a modal dialog by raising the dialog every time you click on the one main window.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文