]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/socket.cpp
VTK wrapper of vtkRenderWindow for wxPython. Tested on MSW so far.
[wxWidgets.git] / src / common / socket.cpp
index f66313eaf10c274b9efd467f7c5998dcd97e2795..0f7a63316572f5aa12582fd38cc4dd34d8598285 100644 (file)
 #include "wx/socket.h"
 
 
-#if defined(__WXMSW__)
-#define PROCESS_EVENTS() wxYield()
+#if defined(__WXMSW__) || defined(__WXPM__) || defined(__WXMOTIF__) || defined(__WXMAC__)
+    #define PROCESS_EVENTS() wxYield()
 #elif defined(__WXGTK__)
-#include <gtk/gtk.h>
-#define PROCESS_EVENTS() gtk_main_iteration()
-#endif  
+    #include <gtk/gtk.h>
+    #define PROCESS_EVENTS() gtk_main_iteration()
+#endif
 
 
 // --------------------------------------------------------------
@@ -68,7 +68,7 @@ class wxSocketState : public wxObject
 public:
   bool notify_state;
   GSocketEventFlags evt_notify_state;
-  wxSocketBase::wxSockFlags socket_flags;
+  wxSockFlags socket_flags;
   wxSocketBase::wxSockCbk c_callback;
   char *c_callback_data;
 
@@ -80,8 +80,7 @@ public:
 // wxSocketBase ctor and dtor
 // --------------------------------------------------------------
 
-wxSocketBase::wxSocketBase(wxSocketBase::wxSockFlags _flags,
-         wxSocketBase::wxSockType _type) :
+wxSocketBase::wxSocketBase(wxSockFlags _flags, wxSockType _type) :
   wxEvtHandler(),
   m_socket(NULL), m_id(-1),
   m_flags(_flags), m_type(_type),
@@ -188,7 +187,7 @@ wxUint32 wxSocketBase::DeferRead(char *buffer, wxUint32 nbytes)
     DoDefer();
   }
 
-  // Wait for buffer completion. 
+  // Wait for buffer completion.
   while (m_defer_buffer != NULL)
     PROCESS_EVENTS();
 
@@ -235,13 +234,13 @@ wxUint32 wxSocketBase::_Read(char* buffer, wxUint32 nbytes)
 
   // If the socket is not connected, or we have got the whole
   // needed buffer, return immedately
-  if (!m_connected || !m_socket || !nbytes) 
+  if (!m_connected || !m_socket || !nbytes)
     return total;
 
   // Possible combinations (they are checked in this order)
   // NOWAIT
   // SPEED | WAITALL
-  // SPEED          
+  // SPEED
   // WAITALL
   // NONE
   //
@@ -316,7 +315,7 @@ wxSocketBase& wxSocketBase::ReadMsg(char* buffer, wxUint32 nbytes)
 
   if (sig != 0xfeeddead)
   {
-    wxLogMessage(T("Warning: invalid signature returned to ReadMsg"));
+    wxLogMessage(wxT("Warning: invalid signature returned to ReadMsg"));
     goto exit;
   }
 
@@ -374,7 +373,7 @@ wxSocketBase& wxSocketBase::ReadMsg(char* buffer, wxUint32 nbytes)
 
   if (sig != 0xdeadfeed)
   {
-    //wxLogMessage(T("Warning: invalid signature returned to ReadMsg"));
+    //wxLogMessage(wxT("Warning: invalid signature returned to ReadMsg"));
     goto exit;
   }
 
@@ -442,7 +441,7 @@ wxUint32 wxSocketBase::DeferWrite(const char *buffer, wxUint32 nbytes)
     DoDefer();
   }
 
-  // Wait for buffer completion. 
+  // Wait for buffer completion.
   while (m_defer_buffer != NULL)
     PROCESS_EVENTS();
 
@@ -453,7 +452,7 @@ wxUint32 wxSocketBase::DeferWrite(const char *buffer, wxUint32 nbytes)
   m_defering = NO_DEFER;
 
   wxString s;
-  s.Printf("Saliendo de DeferWrite: total %d bytes", nbytes-m_defer_nbytes);
+  s.Printf(wxT("Saliendo de DeferWrite: total %d bytes"), nbytes-m_defer_nbytes);
   //wxLogMessage(s);
 
   return nbytes-m_defer_nbytes;
@@ -490,7 +489,7 @@ wxUint32 wxSocketBase::_Write(const char *buffer, wxUint32 nbytes)
   // Possible combinations (they are checked in this order)
   // NOWAIT
   // SPEED | WAITALL
-  // SPEED          
+  // SPEED
   // WAITALL
   // NONE
   //
@@ -686,7 +685,7 @@ wxSocketBase& wxSocketBase::Discard()
 
   // TODO: TriggerRead
   return *this;
-  
+
 #undef MAX_BUFSIZE
 }
 
@@ -901,7 +900,7 @@ void wxSocketBase::SetFlags(wxSockFlags _flags)
 {
   m_flags = _flags;
 }
-                    
+
 // --------------------------------------------------------------
 // wxSocketBase callback management
 // --------------------------------------------------------------