bool WDL_VirtualIconButton::OnMouseDblClick(int xpos, int ypos) { if (m_is_button) { DoSendCommand(xpos, ypos); return true; } return false; }
void WDL_VirtualIconButton::OnMouseUp(int xpos, int ypos) { if (!m_is_button) return; int waspress=!!m_pressed; m_pressed&=~1; RequestRedraw(NULL); if (waspress && !m_immediate) { DoSendCommand(xpos, ypos); } }
int WDL_VirtualIconButton::OnMouseDown(int xpos, int ypos) { if (m_en&&m_is_button) { m_pressed=3; RequestRedraw(NULL); if (m_immediate) { DoSendCommand(xpos, ypos); } return 1; } return 0; }
void* XDebugComThread::Entry() { clDEBUG() << "CodeLite >>> XDebugComThread started" << clEndl; //---------------------------------------------------------------- // Start the debugger server and wait for XDebug to connect to us //---------------------------------------------------------------- clSocketBase::Ptr_t client; int retry(0); try { wxString connectionString; connectionString << "tcp://" << m_host << ":" << m_port; clDEBUG() << "CodeLite >>> Creating server on:" << connectionString << clEndl; m_server.Start(connectionString); clDEBUG() << "CodeLite >>> Listening on" << m_host << ":" << m_port << clEndl; // Wait for new connection (up to m_waitForConnTimeout seconds, which defaults to 5 seconds ) do { if((m_waitForConnTimeout > 0) && (retry > m_waitForConnTimeout)) { // Don't wait any longer for XDebug m_xdebugMgr->CallAfter(&XDebugManager::XDebugNotConnecting); return NULL; } client = m_server.WaitForNewConnection(1); ++retry; clDEBUG() << "CodeLite >>> Waiting for connection.." << clEndl; } while(!TestDestroy() && !client); CL_DEBUG("CodeLite >>> Successfully accepted connection from XDebug!"); m_xdebugMgr->CallAfter(&XDebugManager::SetConnected, true); //---------------------------------------------------------------- // Protocol: // First we read the init XML //---------------------------------------------------------------- std::string initXML; if(DoReadReply(initXML, client)) { m_xdebugMgr->CallAfter(&XDebugManager::OnSocketInput, initXML); } else { // Something bad happened m_xdebugMgr->CallAfter(&XDebugManager::OnCommThreadTerminated); return NULL; } // The main loop: request-reply mode while(!TestDestroy()) { wxString command; if(m_queue.ReceiveTimeout(20, command) == wxMSGQUEUE_NO_ERROR) { DoSendCommand(command, client); // Wait for the reply std::string reply; if(!DoReadReply(reply, client)) { // AN error occurred - close session break; } // Notify XDebugManager m_xdebugMgr->CallAfter(&XDebugManager::OnSocketInput, reply); } } } catch(clSocketException& e) { CL_DEBUG("XDebugComThread caught an exception: %s", e.what()); m_xdebugMgr->CallAfter(&XDebugManager::OnCommThreadTerminated); return NULL; } m_xdebugMgr->CallAfter(&XDebugManager::OnCommThreadTerminated); return NULL; }
void* XDebugComThread::Entry() { wxLog::EnableLogging(false); CL_DEBUG("CodeLite >>> XDebugComThread started"); //---------------------------------------------------------------- // Start the debugger server and wait for XDebug to connect to us //---------------------------------------------------------------- clSocketBase::Ptr_t client; int retry(0); try { CL_DEBUG("CodeLite >>> Creating server on %s:%d", m_host, m_port); wxCharBuffer cb = m_host.mb_str(wxConvUTF8); m_server.CreateServer(cb.data(), m_port); CL_DEBUG("CodeLite >>> Listening on %s:%d", m_host, m_port); // Wait for new connection (up to 5 seconds ) do { if ( retry > 5 ) { // Don't wait any longer for XDebug m_xdebugMgr->CallAfter( &XDebugManager::XDebugNotConnecting ); return NULL; } client = m_server.WaitForNewConnection(1); ++retry; CL_DEBUG("CodeLite >>> waiting for connection.."); } while( !TestDestroy() && !client ); CL_DEBUG("CodeLite >>> Successfully accepted connection from XDebug!"); m_xdebugMgr->CallAfter( &XDebugManager::SetConnected, true ); //---------------------------------------------------------------- // Protocol: // First we read the init XML //---------------------------------------------------------------- std::string initXML; if ( DoReadReply( initXML, client ) ) { m_xdebugMgr->CallAfter( &XDebugManager::OnSocketInput, initXML ); } else { // Something bad happened m_xdebugMgr->CallAfter( &XDebugManager::OnCommThreadTerminated ); return NULL; } // The main loop: request-reply mode while ( !TestDestroy() ) { wxString command; if ( m_queue.ReceiveTimeout(20, command) == wxMSGQUEUE_NO_ERROR ) { DoSendCommand( command, client ); // Wait for the reply std::string reply; if ( !DoReadReply( reply, client ) ) { // AN error occurred - close session break; } // Notify XDebugManager m_xdebugMgr->CallAfter( &XDebugManager::OnSocketInput, reply ); } } } catch (clSocketException &e) { CL_DEBUG("XDebugComThread caught an exception: %s", e.what()); m_xdebugMgr->CallAfter( &XDebugManager::OnCommThreadTerminated ); return NULL; } m_xdebugMgr->CallAfter( &XDebugManager::OnCommThreadTerminated ); return NULL; }
nsresult XRemoteClient::SendCommandInternal(const char *aProgram, const char *aUsername, const char *aProfile, const char *aCommand, PRInt32 argc, char **argv, const char* aDesktopStartupID, char **aResponse, bool *aWindowFound) { *aWindowFound = false; bool isCommandLine = !aCommand; // FindBestWindow() iterates down the window hierarchy, so catch X errors // when windows get destroyed before being accessed. sOldHandler = XSetErrorHandler(HandleBadWindow); Window w = FindBestWindow(aProgram, aUsername, aProfile, isCommandLine); nsresult rv = NS_OK; if (w) { // ok, let the caller know that we at least found a window. *aWindowFound = true; // Ignore BadWindow errors up to this point. The last request from // FindBestWindow() was a synchronous XGetWindowProperty(), so no need to // Sync. Leave the error handler installed to detect if w gets destroyed. sGotBadWindow = false; // make sure we get the right events on that window XSelectInput(mDisplay, w, (PropertyChangeMask|StructureNotifyMask)); bool destroyed = false; // get the lock on the window rv = GetLock(w, &destroyed); if (NS_SUCCEEDED(rv)) { // send our command if (isCommandLine) { rv = DoSendCommandLine(w, argc, argv, aDesktopStartupID, aResponse, &destroyed); } else { rv = DoSendCommand(w, aCommand, aDesktopStartupID, aResponse, &destroyed); } // if the window was destroyed, don't bother trying to free the // lock. if (!destroyed) FreeLock(w); // doesn't really matter what this returns } } XSetErrorHandler(sOldHandler); PR_LOG(sRemoteLm, PR_LOG_DEBUG, ("SendCommandInternal returning 0x%x\n", rv)); return rv; }