[haiku-development] BAboutWindow lifecycle

  • From: pulkomandy@xxxxxxxxxxxxx
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Mon, 29 Apr 2013 19:55:37 +0200

Hello devs,

I have a problem with the way our BAboutWindow currently behaves. The idea 
of the current code is that you create the window on the first call to
App::AboutRequested and show it. Instead of closing, the window is hidden, 
so that subsequent calls just show it again.

To do this, the BAboutWindow code overrides QuitRequested to hide the 
window and return false (that stops the quitting process). An annoying side 
effect is that Application::QuitRequested will not quit the app if a window 
returns false from this method.

Moreover, having the window hidden means its BLooper keeps running. This 
sounds like wasting more resources that recreating the window if it is 
needed again (an unlikely event, you don't usually look at an about window 
multiple times). It also is nonstandard behavior, and a trap for the 
unsuspecting developers using the class.

This can easily be fixed by letting the window close. Callers in our source 
tree can be adjusted to always recreate it. There is a regression in doing 
that, however: we also had code to detect an already visible about window 
and bring it to the current workspace and/or activating it. I can see no 
easy way of doing that if the application does not keep a reference to the 
window, and since the window can quit itself, I don't see how the app could 
make sure the reference is still valid.

I think a way to solve this is making the about window application-modal. 
This will make sure it is above other windows for the app and removes the 
need for explicitly activating it in useful cases (you could still manage 
to open multiple about windows using hey, but I don't think that's an 
actual problem). Having separate about window in different workspaces don't 
seem too much of a problem either (or maybe application-modality already 
solves that as well ?)

On a final note, I also plan to use BAboutWindow as the default behavior 
for BApplication::BAboutRequested, which currently opens a BAlert with just 
the application name in it. I think BAboutWindow will show good enough 
results (it gets the icon, application name, and other informations from 
the app resources).

I wanted to make sure it's ok to do these changes, as it will need 
reworking all BAboutWindow users in our source tree. Is everyone ok with 
these changes?

-- 
Adrien.

Other related posts: