Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8972943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:20:19+00:00 2026-06-15T18:20:19+00:00

This C function can be used to disable or enable windows decorations in many

  • 0

This C function can be used to disable or enable windows decorations in many window managers. If ‘mode’ is ‘d’ the window will hide the decorations, otherwise if the ‘mode’ is ‘D’ the window will show them.

void window_tune_decorations(Display *disp, Window win, char mode) {
    long hints[5] = { 2, 0, 0, 0, 0};
    Atom motif_hints = XInternAtom(disp, "_MOTIF_WM_HINTS", False);

    switch (mode) {
        case 'D':
            hints[2] = 1;
            /* fall through */
        case 'd':
            XChangeProperty(disp, win, motif_hints, motif_hints, 32, PropModeReplace, (unsigned char *)hints, 5);
            break;
        default:
            fputs("Invalid mode.\n", stderr);
    }
}

I would like to implement a “toggle mode”. So my question is, there a way to detect if a windows has the decorations?
I tried using XGetWindowProperty with _MOTIF_WM_HINTS, but I am not sure how to interpret the output.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T18:20:20+00:00Added an answer on June 15, 2026 at 6:20 pm

    You interpret the data you get from XGetWindowProperty the same way you interpret data sent to XChangeProperty.

    In the case of _MOTIF_WM_HINTS it’s an array of 5 longs, or perhaps the struct MwmHints (syn. MotifWmHints). It’s a struct of 5 long fields, plus several #defined bit flags. It is inherited from the Motif window manager, but we don’t usually keep Motif includes and libraries around nowadays, so the struct gets copied to various places (bad practice but everyonee is doing it). You may find its definition in xprops.h of Gnome and several other places. Look it up on the ‘net and copy to your code, or find it in an include file you already depend on, or just look at the definition and keep using the array of 5 longs, your choice.

    You need to check the right flags in the right fields. For decorations, check if the window is override-redirect first. If it is, it is undecorated (obviously) and you cannot add any decorations. If the window manager is not running, it’s undecorated as well, and you cannot add any decorations in this case too.

    Otherwise, if the window does not have the property at all (XGetWindowProperty sets type to None), you may assume it’s decorated.

    If it does have the property, and MWM_HINTS_DECORATIONS bit is set in flags, then it has exactly the decorations specified in the decorations field by the MWM_DECOR_* bit values. If the field is non-zero, there are some decorations present. AFAIK if MWM_HINTS_DECORATIONS is unset, then the window is (surprisingly) decorated. But please test this yourself, I don’t remember and don’t have an X11 machine around at the moment so I can’t check it.

    Naturally, some window managers don’t use _MOTIF_WM_HINTS (e.g. ones that were around before Motif). If you have one of those, you cannot check or set decorations with this method.

    Don’t forget to XFree(hints).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given i have the IO function: // this can either be IO or some
I can't run this function. It gives the error: ERROR at line 9: PL/SQL:
Can someone elaborate how this function works? Does it load every time from disk
This is quite weird but my search function can search for any word except
Can anyone tell me why this function is not working ? for(var i=1;i<=12;i++) {
Does anyone know how I can reverse this function to produce the original input
I'm a bit worried if this function sends emails that can be recognized correctly
So I know I can write my own HTML-encoding function like this: function getHTMLEncode(t)
Please help me. I can't understand why this function, that uses texture memory __global__
I am a Ruby newbie. How can I write better for this function? can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.