paragui-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[paragui-cvs] CVS: paragui/src/core pgapplication.cpp,1.2.4.18,1.2.4.19


From: Alexander Pipelka <address@hidden>
Subject: [paragui-cvs] CVS: paragui/src/core pgapplication.cpp,1.2.4.18,1.2.4.19 pgmessageobject.cpp,1.1.6.6,1.1.6.7
Date: Wed, 16 Apr 2003 10:02:52 -0400

Update of /cvsroot/paragui/paragui/src/core
In directory subversions:/tmp/cvs-serv26038/src/core

Modified Files:
      Tag: devel-1-0
        pgapplication.cpp pgmessageobject.cpp 
Log Message:
- fixed event bug !
  Thanks Michael Bartl <address@hidden>



Index: pgapplication.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/core/pgapplication.cpp,v
retrieving revision 1.2.4.18
retrieving revision 1.2.4.19
diff -C2 -r1.2.4.18 -r1.2.4.19
*** pgapplication.cpp   5 Apr 2003 14:48:33 -0000       1.2.4.18
--- pgapplication.cpp   16 Apr 2003 14:02:49 -0000      1.2.4.19
***************
*** 196,199 ****
--- 196,202 ----
        assert(data);
  
+       // Flush queue
+       while(SDL_PollEvent(&event));
+ 
        while(!my_quitEventLoop) {
                
***************
*** 685,689 ****
        while(list != objectList.end()) {
  
!               if(*list == this) {
                        list++;
                        continue;
--- 688,692 ----
        while(list != objectList.end()) {
  
!               if(*list == this || *list == NULL) {
                        list++;
                        continue;
***************
*** 691,695 ****
  
                delete *list;
! 
                list = objectList.begin();
        }
--- 694,699 ----
  
                delete *list;
!               objectList.erase(list);
!               
                list = objectList.begin();
        }

Index: pgmessageobject.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/core/pgmessageobject.cpp,v
retrieving revision 1.1.6.6
retrieving revision 1.1.6.7
diff -C2 -r1.1.6.6 -r1.1.6.7
*** pgmessageobject.cpp 5 Apr 2003 14:48:33 -0000       1.1.6.6
--- pgmessageobject.cpp 16 Apr 2003 14:02:49 -0000      1.1.6.7
***************
*** 52,59 ****
  
        objectList.push_back(this);
- 
-       // init mutexes
-       //my_mutexSendMessage = SDL_CreateMutex();
-       //my_mutexReceiveMessage = SDL_CreateMutex();
  }
  
--- 52,55 ----
***************
*** 63,81 ****
  PG_MessageObject::~PG_MessageObject() {
  
-       // destroy mutexes
-       //SDL_DestroyMutex(my_mutexSendMessage);
-       //my_mutexSendMessage = NULL;
- 
-       //SDL_DestroyMutex(my_mutexReceiveMessage);
-       //my_mutexReceiveMessage = NULL;
- 
        RemoveObject(this);
  
        PG_UnregisterEventObject(this);
  
!       if (inputFocusObject == this)
                inputFocusObject = NULL;
!       if (lastwidget == this)
                lastwidget = NULL;
  }
  
--- 59,77 ----
  PG_MessageObject::~PG_MessageObject() {
  
        RemoveObject(this);
  
        PG_UnregisterEventObject(this);
  
!       if (inputFocusObject == this) {
                inputFocusObject = NULL;
!       }
! 
!       if (lastwidget == this) {
                lastwidget = NULL;
+       }
+ 
+       if (captureObject == this) {
+               captureObject = NULL;
+       }
  }
  
***************
*** 92,102 ****
        MSG_MESSAGE* msg = NULL;
        SDL_Event e;
-       
-       //if(SDL_mutexP(my_mutexReceiveMessage) == -1)
-       //      return false;
  
        // check if we are able to process messages
        if(!my_canReceiveMessages) {
-               //SDL_mutexV(my_mutexReceiveMessage);
                return false;
        }
--- 88,94 ----
***************
*** 105,109 ****
                if(captureObject != this)
                        if(!AcceptEvent(event)) {
-                               //SDL_mutexV(my_mutexReceiveMessage);
                                return false;
                        }
--- 97,100 ----
***************
*** 171,176 ****
        }
  
-       //SDL_mutexV(my_mutexReceiveMessage);
- 
        return rc;
  }
--- 162,165 ----
***************
*** 362,367 ****
        bool processed = false;
        vector<PG_MessageObject*>::iterator list = objectList.begin();
        while(list != objectList.end()) {
!               if((*list)->ProcessEvent(event)) {
                        processed = true;
                        break;          // exit loop if an object responds
--- 351,363 ----
        bool processed = false;
        vector<PG_MessageObject*>::iterator list = objectList.begin();
+       PG_MessageObject* o = NULL;
        while(list != objectList.end()) {
!               o = (*list);
!               if(o == NULL) {
!                       objectList.erase(list);
!                       list = objectList.begin();
!                       continue;
!               }
!               if(o->ProcessEvent(event)) {
                        processed = true;
                        break;          // exit loop if an object responds
***************
*** 414,420 ****
        }
  
!       // remove the object from the chain
!       objectList.erase(list);
! 
        return true;
  }
--- 410,416 ----
        }
  
!       // mark object for removal
!       *list = NULL;
!       
        return true;
  }
***************
*** 424,430 ****
        bool rc = false;
  
-       //if(SDL_mutexP(my_mutexSendMessage) == -1)
-       //      return false;
- 
        // check if there is a callback function
        PG_EVENTHANDLERDATA* cbdata = PG_FindEventHandler(type, this);
--- 420,423 ----
***************
*** 452,456 ****
  
                SDL_Event event;
!               event.type = SDL_USEREVENT;                                     
        // USEREVENT
                event.user.code = 0;                                            
        // RESERVED
                event.user.data1 = (void*)msg;                                  
// OUR MESSAGE OBJECT
--- 445,449 ----
  
                SDL_Event event;
!               event.type = SDL_USEREVENT;                                     
// USEREVENT
                event.user.code = 0;                                            
        // RESERVED
                event.user.data1 = (void*)msg;                                  
// OUR MESSAGE OBJECT
***************
*** 459,464 ****
                rc = (SDL_PushEvent(&event) == 0);
        }
- 
-       //SDL_mutexV(my_mutexSendMessage);
  
        return rc;
--- 452,455 ----





reply via email to

[Prev in Thread] Current Thread [Next in Thread]