repo: rxvt-unicode-sixel
action: commit
revision: 
path_from: 
revision_from: 11e6b379f11027e5f8d00bcad8398e87155dec97:
path_to: 
revision_to: 
git.thebackupbox.net
rxvt-unicode-sixel
git clone git://git.thebackupbox.net/rxvt-unicode-sixel
commit 11e6b379f11027e5f8d00bcad8398e87155dec97
Author: Marc Lehmann 
Date:   Mon Feb 14 20:46:47 2005 +0000

    *** empty log message ***

diff --git a/Changes b/Changes
index 143487dc57083588de60900cfce8c15cfd12f4e6..
index ..e76d97fb7c326aa4098943893cb31e228ba22295 100644
--- a/Changes
+++ b/Changes
@@ -22,6 +22,11 @@ WISH: just for fun, do shade and tint with XRender.
         - after deciding that LSM is dead, remove all traces of it,
           along with other, similar, cleanups.
         - _try_ to react sensibly to some non-monotonic time changes.
+        - don't crash in urxvtc when getcwd fails (reported by Paco-Paco).
+        - tweak font searching algorithm a bit to get faster and be
+          more compatible with the font older rxvt-unicode versions chose
+          (reported by Paco-Paco).
+        - urxvtd tries to stay in "/" whenever possible.

 5.0  Fri Feb 11 18:31:48 CET 2005
 	- document a race-free hack to start urxvtd.
diff --git a/src/rxvtc.C b/src/rxvtc.C
index 8f70becb18d4fe66e971ae507b434a23542948be..
index ..f4db4d1b27681963f60280db7b780f5cc3c6cdb2 100644
--- a/src/rxvtc.C
+++ b/src/rxvtc.C
@@ -65,8 +65,6 @@ int
 main (int argc, const char *const *argv)
 {
   client c;
-  char buf[PATH_MAX];
-
   {
     sigset_t ss;

@@ -76,8 +74,17 @@ main (int argc, const char *const *argv)
   }

   c.send ("NEW");
+
   // instead of getcwd we could opendir (".") and pass the fd for fchdir *g*
-  c.send ("CWD"), c.send (getcwd (buf, sizeof (buf)));
+  char cwd[PATH_MAX];
+
+  if (!getcwd (cwd, sizeof (cwd)))
+    {
+      perror ("unable to determine current working directory");
+      exit (EXIT_FAILURE);
+    }
+
+  c.send ("CWD"), c.send (cwd);

   for (char **var = environ; *environ; environ++)
     c.send ("ENV"), c.send (*environ);
diff --git a/src/rxvtd.C b/src/rxvtd.C
index 67048a5f7955a5a0307dd70f5e2cdced66700136..
index ..6c56f4b2e3eaa2ede4e7bd58ebfc494c409d1a7e 100644
--- a/src/rxvtd.C
+++ b/src/rxvtd.C
@@ -196,6 +196,7 @@ void server::read_cb (io_watcher &w, short revents)
             term->log_hook = 0;

             environ = old_environ;
+            chdir ("/");

             if (!success)
               term->destroy ();
@@ -215,6 +216,8 @@ main (int argc, const char *const *argv)
 {
   rxvt_init ();

+  chdir ("/");
+
   char *sockname = rxvt_connection::unix_sockname ();
   unix_listener l (sockname);
   printf ("rxvt-unicode daemon listening on %s.\n", sockname);
diff --git a/src/rxvtfont.C b/src/rxvtfont.C
index 22e677eb5f12d53ae2701040e95a0343251b002d..
index ..2c0fdd0f3dbab8a7d90261df5be56bd38988ce2e 100644
--- a/src/rxvtfont.C
+++ b/src/rxvtfont.C
@@ -718,6 +718,8 @@ rxvt_font_x11::load (const rxvt_fontprop &prop)

       if (replace_field (fname, list[i], 6, '0', field_str))
         diff += 10; // slightly penalize scalable fonts
+      else if (replace_field (fname, list[i], 11, '0', "0"))
+        diff += 300; // more heavily penalize what looks like scaled bitmap fotns

       if (!set_properties (p, fname))
         continue;
@@ -743,7 +745,7 @@ rxvt_font_x11::load (const rxvt_fontprop &prop)
       font_weight *best = fonts + count - 1;

       for (font_weight *w = best; w-- > fonts; )
-        if (w->diff < best->diff)
+        if (w->diff <= best->diff)
           best = w;

       if (!best->name
@@ -1098,7 +1100,7 @@ rxvt_font_xft::load (const rxvt_fontprop &prop)
   FcValue v;

   if (prop.height != rxvt_fontprop::unset
-      || (FcPatternGet (p, FC_PIXEL_SIZE, 0, &v) != FcResultMatch
+      && (FcPatternGet (p, FC_PIXEL_SIZE, 0, &v) != FcResultMatch
           && FcPatternGet (p, FC_SIZE, 0, &v) != FcResultMatch))
     FcPatternAddInteger (p, FC_PIXEL_SIZE, prop.height);

-----END OF PAGE-----