Please consider a donation to the Higher Intellect project. See https://preterhuman.net/donate.php or the Donate to Higher Intellect page for more info.

Can I fudge() X windows

From Higher Intellect Vintage Wiki

Q:

Is there any X equivalent to to the GL fudge() routine?

It seems that there must be, because GL programs still work under X windows, but I can't find anything anywhere in any books.


A:

GL is not a direct throughput to X; it has different building philosophies about a lot of things. So you could expect to have GL have a 'struct Window { Size fudge_size; ... }' and at these numbers to the windows size when doing a size request (either by calling winopen(), and/or by the user doing a resize (although this should not do the add, but you should subtract the fudge size from your client area)).

Since IRIS GL's windowing support (since IRIX 4.0) is really all built on top of Xlib, you can definitely get the same effect as fudge() on your own, but it is pretty obscure.

fudge() works by filling in the base_width and base_height fields of the X ICCCM WM_NORMAL_HINTS toplevel window property.

Get the same effect with something like this:

  XSizeHints *size_hints = XAllocSizeHints();

  size_hints->flags = PBaseSize;
  size_hints->base_width = fudge_width;
  size_hints->base_height = fudge_height;

  /* set an other size_hints fields you want; remember to
     logicOR in the flag argument for any fields you set. */

  XSetNormalHints(dpy, win, size_hints);

See /usr/include/X11/Xutil.h's XSizeHints structure to understand what the property lets you do.

You could also use XGetNormalHints to readback whatever hints already exist so you could do a read-modify-write of the ICCCM property if a toolkit like Motif is already making an initial attempt at the property.

BTW, I didn't try the code above to make sure this is right.

Also, note that the base_width and base_height fields were not in the original ICCCM spec so really old window managers might not understand it (4Dwm definitely does).