SawfishWM / sawfish

Sawfish Window-Manager
GNU General Public License v2.0
161 stars 32 forks source link

Restore support for Button9. #52

Closed derek-upham closed 4 months ago

derek-upham commented 2 years ago

This is the fix for the "revert" in 8b1c28809eee4d50c25fdd4cd0e4da7a46563556 eleven years ago (oof).

It looks like the specific choice of Button9Mask (1<<16) clobbered the low-order event bit. Even Button8Mask (1<<15) was bad, as it used the same mask as X11's AnyModifier.

This commit does a couple of things:

  1. Clean up the event type/mask enum.

    Put the button 6, 7, and 8 masks into the enum, where the reader can easily see how they relate to the others.

    Trim the masks, to precisely match the values that they cover.

    Document the three remaining bits, and why there are only three.

  2. Clean up button_num_init():

    Eliminate the use of snprintf/strncmp to find buttons to remove. The new explicit list is safer, and someone searching for "Button9" (for example) to find edit locations will find this easily.

    Calculate the number of buttons based on compile-time data. This gets rid of a magic number value that might be easy to miss during updates.

  3. Add button 9 throughout.

Nanolx commented 4 months ago

Thanks.