Actually, if you have problems with that, I've just found some code I implemented a long time ago when using Qt3. It created a non-resizable border for dialogs (now not required in Qt4 as it is done automatically). If you modify this to set your specific EWM hints, it should work:
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <QX11Info>
void MyWidget::callIfWidgetIsTopLevelAndNonResizeable()
{
struct PropMotifWmHints
{
unsigned long flags;
unsigned long functions;
unsigned long decorations;
long inputMode;
unsigned long status;
};
#define QT_XA_MOTIF_WM_HINTS "_MOTIF_WM_HINTS"
#define QT_MWM_HINTS_FUNCTIONS 0x01
#define QT_MWM_HINTS_DECORATIONS 0x10
#define QT_MWM_ALL_FUNCS_WITHOUT_RESIZE 0x3C
#define QT_MWM_ALL_DECOR_WITHOUT_RESIZE_HANDLE 0x7A
PropMotifWmHints prop = {0};
prop.flags |= QT_MWM_HINTS_FUNCTIONS | QT_MWM_HINTS_DECORATIONS;
prop.functions |= QT_MWM_ALL_FUNCS_WITHOUT_RESIZE;
prop.decorations |= QT_MWM_ALL_DECOR_WITHOUT_RESIZE_HANDLE;
Atom atom = XInternAtom(x11Display(), QT_XA_MOTIF_WM_HINTS, false);
winId(),
atom, atom,
32,
PropModeReplace,
(u_char*) &prop,
sizeof(PropMotifWmHints) / sizeof(long));
}
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <QX11Info>
void MyWidget::callIfWidgetIsTopLevelAndNonResizeable()
{
struct PropMotifWmHints
{
unsigned long flags;
unsigned long functions;
unsigned long decorations;
long inputMode;
unsigned long status;
};
#define QT_XA_MOTIF_WM_HINTS "_MOTIF_WM_HINTS"
#define QT_MWM_HINTS_FUNCTIONS 0x01
#define QT_MWM_HINTS_DECORATIONS 0x10
#define QT_MWM_ALL_FUNCS_WITHOUT_RESIZE 0x3C
#define QT_MWM_ALL_DECOR_WITHOUT_RESIZE_HANDLE 0x7A
PropMotifWmHints prop = {0};
prop.flags |= QT_MWM_HINTS_FUNCTIONS | QT_MWM_HINTS_DECORATIONS;
prop.functions |= QT_MWM_ALL_FUNCS_WITHOUT_RESIZE;
prop.decorations |= QT_MWM_ALL_DECOR_WITHOUT_RESIZE_HANDLE;
Atom atom = XInternAtom(x11Display(), QT_XA_MOTIF_WM_HINTS, false);
XChangeProperty(QX11Info::display(),
winId(),
atom, atom,
32,
PropModeReplace,
(u_char*) &prop,
sizeof(PropMotifWmHints) / sizeof(long));
}
To copy to clipboard, switch view to plain text mode
Bookmarks