void ttrack::signal_handler_left_button_up( const event::tevent event, bool& handled) { DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; set_state2(FOCUSSED); handled = true; }
void ttrack::signal_handler_mouse_leave( const event::tevent event, bool& handled) { DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; if (!get_active()) { handled = true; return; } set_state2(NORMAL); handled = true; }
void ttrack::signal_handler_left_button_down( const event::tevent event, bool& handled) { DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n"; twindow* window = get_window(); if (window && require_capture_) { window->mouse_capture(); } set_state2(PRESSED); handled = true; }
static BOOL set_state1(DWORD state) { return set_state2(state, 0); }
/* service_main */ static VOID WINAPI service_main(DWORD argc, LPTSTR *argv) { config_t conf; void* net; void* threads; void* pipe; h_service = RegisterServiceCtrlHandler(LDMSVC_SERVICE_NAME, handler); if(h_service == NULL) { return; } set_state1(SERVICE_START_PENDING); // SERVICE_START_PENDING // open the heap if(!heap_start()) { dout("Failed to create the heap\n"); set_state2(SERVICE_STOPPED, 1); return; } // parse configuration if(!config_parse_args(&conf, argc, argv)) { heap_stop(); set_state2(SERVICE_STOPPED, 1); return; } if(0) { dout(va("PORT: %u\n", conf.port)); dout(va("PIPE: %s\n", conf.pipe)); dout(va("MAXC: %u\n", conf.maxconn)); } // open network if((net = net_start()) == NULL) { heap_stop(); set_state2(SERVICE_STOPPED, 1); return; } // open the pipe if((pipe = pipe_start(conf.pipe)) == NULL) { net_stop(net); heap_stop(); set_state2(SERVICE_STOPPED, 1); return; } // connect the pipe if(!pipe_open(pipe)) { pipe_stop(pipe); net_stop(net); heap_stop(); set_state2(SERVICE_STOPPED, 1); return; } // start threads if((threads = threads_start(net, pipe, conf.maxconn)) == NULL) { pipe_stop(pipe); net_stop(net); heap_stop(); set_state2(SERVICE_STOPPED, 1); return; } set_state1(SERVICE_RUNNING); // SERVICE_RUNNING while(svc_state == SERVICE_RUNNING) { if(!net_is_ready(net)) { net_bind(net, NULL, conf.port); } if(!threads_think(threads)) { break; } Sleep(1); } set_state1(SERVICE_STOP_PENDING); // SERVICE_STOP_PENDING // close everything here threads_stop(threads); pipe_stop(pipe); net_stop(net); heap_stop(); set_state2(SERVICE_STOPPED, 0); // SERVICE_STOPPED }