-void GSocketGUIFunctionsTableConcrete::Install_Callback(GSocket *socket,
- GSocketEvent event)
-{
- int *m_id = (int *)(socket->m_gui_dependent);
- const int fd = socket->m_fd;
-
- if ( fd == -1 )
- return;
-
- int c;
- switch (event)
- {
- case GSOCK_LOST: /* fall-through */
- case GSOCK_INPUT: c = 0; break;
- case GSOCK_OUTPUT: c = 1; break;
- case GSOCK_CONNECTION: c = ((socket->m_server) ? 0 : 1); break;
- default: return;
- }
-
- wxSelectDispatcher * const dispatcher = wxSelectDispatcher::Get();
- if ( !dispatcher )
- return;
-
- wxGSocketIOHandler *
- handler = (wxGSocketIOHandler*)dispatcher->FindHandler(fd);
- if ( !handler )
- {
- handler = new wxGSocketIOHandler(socket);
- }
-
- if (c == 0)
- {
- m_id[0] = fd;
- handler->AddFlag(wxFDIO_INPUT);
- }
- else
- {
- m_id[1] = fd;
- handler->AddFlag(wxFDIO_OUTPUT);
- }
-
- dispatcher->RegisterFD(fd, handler, handler->GetFlags());
-}