コード例 #1
0
ファイル: aalinuxkbd.c プロジェクト: Ortuna/aalib
static int linux_init(struct aa_context *context, int mode)
{
    int i;
    struct sigaction siga;
    if (!(mode & AA_SENDRELEASE))
	return 0;
    if (!rawmode_init())
	return 0;
#ifdef SIGWINCH
    signal(SIGWINCH, handler);
#endif
#ifdef GPM_MOUSEDRIVER
    aa_recommendlowmouse("gpm");
#endif
    allow_switch(1);
    atexit(rawmode_exit);
    for (i = 0; i < (int) sizeof(sig2catch); i++) {
	siga.sa_handler = exithandler;
	siga.sa_flags = 0;
	/*zero_sa_mask(&(siga.sa_mask)); */
	memset(&siga.sa_mask, 0, sizeof(sigset_t));
	sigaction((int) sig2catch[i], &siga, old_signal_handler + i);
    }

    return 1;
}
コード例 #2
0
ファイル: vc.c プロジェクト: aunali1/exopc
void set_vc_screen_page(int page)
{
    WRITE_BYTE(BIOS_CURRENT_SCREEN_PAGE, page);

    /* okay, if we have the current console, and video ram is mapped.
     * this has to be "atomic," or there is a "race condition": the
     * user may change consoles between our check and our remapping
     */
    forbid_switch();
    if (SCR_STATE.mapped)	/* should I check for foreground VC instead? */
	get_video_ram(WAIT);
    allow_switch();
}
コード例 #3
0
ファイル: vc.c プロジェクト: aunali1/exopc
/* this puts the VC under process control */
void set_process_control(void)
{
    struct vt_mode vt_mode;
    struct sigaction sa;

    vt_mode.mode = VT_PROCESS;
    vt_mode.waitv = 0;
    vt_mode.relsig = SIG_RELEASE;
    vt_mode.acqsig = SIG_ACQUIRE;
    vt_mode.frsig = 0;

    SCR_STATE.vt_requested = 0;	/* a switch has not been attempted yet */
    allow_switch();

/*      NEWSETQSIG (SIG_RELEASE, release_vt); */
/*      NEWSETQSIG (SIG_ACQUIRE, acquire_vt); */

    if (do_ioctl(console_fd, VT_SETMODE, (int) &vt_mode))
	debug_vid("initial VT_SETMODE failed!\n");
    debug_vid("VID: Set process control\n");
}
コード例 #4
0
ファイル: console.c プロジェクト: jschwartzenberg/dosemu2
static int console_post_init(void)
{
  int kdmode;

  set_vc_screen_page();
  set_process_control();
  k_printf("KBD: Taking mouse control\n");  /* Actually only in KD_GRAPHICS... */
  /* Some escape sequences don't work in KD_GRAPHICS... */
  kdmode = config.vga? KD_GRAPHICS: KD_TEXT;
  ioctl(console_fd, KDSETMODE, kdmode);

  /* Clear the Linux console screen. The console recognizes these codes:
   * \033[?25h = show cursor.
   * \033[0m = reset color.
   * \033[H = Move cursor to upper-left corner of screen.
   * \033[2J = Clear screen.
   */
  if (!config.vga) {
    int co, li;
    gettermcap(0, &co, &li);
    fprintf(stdout,"\033[?25h\033[0m\033[H\033[2J");
    vga_emu_setmode(config.cardtype == CARD_MDA ? 7 : 3, co, li);
  }
  scr_state.mapped = 0;
  allow_switch();

  /*
     Switch to dosemu VT if config.forcevtswitch is set.
     The idea of this action is that in case of config.console_video
     dosemu need to work at active VT (at least at start) for accessing
     video memory. So to be able to run dosemu for instance
     through cron we need config option like forcevtswitch.
     The action seems sensible only if config.console_video.
                                                   [email protected]
  */

  if (config.force_vt_switch && !vc_active()) {
    if (ioctl(console_fd, VT_ACTIVATE, scr_state.console_no)<0)
      v_printf("VID: error VT switching %s\n", strerror(errno));
  }

  /* XXX - get this working correctly! */
#define OLD_SET_CONSOLE 1
#ifdef OLD_SET_CONSOLE
  init_get_video_ram(WAIT);
  scr_state.mapped = 1;
#endif
  if (vc_active()) {
    int other_no = (scr_state.console_no == 1 ? 2 : 1);
    v_printf("VID: we're active, waiting...\n");
#ifndef OLD_SET_CONSOLE
    init_get_video_ram(WAIT);
    scr_state.mapped = 1;
#endif
    if (!config.vga) {
      ioctl(console_fd, VT_ACTIVATE, other_no);
/*
 *    Fake running signal_handler() engine to process release/acquire
 *    vt's.
 */
      while(vc_active())
        coopth_wait();
      ioctl(console_fd, VT_ACTIVATE, scr_state.console_no);
      while(!vc_active())
        coopth_wait();
    }
  }
  else
    v_printf("VID: not active, going on\n");

  allow_switch();
  return 0;
}