Ejemplo n.º 1
0
static int slang_init(struct aa_context *context, int mode)
{
    if (!__slang_is_up) {
	fflush(stdout);
	SLtt_get_terminfo();
	__slang_is_up = 1;
	uninitslang = 1;
    }
    f = fopen("/dev/null", "r");
    if (SLang_init_tty(-1, 0, 0) == -1) {
	return 0;
    }
    if (-1 == SLkp_init()) {
	return 0;
    }
    __slang_keyboard = 1;
#ifdef GPM_MOUSEDRIVER
    aa_recommendlowmouse("gpm");
#endif

#ifdef SIGWINCH
    signal(SIGWINCH, handler);
#endif
    return 1;
}
Ejemplo n.º 2
0
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;
}
Ejemplo n.º 3
0
static int X_init(aa_context * c, int mode)
{
    struct xdriverdata *d=c->driverdata;
    if(c->driver!=&X11_d) return 0;
    d->attr.event_mask |= StructureNotifyMask | KeyPressMask | (mode & AA_SENDRELEASE ? KeyReleaseMask : 0);
    XSelectInput(d->dp, d->wi, d->attr.event_mask);
    aa_recommendlowmouse("X11");
    return 1;
}
Ejemplo n.º 4
0
static int stdin_init(struct aa_context *context, int mode)
{
#ifdef SIGWINCH
    signal(SIGWINCH, handler);
#endif
#ifdef GPM_MOUSEDRIVER
    aa_recommendlowmouse("gpm");
#endif
    return 1;
}
Ejemplo n.º 5
0
static int slang_init(__AA_CONST struct aa_hardware_params *p,__AA_CONST  void *none, struct aa_hardware_params *dest, void **params)
{
    struct aa_hardware_params def={NULL, AA_NORMAL_MASK | AA_BOLD_MASK | AA_REVERSE_MASK | AA_BOLDFONT_MASK | AA_DIM_MASK};
    *dest=def;
    fflush(stdout);
    if (!__slang_is_up) {
	SLtt_get_terminfo();
	__slang_is_up = 1;
	uninitslang = 1;
    }
    if (SLsmg_init_smg() != 0)
	return 0;
    if (SLtt_Use_Ansi_Colors) {
	dest->supported &= ~AA_BOLDFONT_MASK;
    }
    SLsmg_Display_Eight_Bit = 128;
    dest->supported |= AA_EIGHT;
#ifdef GPM_MOUSEDRIVER
    aa_recommendlowmouse("gpm");
#endif
    aa_recommendlowkbd ("linux");
    aa_recommendlowkbd("slang");
    return 1;
}
Ejemplo n.º 6
0
static int
linux_init (__AA_CONST struct aa_hardware_params *p, __AA_CONST void *none,
	    struct aa_hardware_params *dest, void **params)
{
  static int registered;
  static struct aa_font font;
  __AA_CONST static struct aa_hardware_params def = { NULL,
    AA_DIM_MASK | AA_REVERSE_MASK | AA_NORMAL_MASK | AA_BOLD_MASK |
      AA_EXTENDED
  };
  struct stat sbuf;
  int major, minor;
  char fname[20];
  char tmp[256], *env;
  int vt;
  int i, y;
  int fd;
  *dest = def;
  fflush (stdout);
  fd = dup (fileno (stderr));
  fstat (fd, &sbuf);
  major = sbuf.st_rdev >> 8;
  vt = minor = sbuf.st_rdev & 0xff;
  close (fd);
  if (major != 4 || minor >= 64)
    return (0);
  if ((env = getenv ("AAVCS")) != NULL)
    {
      int p1 = 0, p2;
      nvcs = 0;
      while (env[p1])
	{
	  while (env[p1] && env[p1] == ' ')
	    p1++;
	  if (!env[p1])
	    break;
	  p2 = 0;
	  while (env[p1] && env[p1] != ' ')
	    tmp[p2++] = env[p1++];
	  tmp[p2] = 0;
	  vc[nvcs] = fopen (tmp, "w+");
	  if (vc[nvcs] == NULL)
	    return 0;
	  nvcs++;
	}
    }
  else
    {
      sprintf (fname, "/dev/vcsa%i", vt);
      vc[0] = fopen (fname, "w+");
      nvcs = 1;
    }
  if (vc[0] == NULL)
    return 0;
  if (!registered)
    {
      char *data;
      fd = open ("/dev/console", 0);
      if (fd >= 0)
	{
	  char buf[32 * 1024];
	  struct consolefontdesc desc;
	  desc.chardata = buf;
	  desc.charcount = 1024;
	  i = ioctl (fd, GIO_FONTX, &desc);
	  close (fd);
	  if (i)
	    {			/*probably mda/hercules */
	      dest->font = &aa_font14;
	      dest->supported &= ~AA_DIM_MASK;
	      goto skip;
	    }
	  font.name = "Font used by your console";
	  font.shortname = "current";
	  font.height = desc.charheight;
	  data = malloc (desc.charheight * 256);
	  font.data = data;
	  if (font.data == NULL)
	    goto skip;
	  y = 0;
	  for (i = 0; i < 8192; i++)
	    {
	      if (i % 32 < font.height)
		{
		  data[y] = desc.chardata[i], y++;
		}
	    }
	  aa_registerfont (&font);
	  dest->font = &font;
	}
    }
skip:;
#ifdef GPM_MOUSEDRIVER
  aa_recommendlowmouse ("gpm");
#endif
  aa_recommendlowkbd ("linux");
  aa_recommendlowkbd ("slang");
  aa_recommendlowkbd ("curses");
  return 1;
}