int accounting_stop() { printf("Turning off accouting...\n"); char *cmd[] = { ACCOUNTING_COMMAND }; run_async(cmd); return 0; }
static bool start_child(const char* cmd) { #ifdef HAVE_LIBSTARTUP_NOTIFICATION run_async("ede-launch-sn --program %s --icon applications-order", cmd); #endif int ret = start_child_process_with_core(cmd); if(ret == 199) { alert(_("Program '%s' not found.\n\nPlease check if given path to the " "executable was correct or adjust $PATH environment variable to " "point to the directory where target executable exists"), cmd); return false; } if(ret == EACCES) { /* now check the if file is executable since EACCES is common error if not so */ if(access(cmd, X_OK) != 0) alert(_("You are trying to execute '%s', but it is not executable file"), cmd); else alert(_("You do not have enough permissions to execute '%s'"), cmd); return false; } return true; }
/* called when splash option is off */ bool Splash::next_client_nosplash(void) { if(slist->empty()) return false; if(counter == 0) slist_it = slist->begin(); if(slist_it == slist->end()) { counter = 0; return false; } E_ASSERT(counter < slist->size() && "Internal error; 'counter' out of bounds"); const char* msg = (*slist_it)->description.c_str(); const char* cmd = (*slist_it)->exec.c_str(); printf("%s\n", msg); /* run command */ if(!dryrun) run_async(cmd); ++slist_it; ++counter; return true; }
static void report_cb(Fl_Widget*, void*) { String bug_tool = file_path("ede-bug-report"); if(bug_tool.empty()) { alert(_("Unable to find ede-bug-report tool." " Please check if PATH variable contains directory where this tool was installed")); return; } collect_info_once(); TempFile tmp; if(!tmp.create("/tmp/.ecrash-dump")) { alert(_("Unable to create temporary file: (%i) %s"), tmp.status(), strerror(tmp.status())); return; } /* close it since we need the file name */ tmp.close(); txt_buf->savefile(tmp.name()); run_async("%s --gdb-dump %s", bug_tool.c_str(), tmp.name()); /* wait some time until the file was read; dumb, I know :( */ sleep(1); /* remove it */ tmp.unlink(); }
void run() const { if (!cb && !async_cb) { // stubbed return; } if (async) run_async(); else run_sync(); }
int DesktopIcon::handle(int event) { switch(event) { case FL_FOCUS: case FL_UNFOCUS: case FL_ENTER: case FL_LEAVE: return 1; /* We have to handle FL_MOVE too, if want to get only once FL_ENTER when entered or FL_LEAVE when leaved */ case FL_MOVE: return 1; case FL_PUSH: if(Fl::event_button() == 3) { /* MenuItem::popup() by default does not call callbacks */ const MenuItem* m = imenu->menu()->popup(Fl::event_x(), Fl::event_y()); if(m && m->callback()) m->do_callback(0, this); } return 1; case FL_RELEASE: if(Fl::event_clicks() > 0) run_async("ede-launch %s", settings->cmd.c_str()); return 1; case FL_DND_ENTER: case FL_DND_DRAG: case FL_DND_LEAVE: return 1; case FL_DND_RELEASE: E_DEBUG(E_STRLOC ": FL_DND_RELEASE on icon\n"); return 1; case FL_PASTE: E_DEBUG(E_STRLOC ": FL_PASTE on icon with %s\n", Fl::event_text()); return 1; default: break; } return 0; }
static Link af_call(Link self, Link This, Link Arg){ // create the structure that will hold the data passed to the new thread struct Async_data * ad = malloc(sizeof(struct Async_data)); ad->This = NULL; ad->Arg = NULL; ad->Self = NULL; // populate the structure if (This) ad->This = link_dup(This); if (Arg) ad->Arg = object_copy(Arg); if (self) ad->Self = link_dup(self); // start the new thread, and return the thread handle thread_t thread_handle = run_async(_run_async , ad); Link thread = object_create(thread_type); thread->value.vptr = malloc(sizeof(thread_t)); *((thread_t *)(thread->value.vptr)) = thread_handle; return thread; }
void init(INITFUNC_ARGS){ blue_gl_init(lib, Module); /* Set up the X environment */ XInitThreads(); display = XOpenDisplay(0); vi = glXChooseVisual(display, DefaultScreen(display), double_attributes); if (! vi) vi = glXChooseVisual(display, DefaultScreen(display), single_attributes); bl_window = XInternAtom (display, "bl_window", False); bl_message = XInternAtom (display, "bl_message", False); wm_delete = XInternAtom(display, "WM_DELETE_WINDOW", False); wm_protocols = XInternAtom(display, "WM_PROTOCOLS", False); attributes.event_mask = event_mask; attributes.colormap = XCreateColormap(display, RootWindow(display, vi->screen),vi->visual, AllocNone); /* start the event loop */ run_async(event_loop, NULL); }
int main(int argc, char *argv[]) { screen(width,height); screentitle("PlayWave"); settextfont("FreeMono.ttf",45); setonkey(keyfnc); run_async(sndPlayer,NULL); while(1) { fillrect(0,0,width,height,0); drawtext( "Press Something",0 ,0,0xf0ffff00); if(keystate==1){ inchz(); } else if(keystate == -1){ dechz(); } generateWave(); drawwav(); drawtext(keymsg_buf ,0,45,0xf0ffff00); flushscreen(); } return 0; }
int accounting_start() { char *cmd[] = { ACCOUNTING_COMMAND, ACCOUNTING_FILE }; run_async(cmd); return 0; }
static void open_cb(Fl_Widget*, void* d) { DesktopIcon* di = (DesktopIcon*)d; IconSettings* s = di->get_settings(); run_async("ede-launch %s", s->cmd.c_str()); }
int main(int argc, char** argv) { bool do_startup = false; bool do_dryrun = false; bool show_splash = true; if(argc > 1) { const char* a; for(int i = 1; i < argc; i++) { a = argv[i]; if(CHECK_ARGV(a, "-h", "--help")) { help(); return 0; } else if(CHECK_ARGV(a, "-s", "--startup")) do_startup = true; else if(CHECK_ARGV(a, "-d", "--dry-run")) do_dryrun = true; else if(CHECK_ARGV(a, "-n", "--no-splash")) show_splash = false; else { printf("Unknown parameter '%s'. Run 'evoke -h' for options\n", a); return 1; } } } EDE_APPLICATION("evoke"); /* make sure X11 is running before rest of code is called */ fl_open_display(); /* initialize main service object */ EvokeService* service = EvokeService::instance(); /* * Main loop is not initialized before startup (and splash) are finished; * this is intentional so we could use 'dryrun' to test a splash theme and startup items * without interfering with already running evoke instance (and getting lock error) * * TODO: dryrun option is pretty dummy; better to use "test-splash" or similar */ if(do_startup) { service->read_startup(); service->run_startup(show_splash, do_dryrun); } /* only testing, quit nicely */ if(do_dryrun) return 0; if(!service->setup_lock(LOCK_FILE)) { printf("*** Either another evoke instance is running or I can't create lock file.\n"); printf("*** If program abnormaly crashed before, just remove '%s' and start it again.\n", LOCK_FILE); return 1; } signal(SIGINT, quit_signal); signal(SIGTERM, quit_signal); signal(SIGKILL, quit_signal); signal(SIGQUIT, quit_signal); #ifdef USE_SIGHUP /* * This is mostly used when we get request to shutdown session and close/kill all windows. * If evoke is started from gui console (xterm, rxvt), closing that window we will get * SIGHUP since terminal will disconnect all controlling processes. On other hand, if evoke * is started as session carrier (eg. run from xinitrc), this is not needed. */ signal(SIGHUP, quit_signal); #endif service->start_xsettings_manager(); /* set stuff so xsettings manager can receive events */ XSelectInput(fl_display, RootWindow(fl_display, fl_screen), PropertyChangeMask | SubstructureNotifyMask | ClientMessage); Fl::add_handler(xmessage_handler); /* run applicator for settings; it must be done after manager is fully on */ if(do_startup) run_async("ede-settings-apply"); service->start(); while(service->running()) { /* * FLTK will not report SelectionClear needed for XSETTINGS manager * so we must catch it first before FLTK discards it (if we can :P) * This can be missed greatly due a large number of XDamage events * and using this method is not quite safe. */ if(fl_xevent && fl_xevent->type == SelectionClear) service->handle(fl_xevent); Fl::wait(FOREVER); } return 0; }
static void click_cb(Fl_Widget*, void*) { run_async("ede-keyboard-conf"); }
int rundaemon(char *argv[], char *pidpath) { return writepid(run_async(argv), pidpath); }
static void background_conf_cb(Fl_Widget*, void*) { run_async("ede-launch ede-desktop-conf"); }
static void icons_conf_cb(Fl_Widget*, void*) { run_async("ede-launch ede-desktop-conf --icons"); }
void runfsck() { char *cmd[] = { "nice", "-4", "fsck", "-B", "-p" }; run_async(cmd); }