Fresco/SDL/src Console.cc,1.14,1.15 Console.hh,1.11,1.12

Nick Lewycky <[email protected]>
Newsgroups gmane.comp.video.fresco.cvs
Message-ID <[email protected]>
Update of /cvs/fresco/Fresco/SDL/src
In directory purcel:/tmp/cvs-serv15745/SDL/src

Modified Files:
	Console.cc Console.hh 
Log Message:
Back out patch from bug106.
Fix SDLConsole wakeup handling.


Index: Console.cc
===================================================================
RCS file: /cvs/fresco/Fresco/SDL/src/Console.cc,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- Console.cc	4 Jan 2003 13:51:02 -0000	1.14
+++ Console.cc	12 Jan 2003 02:25:09 -0000	1.15
@@ -123,8 +123,6 @@
   SDL_Init(SDL_INIT_VIDEO);
   SDL_ShowCursor(SDL_DISABLE);
   SDL_EnableUNICODE(SDL_ENABLE);
-
-  pipe(_wakeupPipe);
 }
 
 SDL::Console::~Console()
@@ -134,8 +132,6 @@
   for (dlist_t::iterator i = _drawables.begin();
        i != _drawables.end();
        i++) delete *i;
-  close(_wakeupPipe[0]);
-  close(_wakeupPipe[1]);
   SDL_Quit();
 }
 
@@ -189,20 +185,16 @@
   os << "sorry, device info isn't available for SDL at this time" << std::endl;
 }
 
-// a true result is a promise that we won't block when next_event is next called
-bool SDL::Console::has_event()
-{
-  Prague::Trace trace("SDL::Console::next_event()");
-
-  return SDL_PeepEvents(0, 1, SDL_PEEKEVENT, 0);
-}
-
 Input::Event *SDL::Console::next_event()
 {
   Prague::Trace trace("SDL::Console::next_event()");
   
   SDL_Event event;
   SDL_WaitEvent(&event);
+  if (event.type == SDL_USEREVENT)
+  {
+    return 0;
+  }
   return synthesize(event);
 }
 
@@ -210,7 +202,12 @@
 {
   Prague::Trace trace("SDL::Console::wakeup()");
 
-  char c = 'z'; write(_wakeupPipe[1],&c,1);
+  SDL_Event event;
+  event.type = SDL_USEREVENT;
+  SDL_PushEvent(&event);
+  event.user.code = 0;
+  event.user.data1 = 0;
+  event.user.data2 = 0;
 }
 
 Input::Event *SDL::Console::synthesize(const SDL_Event &e)
@@ -350,7 +347,7 @@
 				    double blue)
 {
 #ifdef RMDEBUG
-  // I try to stay 'below' the Drawable where ever possible so that bugs in
+  // I try to stay 'below' the Drawable whereever possible so that bugs in
   // that code cannot influence the highlighting.
 
   if (is_gl()) {

Index: Console.hh
===================================================================
RCS file: /cvs/fresco/Fresco/SDL/src/Console.hh,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- Console.hh	4 Jan 2003 13:51:02 -0000	1.11
+++ Console.hh	12 Jan 2003 02:25:09 -0000	1.12
@@ -124,7 +124,6 @@
 
   // Input related:
   virtual void device_info(std::ostream &);
-  virtual bool has_event();
   virtual Fresco::Input::Event *next_event();
   virtual void activate_autoplay();
   virtual void highlight_screen(Fresco::Coord, Fresco::Coord,
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.