Ticket #1355: 1355.diff

File 1355.diff, 3.0 KB (added by NateEag, 16 years ago)

A possible fix for the bug, with a tiny bit of style cleanup too.

  • src/apps/glteapot/TeapotApp.h

     
    1313    public:
    1414        TeapotApp(const char* sign);
    1515        virtual void MessageReceived(BMessage* msg);
    16 //      void AboutRequested();
    1716    private:
    1817        TeapotWindow*   fTeapotWindow;
    1918};
  • src/apps/glteapot/TeapotWindow.cpp

     
    4141    BMenuItem*  item;
    4242    msg.AddInt32("num", 256);
    4343    menu->AddItem(item = new BMenuItem("Add a teapot", new BMessage(msg), 'N'));
    44     item->SetTarget(fObjectView);   
     44    item->SetTarget(fObjectView);
    4545    menu->AddSeparatorItem();
    46     menu->AddItem(item = new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED), 'Q'));
    47     item->SetTarget(be_app);
    48     msg.RemoveName("num");
     46    menu->AddItem(new BMenuItem("Quit", new BMessage(M_FILE_QUIT), 'Q'));
    4947    menuBar->AddItem(menu = new BMenu("Options"));
    5048    menu->AddItem(item = new BMenuItem("Perspective", new BMessage(kMsgPerspective)));
    5149    item->SetTarget(fObjectView);
     
    6866    menu->AddItem(item = new BMenuItem("Gouraud shading", new BMessage(kMsgGouraud)));
    6967    item->SetTarget(fObjectView);
    7068    item->SetMarked(true);
    71 //  menu->AddItem(item = new BMenuItem("Texture mapped", new BMessage(kMsgTextured)));
    72 //  item->SetTarget(fObjectView);
    7369    menu->AddItem(item = new BMenuItem("Fog", new BMessage(kMsgFog)));
    7470    item->SetTarget(fObjectView);
    7571
     
    163159bool
    164160TeapotWindow::QuitRequested()
    165161{
    166 //  printf("closing \n");
    167162    fObjectView->EnableDirectMode(false);
    168163    be_app->PostMessage(B_QUIT_REQUESTED);
     164
    169165    return true;
    170166}
    171167
     
    182178void
    183179TeapotWindow::MessageReceived(BMessage* msg)
    184180{
    185 //  msg->PrintToStream();
    186181    switch (msg->what) {
     182        case M_FILE_QUIT:
     183            PostMessage(B_QUIT_REQUESTED);
     184            break;
     185
    187186        default:
    188187            BDirectWindow::MessageReceived(msg);
    189     }       
     188    }
    190189}
  • src/apps/glteapot/TeapotWindow.h

     
    1010
    1111#include "ObjectView.h"
    1212
     13enum {
     14  M_FILE_QUIT
     15};
     16
    1317class TeapotWindow : public BDirectWindow {
    1418    public:
    1519        TeapotWindow(BRect r, char* name, window_type wt, ulong something);
    1620       
    1721        virtual bool QuitRequested();
    18         virtual void DirectConnected( direct_buffer_info* info );
     22        virtual void DirectConnected(direct_buffer_info* info);
    1923        virtual void MessageReceived(BMessage* msg);
    2024
    2125    private:
  • src/apps/glteapot/TeapotApp.cpp

     
    2626void
    2727TeapotApp::MessageReceived(BMessage* msg)
    2828{
    29 //  msg->PrintToStream();
    3029    switch (msg->what) {
    3130
    3231        default: