Re: FVWM: window flags bitfield

From: Paul D. Smith <psmith_at_BayNetworks.COM>
Date: 10 Dec 1997 11:25:02 -0500

%% Dan Espen <dane_at_mk.bellcore.com> writes:

  de> Maybe I'm confused. There are flags in the WindowList structure, and
  de> flags in the name_list (Style flags) structure. The bits serve
  de> different purposes in each. In both cases, it looks like all the bits
  de> are used up. I thought the term GSFR applied to the Style Flags.

I think it does, although any flags field where all the bits are used up
is a potential problem.

  de> In the case of the WindowList, I don't see any obstacle to adding
  de> another unsigned long (flags2?) to hold additional bits.

  de> On the separate subject of the style flags, after the iconboxes patch,
  de> I don't see any obstacle to doing the same thing for new style
  de> bitfields.

The problem is, as you say, all the bits are used up. There are many
ways to solve the problem, of course. One way is this, keep adding new
ulongs with new names. That's probably the most trivial way to fix it.

I don't like this (although I don't hack fvwm so I don't really have any
say :); now when you want to test a flag you have to remember and put in
the code which "flags" param it is: flags, flags2, flags3, etc. It's
just kind of gross.

I'd prefer changing the type of the flags field from ulong to an array
of unsigned char, something like this:

  #include <limits.h>

  #ifndef CHAR_BIT
  #define CHAR_BIT 8 /* ISO C should #define this for us in limits.h */
  #endif

    ...

  #define MAX_STYLE_FLAGS 54 /* Increment for new flags */

  #define STYLE_FLAG_SIZE ((MAX_FLAGS/CHAR_BIT)+1)

  ...
    unsigned char on_flags[STYLE_FLAG_SIZE];
  ...

then provide a set of functions or macros for testing and setting bits
and hiding this structure.

Since this touches all code that currently looks at these bits, it was
decided it's too big a change to make before 2.1. Of course, that was
when we thought 2.1 would be out in the summer of 1996 or so ;) :)

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <psmith_at_baynetworks.com>         Network Management Development
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
     These are my opinions--Bay Networks takes no responsibility for them.
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to majordomo_at_hpc.uh.edu.
To report problems, send mail to fvwm-owner_at_hpc.uh.edu.
Received on Wed Dec 10 1997 - 10:28:13 GMT

This archive was generated by hypermail 2.3.0 : Mon Aug 29 2016 - 19:38:01 BST