[haiku-development] app_server flag fixes

  • From: Caitlin Shaw <rogueeve@xxxxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sun, 04 Oct 2009 12:04:59 -0700

I was investigating why the Vulcan Death Grip no longer works to kill DeskBar tabs (actually it does, it's just it's now CTRL+WIN+SHIFT instead of CTRL+ALT+SHIFT). And noticed what appear to be some issues with some of the new window flags:


By default, the server will "eat" mouse-clicks made while CTRL+ALT is down, and treat the click as if it were a click on the window tab (i.e. you can move the window around while clicking within the window client area). The flag B_NO_SERVER_SIDE_WINDOW_MODIFIERS is said to disable this behavior, but doesn't seem to actually work.

The problem seems to be in src/servers/app/Window.cpp(1849). The flag is not one of the ones listed in ValidWindowFlags(), and so is filtered out by the app_server. Adding the flag to ValidWindowFlags() got it working for me. I assume, but did not actually check, that two other flags which were missing, B_CLOSE_ON_ESCAPE and B_AUTO_UPDATE_SIZE_LIMITS, were also broken.

It looks like someone added the flags into headers/os/interface/Window.h(61) but forgot to add them into ValidWindowFlags(). The simple patch is to add the flags to ValidWindowFlags(), however it seems it would help ensure this would not occur again if the flags did not have to match up in two separate source files. My initial idea was to define a new constant, e.g. B_VALID_WINDOW_FLAGS, within Window.h and have ValidWindowFlags() just return that constant. The constant would be placed right below the enum so it would be obvious to someone adding a flag to the enum that B_VALID_WINDOW_FLAGS was supposed to be updated as well. However, Window.h is not just an app_server file but the actual <Window.h> provided to all applications, so was hesitant to submit a patch changing it without asking the developers first.

Two other things:

It seems to make sense that the CTRL+ALT trick to move the window should only "eat" the click if you pressed exactly CTRL+ALT, not e.g. "CTRL+ALT+SHIFT". This idea also seems to be mentioned in a comment by stippi to ticket 4230. I patched mine to do this; do folks approve of this change?

It also occurred to me that if the window is not movable, and a CTRL+ALT click is done within it's contents using the primary mouse button, then the "server side window modifiers" are meaningless in that particular case anyway, so the click might want to be let through. What do you think, makes sense or inconsistent?


Other related posts: