Author: manolo
Date: 2010-03-26 09:04:06 -0700 (Fri, 26 Mar 2010)
New Revision: 7340
Log:
Removed 3 Carbon calls from file Fl_cocoa.mm

Modified:
   branches/branch-1.3/src/Fl_cocoa.mm

Modified: branches/branch-1.3/src/Fl_cocoa.mm
===================================================================
--- branches/branch-1.3/src/Fl_cocoa.mm 2010-03-25 16:53:05 UTC (rev 7339)
+++ branches/branch-1.3/src/Fl_cocoa.mm 2010-03-26 16:04:06 UTC (rev 7340)
@@ -45,15 +45,9 @@
  "_GetKeys", referenced from:
  Fl::get_key(int)  in Fl_get_key.o
  
- "_GetCurrentEventQueue", referenced from:
- do_queued_events(double)in Fl.o
- 
  "_InstallEventLoopTimer", referenced from:
  Fl::add_timeout(double, void (*)(void*), void*)in Fl.o
  
- "_FlushEvents", referenced from:
- fl_open_display()     in Fl.o
- 
  "_GetEventParameter", referenced from:
  carbonTextHandler(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*) in Fl.o
  
@@ -73,9 +67,6 @@
  "_GetMainEventLoop", referenced from:
  Fl::add_timeout(double, void (*)(void*), void*)in Fl.o
  
- "_GetCurrentKeyModifiers", referenced from:
- -[FLView flagsChanged:] in Fl.o
- 
  */
 
 #ifndef FL_DOXYGEN
@@ -289,7 +280,6 @@
   fd_set _fdsets[3];           // r/w/x sets user wants to monitor
   int _maxfd;                  // max fd count to monitor
   int _cancelpipe[2];          // pipe used to help cancel thread
-  void *_userdata;             // thread's userdata
   
 public:
   DataReady()
@@ -302,7 +292,6 @@
     pthread_mutex_init(&_datalock, NULL);
     FD_ZERO(&_fdsets[0]); FD_ZERO(&_fdsets[1]); FD_ZERO(&_fdsets[2]);
     _cancelpipe[0] = _cancelpipe[1] = 0;
-    _userdata = 0;
     _maxfd = 0;
   }
   
@@ -333,7 +322,7 @@
   int CheckData(fd_set& r, fd_set& w, fd_set& x);
   void HandleData(fd_set& r, fd_set& w, fd_set& x);
   static void* DataReadyThread(void *self);
-  void StartThread(void *userdata);
+  void StartThread(void);
   void CancelThread(const char *reason);
 };
 
@@ -437,7 +426,6 @@
     /*LOCK*/  fd_set r = self->GetFdset(0);
     /*LOCK*/  fd_set w = self->GetFdset(1);
     /*LOCK*/  fd_set x = self->GetFdset(2);
-    //    /*LOCK*/  void *userdata = self->_userdata;
     /*LOCK*/  int cancelpipe = self->GetCancelPipe(0);
     /*LOCK*/  if ( cancelpipe > maxfd ) maxfd = cancelpipe;
     /*LOCK*/  FD_SET(cancelpipe, &r);          // add cancelpipe to fd's to 
watch
@@ -474,12 +462,11 @@
 }
 
 // START 'DATA READY' THREAD RUNNING, CREATE INTER-THREAD PIPE
-void DataReady::StartThread(void *new_userdata)
+void DataReady::StartThread(void)
 {
   CancelThread(DEBUGTEXT("STARTING NEW THREAD\n"));
   DataLock();
   /*LOCK*/  pipe(_cancelpipe); // pipe for sending cancel msg to thread
-  /*LOCK*/  _userdata = new_userdata;
   DataUnlock();
   DEBUGMSG("*** START THREAD\n");
   pthread_create(&tid, NULL, DataReadyThread, (void*)this);
@@ -695,7 +682,7 @@
   
   // Start thread to watch for data ready
   if ( dataready.GetNfds() ) {
-    dataready.StartThread((void*)GetCurrentEventQueue());
+    dataready.StartThread();
   }
   
   fl_unlock_function();
@@ -1551,7 +1538,13 @@
     [NSApp setDelegate:mydelegate];
     [NSApp finishLaunching];
                
-    FlushEvents(everyEvent,0);
+    // empty the event queue
+    NSEvent *ign_event;
+    do ign_event = [NSApp nextEventMatchingMask:NSAnyEventMask 
+                                       untilDate:[NSDate 
dateWithTimeIntervalSinceNow:0] 
+                                          inMode:NSDefaultRunLoopMode 
+                                         dequeue:YES];
+    while (ign_event);
     
     fl_default_cursor = [NSCursor arrowCursor];
     Gestalt(gestaltSystemVersion, &MACsystemVersion);
@@ -1957,7 +1950,7 @@
 }
 - (void)flagsChanged:(NSEvent *)theEvent {
   fl_lock_function();
-  static UInt32 prevMods = mods_to_e_state( GetCurrentKeyModifiers() );
+  static UInt32 prevMods = 0;
   NSUInteger mods = [theEvent modifierFlags];
   Fl_Window *window = (Fl_Window*)[(FLWindow*)[theEvent window] getFl_Window];
   UInt32 tMods = prevMods ^ mods;

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to