}
if (len > 0)
- tt_write ((unsigned char *)mb, len);
+ tt_write (mb, len);
else
scr_bell ();
}
static int debug_key = 1; /* accessible by a debugger only */
#endif
int valid_keysym;
- unsigned char kbuf[KBUFSZ];
+ char kbuf[KBUFSZ];
/*
* use Num_Lock to toggle Keypad on/off. If Num_Lock is off, allow an
#if 0
#ifdef X_HAVE_UTF8_STRING
if (enc_utf8 && 0) // currently disabled, doesn't seem to work, nor is useful
- len = Xutf8LookupString (Input_Context, &ev, (char *)kbuf,
+ len = Xutf8LookupString (Input_Context, &ev, kbuf,
KBUFSZ, &keysym, &status_return);
else
#endif
else
#endif
{
- len = XLookupString (&ev, (char *)kbuf, KBUFSZ, &keysym, &compose);
+ len = XLookupString (&ev, kbuf, KBUFSZ, &keysym, &compose);
valid_keysym = keysym != NoSymbol;
}
/* set 8-bit on */
if (meta && (meta_char == 0x80))
{
- unsigned char *ch;
+ char *ch;
for (ch = kbuf; ch < kbuf + len; ch++)
*ch |= 0x80;
#endif
)
{
- const unsigned char ch = C0_ESC;
+ const char ch = C0_ESC;
tt_write (&ch, 1);
}
/*{{{ rxvt_cmd_write (), rxvt_cmd_getc () */
/* attempt to `write' count to the input buffer */
unsigned int
-rxvt_term::cmd_write (const unsigned char *str, unsigned int count)
+rxvt_term::cmd_write (const char *str, unsigned int count)
{
unsigned int n, s;
{
bool flag = false;
unicode_t ch = NOCHAR;
- unsigned char *seq_begin; // remember start of esc-sequence here
+ char *seq_begin; // remember start of esc-sequence here
for (;;)
{
while (cmdbuf_ptr < cmdbuf_endp)
{
// assume 7-bit to be ascii ALWAYS
- if (*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b)
+ if ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b)
return *cmdbuf_ptr++;
wchar_t wc;
- size_t len = mbrtowc (&wc, (char *)cmdbuf_ptr, cmdbuf_endp - cmdbuf_ptr, mbstate);
+ size_t len = mbrtowc (&wc, cmdbuf_ptr, cmdbuf_endp - cmdbuf_ptr, mbstate);
if (len == (size_t)-2)
{
break;
case C0_ENQ: /* terminal Status */
if (rs[Rs_answerbackstring])
- tt_write ((const unsigned char *)rs[Rs_answerbackstring],
- (unsigned int)strlen (rs[Rs_answerbackstring]));
+ tt_write (rs [Rs_answerbackstring], strlen (rs [Rs_answerbackstring]));
else
- tt_write ((unsigned char *)VT100_ANS,
- (unsigned int)strlen (VT100_ANS));
+ tt_write (VT100_ANS, strlen (VT100_ANS));
break;
case C0_BEL: /* bell */
scr_bell ();
/* 8.3.110: SINGLE CHARACTER INTRODUCER */
case C1_SCI: /* ESC Z */
- tt_write ((const unsigned char *)ESCZ_ANSWER,
- (unsigned int) (sizeof (ESCZ_ANSWER) - 1));
+ tt_write (ESCZ_ANSWER, sizeof (ESCZ_ANSWER) - 1);
break; /* steal obsolete ESC [ c */
/* 8.3.16: CONTROL SEQUENCE INTRODUCER */
break;
case CSI_DA: /* 8.3.24: (0) DEVICE ATTRIBUTES */
- tt_write ((const unsigned char *)VT100_ANS,
- (unsigned int) (sizeof (VT100_ANS) - 1));
+ tt_write (VT100_ANS, sizeof (VT100_ANS) - 1);
break;
case CSI_SGR: /* 8.3.118: (0) SELECT GRAPHIC RENDITION */
* get input up until STRING TERMINATOR (or BEL)
* ends_how is terminator used. returned input must be free()'d
*/
-unsigned char *
+char *
rxvt_term::get_to_st (unicode_t &ends_how)
{
unicode_t ch;
ends_how = (ch == 0x5c ? C0_ESC : ch);
- return (unsigned char *)rxvt_wcstombs (string);
+ return rxvt_wcstombs (string);
}
/*----------------------------------------------------------------------*/
void
rxvt_term::process_dcs_seq ()
{
- unsigned char *s;
+ char *s;
unicode_t eh;
/*
if (ch == ';')
{
- unsigned char *s = get_to_st (eh);
+ char *s = get_to_st (eh);
if (s)
{
- process_xterm_seq (arg, (char *)s, eh);
+ process_xterm_seq (arg, s, eh);
free (s);
}
}
}
void
-rxvt_term::process_color_seq (int report, int color, const char *str, unsigned char resp)
+rxvt_term::process_color_seq (int report, int color, const char *str, char resp)
{
if (str[0] == '?' && !str[1])
{
* XTerm escape sequences: ESC ] Ps;Pt (ST|BEL)
*/
void
-rxvt_term::process_xterm_seq (int op, const char *str, unsigned char resp)
+rxvt_term::process_xterm_seq (int op, const char *str, char resp)
{
int changed = 0;
int color;
rxvt_term::tt_printf (const char *fmt,...)
{
va_list arg_ptr;
- unsigned char buf[256];
+ char buf[256];
va_start (arg_ptr, fmt);
vsnprintf ((char *)buf, 256, fmt, arg_ptr);
const unsigned int MAX_PTY_WRITE = 255; // minimum MAX_INPUT
void
-rxvt_term::tt_write (const unsigned char *data, unsigned int len)
+rxvt_term::tt_write (const char *data, unsigned int len)
{
if (v_buflen == 0)
{
len -= written;
}
- v_buffer = (unsigned char *)realloc (v_buffer, v_buflen + len);
+ v_buffer = (char *)realloc (v_buffer, v_buflen + len);
memcpy (v_buffer + v_buflen, data, len);
v_buflen += len;
SavedModes |= PrivMode_menuBar;
}
-#ifdef CURSOR_BLINK
- if (OPTION (Opt_cursorBlink))
- (void)gettimeofday (&lastcursorchange, NULL);
-#endif
-
run_command (argv);
}
vt = XCreateSimpleWindow (disp, top,
window_vt_x,
window_vt_y,
- TermWin_TotalWidth (),
- TermWin_TotalHeight (),
+ width,
+ height,
0,
pix_colors_focused[Color_fg],
pix_colors_focused[Color_bg]);
{
menuBar.win = XCreateSimpleWindow (disp, top,
window_vt_x, 0,
- TermWin_TotalWidth (),
+ width,
menuBar_TotalHeight (),
0,
pix_colors_focused[Color_fg],
output_string (rxvt_term *rt, const char *str)
{
if (strncmp (str, "command:", 8) == 0)
- rt->cmd_write ((unsigned char *)str + 8, strlen (str) - 8);
+ rt->cmd_write (str + 8, strlen (str) - 8);
else if (strncmp (str, "perl:", 5) == 0)
PERL_INVOKE((rt, HOOK_KEYBOARD_COMMAND, DT_STRING, str + 5, DT_END));
else
- rt->tt_write ((unsigned char *)str, strlen (str));
+ rt->tt_write (str, strlen (str));
}
static void
else if (rt->meta_char == C0_ESC) /* escape prefix */
#endif
{
- const unsigned char ch = C0_ESC;
+ const char ch = C0_ESC;
rt->tt_write (&ch, 1);
}
}
- rt->tt_write ((unsigned char *) buf, buflen);
+ rt->tt_write (buf, buflen);
}
static int
{
keysym_t *key = new keysym_t;
wchar_t *wc = rxvt_mbstowcs (trans);
- const char *translation = rxvt_wcstoutf8 (wc);
+ char *translation = rxvt_wcstoutf8 (wc);
free (wc);
if (key && translation)
if (menubar_visible ())
XMoveResizeWindow (disp, menuBar.win,
window_vt_x, 0,
- TermWin_TotalWidth (), menuBar_TotalHeight ());
+ width, menuBar_TotalHeight ());
XMoveResizeWindow (disp, vt,
window_vt_x, window_vt_y,
- TermWin_TotalWidth (), TermWin_TotalHeight ());
+ width, height);
scr_clear ();
#ifdef XPM_BACKGROUND
static const struct
{
- const char name; /* (l)eft, (u)p, (d)own, (r)ight */
- const unsigned char str[5]; /* str[0] = strlen (str+1) */
+ const char name; /* (l)eft, (u)p, (d)own, (r)ight */
+ const char str[5]; /* str[0] = strlen (str+1) */
}
Arrows[NARROWS] = {
{ 'l', "\003\033[D" },
* remove the first character of STR if it's '\0'
*/
int
-rxvt_action_type (action_t *action, unsigned char *str)
+rxvt_action_type (action_t *action, char *str)
{
unsigned int len;
if (str[0] == '\0')
{
/* the functional equivalent: memmove (str, str+1, len); */
- unsigned char *dst = (str);
- unsigned char *src = (str + 1);
- unsigned char *end = (str + len);
+ char *dst = (str);
+ char *src = (str + 1);
+ char *end = (str + len);
while (src <= end)
*dst++ = *src++;
if (str[0] != '\0')
action->type = MenuTerminalAction;
}
+
action->str = str;
action->len = len;
for (i = 0; i < NARROWS; i++)
{
- unsigned char *str;
- unsigned int len;
+ char *str;
+ unsigned int len;
if (!parse[i].len)
continue;
- str = (unsigned char *) rxvt_malloc (parse[i].len + xtra_len + 1);
+ str = (char *)rxvt_malloc (parse[i].len + xtra_len + 1);
len = 0;
if (beg.len)
}
if (len)
{
- unsigned char *str = (unsigned char *)rxvt_malloc (len + 1);
+ char *str = (char *)rxvt_malloc (len + 1);
strcpy (str, action);
if (x >= width)
return;
else if (x + len >= width)
- len = (TermWin_TotalWidth () - x);
+ len = (this->width - x);
#ifdef MENUBAR_SHADOW_IN
state = -state;
ActiveMenu->w = Menu_PixelWidth (ActiveMenu);
if ((x + ActiveMenu->w) >= width)
- x = (TermWin_TotalWidth () - ActiveMenu->w);
+ x = (this->width - ActiveMenu->w);
/* find the height */
for (h = 0, item = ActiveMenu->head; item != NULL; item = item->next)
/* ensure menu is in window limits */
if ((x1 + menu->w) >= width)
- x1 = (TermWin_TotalWidth () - menu->w);
+ x1 = (this->width - menu->w);
if ((y1 + menu->h) >= height)
- y1 = (TermWin_TotalHeight () - menu->h);
+ y1 = (this->height - menu->h);
menu->x = (x1 < 0 ? 0 : x1);
menu->y = (y1 < 0 ? 0 : y1);
void
rxvt_action_decode (FILE *fp, action_t *act)
{
- unsigned char *str;
+ char *str;
short len;
if (act == NULL || (len = act->len) == 0 || (str = act->str) == NULL)
*/
while (len > 0)
{
- unsigned char ch = *str++;
+ char ch = *str++;
switch (ch)
{
default:
if (ch <= 31)
fprintf (fp, "^%c", ('@' + ch));
- else if (ch > 127)
+ else if ((unsigned char)ch > 127)
fprintf (fp, "\\%o", ch);
else
fprintf (fp, "%c", ch);
#define MENUBAR_H_
typedef struct {
- short type; /* must not be changed; first element */
- short len; /* strlen (str) */
- unsigned char *str; /* action to take */
+ int type; /* must not be changed; first element */
+ int len; /* strlen (str) */
+ char *str; /* action to take */
} action_t;
typedef struct {
- short type; /* must not be changed; first element */
+ int type; /* must not be changed; first element */
struct menu_t *menu; /* sub-menu */
} submenu_t;
* MACRO DEFINES
*****************************************************************************
*/
-#define memset(x, y, z) memset((x), (y), (size_t)(z))
-#define memcpy(x, y, z) memcpy((void *)(x), (const void *)(y), (z))
-#define memmove(x, y, z) memmove((void *)(x), (const void *)(y), (z))
-#define strcasecmp(x, y) strcasecmp((x), (y))
-#define strncasecmp(x, y, z) strncasecmp((x), (y), (z))
-#define strcpy(x, y) strcpy((char *)(x), (const char *)(y))
-#define strncpy(x, y, z) strncpy((char *)(x), (const char *)(y), (z))
-#define strcmp(x, y) strcmp((const char *)(x), (const char *)(y))
-#define strncmp(x, y, z) strncmp((const char *)(x), (const char *)(y), (z))
-#define strcat(x, y) strcat((char *)(x), (const char *)(y))
-#define strncat(x, y, z) strncat((char *)(x), (const char *)(y), (z))
-#define strdup(x) strdup((const char *)(x))
-#define strlen(x) strlen((const char *)(x))
-#define strchr(x, y) strchr((const char *)(x), (int)(y))
-#define strrchr(x, y) strrchr((const char *)(x), (int)(y))
-
#define dDisp Display *disp = display->display
/* convert pixel dimensions to row/column values. Everything as int32_t */
#define Width2Pixel(n) ((int32_t)(n) * (int32_t)fwidth)
#define Height2Pixel(n) ((int32_t)(n) * (int32_t)fheight)
-#define TermWin_TotalWidth() ((int32_t)this->width)
-#define TermWin_TotalHeight() ((int32_t)this->height)
-
// for m >= -n, ensure remainder lies between 0..n-1
#define MOD(m,n) (((m) + (n)) % (n))
bar_t BarList;
# endif /* (MENUBAR_MAX > 1) */
#endif
-#ifdef CURSOR_BLINK
- struct timeval lastcursorchange;
-#endif
-#ifdef POINTER_BLANK
- struct timeval lastmotion;
-#endif
#if ENABLE_OVERLAY
int ov_x, ov_y, ov_w, ov_h; // overlay dimensions
char *env_colorfgbg;
char *locale;
char charsets[4];
- unsigned char *v_buffer; /* pointer to physical buffer */
+ char *v_buffer; /* pointer to physical buffer */
unsigned int v_buflen; /* size of area to write */
stringvec *argv, *envv; /* if != 0, will be freed on destroy time */
const char *rs[NUM_RESOURCES];
/* command input buffering */
- unsigned char *cmdbuf_ptr, *cmdbuf_endp;
- unsigned char cmdbuf_base[CBUFSIZ];
+ char *cmdbuf_ptr, *cmdbuf_endp;
+ char cmdbuf_base[CBUFSIZ];
rxvt_salloc *talloc; // text line allocator
rxvt_salloc *ralloc; // rend line allocator
#endif
// modifies first argument(!)
- void paste (unsigned char *data, unsigned int len);
+ void paste (char *data, unsigned int len);
void flush ();
void pointer_unblank ();
void tt_printf (const char *fmt,...);
- void tt_write (const unsigned char *data, unsigned int len);
+ void tt_write (const char *data, unsigned int len);
void pty_write ();
void tt_winch ();
// command.C
void lookup_key (XKeyEvent &ev);
- unsigned int cmd_write (const unsigned char *str, unsigned int count);
+ unsigned int cmd_write (const char *str, unsigned int count);
unicode_t next_char ();
unicode_t cmd_getc ();
void process_escape_seq ();
void process_csi_seq ();
void process_window_ops (const int *args, unsigned int nargs);
- unsigned char *get_to_st (unicode_t &ends_how);
+ char *get_to_st (unicode_t &ends_how);
void process_dcs_seq ();
void process_osc_seq ();
- void process_color_seq (int report, int color, const char *str, unsigned char resp);
- void process_xterm_seq (int op, const char *str, unsigned char resp);
+ void process_color_seq (int report, int color, const char *str, char resp);
+ void process_xterm_seq (int op, const char *str, char resp);
int privcases (int mode, unsigned long bit);
void process_terminal_mode (int mode, int priv, unsigned int nargs, const int *arg);
void process_sgr_mode (unsigned int nargs, const int *arg);
STRLEN len;
char *str = SvPVbyte (octets, len);
C_ARGS:
- (unsigned char *)str, len
+ str, len
SV *
rxvt_term::overlay (int x, int y, int w, int h, int rstyle = OVERLAY_RSTYLE, int border = 2)
XCopyArea (display->display, vt, vt,
gc, 0, Row2Pixel (len + i),
- (unsigned int)TermWin_TotalWidth (),
+ (unsigned int)this->width,
(unsigned int)Height2Pixel (wlen - len + 1),
0, Row2Pixel (len));
len = -1;
* Paste a selection direct to the command fd
*/
void
-rxvt_term::paste (unsigned char *data, unsigned int len)
+rxvt_term::paste (char *data, unsigned int len)
{
/* convert normal newline chars into common keyboard Return key sequence */
for (unsigned int i = 0; i < len; i++)
char *s = rxvt_wcstombs (w);
free (w);
// TODO: strlen == only the first element will be converted. well...
- paste ((unsigned char *)s, strlen (s));
+ paste (s, strlen (s));
free (s);
}
else
&& cl)
{
for (int i = 0; i < cr; i++)
- paste ((unsigned char *)cl[i], strlen (cl[i]));
+ paste (cl[i], strlen (cl[i]));
XFreeStringList (cl);
}
else
- paste (ct.value, ct.nitems); // paste raw
+ paste ((char *)ct.value, ct.nitems); // paste raw
bailout:
XFree (ct.value);
if (selection.text)
{ /* internal selection */
char *str = rxvt_wcstombs (selection.text, selection.len);
- paste ((unsigned char *)str, strlen (str));
+ paste (str, strlen (str));
free (str);
return;
}
BOOL (Rs_secondaryScroll, "secondaryScroll", "ssr", Opt_secondaryScroll, "enable secondary screen scroll"),
#endif
#if ENABLE_PERL
- STRG (Rs_perl_lib, "perl-lib", "perl-lib", "string", "colon-separated directories with extension scripts"),
- STRG (Rs_perl_eval, "perl-eval", "perl-eval", "string", "code to be evaluated after all extensions have been loaded"),
+ RSTRG (Rs_perl_lib, "perl-lib", "string"), //, "colon-separated directories with extension scripts"),
+ RSTRG (Rs_perl_eval, "perl-eval", "perl-eval"), // "string", "code to be evaluated after all extensions have been loaded"),
STRG (Rs_perl_ext, "perl-ext", "pe", "string", "colon-separated list of perl extensions to enable"),
#endif
#if 0 && TODO
void
rxvt_term::resize_pixmap ()
{
- XGCValues gcvalue;
- GC gc;
- unsigned int width = TermWin_TotalWidth ();
- unsigned int height = TermWin_TotalHeight ();
+ XGCValues gcvalue;
+ GC gc;
dDisp;
if (pixmap != None)
pixmap = None;
if (!OPTION (Opt_transparent) || !am_transparent)
- XSetWindowBackground (disp, vt,
- pix_colors[Color_bg]);
+ XSetWindowBackground (disp, vt, pix_colors[Color_bg]);
return;
}
if (w == 0)
{
/* basic X tiling - let the X server do it */
- pixmap = XCreatePixmap (disp, vt,
- xpmw, xpmh,
- (unsigned int)display->depth);
+ pixmap = XCreatePixmap (disp, vt, xpmw, xpmh,
+ (unsigned int)display->depth);
XCopyArea (disp, bgPixmap.pixmap, pixmap, gc,
- 0, 0, xpmw, xpmh, 0, 0);
+ 0, 0, xpmw, xpmh, 0, 0);
}
else
{
- float incr, p;
- Pixmap tmp;
+ float incr, p;
+ Pixmap tmp;
- pixmap = XCreatePixmap (disp, vt,
- width, height,
- (unsigned int)display->depth);
+ pixmap = XCreatePixmap (disp, vt, width, height,
+ (unsigned int)display->depth);
/*
* horizontal scaling
*/
rxvt_pixmap_incr (&w, &x, &incr, &p, width, xpmw);
- tmp = XCreatePixmap (disp, vt,
- width, xpmh, (unsigned int)display->depth);
- XFillRectangle (disp, tmp, gc, 0, 0, width,
- xpmh);
+ tmp = XCreatePixmap (disp, vt, width, xpmh, (unsigned int)display->depth);
+ XFillRectangle (disp, tmp, gc, 0, 0, width, xpmh);
for ( /*nil */ ; x < w; x++, p += incr)
{