Motif主窗口没有系统菜单,如何最小化和最大化框? (C++)
如何创建没有系统菜单、最小化和最大化框的 Motif 主窗口?我只是无法通过谷歌搜索和阅读文档和教程来找到方法。我相信使用 XtVaCreateManagedWindow
的一些附加参数应该是可能的,但是哪个呢?
我尝试了 XtVaSetValues
的几种变体(topWid
、XmNmwmDecorations
,...),但没有一个起作用。相反,我收到一条错误消息,提示我需要使用供应商 shell 来执行此操作。然而,大多数小部件类型并不是从供应商 shell 派生的,当我尝试使用对话框 shell 并将可滚动文本小部件放入其中时,文本小部件似乎控制了对话框。
How do I create a Motif main window that doesn't have a system menu, minimize and maximize boxes? I just cannot find out how by googling and reading docs and tutorials. I believe that it should be possible with some additional parameters for XtVaCreateManagedWindow
, but which?
I have tried several variants of XtVaSetValues
(topWid
, XmNmwmDecorations
, ...) but none worked. Instead I get an error message that I need to use a vendor shell for this. Most widget types aren't derived from vendor shells however, and when I e.g. try to use a dialog shell and put a scrollable text widget inside of it, then then text widget seems to control the dialog.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
显然,不可能(轻易)摆脱窗口(系统)菜单,但似乎可以使用如下代码禁用窗口菜单项:
它也删除了相关的窗口装饰,显然甚至适用于非供应商外壳小部件。
Apparently it's not (easily) possible to get rid of the window (system) menu, but it seems to be possible to disable window menu items with some code like this:
which removes the related window decoration too and apparently even works for non vendor shell widgets.
还应该可以去除装饰(即使它们不可见)。但是,请注意这些“系统菜单”装饰属于窗口管理器,而不是您的 Motif 程序本身。由窗口管理器来处理您的请求或忽略它们——您可能会使用任何 MWM 资源获得特定于供应商的行为。
无论如何,这是要尝试的代码示例:
There should also be the possibility to remove the decorations (i.e. make them invisible). However, please note that these "system menu" decorations belong to the Window Manager, not your Motif program itself. It is up to the Window Manager to handle your requests or disregard them--you might get vendor-specific behavior with any MWM resources.
Anyway, here's the code sample to try out:
如果您打算从
Mwm
运行您的应用程序,您可以通过设置(例如通过XtVaAppInitialize()
)以下X11资源来实现所需的行为:这些资源在更多内容中进行了解释详细信息此处和此处。
说到窗口菜单,这取决于所使用的特定窗口管理器。例如,
Mwm
允许客户端使用Mwm*YourApplicationClassHere.windowMenu
资源设置菜单名称,菜单本身必须在${HOME} 中定义/.mwmrc
或全局mwmrc
,或VendorShell
的XmNmwmMenu
资源。生成的自定义窗口菜单作为_MOTIF_WM_MENU
原子公开,现代窗口管理器似乎忽略了它。示例
mwmrc
菜单定义可能如下所示(请参阅功能描述< /a>)。可以使用
f.send_msg
添加自定义菜单项(示例 此处和此处)。我非常确定上述所有内容也适用于
Dtwm
(CDE)。If you intend to run your application from
Mwm
, you can achieve the desired behavior by setting (e.g. viaXtVaAppInitialize()
) the following X11 resources:These resources are explained in more detail here and here.
Speaking of window menu, this one depends on a specific window manager in use.
Mwm
, for instance, allows the client to set the menu name usingMwm*YourApplicationClassHere.windowMenu
resource, the menu itself must be defined in either${HOME}/.mwmrc
or globalmwmrc
, orXmNmwmMenu
resource ofVendorShell
. The resulting custom window menu is exposed as a_MOTIF_WM_MENU
atom, which seems to be ignored by modern window managers.Sample
mwmrc
menu definitions may look like this(see the function descriptions). Custom menu items can be added using
f.send_msg
(examples here and here).I'm pretty sure all of the above also applies to
Dtwm
(CDE).