[haiku-commits] r33474 - haiku/trunk/src/apps/haiku3d

  • From: alex@xxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 7 Oct 2009 02:12:25 +0200 (CEST)

Author: aldeck
Date: 2009-10-07 02:12:25 +0200 (Wed, 07 Oct 2009)
New Revision: 33474
Changeset: http://dev.haiku-os.org/changeset/33474/haiku

Modified:
   haiku/trunk/src/apps/haiku3d/App.cpp
   haiku/trunk/src/apps/haiku3d/App.h
   haiku/trunk/src/apps/haiku3d/Haiku3d.rdef
   haiku/trunk/src/apps/haiku3d/MainWindow.cpp
   haiku/trunk/src/apps/haiku3d/MainWindow.h
Log:
* Fixed closing via deskbar's close all. The problem was that i forgot to
define the app_flags in the rdef, case that isn't well handled apparently
when creating a BMessenger targeting the app.
Thanks to Michael and Rene for helping! Fixes #4712

* Removed unneeded and faulty App::MessageReceived and a strange (probably
 copy pasted then forgotten) MainWindow::QuitRequested.
* Minor changes. Made App destructor virtual, moved init into ReadyToRun,
 fixed a few style violations.


Modified: haiku/trunk/src/apps/haiku3d/App.cpp
===================================================================
--- haiku/trunk/src/apps/haiku3d/App.cpp        2009-10-06 22:57:35 UTC (rev 
33473)
+++ haiku/trunk/src/apps/haiku3d/App.cpp        2009-10-07 00:12:25 UTC (rev 
33474)
@@ -14,11 +14,9 @@
 
 App::App()
        :
-       BApplication("application/x-vnd.Haiku-Haiku3d")
+       BApplication("application/x-vnd.Haiku-Haiku3d"),
+       fMainWindow(NULL)
 {
-       BRect frame(50, 50, 640 + 50, 480 + 50);
-       const char *title = "Haiku3d";
-       fMainWindow = new MainWindow(frame, title);
 }
 
 
@@ -27,16 +25,29 @@
 }
 
 
-void App::AboutRequested()
+void
+App::ReadyToRun()
 {
+       BRect frame(50, 50, 640 + 50, 480 + 50);
+       const char* title = "Haiku3d";
+       fMainWindow = new MainWindow(frame, title);
+       fMainWindow->Show();
+}
+
+
+void
+App::AboutRequested()
+{
        BAlert* alert;
        alert = new BAlert("About", "A little 3d demo", "ok");
        alert->Go(NULL);
 }
 
 
-void App::MessageReceived(BMessage *message)
+bool
+App::QuitRequested()
 {
+       return true;
 }
 
 

Modified: haiku/trunk/src/apps/haiku3d/App.h
===================================================================
--- haiku/trunk/src/apps/haiku3d/App.h  2009-10-06 22:57:35 UTC (rev 33473)
+++ haiku/trunk/src/apps/haiku3d/App.h  2009-10-07 00:12:25 UTC (rev 33474)
@@ -12,15 +12,16 @@
 #include <Application.h>
 
 class App: public BApplication {
-protected:
-       BWindow*                fMainWindow;
 public:
                                        App();
-                                       ~App();
+       virtual                 ~App();
 
+       virtual void    ReadyToRun();
        virtual void    AboutRequested();
-       virtual void    MessageReceived(BMessage *message);
+       virtual bool    QuitRequested();
 
+protected:
+       BWindow*                fMainWindow;
 };
 
 #endif /* _APP_H */

Modified: haiku/trunk/src/apps/haiku3d/Haiku3d.rdef
===================================================================
--- haiku/trunk/src/apps/haiku3d/Haiku3d.rdef   2009-10-06 22:57:35 UTC (rev 
33473)
+++ haiku/trunk/src/apps/haiku3d/Haiku3d.rdef   2009-10-07 00:12:25 UTC (rev 
33474)
@@ -6,7 +6,7 @@
  *             Alexandre Deckner alex@xxxxxxxxxxxx
  */
 
-resource(1, "BEOS:APP_SIG") #'MIMS' "application/x-vnd.Haiku-Haiku3d";
+resource app_signature "application/x-vnd.Haiku-Haiku3d";
 
 resource app_version {
        major  = 1,
@@ -20,6 +20,8 @@
        long_info = "Haiku3d ©2009 Haiku, Inc."
 };
 
+resource app_flags B_SINGLE_LAUNCH;
+
 resource vector_icon {
        $"6E6369660603040E0B02001602380BBEBE16B13FA2DA398FCAC733EC49EB0A00"
        $"C0FFFF020016023F09763F2172BEF5F53EDF474C8602C9BA65008DFFFF020016"

Modified: haiku/trunk/src/apps/haiku3d/MainWindow.cpp
===================================================================
--- haiku/trunk/src/apps/haiku3d/MainWindow.cpp 2009-10-06 22:57:35 UTC (rev 
33473)
+++ haiku/trunk/src/apps/haiku3d/MainWindow.cpp 2009-10-07 00:12:25 UTC (rev 
33474)
@@ -35,16 +35,13 @@
 bool
 MainWindow::QuitRequested()
 {
-       be_app->Lock();
-       if (be_app->CountWindows() < 2)
-               be_app_messenger.SendMessage(B_QUIT_REQUESTED);
-       be_app->Unlock();
+       be_app->PostMessage(B_QUIT_REQUESTED);
        return true;
 }
 
 
 void
-MainWindow::MessageReceived(BMessage *message)
+MainWindow::MessageReceived(BMessage* message)
 {
        switch (message->what) {
                default:

Modified: haiku/trunk/src/apps/haiku3d/MainWindow.h
===================================================================
--- haiku/trunk/src/apps/haiku3d/MainWindow.h   2009-10-06 22:57:35 UTC (rev 
33473)
+++ haiku/trunk/src/apps/haiku3d/MainWindow.h   2009-10-07 00:12:25 UTC (rev 
33474)
@@ -18,7 +18,7 @@
                                        ~MainWindow();
 
        virtual bool    QuitRequested();
-       virtual void    MessageReceived(BMessage *message);
+       virtual void    MessageReceived(BMessage* message);
        virtual void    DirectConnected(direct_buffer_info* info);
 
 protected:


Other related posts: