Ejemplo n.º 1
0
void
map_scrollBar (int map)
{
  if (scrollbar_mapping (map))
    {
      scr_touch ();
      resize ();
    }
}
Ejemplo n.º 2
0
Pixmap
set_bgPixmap (const char *file)
{
  char *f;

  assert (file != NULL);

  if (bgPixmap.pixmap != None)
    {
      XFreePixmap (Xdisplay, bgPixmap.pixmap);
      bgPixmap.pixmap = None;
    }
  XSetWindowBackground (Xdisplay, TermWin.vt, PixColors[bgColor]);

  if (*file != '\0')
    {
      XWindowAttributes attr;
      XGetWindowAttributes (Xdisplay, Xroot, &attr);

      xpmAttr.closeness = 30000;
      xpmAttr.colormap = attr.colormap;
      xpmAttr.valuemask = (XpmCloseness | XpmColormap | XpmSize | XpmReturnPixels);

      /* search environment variables here too */
      if ((f = search_path (rs_path, file, XPM_EXT)) == NULL)
#ifdef PATH_ENV
	if ((f = search_path (getenv (PATH_ENV), file, XPM_EXT)) == NULL)
#endif
	  f = search_path (getenv ("PATH"), file, XPM_EXT);

      if (f == NULL || XpmReadFileToPixmap (Xdisplay, Xroot, f,
					    &bgPixmap.pixmap,
					    NULL, &xpmAttr))
	{
	  char *p;
	  /* semi-colon delimited */
	  if ((p = strchr (file, ';')) == NULL)
	    p = strchr (file, '\0');

	  print_error ("couldn't load XPM file \"%.*s\"", (p - file), file);
	  resize_pixmap ();
	}
      else if (bgPixmap.pixmap != None)
	resize_pixmap ();
    }

  XClearWindow (Xdisplay, TermWin.vt);
  scr_touch ();
  XFlush (Xdisplay);
  return bgPixmap.pixmap;
}
Ejemplo n.º 3
0
/*
 * XTerm escape sequences: ESC ] Ps;Pt BEL
 *       0 = change iconName/title
 *       1 = change iconName
 *       2 = change title
 *      46 = change logfile (not implemented)
 *      50 = change font
 *
 * rxvt extensions:
 *      10 = menu
 *      20 = bg pixmap
 *      39 = change default fg color
 *      49 = change default bg color
 */
void
xterm_seq (int op, char *str)
{
  int changed = 0;

  assert (str != NULL);
  switch (op)
    {
    case XTerm_name:
      set_title (str);		/* drop */
    case XTerm_iconName:
      set_iconName (str);
      break;
    case XTerm_title:
      set_title (str);
      break;
    case XTerm_Menu:
      menubar_dispatch (str);
      break;
    case XTerm_Pixmap:
#ifdef XPM_BACKGROUND
      if (*str != ';')
	set_bgPixmap (str);

      while ((str = strchr (str, ';')) != NULL)
	{
	  str++;
	  changed += scale_pixmap (str);
	}
      if (changed)
	{
	  resize_pixmap ();
	  scr_touch ();
	}
#endif /* XPM_BACKGROUND */
      break;

    case XTerm_restoreFG:
      set_window_color (fgColor, str);
      break;
    case XTerm_restoreBG:
      set_window_color (bgColor, str);
      break;
    case XTerm_logfile:
      break;
    case XTerm_font:
      change_font (0, str);
      break;
    }
}
Ejemplo n.º 4
0
/* set_fonts () - load and set the various fonts
 *
 * init = 1   - initialize
 *
 * fontname == FONT_UP  - switch to bigger font
 * fontname == FONT_DN  - switch to smaller font
 */
bool
rxvt_term::set_fonts ()
{
  rxvt_fontset *fs = new rxvt_fontset (this);
  rxvt_fontprop prop;

  if (!fs
      || !fs->populate (rs[Rs_font] ? rs[Rs_font] : "fixed")
      || !fs->realize_font (1))
    {
      delete fs;
      return false;
    }

#if ENABLE_STYLES
  for (int i = RS_styleCount; --i; )
    if (fontset[i] != fontset[0])
      delete fontset[i];
#endif

  delete fontset[0];
  fontset[0] = fs;

  prop = (*fs)[1]->properties ();
  prop.height += lineSpace;

  fs->set_prop (prop, false);

  fwidth  = prop.width;
  fheight = prop.height;
  fbase   = prop.ascent;

  for (int style = 1; style < 4; style++)
    {
#if ENABLE_STYLES
      const char *res = rs[Rs_font + style];

      if (res && !*res)
        fontset[style] = fontset[0];
      else
        {
          fontset[style] = fs = new rxvt_fontset (this);
          rxvt_fontprop prop2 = prop;

          if (res)
            {
              fs->populate (res);
              fs->set_prop (prop2, false);
            }
          else
            {
              fs->populate (fontset[0]->fontdesc);

              if (SET_STYLE (0, style) & RS_Bold)   prop2.weight = rxvt_fontprop::bold;
              if (SET_STYLE (0, style) & RS_Italic) prop2.slant  = rxvt_fontprop::italic;

              fs->set_prop (prop2, true);
            }

        }
#else
      fontset[style] = fontset[0];
#endif
    }

  if (parent[0])
    {
      resize_all_windows (0, 0, 0);
      scr_remap_chars ();
      scr_touch (true);
    }

  return true;
}