1.5
- share io manager between rxvt-unicode and vpe
+ - bugfix for --disable-utmp, reported by fefe himsel.
+ - colors were sometimes not used correctly because
+ parts of the code expected a monochrome display.
+ reported by fefe.
+ - make it compile without pointer_blank, reported by
+ Markus Demleitner.
1.4 Fri Jan 16 23:03:22 CET 2004
- fix stupid segfault on esc-c
/*--------------------------------*-C-*---------------------------------*
* File: command.c
*----------------------------------------------------------------------*
- * $Id: command.C,v 1.28 2004-01-16 22:11:09 pcg Exp $
+ * $Id: command.C,v 1.29 2004-01-19 17:26:43 pcg Exp $
*
* All portions of code are copyright by their respective author/s.
* Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk>
#endif
}
+#ifdef POINTER_BLANK
void
rxvt_term::pointer_unblank ()
{
XDefineCursor (Xdisplay, TermWin.vt, TermWin_cursor);
recolour_cursor ();
-#ifdef POINTER_BLANK
hidden_pointer = 0;
if (Options & Opt_pointerBlank)
pointer_ev.start (NOW + pointerBlankDelay);
-#endif
}
-#ifdef POINTER_BLANK
void
rxvt_term::pointer_blank ()
{
*/
/* #define NO_BOLD_UNDERLINE_REVERSE */
-/*
- * Disable using simulated bold using overstrike. You can also turn off
- * overstrike just for multi char fonts
- * Note: NO_BOLDOVERSTRIKE implies NO_BOLDOVERSTRIKE_MULTI
- */
-/* #define NO_BOLDOVERSTRIKE */
-/* #define NO_BOLDOVERSTRIKE_MULTI */
-
/*
* Don't bother cleaning up pixel droppings. If you don't use bold
* overstrike then you don't usually need this
/*--------------------------------*-C-*---------------------------------*
* File: init.c
*----------------------------------------------------------------------*
- * $Id: init.C,v 1.16 2003-12-18 13:33:02 pcg Exp $
+ * $Id: init.C,v 1.17 2004-01-19 17:26:43 pcg Exp $
*
* All portions of code are copyright by their respective author/s.
* Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk>
{ /* bright colors */
i -= 8;
#ifndef NO_BRIGHTCOLOR
-
rs[Rs_color + idx] = rs[Rs_color + minBrightCOLOR + i];
return;
#endif
-
}
+
if (i >= 0 && i <= 7) /* normal colors */
rs[Rs_color + idx] = rs[Rs_color + minCOLOR + i];
}
XGCValues gcvalue;
long vt_emask;
-#ifdef PREFER_24BIT
XSetWindowAttributes attributes;
XWindowAttributes gattr;
- XCMAP = DefaultColormap(Xdisplay, Xscreen);
- XVISUAL = DefaultVisual(Xdisplay, Xscreen);
+ Xcmap = DefaultColormap (Xdisplay, Xscreen);
+ Xvisual = DefaultVisual (Xdisplay, Xscreen);
+ Xscreen = DefaultScreen (Xdisplay);
if (Options & Opt_transparent)
{
- XGetWindowAttributes(Xdisplay, RootWindow(Xdisplay, Xscreen),
- &gattr);
- XDEPTH = gattr.depth;
+ XGetWindowAttributes (Xdisplay, RootWindow(Xdisplay, Xscreen), &gattr);
+ Xdepth = gattr.depth;
}
else
{
- XDEPTH = DefaultDepth(Xdisplay, Xscreen);
+ Xdepth = DefaultDepth(Xdisplay, Xscreen);
+#ifdef PREFER_24BIT
/*
* If depth is not 24, look for a 24bit visual.
*/
- if (XDEPTH != 24)
+ if (Xdepth != 24)
{
XVisualInfo vinfo;
if (XMatchVisualInfo(Xdisplay, Xscreen, 24, TrueColor, &vinfo))
{
- XDEPTH = 24;
- XVISUAL = vinfo.visual;
- XCMAP = XCreateColormap(Xdisplay,
+ Xdepth = 24;
+ Xvisual = vinfo.visual;
+ Xcmap = XCreateColormap(Xdisplay,
RootWindow(Xdisplay, Xscreen),
- XVISUAL, AllocNone);
+ Xvisual, AllocNone);
}
}
- }
#endif
+ }
/* grab colors before netscape does */
rxvt_Get_Colours (this);
PixColors[Color_fg],
PixColors[Color_bg]);
#ifdef DEBUG_X
-
XStoreName(Xdisplay, TermWin.vt, "vt window");
#endif
- pointer_unblank ();
-
vt_emask = (ExposureMask | ButtonPressMask | ButtonReleaseMask
| PropertyChangeMask);
+
#ifdef POINTER_BLANK
+ pointer_unblank ();
if ((Options & Opt_pointerBlank))
vt_emask |= PointerMotionMask;
else
#endif
-
vt_emask |= (Button1MotionMask | Button3MotionMask);
+
XSelectInput(Xdisplay, TermWin.vt, vt_emask);
#if defined(MENUBAR) && (MENUBAR_MAX > 1)
dup2 (tty_fd, STDIN_FILENO);
#endif
+#ifdef UTMP_SUPPORT
rxvt_privileged_utmp (this, SAVE);
+#endif
+
#if defined(HAVE_STRUCT_UTMP) && defined(HAVE_TTYSLOT)
dup2 (fdstdin, STDIN_FILENO);
#include <cstdlib>
#include <cerrno>
-#include <sys/select.h>
#include <sys/time.h>
+#if 1 // older unices need these includes for select(2)
+# include <unistd.h>
+# include <sys/types.h>
+#endif
+
+// if the BSDs would at least be marginally POSIX-compatible.. *sigh*
+// until that happens, sys/select.h must come last
+#include <sys/select.h>
+
#include "iom.h"
// TSTAMP_MAX must still fit into a positive struct timeval
set_now ();
tw0.start (TSTAMP_MAX);
- printf ("abort, %f but inly on %f\n", NOW, tw0.at);
#endif
}
SECONDARY
};
-enum {
- SBYTE = 0,
- WBYTE
-};
-
-
-#define RS_None 0 /* Normal */
+#define RS_None 0 /* Normal */
#define RS_fgMask 0x000001FFu /* 512 colors */
#define RS_bgMask 0x0003FE00u /* 512 colors */
#define RS_RVid 0x00100000u /* reverse video */
#define RS_Uline 0x00200000u /* underline */
-#define RS_wide 0x00400000u /* only multibyte characters */
-#define IS_WIDE(r) ((r) & RS_wide)
-
-#define RS_fontMask 0xff000000u /* plenty(?) of fonts */
-#define RS_fontShift 24
+#define RS_fontMask 0xffc00000u /* plenty(?) of fonts */
+#define RS_fontShift 22
#define RS_baseattrMask (RS_Bold|RS_Blink|RS_RVid|RS_Uline)
-#define RS_attrMask (RS_baseattrMask|RS_fontMask|RS_wide)
+#define RS_attrMask (RS_baseattrMask|RS_fontMask)
#define Sel_none 0 /* Not waiting */
#define Sel_normal 0x01 /* normal selection */
};
#define Color_Bits 9
-#define NPIXCLR_SETS 9 /* (256 + 14) bits / 32 bits */
+#define NPIXCLR_SETS ((TOTAL_COLORS + 31) / 32)
#define NPIXCLR_BITS 32
-#define DEFAULT_RSTYLE (RS_None | (Color_fg) | (Color_bg<<Color_Bits))
+#define DEFAULT_RSTYLE (RS_None | (Color_fg) | (Color_bg<<Color_Bits))
/*
* Resource list
(PrivMode_Autowrap|PrivMode_aplKP|PrivMode_ShiftKeys|PrivMode_VisibleCursor)
#endif
-#ifdef PREFER_24BIT
-# define XDEPTH R->Xdepth
-# define XCMAP R->Xcmap
-# define XVISUAL R->Xvisual
-#else
-# ifdef DEBUG_DEPTH
-# define XDEPTH DEBUG_DEPTH
-# else
-# define XDEPTH DefaultDepth(R->Xdisplay,Xscreen)
-# define XCMAP DefaultColormap(R->Xdisplay,Xscreen)
-# define XVISUAL DefaultVisual(R->Xdisplay,Xscreen)
-# endif
-#endif
-#define IMBUFSIZ 128 /* input modifier buffer sizes */
+#define XDEPTH R->Xdepth
+#define XCMAP R->Xcmap
+#define XVISUAL R->Xvisual
+
+#define IMBUFSIZ 128 /* input modifier buffer sizes */
#ifndef BUFSIZ
-# define BUFSIZ 4096
+# define BUFSIZ 4096
#endif
-#define KBUFSZ 512 /* size of keyboard mapping buffer */
+#define KBUFSZ 512 /* size of keyboard mapping buffer */
/*
*****************************************************************************
#define TermWin_TotalWidth() ((int32_t)TermWin.width + 2 * (int32_t)TermWin.int_bwidth)
#define TermWin_TotalHeight() ((int32_t)TermWin.height + 2 * (int32_t)TermWin.int_bwidth)
-#define Xscreen DefaultScreen(R->Xdisplay)
#define Xroot DefaultRootWindow(R->Xdisplay)
/* how to build & extract colors and attributes */
#define SET_ATTR(x,a) (((x) & ~RS_attrMask)| (a))
#define SET_PIXCOLOR(h, x) ((h)->pixcolor_set[(x) / NPIXCLR_BITS] |= (1 << ((x) % NPIXCLR_BITS)))
-#define ISSET_PIXCOLOR(h, x) ((h)->pixcolor_set[(x) / NPIXCLR_BITS] & (1 << ((x) % NPIXCLR_BITS)))
+#define ISSET_PIXCOLOR(h, x) ((h)->pixcolor_set[(x) / NPIXCLR_BITS] & (1 << ((x) % NPIXCLR_BITS)))
#ifdef HAVE_SCROLLBARS
# define scrollbar_TotalWidth() (scrollBar.width + sb_shadow * 2)
ttymode;
unsigned long PrivateModes,
SavedModes;
-/* ---------- */
-#ifdef PREFER_24BIT
- Visual *Xvisual;
-#endif
/* ---------- */
Atom xa[NUM_XA];
/* ---------- */
XColor xc;
xc.pixel = p;
- if (!XQueryColor (R->Xdisplay, XCMAP, &xc))
+ if (!XQueryColor (R->Xdisplay, R->Xcmap, &xc))
return false;
XRenderColor d;
return
XftColorAllocValue (R->Xdisplay,
- XVISUAL,
- XCMAP,
+ R->Xvisual,
+ R->Xcmap,
&d,
&c);
#else
{
XColor xc;
- if (XParseColor (R->Xdisplay, XCMAP, name, &xc))
+ if (XParseColor (R->Xdisplay, R->Xcmap, name, &xc))
return set (aR_ xc.red, xc.green, xc.blue);
return false;
xc.blue = cb;
xc.flags = DoRed | DoGreen | DoBlue;
- if (XAllocColor (R->Xdisplay, XCMAP, &xc))
+ if (XAllocColor (R->Xdisplay, R->Xcmap, &xc))
return set (aR_ xc.pixel);
return false;
XColor c;
c.pixel = p;
- XQueryColor (R->Xdisplay, XCMAP, &c);
+ XQueryColor (R->Xdisplay, R->Xcmap, &c);
cr = c.red;
cg = c.green;
/*
- * $Id: rxvtlib.h.in,v 1.7 2003-12-18 05:45:11 pcg Exp $
+ * $Id: rxvtlib.h.in,v 1.8 2004-01-19 17:26:43 pcg Exp $
*/
#ifndef _RXVTLIB_H_ /* include once only */
TermWin_t TermWin;
scrollBar_t scrollBar;
menuBar_t menuBar;
- Display *Xdisplay;
unsigned long Options;
XSizeHints szHint;
+ Display *Xdisplay;
+ int Xdepth;
+ int Xscreen;
+ Visual *Xvisual;
Colormap Xcmap;
rxvt_color *PixColors;
short numPixColors;
Cursor TermWin_cursor; /* cursor for vt window */
- int Xdepth;
int sb_shadow; /* scrollbar shadow width */
int Xfd; /* file descriptor of X server connection */
int cmd_fd; /* pty file descriptor; connected to command */
/*--------------------------------*-C-*--------------------------------------*
* File: screen.c
*---------------------------------------------------------------------------*
- * $Id: screen.C,v 1.16 2004-01-16 22:11:09 pcg Exp $
*
* Copyright (c) 1997-2001 Geoff Wing <gcw@pobox.com>
*
// rely on wcwidth to tell us the character width, at least for non-ascii
int width = c <= 128 ? 1 : wcwidth (c);
- // width 0 characters (e.g. combining chars) are ignored. your problem, really
- while (width-- > 0)
- {
- stp[R->screen.cur.col] = c;
- srp[R->screen.cur.col] = rend;
+ // width -1 characters (e.g. combining chars) are ignored currently.
+ if (width > 0)
+ do
+ {
+ stp[R->screen.cur.col] = c;
+ srp[R->screen.cur.col] = rend;
- if (R->screen.cur.col < last_col - 1)
- R->screen.cur.col++;
- else
- {
- R->screen.tlen[row] = last_col;
- if (R->screen.flags & Screen_Autowrap)
- R->screen.flags |= Screen_WrapNext;
- break;
- }
+ if (R->screen.cur.col < last_col - 1)
+ R->screen.cur.col++;
+ else
+ {
+ R->screen.tlen[row] = last_col;
+ if (R->screen.flags & Screen_Autowrap)
+ R->screen.flags |= Screen_WrapNext;
+ break;
+ }
- c = NOCHAR;
- }
+ c = NOCHAR;
+ }
+ while (--width > 0);
+ else
+ 1; /* handle combining character etc. here. */
}
+
if (R->screen.tlen[row] != -1) /* XXX: think about this */
- MAX_IT(R->screen.tlen[row], R->screen.cur.col);
+ MAX_IT(R->screen.tlen[row], R->screen.cur.col);
/*
* If we wrote anywhere in the selected area, kill the selection
rxvt_set_font_style(aR);
}
-\f
-/* ------------------------------------------------------------------------- *
- * GRAPHICS COLOURS *
- * ------------------------------------------------------------------------- */
-
-#ifdef RXVT_GRAPHICS
-/* EXTPROTO */
-int
-rxvt_scr_get_fgcolor(pR)
-{
- return GET_FGCOLOR(R->rstyle);
-}
-
-/* ------------------------------------------------------------------------- */
-/* EXTPROTO */
-int
-rxvt_scr_get_bgcolor(pR)
-{
- return GET_BGCOLOR(R->rstyle);
-}
-#endif
\f
/* ------------------------------------------------------------------------- *
* MAJOR SCREEN MANIPULATION *
* R->screen.text/R->screen.rend contain what the screen will change to.
*/
-#if defined (NO_BRIGHTCOLOR) || defined (VERYBOLD)
-# define MONO_BOLD(x) ((x) & (RS_Bold|RS_Blink))
-# define MONO_BOLD_FG(x, fg) MONO_BOLD(x)
-#else
-# define MONO_BOLD(x) \
- (((x) & (RS_Bold | RS_fgMask)) == (RS_Bold | Color_fg))
-# define MONO_BOLD_FG(x, fg) (((x) & RS_Bold) && (fg) == Color_fg)
-#endif
-
#define FONT_WIDTH(X, Y) \
(X)->per_char[(Y) - (X)->min_char_or_byte2].width
#define FONT_RBEAR(X, Y) \
unsigned char clearfirst, /* first character writes before cell */
clearlast, /* last character writes beyond cell */
must_clear, /* use draw_string not draw_image_string */
-#ifndef NO_BOLDFONT
- bfont, /* we've changed font to bold font */
-#endif
rvid, /* reverse video this position */
- wbyte, /* we're in multibyte */
showcursor; /* show the cursor */
- int fore, back; /* desired foreground/background */
int16_t col, row, /* column/row we're processing */
ocrow; /* old cursor row */
int cursorwidth;
/*
* A: set up vars
*/
- clearfirst = clearlast = must_clear = wbyte = 0;
-#ifndef NO_BOLDFONT
- bfont = 0;
-#endif
+ clearfirst = clearlast = must_clear = 0;
if (currmaxcol < TermWin.ncol)
{
*srp = SET_BGCOLOR(*srp, ccol2);
#endif
}
-
- while (IS_WIDE (*srp))
- cursorwidth++, srp++;
}
/* make sure no outline cursor is left around */
continue;
}
- if (((rend ^ srp[col]) & ~RS_wide) != 0)
+ if (rend != srp[col])
break;
count++;
/*
* Determine the attributes for the string
*/
- int fid = GET_FONT(rend);
- fore = GET_FGCOLOR(rend);
- back = GET_BGCOLOR(rend);
- rend = GET_ATTR(rend);
+ int fid = GET_FONT (rend);
+ int fore = GET_FGCOLOR (rend); // desired foreground
+ int back = GET_BGCOLOR (rend); // desired background
+
+ rend = GET_ATTR (rend);
- rvid = (rend & RS_RVid) ? 1 : 0;
+ rvid = !!(rend & RS_RVid);
#ifdef OPTION_HC
if (!rvid && (rend & RS_Blink))
{
else if (rend & RS_Bold)
{
if (Xdepth > 2 && ISSET_PIXCOLOR (this, Color_BD))
- {
- fore = Color_BD;
-# ifndef VERYBOLD
- rend &= ~RS_Bold; /* we've taken care of it */
-# endif
- }
+ fore = Color_BD;
}
else if (rend & RS_Uline)
{
if (Xdepth > 2 && ISSET_PIXCOLOR (this, Color_UL))
- {
- fore = Color_UL;
- rend &= ~RS_Uline; /* we've taken care of it */
- }
+ fore = Color_UL;
}
#endif