COLOR_CURSOR_BACKGROUND,
COLOR_CURSOR_FOREGROUND,
#endif /* ! NO_CURSORCOLOR */
- NULL, /* Color_pointer */
+ NULL, /* Color_pointer_fg */
+ NULL, /* Color_pointer_bg */
NULL, /* Color_border */
#ifndef NO_BOLD_UNDERLINE_REVERSE
NULL, /* Color_BD */
#ifdef OPTION_HC
NULL,
#endif
+#if TINTING
+ NULL,
+#endif
#ifdef KEEP_SCROLLCOLOR
COLOR_SCROLLBAR,
COLOR_SCROLLTROUGH,
color_aliases (Color_cursor);
color_aliases (Color_cursor2);
#endif /* NO_CURSORCOLOR */
- color_aliases (Color_pointer);
+ color_aliases (Color_pointer_fg);
+ color_aliases (Color_pointer_bg);
color_aliases (Color_border);
#ifndef NO_BOLD_UNDERLINE_REVERSE
color_aliases (Color_BD);
xcol = PixColors[Color_fg];
break;
#endif /* ! NO_CURSORCOLOR */
- case Color_pointer:
+ case Color_pointer_fg:
xcol = PixColors[Color_fg];
break;
default:
SET_PIXCOLOR (i);
}
- if (XDEPTH <= 2 || !rs[Rs_color + Color_pointer])
- PixColors[Color_pointer] = PixColors[Color_fg];
- if (XDEPTH <= 2 || !rs[Rs_color + Color_border])
- PixColors[Color_border] = PixColors[Color_fg];
+ if (XDEPTH <= 2)
+ {
+ if (!rs[Rs_color + Color_pointer_fg]) PixColors[Color_pointer_fg] = PixColors[Color_fg];
+ if (!rs[Rs_color + Color_pointer_bg]) PixColors[Color_pointer_bg] = PixColors[Color_bg];
+ if (!rs[Rs_color + Color_border] ) PixColors[Color_border] = PixColors[Color_fg];
+ }
/*
* get scrollBar/menuBar shadow colors
PixColors[Color_fg]);
#endif
- xterm_seq (XTerm_title, rs[Rs_title], CHAR_ST);
- xterm_seq (XTerm_iconName, rs[Rs_iconName], CHAR_ST);
+ process_xterm_seq (XTerm_title, rs[Rs_title], CHAR_ST);
+ process_xterm_seq (XTerm_iconName, rs[Rs_iconName], CHAR_ST);
classHint.res_name = (char *)rs[Rs_name];
classHint.res_class = (char *)RESCLASS;
wmHint.window_group = TermWin.parent[0];
XSetWMProperties (display->display, TermWin.parent[0], NULL, NULL,
- (char **)argv, argc, &szHint, &wmHint, &classHint);
+ (char **)argv, argc, &szHint, &wmHint, &classHint);
+
+#ifndef NO_FRILLS
+ long pid = getpid ();
+ XChangeProperty (display->display, TermWin.parent[0],
+ display->atom ("_NET_WM_PID"), XA_CARDINAL, 32,
+ PropModeReplace, (unsigned char *)&pid, 1);
+#endif
XSelectInput (display->display, TermWin.parent[0],
KeyPressMask
#include <cstring>
+vector<rxvt_term *> rxvt_term::termlist;
+
static char curlocale[128];
-void
+bool
rxvt_set_locale (const char *locale)
{
- if (locale && STRNCMP (locale, curlocale, 128))
- {
- STRNCPY (curlocale, locale, 128);
- setlocale (LC_CTYPE, curlocale);
- }
+ if (!locale || !STRNCMP (locale, curlocale, 128))
+ return false;
+
+ STRNCPY (curlocale, locale, 128);
+ setlocale (LC_CTYPE, curlocale);
+ return true;
}
#if ENABLE_COMBINING
incr_ev (this, &rxvt_term::incr_cb)
{
cmdbuf_ptr = cmdbuf_endp = cmdbuf_base;
+
+ termlist.push_back (this);
}
rxvt_term::~rxvt_term ()
{
+ termlist.erase (find (termlist.begin (), termlist.end(), this));
+
if (cmd_fd >= 0)
close (cmd_fd);
/*
* Catch a SIGCHLD signal and exit if the direct child has died
*/
+
+void rxvt_term::child_exited (int pid)
+{
+ for (rxvt_term **t = termlist.begin (); t < termlist.end (); t++)
+ if (pid == (*t)->cmd_pid)
+ {
+ (*t)->destroy ();
+ break;
+ }
+}
+
/* ARGSUSED */
/* EXTPROTO */
RETSIGTYPE
rxvt_Child_signal (int sig __attribute__ ((unused)))
{
int pid, save_errno = errno;
- while ((pid = waitpid (-1, NULL, WNOHANG)) == -1 && errno == EINTR)
- ;
- errno = save_errno;
-#if 0
- if (pid == cmd_pid)
- exit (EXIT_SUCCESS);
-#endif
+ while ((pid = waitpid (-1, NULL, WNOHANG)) > 0)
+ rxvt_term::child_exited (pid);
+
+ errno = save_errno;
}
/*
void
rxvt_term::set_title (const char *str)
{
-#ifndef SMART_WINDOW_TITLE
- XStoreName (display->display, TermWin.parent[0], str);
-#else
+#ifdef SMART_WINDOW_TITLE
char *name;
if (!XFetchName (display->display, TermWin.parent[0], &name))
name = NULL;
if (name == NULL || STRCMP (name, str))
+#endif
XStoreName (display->display, TermWin.parent[0], str);
+#ifdef SMART_WINDOW_TITLE
if (name)
XFree (name);
#endif
void
rxvt_term::set_icon_name (const char *str)
{
-#ifndef SMART_WINDOW_TITLE
- XSetIconName (display->display, TermWin.parent[0], str);
-#else
+#ifdef SMART_WINDOW_TITLE
char *name;
if (!XGetIconName (display->display, TermWin.parent[0], &name))
name = NULL;
if (name == NULL || STRCMP (name, str))
+#endif
XSetIconName (display->display, TermWin.parent[0], str);
+#ifdef SMART_WINDOW_TITLE
if (name)
XFree (name);
#endif
goto Done;
}
}
+
if (!rXParseAllocColor (& xcol, color))
return;
+
/* XStoreColor (display->display, XCMAP, XColor*); */
/*
set_colorfgbg ();
recolour_cursor ();
- /* the only reasonable way to enforce a clean update */
- scr_poweron ();
+ scr_touch (true);
}
#else
void
rxvt_term::recolour_cursor ()
{
-#if TODO
- rxvt_color xcol[2];
+ XColor xcol[2];
- xcol[0] = PixColors[Color_pointer];
- xcol[1] = PixColors[Color_bg];
+ xcol[0].pixel = ISSET_PIXCOLOR (Color_pointer_fg) ? PixColors[Color_pointer_fg] : PixColors[Color_fg];
+ xcol[1].pixel = ISSET_PIXCOLOR (Color_pointer_bg) ? PixColors[Color_pointer_bg] : PixColors[Color_bg];
XQueryColors (display->display, XCMAP, xcol, 2);
- XRecolorCursor (display->display, TermWin_cursor, & (xcol[0]), & (xcol[1]));
-#endif
+ XRecolorCursor (display->display, TermWin_cursor, xcol + 0, xcol + 1);
}
/*----------------------------------------------------------------------*/