git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2539
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
wxWindow *m_topWindow;
gint m_idleTag;
wxWindow *m_topWindow;
gint m_idleTag;
unsigned char *m_colorCube;
int argc;
unsigned char *m_colorCube;
int argc;
wxWindow *m_topWindow;
gint m_idleTag;
wxWindow *m_topWindow;
gint m_idleTag;
unsigned char *m_colorCube;
int argc;
unsigned char *m_colorCube;
int argc;
#include "wx/socket.h"
#include "wx/url.h"
#include "wx/protocol/http.h"
#include "wx/socket.h"
#include "wx/url.h"
#include "wx/protocol/http.h"
#if defined(__WXMOTIF__) || defined(__WXGTK__)
#include "mondrian.xpm"
#if defined(__WXMOTIF__) || defined(__WXGTK__)
#include "mondrian.xpm"
#endif
#include "wx/socket.h"
#endif
#include "wx/socket.h"
#if defined(__WXMOTIF__) || defined(__WXGTK__)
#include "mondrian.xpm"
#if defined(__WXMOTIF__) || defined(__WXGTK__)
#include "mondrian.xpm"
void MyFrame::OnSockRequest(wxSocketEvent& evt)
{
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");
wxSocketBase *sock = evt.Socket();
printf("OnSockRequest OK\n");
break;
case wxSocketBase::EVT_LOST:
break;
case wxSocketBase::EVT_LOST:
printf("Destroying socket\n");
wxPendingDelete.Append(sock);
return;
printf("Destroying socket\n");
wxPendingDelete.Append(sock);
return;
void MyFrame::OnSockRequestServer(wxSocketEvent& evt)
{
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");
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 = server->Accept();
if (sock2 == NULL)
sock2->Notify(TRUE);
sock2->SetEventHandler(*this, SKDEMO_SOCKET);
server->SetNotify(wxSocketBase::REQ_ACCEPT);
sock2->Notify(TRUE);
sock2->SetEventHandler(*this, SKDEMO_SOCKET);
server->SetNotify(wxSocketBase::REQ_ACCEPT);
}
// My frame Constructor
}
// My frame Constructor
#ifdef __WXGTK__
extern bool g_isIdle;
#ifdef __WXGTK__
extern bool g_isIdle;
extern void wxapp_install_idle_handler();
#endif
extern void wxapp_install_idle_handler();
#endif
wxPendingEventsLocker->Leave();
#ifdef __WXGTK__
wxPendingEventsLocker->Leave();
#ifdef __WXGTK__
-// if (g_isIdle) wxapp_install_idle_handler();
+ if (g_isIdle)
+ wxapp_install_idle_handler();
static gint wxapp_wakeup_timerout_callback( gpointer WXUNUSED(data) )
{
gtk_timeout_remove( wxTheApp->m_wakeUpTimerTag );
static gint wxapp_wakeup_timerout_callback( gpointer WXUNUSED(data) )
{
gtk_timeout_remove( wxTheApp->m_wakeUpTimerTag );
//-----------------------------------------------------------------------------
// wxApp
//-----------------------------------------------------------------------------
// wxApp
m_idleTag = gtk_idle_add( wxapp_idle_callback, (gpointer) NULL );
m_idleTag = gtk_idle_add( wxapp_idle_callback, (gpointer) NULL );
m_wakeUpTimerTag = gtk_timeout_add( 10, wxapp_wakeup_timerout_callback, (gpointer) NULL );
m_wakeUpTimerTag = gtk_timeout_add( 10, wxapp_wakeup_timerout_callback, (gpointer) NULL );
m_colorCube = (unsigned char*) NULL;
}
m_colorCube = (unsigned char*) NULL;
}
{
if (m_idleTag) gtk_idle_remove( m_idleTag );
{
if (m_idleTag) gtk_idle_remove( m_idleTag );
if (m_wakeUpTimerTag) gtk_timeout_remove( m_wakeUpTimerTag );
if (m_wakeUpTimerTag) gtk_timeout_remove( m_wakeUpTimerTag );
if (m_colorCube) free(m_colorCube);
}
if (m_colorCube) free(m_colorCube);
}
static gint wxapp_wakeup_timerout_callback( gpointer WXUNUSED(data) )
{
gtk_timeout_remove( wxTheApp->m_wakeUpTimerTag );
static gint wxapp_wakeup_timerout_callback( gpointer WXUNUSED(data) )
{
gtk_timeout_remove( wxTheApp->m_wakeUpTimerTag );
//-----------------------------------------------------------------------------
// wxApp
//-----------------------------------------------------------------------------
// wxApp
m_idleTag = gtk_idle_add( wxapp_idle_callback, (gpointer) NULL );
m_idleTag = gtk_idle_add( wxapp_idle_callback, (gpointer) NULL );
m_wakeUpTimerTag = gtk_timeout_add( 10, wxapp_wakeup_timerout_callback, (gpointer) NULL );
m_wakeUpTimerTag = gtk_timeout_add( 10, wxapp_wakeup_timerout_callback, (gpointer) NULL );
m_colorCube = (unsigned char*) NULL;
}
m_colorCube = (unsigned char*) NULL;
}
{
if (m_idleTag) gtk_idle_remove( m_idleTag );
{
if (m_idleTag) gtk_idle_remove( m_idleTag );
if (m_wakeUpTimerTag) gtk_timeout_remove( m_wakeUpTimerTag );
if (m_wakeUpTimerTag) gtk_timeout_remove( m_wakeUpTimerTag );
if (m_colorCube) free(m_colorCube);
}
if (m_colorCube) free(m_colorCube);
}