Results 1 to 5 of 5

Thread: setting EWM (extended window manager) hints via Qt4 (X11)

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    Join Date
    Jan 2006
    Location
    Mountain View, CA
    Posts
    279
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanked 42 Times in 37 Posts

    Default Re: setting EWM (extended window manager) hints via Qt4 (X11)

    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:

    Qt Code:
    1. #include <X11/Xlib.h>
    2. #include <X11/Xutil.h>
    3. #include <X11/Xatom.h>
    4.  
    5. #include <QX11Info>
    6.  
    7. void MyWidget::callIfWidgetIsTopLevelAndNonResizeable()
    8. {
    9. struct PropMotifWmHints
    10. {
    11. unsigned long flags;
    12. unsigned long functions;
    13. unsigned long decorations;
    14. long inputMode;
    15. unsigned long status;
    16. };
    17. #define QT_XA_MOTIF_WM_HINTS "_MOTIF_WM_HINTS"
    18. #define QT_MWM_HINTS_FUNCTIONS 0x01
    19. #define QT_MWM_HINTS_DECORATIONS 0x10
    20. #define QT_MWM_ALL_FUNCS_WITHOUT_RESIZE 0x3C
    21. #define QT_MWM_ALL_DECOR_WITHOUT_RESIZE_HANDLE 0x7A
    22.  
    23. PropMotifWmHints prop = {0};
    24. prop.flags |= QT_MWM_HINTS_FUNCTIONS | QT_MWM_HINTS_DECORATIONS;
    25. prop.functions |= QT_MWM_ALL_FUNCS_WITHOUT_RESIZE;
    26. prop.decorations |= QT_MWM_ALL_DECOR_WITHOUT_RESIZE_HANDLE;
    27.  
    28. Atom atom = XInternAtom(x11Display(), QT_XA_MOTIF_WM_HINTS, false);
    29. XChangeProperty(QX11Info::display(),
    30. winId(),
    31. atom, atom,
    32. 32,
    33. PropModeReplace,
    34. (u_char*) &prop,
    35. sizeof(PropMotifWmHints) / sizeof(long));
    36. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by Chicken Blood Machine; 28th March 2006 at 19:32.
    Save yourself some pain. Learn C++ before learning Qt.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.