Motif main window without system menu, minimize and maximize fields how? (C ++)
How do I create a main Motif window without a system menu, minimize and maximize fields? I just can't figure out how to find and read the docs and manuals. I believe it is possible with some additional parameters for XtVaCreateManagedWindow
, but what?
I have tried several options XtVaSetValues
( topWid
, XmNmwmDecorations
, ...), but none worked. Instead, I get the error that I need to use a vendor wrapper to do this. However, most types of widgets are not produced from vendor skins, and when I, for example, try using a dialog wrapper and put a scrollable text widget in it and then the text widget seems to be driving the dialog.
source to share
Apparently it is not possible (easily) to get rid of the (system) menu window, but it seems that it is possible to disable the window menu items with some code:
int i;
XtVaGetValues (widget, XmNmwmFunctions, &i);
i &= ~(MWM_FUNC_ALL | MWM_FUNC_MINIMIZE | MWM_FUNC_MAXIMIZE | MWM_FUNC_CLOSE);
XtVaSetValues (widget, XmNmwmFunctions, i);
which also removes its associated window decoration and seems to work even for non-vendor shell widgets.
source to share
It should also be possible to remove decorations (i.e. make them invisible). Note, however, that these "system menu" decorations refer to Window Manager, not your Motif program. The window manager can handle your requests or ignore them - you can get vendor specific behavior with any MWM resources.
Anyway, here's some sample code to test:
int decors; //bit-mask of flags defining the decorations, from Xm/MwmUtil.h
XtVaGetValues(dlg, XmNmwmDecorations, &decors, NULL);
decors &= ~MWM_DECOR_MENU;
decors &= ~MWM_DECOR_MAXIMIZE;
decors &= ~MWM_DECOR_MINIMIZE;
XtVaSetValues(dlg, XmNmwmDecorations, decors, NULL);
source to share
If you intend to run the application from Mwm
, you can achieve the desired behavior by installing (for example through XtVaAppInitialize()
) the following X11 resources:
! Title bar buttons
Mwm*YourApplicationClassHere.clientDecoration: -minimize -maximize
! Window menu functions
Mwm*YourApplicationClassHere.clientFunctions: -minimize -maximize
These resources are described in more detail here and here .
Speaking of window menus, it depends on the specific window manager you are using. Mwm
for example allows the client to set the name of a menu using a resource Mwm*YourApplicationClassHere.windowMenu
, the menu itself must be defined in ${HOME}/.mwmrc
either a global mwmrc
or XmNmwmMenu
resource VendorShell
. The resulting custom window menu is rendered as an atom _MOTIF_WM_MENU
, seemingly ignored by modern window managers.
Examples of mwmrc
defining a menu might look like this:
Menu CustomMenu0
{
Restore _R Alt<Key>F5 f.restore
Move _M Alt<Key>F7 f.move
Size _S Alt<Key>F8 f.resize
Minimize _n Alt<Key>F9 f.minimize
Maximize _x Alt<Key>F10 f.maximize
Lower _L Alt<Key>F3 f.lower
no-label f.separator
Pass\ Keys _K f.pass_keys
no-label f.separator
Close _C Alt<Key>F4 f.kill
}
Menu CustomMenu1
{
Your\ Application\ Name\ Here f.title
no-label f.separator
Close _C Alt<Key>F4 f.kill
}
(see function description). Custom menu items can be added using f.send_msg
(examples here and here ).
I'm sure all of the above also applies to Dtwm
(CDE).
source to share