WISH: look into XAddConnectionWatch, does anybody need that?
DUMB: support tex fonts
-TODO: cursor over overlays, when focus change?
TODO: cursor restore/rendition restore on rmcup
- the aterm code now frees the as visual and image manager objects
when a window was closed.
- use current rendition style in DCH sequence.
- the 132/80 mode switch no longer forces a screen reset.
- new perl extension "overlay-osc", for status displays and the like.
+ - fix some minor cursor drawing issues with overlays by allowing
+ overlays to modify screen flags (to disable the cursor themselves).
9.05 Sun Jun 15 20:09:20 CEST 2008
- new option --cd/chdir to set the starting working directory.
NOCHAR = 0xffff, // must be invalid in ANY codeset (!)
};
-struct rxvt_codeset_conv {
+struct rxvt_codeset_conv
+{
uint32_t (*from_unicode) (unicode_t unicode);
#if ENCODING_TO_UNICODE
unicode_t (*to_unicode) (uint32_t enc);
#define FROM_UNICODE(cs,code) rxvt_codeset[cs].from_unicode (code)
#define TO_UNICODE(cs,code) rxvt_codeset[cs].to_unicode (code)
-struct unicode { // namespace für arme
+struct unicode // namespace für arme
+{
static bool is_space (unicode_t c);
};
# printf "\033]777;overlay;action;args\007"
#
# action "simple;<id>;<timeout>;<x>;<y>;<h|t>;<text>"
-# printf "\033]777;overlay;simple;ov1;0;0;t;test\007"
+# printf "\033]777;overlay;simple;ov1;5;0;0;t;test\007"
#
# action "timeout;<id>;<seconds>"
* the 'essential' information for reporting Mouse Events
* pared down from XButtonEvent
*/
-struct mouse_event {
+struct mouse_event
+{
int clicks;
Time time; /* milliseconds */
unsigned int state; /* key or button mask */
#if ENABLE_FRILLS
# include <X11/Xmd.h>
-typedef struct _mwmhints {
+typedef struct _mwmhints
+{
CARD32 flags;
CARD32 functions;
CARD32 decorations;
#define Width2Pixel(n) ((int32_t)(n) * (int32_t)fwidth)
#define Height2Pixel(n) ((int32_t)(n) * (int32_t)fheight)
-#define LINENO(n) MOD (term_start + int(n), total_rows)
-#define ROW(n) row_buf [LINENO (n)]
+#define LINENO_of(t,n) MOD ((t)->term_start + int(n), (t)->total_rows)
+#define ROW_of(t,n) (t)->row_buf [LINENO_of ((t), n)]
+
+#define LINENO(n) LINENO_of (this, n)
+#define ROW(n) ROW_of (this, n)
/* how to build & extract colors and attributes */
#define GET_BASEFG(x) (((x) & RS_fgMask))
#define ISSET_PIXCOLOR(idx) (!!rs[Rs_color + (idx)])
#if ENABLE_STYLES
-# define FONTSET(style) fontset[GET_STYLE (style)]
+# define FONTSET_of(t,style) (t)->fontset[GET_STYLE (style)]
#else
-# define FONTSET(style) fontset[0]
+# define FONTSET_of(t,style) (t)->fontset[0]
#endif
+#define FONTSET(style) FONTSET_of (this, style)
+
typedef callback<void (const char *)> log_callback;
typedef callback<int (int)> getfd_callback;
#define LINE_FILTER 0x0008 // line needs to be filtered before display (NYI)
#define LINE_BIDI 0x0010 // line needs bidi (NYI)
-struct line_t {
+struct line_t
+{
text_t *t; // terminal the text
rend_t *r; // rendition, uses RS_ flags
tlen_t_ l; // length of each text line
/****************************************************************************/
// primitive wrapper around mbstate_t to ensure initialisation
-struct mbstate {
+struct mbstate
+{
mbstate_t mbs;
operator mbstate_t *() { return &mbs; }
// compose chars are used to represent composite characters
// that are not representable in unicode, as well as characters
// not fitting in the BMP.
-struct compose_char {
+struct compose_char
+{
unicode_t c1, c2; // any chars != NOCHAR are valid
compose_char (unicode_t c1, unicode_t c2)
: c1(c1), c2(c2)
{ }
};
-class rxvt_composite_vec {
+class rxvt_composite_vec
+{
vector<compose_char> v;
public:
text_t compose (unicode_t c1, unicode_t c2 = NOCHAR);
#define SET_R(r) rxvt_current_term = const_cast<rxvt_term *>(r)
#define GET_R rxvt_current_term
-typedef struct {
+/* ------------------------------------------------------------------------- */
+struct overlay_base
+{
+ int x, y, w, h; // overlay dimensions
+ text_t **text;
+ rend_t **rend;
+
+ // while tempting to add swap() etc. here, it effetcively only increases code size
+};
+
+/* ------------------------------------------------------------------------- */
+
+typedef struct
+{
int row;
int col;
} row_col_t;
* END······················= total_rows
*/
-struct TermWin_t {
+struct TermWin_t
+{
int width; /* window width [pixels] */
int height; /* window height [pixels] */
int fwidth; /* font width [pixels] */
* * Note: col == -1 ==> we're left of screen
*
*/
-typedef struct {
+struct screen_t
+{
row_col_t cur; /* cursor position on the screen */
int tscroll; /* top of settable scroll region */
int bscroll; /* bottom of settable scroll region */
unsigned int s_charset; /* saved character set number [0..3] */
char s_charset_char;
rend_t s_rstyle; /* saved rendition style */
-} screen_t;
+};
-enum selection_op_t {
+enum selection_op_t
+{
SELECTION_CLEAR = 0, /* nothing selected */
SELECTION_INIT, /* marked a point */
SELECTION_BEGIN, /* started a selection */
SELECTION_DONE /* selection put in CUT_BUFFER0 */
};
-typedef struct {
+struct selection_t
+{
wchar_t *text; /* selected text */
unsigned int len; /* length of selected text */
unsigned int screen; /* screen being used */
row_col_t beg; /* beginning of selection <= mark */
row_col_t mark; /* point of initial click <= end */
row_col_t end; /* one character past end point */
-} selection_t;
+};
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
-struct rxvt_vars : TermWin_t {
+struct rxvt_vars : TermWin_t
+{
scrollBar_t scrollBar;
uint8_t options[(Opt_count + 7) >> 3];
XSizeHints szHint;
#endif
};
-struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen {
+struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen
+{
// special markers with magic addresses
static const char resval_undef []; // options specifically unset
#endif
#if ENABLE_OVERLAY
- int ov_x, ov_y, ov_w, ov_h; // overlay dimensions
- text_t **ov_text;
- rend_t **ov_rend;
+ overlay_base ov;
void scr_swap_overlay () NOTHROW;
void scr_overlay_new (int x, int y, int w, int h) NOTHROW;
#include "rxvtutil.h"
-struct rxvt_connection {
+struct rxvt_connection
+{
int fd;
static char *unix_sockname ();
struct rxvt_term;
-struct rxvt_fontprop {
+struct rxvt_fontprop
+{
enum {
unset = -1,
medium = 100, bold = 200,
int weight, slant;
};
-struct rxvt_font {
+struct rxvt_font
+{
// managed by the fontset
rxvt_term *term;
void set_term (rxvt_term *term) { this->term = term; }
struct rxvt_fallback_font;
-struct rxvt_fontset {
+struct rxvt_fontset
+{
char *fontdesc;
rxvt_fontset (rxvt_term *term);
#define SvOVERLAY(sv) (overlay *)SvPTR (sv, "urxvt::overlay")
-class overlay {
+class overlay : overlay_base
+{
rxvt_term *THIS;
AV *overlay_av;
- int x, y, w, h;
int border;
- text_t **text;
- rend_t **rend;
public:
HV *self;
};
overlay::overlay (rxvt_term *THIS, int x_, int y_, int w_, int h_, rend_t rstyle, int border)
-: THIS(THIS), x(x_), y(y_), w(w_), h(h_), border(border == 2), overlay_av (0)
+: THIS(THIS), border(border == 2), overlay_av (0)
{
+ x = x_;
+ y = y_;
+ w = w_;
+ h = h_;
+
if (w < 0) w = 0;
if (h < 0) h = 0;
int ov_w = min (w, THIS->ncol - ov_x);
int ov_h = min (h, THIS->nrow - ov_y);
+ // hide cursor if it is within the overlay area
+ if (IN_RANGE_EXC (THIS->screen.cur.col - ov_x, 0, ov_w)
+ && IN_RANGE_EXC (THIS->screen.cur.row - ov_y, 0, ov_h))
+ THIS->screen.flags &= ~Screen_VisibleCursor;
+
for (int y = ov_h; y--; )
{
text_t *t1 = text [y];
};
#ifdef USE_XIM
-struct im_watcher : rxvt_watcher, callback<void (void)> {
+struct im_watcher : rxvt_watcher, callback<void (void)>
+{
void start (rxvt_display *display)
{
display->reg (this);
#define MOD(m,n) (((m) + (n)) % (n))
// makes dynamically allocated objects zero-initialised
-struct zero_initialized {
+struct zero_initialized
+{
void *operator new (size_t s);
void operator delete (void *p, size_t s);
};
* Copyright (C) 1997-98 Kay Roemer & Arno Puder
*/
template<class T>
-struct simplevec {
+struct simplevec
+{
typedef T* iterator;
typedef const T* const_iterator;
typedef unsigned long size_type;
#if 0
template<typename T>
-struct rxvt_vec : simplevec<void *> {
+struct rxvt_vec : simplevec<void *>
+{
typedef T *iterator;
void push_back (T d) { simplevec<void *>::push_back ((void *)d); }
#endif
template<typename T>
-struct auto_ptr {
+struct auto_ptr
+{
T *p;
auto_ptr () : p (0) { }
// small blocks allocator
-struct rxvt_salloc {
+struct rxvt_salloc
+{
struct chain {
struct chain *next;
};
void
rxvt_term::scr_refresh () NOTHROW
{
- unsigned char have_bg,
- showcursor; /* show the cursor */
int16_t col, row, /* column/row we're processing */
ocrow; /* old cursor row */
int i; /* tmp */
*/
refresh_count = 0;
- have_bg = 0;
+ unsigned int old_screen_flags = screen.flags;
+ char have_bg = 0;
#ifdef HAVE_BG_PIXMAP
have_bg = bgPixmap.pixmap != None;
#endif
*/
scr_reverse_selection ();
+ HOOK_INVOKE ((this, HOOK_REFRESH_BEGIN, DT_END));
+#if ENABLE_OVERLAY
+ scr_swap_overlay ();
+#endif
+
+ char showcursor = screen.flags & Screen_VisibleCursor;
+
/*
* C: set the cursor character (s)
*/
{
unsigned char setoldcursor;
- showcursor = (screen.flags & Screen_VisibleCursor);
#ifdef CURSOR_BLINK
if (hidden_cursor)
showcursor = 0;
}
}
- HOOK_INVOKE ((this, HOOK_REFRESH_BEGIN, DT_END));
-#if ENABLE_OVERLAY
- scr_swap_overlay ();
-#endif
-
#ifndef NO_SLOW_LINK_SUPPORT
/*
* D: CopyArea pass - very useful for slower links
} /* for (col....) */
} /* for (row....) */
-#if ENABLE_OVERLAY
- scr_swap_overlay ();
-#endif
- HOOK_INVOKE ((this, HOOK_REFRESH_END, DT_END));
-
/*
* G: cleanup cursor and display outline cursor if necessary
*/
/*
* H: cleanup selection
*/
+#if ENABLE_OVERLAY
+ scr_swap_overlay ();
+#endif
+ HOOK_INVOKE ((this, HOOK_REFRESH_END, DT_END));
+
scr_reverse_selection ();
+ screen.flags = old_screen_flags;
num_scr = 0;
num_scr_allow = 1;
}
x -= 1; clamp_it (x, 0, ncol - w);
y -= 1; clamp_it (y, 0, nrow - h);
- ov_x = x; ov_y = y;
- ov_w = w; ov_h = h;
+ ov.x = x; ov.y = y;
+ ov.w = w; ov.h = h;
- ov_text = new text_t *[h];
- ov_rend = new rend_t *[h];
+ ov.text = new text_t *[h];
+ ov.rend = new rend_t *[h];
for (y = 0; y < h; y++)
{
- text_t *tp = ov_text[y] = new text_t[w];
- rend_t *rp = ov_rend[y] = new rend_t[w];
+ text_t *tp = ov.text[y] = new text_t[w];
+ rend_t *rp = ov.rend[y] = new rend_t[w];
text_t t0, t1, t2;
rend_t r = OVERLAY_RSTYLE;
void
rxvt_term::scr_overlay_off () NOTHROW
{
- if (!ov_text)
+ if (!ov.text)
return;
want_refresh = 1;
- for (int y = 0; y < ov_h; y++)
+ for (int y = 0; y < ov.h; y++)
{
- delete [] ov_text[y];
- delete [] ov_rend[y];
+ delete [] ov.text[y];
+ delete [] ov.rend[y];
}
- delete [] ov_text; ov_text = 0;
- delete [] ov_rend; ov_rend = 0;
+ delete [] ov.text; ov.text = 0;
+ delete [] ov.rend; ov.rend = 0;
}
void
rxvt_term::scr_overlay_set (int x, int y, text_t text, rend_t rend) NOTHROW
{
- if (!ov_text || x >= ov_w - 2 || y >= ov_h - 2)
+ if (!ov.text || x >= ov.w - 2 || y >= ov.h - 2)
return;
x++, y++;
- ov_text[y][x] = text;
- ov_rend[y][x] = rend;
+ ov.text[y][x] = text;
+ ov.rend[y][x] = rend;
}
void
void
rxvt_term::scr_swap_overlay () NOTHROW
{
- if (!ov_text)
+ if (!ov.text)
return;
+ // hide cursor if it is within the overlay area
+ if (IN_RANGE_EXC (screen.cur.col - ov.x, 0, ov.w)
+ && IN_RANGE_EXC (screen.cur.row - ov.y, 0, ov.h))
+ screen.flags &= ~Screen_VisibleCursor;
+
// swap screen mem with overlay
- for (int y = ov_h; y--; )
+ for (int y = ov.h; y--; )
{
- text_t *t1 = ov_text[y];
- rend_t *r1 = ov_rend[y];
+ text_t *t1 = ov.text[y];
+ rend_t *r1 = ov.rend[y];
- text_t *t2 = ROW(y + ov_y + view_start).t + ov_x;
- rend_t *r2 = ROW(y + ov_y + view_start).r + ov_x;
+ text_t *t2 = ROW(y + ov.y + view_start).t + ov.x;
+ rend_t *r2 = ROW(y + ov.y + view_start).r + ov.x;
- for (int x = ov_w; x--; )
+ for (int x = ov.w; x--; )
{
text_t t = *t1; *t1++ = *t2; *t2++ = t;
rend_t r = *r1; *r1++ = *r2; *r2++ = SET_FONT (r, FONTSET (r)->find_font (t));
STATE_DOWN,
};
-struct scrollBar_t {
+struct scrollBar_t
+{
rxvt_term *term;
char state; /* scrollbar state */
char init; /* scrollbar has been initialised */