示例#1
0
文件: exec.c 项目: nyuichi/umesh
void
exec_init(void)
{
  xv_init(&bg_jobs, sizeof(bg_job));

  exec_signal_init();
}
示例#2
0
main(int argc, char **argv)
{
	XColor    rgb_def;
	XColor    rgb_exact;
	XGCValues gcvalues;

	/*
	 * Initialize XView.
	 */
	xv_init(XV_INIT_ARGC_PTR_ARGV, &argc, argv, NULL);
	INSTANCE = xv_unique_key();
	
	/*
	 * Initialize user interface components.
	 * Do NOT edit the object initializations by hand.
	 */
	Cclock_window1 = cclock_window1_objects_initialize(NULL, 0);

	dpy = (Display *) xv_get(Cclock_window1->window1, XV_DISPLAY);
    cmap = DefaultColormap(dpy,DefaultScreen(dpy));

	can_xid = xv_get(canvas_paint_window(Cclock_window1->canvas1),XV_XID);

	XAllocNamedColor(dpy,cmap,"White",&rgb_def,&rgb_exact);
	gcvalues.foreground = rgb_exact.pixel;
	XAllocNamedColor(dpy,cmap,"Black",&rgb_def,&rgb_exact);
	gcvalues.background = rgb_exact.pixel;
	
	w_gc = XCreateGC(dpy,can_xid,(GCForeground | GCBackground),&gcvalues);

	gcvalues.foreground = rgb_exact.pixel;
	b_gc = XCreateGC(dpy,can_xid,(GCForeground | GCBackground),&gcvalues);


	XSetLineAttributes(dpy, w_gc, 3, LineSolid, CapButt, JoinRound);
	

	
	/*
	 * Turn control over to XView.
	 */
	xv_main_loop(Cclock_window1->window1);
	exit(0);
}
示例#3
0
initscreen()
{
  if (xv_init(NULL)==NULL) return 0;
  frame=(Frame)xv_create(NULL,FRAME,XV_WIDTH,700,XV_HEIGHT,600,
                         FRAME_SHOW_HEADER,FALSE,
                         XV_SHOW,TRUE,NULL);
  canvas=(Canvas)xv_create(frame,CANVAS,CANVAS_REPAINT_PROC,updatescreen,
            CANVAS_X_PAINT_WINDOW,TRUE,
            XV_HEIGHT,SCREENDEPTH,XV_WIDTH,SCREENWIDTH,
            CANVAS_AUTO_EXPAND,FALSE,CANVAS_AUTO_SHRINK,FALSE,
            NULL);
  canvas_paintwin=(Xv_window)xv_get(canvas,CANVAS_NTH_PAINT_WINDOW,0);
  xcanvas=(Window)xv_get(canvas_paintwin,XV_XID);
  display=(Display*)xv_get(frame,XV_DISPLAY);
  screen=(Visual*)xv_get(frame,XV_VISUAL);
  gc=XCreateGC(display,DefaultRootWindow(display),0,GCvalues);
  notify_do_dispatch(); /* this should allow terminal input */
  return 1;
}
示例#4
0
main(int argc, char **argv)
{
	/*
	 * Initialize XView.
	 */
	xv_init(XV_INIT_ARGC_PTR_ARGV, &argc, argv, NULL);
	INSTANCE = xv_unique_key();
	
	/*
	 * Initialize user interface components.
	 * Do NOT edit the object initializations by hand.
	 */
	Eventman_em_bw = eventman_em_bw_objects_initialize(NULL, NULL);
	
	
	/*
	 * Turn control over to XView.
	 */
	xv_main_loop(Eventman_em_bw->em_bw);
	exit(0);
}
示例#5
0
文件: exec.c 项目: nyuichi/umesh
static void
do_sigchld(int sig)
{
  pid_t pid, pgid;
  int status;
  xvect dying_jobs;
  size_t i, j;

  xv_init(&dying_jobs, sizeof(pid_t));

  while ((pid = waitpid(-1, &status, WNOHANG | WUNTRACED)) > 0) {
    if (WIFSTOPPED(status)) {
      post_job_suspend(getpgid(pid), 1);
    }
    else {
      pgid = getpgid(pid);
      xv_push(&dying_jobs, &pgid);
    }
  }

  for (i = 0; i < xv_size(&dying_jobs); ++i) {
    pgid = *(pid_t *)xv_get(&dying_jobs, i);
    if (waitpid(-pgid, &status, WNOHANG | WUNTRACED) == -1 && errno == ECHILD) { /* if the job of pgid is completely dead */
      for (j = 0; j < xv_size(&bg_jobs); ++j) {
        if (((bg_job *)xv_get(&bg_jobs, j))->pgid == pgid) {
          break;
        }
      }
      if (j != xv_size(&bg_jobs)) {
        xv_splice(&bg_jobs, j, 1);
      }
    }
  }

  xv_destroy(&dying_jobs);
}