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
+22 -5
View File
@@ -20,25 +20,27 @@ static const char* kSignature = "application/x-vnd.Haiku-Backgrounds";
class BackgroundsWindow : public BWindow { class BackgroundsWindow : public BWindow {
public: public:
BackgroundsWindow(); BackgroundsWindow();
void RefsReceived(BMessage* message); void RefsReceived(BMessage* message);
protected: protected:
virtual bool QuitRequested(); virtual bool QuitRequested();
virtual void WorkspaceActivated(int32 oldWorkspaces, bool active); virtual void WorkspaceActivated(int32 oldWorkspaces,
bool active);
BackgroundsView* fBackgroundsView; BackgroundsView* fBackgroundsView;
}; };
class BackgroundsApplication : public BApplication { class BackgroundsApplication : public BApplication {
public: public:
BackgroundsApplication(); BackgroundsApplication();
virtual void MessageReceived(BMessage* message);
virtual void RefsReceived(BMessage* message); virtual void RefsReceived(BMessage* message);
private: private:
BackgroundsWindow* fWindow; 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 void
BackgroundsApplication::RefsReceived(BMessage* message) BackgroundsApplication::RefsReceived(BMessage* message)
{ {
@@ -88,6 +104,7 @@ void
BackgroundsWindow::RefsReceived(BMessage* message) BackgroundsWindow::RefsReceived(BMessage* message)
{ {
fBackgroundsView->RefsReceived(message); fBackgroundsView->RefsReceived(message);
Activate();
} }