[comp.windows.x] XSetNormalHints behaviour

jla@AI.MIT.EDU (Joseph Arceneaux) (06/27/89)

A couple of months ago I ran into the problem of consecutive calls to
XSetNormalHints obliterating the values I'd established in previous
calls.  Specifically, on the first call I'd set the size hints and if
no other call to the funtion was made, those values remained in
effect.  However, I noticed that a second call to XSetNormalHints
(with different flag values) would reset my previously initialized
values.  This situation led to the following code:

  if (prompting)                        /* Only set on the first call. */
    size_hints.flags |= prompting;
  else					/* Nasty kludge. */
    {
      XSizeHints hints;
      
      XGetNormalHints (x_current_display, window, &hints);
      if (hints.flags & PSize)
	size_hints.flags |= PSize;
      if (hints.flags & PPosition)
	size_hints.flags |= PPosition;
      if (hints.flags & USPosition)
	size_hints.flags |= USPosition;
      if (hints.flags & USSize)
	size_hints.flags |= USSize;
    }

  XSetNormalHints (x_current_display, window, &size_hints);

This seems to be rather aberrant behaviour.  Has anyone noticed
anything similar?  Is this a feature or a bug?  I've not retested this
in a while, but I believe I was using R3 at the time I discovered
this.

swick@ATHENA.MIT.EDU (Ralph R. Swick) (06/30/89)

     Date:  Mon, 26 Jun 89 14:20:16 EDT
     From:  jla@ai.mit.edu (Joseph Arceneaux)

     A couple of months ago I ran into the problem of consecutive calls to
     XSetNormalHints obliterating the values I'd established in previous
     calls.

It is definitely the case that XSetNormalHints replaces the entire
window property, not merely the fields flagged in the current call.
If you can't remember the original values, you'll have to query
them as you show in your example code.

This is documented in the Xlib specification, Chapter 9.
Page 277 in the Digital Press bible.