wxWindow *m_topWindow;
gint m_idleTag;
+#if wxUSE_THREADS
gint m_wakeUpTimerTag;
+#endif
unsigned char *m_colorCube;
int argc;
wxWindow *m_topWindow;
gint m_idleTag;
+#if wxUSE_THREADS
gint m_wakeUpTimerTag;
+#endif
unsigned char *m_colorCube;
int argc;
#include "wx/socket.h"
#include "wx/url.h"
#include "wx/protocol/http.h"
+#include "wx/thread.h"
#if defined(__WXMOTIF__) || defined(__WXGTK__)
#include "mondrian.xpm"
#endif
#include "wx/socket.h"
+#include "wx/thread.h"
#if defined(__WXMOTIF__) || defined(__WXGTK__)
#include "mondrian.xpm"
void MyFrame::OnSockRequest(wxSocketEvent& evt)
{
+ /* this routine gets called from within the
+ waiting socket thread, i.e. here we are
+ not in the main GUI thread and thus we
+ must not call any GUI function here. */
+
wxSocketBase *sock = evt.Socket();
printf("OnSockRequest OK\n");
break;
case wxSocketBase::EVT_LOST:
- UpdateStatus(-1);
printf("Destroying socket\n");
wxPendingDelete.Append(sock);
return;
void MyFrame::OnSockRequestServer(wxSocketEvent& evt)
{
+ /* this routine gets called from within the
+ waiting socket thread, i.e. here we are
+ not in the main GUI thread and thus we
+ must not call any GUI function here. */
+
wxSocketBase *sock2;
wxSocketServer *server = (wxSocketServer *) evt.Socket();
printf("OnSockRequestServer OK\n");
+ printf("OnSockRequest (event = %d)\n",evt.SocketEvent());
sock2 = server->Accept();
if (sock2 == NULL)
sock2->Notify(TRUE);
sock2->SetEventHandler(*this, SKDEMO_SOCKET);
server->SetNotify(wxSocketBase::REQ_ACCEPT);
- UpdateStatus(1);
}
// My frame Constructor
#ifdef __WXGTK__
extern bool g_isIdle;
-
extern void wxapp_install_idle_handler();
#endif
wxPendingEventsLocker->Leave();
#ifdef __WXGTK__
-// if (g_isIdle) wxapp_install_idle_handler();
+ if (g_isIdle)
+ wxapp_install_idle_handler();
#endif
return TRUE;
g_isIdle = FALSE;
}
-
+#if wxUSE_THREADS
static gint wxapp_wakeup_timerout_callback( gpointer WXUNUSED(data) )
{
gtk_timeout_remove( wxTheApp->m_wakeUpTimerTag );
return TRUE;
}
+#endif
//-----------------------------------------------------------------------------
// wxApp
m_idleTag = gtk_idle_add( wxapp_idle_callback, (gpointer) NULL );
+#if wxUSE_THREADS
m_wakeUpTimerTag = gtk_timeout_add( 10, wxapp_wakeup_timerout_callback, (gpointer) NULL );
+#endif
m_colorCube = (unsigned char*) NULL;
}
{
if (m_idleTag) gtk_idle_remove( m_idleTag );
+#if wxUSE_THREADS
if (m_wakeUpTimerTag) gtk_timeout_remove( m_wakeUpTimerTag );
+#endif
if (m_colorCube) free(m_colorCube);
}
g_isIdle = FALSE;
}
-
+#if wxUSE_THREADS
static gint wxapp_wakeup_timerout_callback( gpointer WXUNUSED(data) )
{
gtk_timeout_remove( wxTheApp->m_wakeUpTimerTag );
return TRUE;
}
+#endif
//-----------------------------------------------------------------------------
// wxApp
m_idleTag = gtk_idle_add( wxapp_idle_callback, (gpointer) NULL );
+#if wxUSE_THREADS
m_wakeUpTimerTag = gtk_timeout_add( 10, wxapp_wakeup_timerout_callback, (gpointer) NULL );
+#endif
m_colorCube = (unsigned char*) NULL;
}
{
if (m_idleTag) gtk_idle_remove( m_idleTag );
+#if wxUSE_THREADS
if (m_wakeUpTimerTag) gtk_timeout_remove( m_wakeUpTimerTag );
+#endif
if (m_colorCube) free(m_colorCube);
}