[NTLUG:Discuss] How to take off the window's decoration??

kbrannen@gte.net kbrannen at gte.net
Thu Jan 9 12:54:05 CST 2003


xiao li wrote:
> Hi Steve,
> I use the same cose as you did. But it doesn't work!?
> So I wonder is there configuration problem I need to do??
> Thanks anyway.
...
>> I've had success with code like this - it works under KDE and GNOME - I
>> havn't tested it on any of the others:
>>
>> ------------------------------------------------------------------------------- 
>>
>>   PropMotifWmHints motif_hints ;
>>   Atom             prop, proptype ;
>>
>>   /* Set up the property */
>>
>>   motif_hints.flags = MWM_HINTS_DECORATIONS ;
>>   motif_hints.decorations = 0 ;   /* NO DECORATIONS */
>>
>>   /* get the atom for the property */
>>
>>   prop = XInternAtom ( disp->getDisplay(), "_MOTIF_WM_HINTS", True ) ;
>>
>>   if ( prop == 0 )
>>     return ;
>>
>>   /* not sure this is correct, seems to work, XA_WM_HINTS didn't work */
>>
>>   proptype = prop ;
>>
>>   XChangeProperty( disp->getDisplay(), Handle,
>>                    prop, proptype,                 /* property, type */
>>                    32,                             /* format: 32-bit 
>> datums */
>>                    PropModeReplace,                /* mode */
>>                    (unsigned char *) &motif_hints, /* data */
>>                    PROP_MOTIF_WM_HINTS_ELEMENTS    /* nelements */
>>                  ) ;
>> -------------------------------------------------------------------------------- 

Here's some code I used to use.  Note that it's very similiar to Steve's, but 
it is slightly different.  Also note that I haven't used this in away, so it 
may not work for you.  And as you can also see, I used to hard code some of 
the values, you may not want those defaults.

As has been pointed out, but probably should be reinterated, a window manager 
doesn't have to obey this, they are only hints.  However, mwm was pretty good 
about always taking the hint. (bada bing bada boom! :-)

Good Luck!
Kevin


void xMwmShellDecor(Widget w, int decorations)
{

         PropMwmHints  prop;
         Atom          atom;

         atom = XmInternAtom(XtDisplay(w), _XA_MWM_HINTS, False);

         prop.flags        = MWM_HINTS_DECORATIONS | MWM_HINTS_FUNCTIONS;
         prop.functions    = MWM_FUNC_MINIMIZE | MWM_FUNC_MOVE;
         prop.decorations  = decorations
                             ? decorations
                             : (MWM_DECOR_BORDER | MWM_DECOR_TITLE);
         prop.inputMode    = 0L;

         XChangeProperty(XtDisplay(w), XtWindow(w),
                         atom, atom, 32, PropModeReplace,
                         (unsigned char *)&prop, PROP_MWM_HINTS_ELEMENTS);
}





More information about the Discuss mailing list