On Wed, May 05, 2004 at 03:03:41AM -0400, Salvatore Domenick Desiano wrote:
> I've been using FVWM for almost ten years, now, so in a sense, every piece
> of work I've done in the last decade owes at least something to FVWM. So,
> my sincere thanks to the team.
> 
> Lately I decided to overhaul my setup, and I've been making heavy use of
> the State portions of window states and styles. I've primarily been using
> a snapshot from April 28, just after the State style was added. Something
> odd was happening, so I started looking poring through and debugging the
> code. Wow. Impressive code base.
> 
> Now, all I know about the code base is what I've learned from printf
> debugging over the last week, so please pardon me if I sound like a
> numnut. Here are is what I think I've learned, and I am intentionaly
> stating the obvious to make sure I'm not making any stupid mistakes, and
> my conclusions:
> 
> 1. Using the WindowStyle command adds a style to the all_styles that is
>    specific to a given window ID.
> 2. The UserState is stored in the flag portion of a style.
> 3. There are four copies of the flags. The actual flags are stored in
>    "flags". The mask of which flags have actually been set is in
>    "flag_mask". To be honest, I haven't figured out how "flag_default"
>    and "change_mask" are used.

The change_mask indicates which flags have been changed recently
but not yet applied to the corresponding windows.  The
flag_default is used to allow for non-zero default values if the
style has never been set (or its last instance has been deleted).
It is used only for a couple of old styles to allow backwards
compatibility.  It's usually not necessary to fiddle with the
defaults.

> 4. The flag portions of styles are merged, bit-by-bit, at the end of
>    merge_styles (style.c).
> 5. The flag sets for the State style are set toward the end of
>    style_parse_one_style_option (style.c:~3650). In this chunk of code,
>    states corresponds to the old states value, mask is a mask of which
>    state bit is being set. This mask is then used to update state.
> 6. The common flags (SCF) are set to state. This appears to be
>    correct.

> 7. The flag mask (SCM) is currently set to 1. I think this is
>    incorrect. I think this should be set to
>    S_USER_STATES(SCM(*ps)) | mask. Right now, only the bottom bit of the
>    mask is ever changed.

Yes.

> 8. I'm not sure how the change mask is used, but I suspect that it needs
>    to be set differently.

The mask has to be or'ed into the change_mask too.  As far as I
know, the flag_mask and the change_mask are always treated the
same when a style is used.

> 9. I have no idea how the default mask is used.

It's irrelevant here.

> I'm loathe to actually change the code in CVS, since I'm not even remotely
> on the development team, so here is the snippet that I think needs to be
> changed:
> 
>       else if (StrEquals(token, "State"))
>       {
>               spargs = GetIntegerArguments(rest, NULL, tmpno, 1);
>               if (spargs == 1 && tmpno[0] >= 0 && tmpno[0] <= 31)
>               {
>                       unsigned int old_state;
>                       unsigned int set_mask;
>                       unsigned int new_state;
>                       unsigned int flag_mask;
>                       unsigned int change_mask;
>                       unsigned int default_mask;
> 
>                       old_state = S_USER_STATES(SCF(*ps));
>                       set_mask = (1 << tmpno[0]);
>                       new_state = old_state;
>                       if (on)
>                       {
>                               new_state |= mask;
>                       }
>                       else
>                       {
>                               new_state &= ~mask;
>                       }
>                       flag_mask = S_USER_STATES(SCM(*ps))
>                       flag_mask |= mask;
>                       change_mask = S_USER_STATES(SCC(*ps));

>                       change_mask |= ~(new_state ^ old_state)

Make that

>                       change_mask |= mask;

Not that it matters.  For the "State" style, the change_mask is
never used because it applies only to new windows.

Just delete this.

>                       default_mask = S_USER_STATES(SCD(*ps));
>                       default_mask = ????;

> 
>                       S_SET_USER_STATES(SCF(*ps), new_state);
>                       S_SET_USER_STATES(SCM(*ps), flag_mask);
>                       S_SET_USER_STATES(SCC(*ps), change_mask);

.. and this:

>                       S_SET_USER_STATES(SCD(*ps), default_mask);

>               }
>               else
>               {
>                       fvwm_msg(
>                               ERR,"style_parse_one_style_option",
>                               "bad State arg: %s", rest);
>               }
>       }
> 
> 
> Thanks again for all of your hard work. Hope this is useful.

I'll commit a fix.

Ciao

Dominik ^_^  ^_^

 --
Dominik Vogt, [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]

--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [EMAIL PROTECTED]
To report problems, send mail to [EMAIL PROTECTED]

Reply via email to