Activate already showing, possibly unfocused window if Backgrounds gets launched while already running. Small clean-up.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33942 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jonas Sundström 2009-11-08 00:25:48 +00:00
parent 9669d0859b
commit 529ff59fed

View File

@ -20,26 +20,28 @@ static const char* kSignature = "application/x-vnd.Haiku-Backgrounds";
class BackgroundsWindow : public BWindow {
public:
BackgroundsWindow();
public:
BackgroundsWindow();
void RefsReceived(BMessage* message);
void RefsReceived(BMessage* message);
protected:
virtual bool QuitRequested();
virtual void WorkspaceActivated(int32 oldWorkspaces, bool active);
protected:
virtual bool QuitRequested();
virtual void WorkspaceActivated(int32 oldWorkspaces,
bool active);
BackgroundsView* fBackgroundsView;
BackgroundsView* fBackgroundsView;
};
class BackgroundsApplication : public BApplication {
public:
BackgroundsApplication();
virtual void RefsReceived(BMessage* message);
public:
BackgroundsApplication();
virtual void MessageReceived(BMessage* message);
virtual void RefsReceived(BMessage* message);
private:
BackgroundsWindow* fWindow;
private:
BackgroundsWindow* fWindow;
};
@ -55,6 +57,20 @@ BackgroundsApplication::BackgroundsApplication()
}
void
BackgroundsApplication::MessageReceived(BMessage* message)
{
switch (message->what) {
case B_SILENT_RELAUNCH:
fWindow->Activate();
break;
default;
BApplication::MessageReceived(message);
break;
}
}
void
BackgroundsApplication::RefsReceived(BMessage* message)
{
@ -88,6 +104,7 @@ void
BackgroundsWindow::RefsReceived(BMessage* message)
{
fBackgroundsView->RefsReceived(message);
Activate();
}