*** empty log message ***
authorpcg <pcg>
Fri, 2 Apr 2004 15:15:25 +0000 (15:15 +0000)
committerpcg <pcg>
Fri, 2 Apr 2004 15:15:25 +0000 (15:15 +0000)
doc/yodl/versioninfo.yo
src/init.C
src/main.C

index b64d52842e947426f97824b7ef3f92dcb7393004..d07813d8f22a624289b4cff03f8b6ab13c2da94a 100644 (file)
@@ -1,8 +1,8 @@
-COMMENT(-- $Id: versioninfo.yo,v 1.7 2004-03-29 23:35:33 pcg Exp $ --)
+COMMENT(-- $Id: versioninfo.yo,v 1.8 2004-04-02 15:15:25 pcg Exp $ --)
 DEFINEMACRO(RXVTNAME)(0)
        (rxvt)
 DEFINEMACRO(RXVTDATE)(0)
-       (2004-03-28)
+       (2004-04-02)
 DEFINEMACRO(RXVTVERSION)(0)
        (2.6)
 DEFINEMACRO(RXVTMAINT)(0)
index fc513f1556dc0dab7389568d4186a64df09fa667..789b0ffc64e2db5296fde06d182184d6094fc3cf 100644 (file)
@@ -315,7 +315,8 @@ const char *const def_colorName[] =
     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                       */
@@ -325,6 +326,9 @@ const char *const def_colorName[] =
 #ifdef OPTION_HC
     NULL,
 #endif
+#if TINTING
+    NULL,
+#endif
 #ifdef KEEP_SCROLLCOLOR
     COLOR_SCROLLBAR,
     COLOR_SCROLLTROUGH,
@@ -646,7 +650,8 @@ rxvt_term::init_resources (int argc, const char *const *argv)
   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);
@@ -896,7 +901,7 @@ rxvt_term::Get_Colours ()
                     xcol = PixColors[Color_fg];
                     break;
 #endif                          /* ! NO_CURSORCOLOR */
-                  case Color_pointer:
+                  case Color_pointer_fg:
                     xcol = PixColors[Color_fg];
                     break;
                   default:
@@ -910,10 +915,12 @@ rxvt_term::Get_Colours ()
       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
@@ -1121,8 +1128,8 @@ rxvt_term::create_windows (int argc, const char *const *argv)
                       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;
@@ -1134,7 +1141,14 @@ rxvt_term::create_windows (int argc, const char *const *argv)
   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
index 15bd06b3b57a45a0f1b0888480fd8da50980233b..a87fc23efb9c548d935906d3e898df394f226676 100644 (file)
 
 #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
@@ -166,10 +169,14 @@ rxvt_term::rxvt_term ()
     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);
 
@@ -407,20 +414,28 @@ rxvt_init_signals ()
 /*
  * 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;
 }
 
 /*
@@ -869,17 +884,17 @@ rxvt_term::font_up_down (int n, int direction)
 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
@@ -888,17 +903,17 @@ rxvt_term::set_title (const char *str)
 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
@@ -935,8 +950,10 @@ rxvt_term::set_window_color (int idx, const char *color)
           goto Done;
         }
     }
+
   if (!rXParseAllocColor (& xcol, color))
     return;
+
   /* XStoreColor (display->display, XCMAP, XColor*); */
 
   /*
@@ -969,8 +986,7 @@ Done:
 
   set_colorfgbg ();
   recolour_cursor ();
-  /* the only reasonable way to enforce a clean update */
-  scr_poweron ();
+  scr_touch (true);
 }
 
 #else
@@ -980,14 +996,12 @@ Done:
 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);
 }
 
 /*----------------------------------------------------------------------*/