[Pkg-urxvt-maintainers] [SCM] Git repository for pkg-urxvt branch, master, updated. debian/9.15-2-20-g4737a55

Ryan Kavanagh rak at alioth.debian.org
Mon Mar 25 14:31:27 UTC 2013


Gitweb-URL: http://git.debian.org/?p=pkg-kde//srv/git.debian.org/git/pkg-urxvt/pkg-urxvt.git;a=commitdiff;h=b192c7b

The following commit has been merged in the master branch:
commit b192c7b945358e10f5bb4a0f4940046965b2cb11
Author: Ryan Kavanagh <rak at debian.org>
Date:   Wed Mar 20 14:23:59 2013 -0400

    Imported Upstream version 9.17
---
 Changes             |   13 +++++-
 config.h.in         |    3 -
 configure           |    6 --
 configure.ac        |    4 --
 doc/rxvt.1.man.in   |    2 +-
 doc/rxvt.7.man.in   |    2 +-
 doc/rxvtc.1.man.in  |    4 +-
 doc/rxvtd.1.man.in  |    4 +-
 libev/Changes       |   18 +++++--
 libev/ev.c          |   49 +++++++++++++++----
 libev/ev.h          |   44 ++++++++--------
 src/background.C    |  136 +++++++++++++++------------------------------------
 src/command.C       |   41 +++++++--------
 src/init.C          |    2 +-
 src/keyboard.C      |   14 ++----
 src/keyboard.h      |    4 +-
 src/main.C          |   20 ++++---
 src/perl/background |   10 ++++
 src/rsinc.h         |    2 +-
 src/rxvt.h          |   61 ++++++++++++-----------
 src/rxvtimg.C       |   37 +++++++++++++-
 src/rxvtimg.h       |    1 +
 src/rxvtperl.xs     |   22 ++++----
 src/rxvttoolkit.C   |    2 +-
 src/rxvttoolkit.h   |    2 +-
 src/screen.C        |   96 +++++++++++++++++++++---------------
 src/version.h       |    4 +-
 src/xdefaults.C     |    6 +-
 28 files changed, 321 insertions(+), 288 deletions(-)

diff --git a/Changes b/Changes
index 9dbd9b2..b7b07f5 100644
--- a/Changes
+++ b/Changes
@@ -28,9 +28,20 @@ TODO: pack rxvt_fatal messages into the exception object
 TODO: load must not cache, but global image cache must be cleaned
 TODO: provide something like % for easy access for parse_keysym
 TODO: description into --help output?
-TODO: shade
 TODO: rxvt -help => (see rxvt-XXX(1))?
 
+9.17 Fri Mar  1 13:46:08 CET 2013
+	- add shade operator in background perl extension.
+        - avoid starting or ending the selection in the middle of wide
+          characters to avoid artifacts (reproted by Tiago Resende).
+	- fix artifacts that may occur if the character in the cursor
+	  cell has width > 1 (reported by Tiago Resende).
+	- fix regression that causes artifacts on scrolling if
+	  saveLines is 0 and the window is resized (reported by Bert
+	  Münnich).
+	- fix build when perl is enabled and pixbuf and transparency
+	  are disabled.
+
 9.16 Thu Dec 27 11:56:43 CET 2012
 	- the "so much new stuff your eyes will pop out" release.
         - INCOMPATIBLE CHANGE: renamed urlLauncher resource to url-launcher.
diff --git a/config.h.in b/config.h.in
index eef30e0..8ade9f5 100644
--- a/config.h.in
+++ b/config.h.in
@@ -1,8 +1,5 @@
 /* config.h.in.  Generated from configure.ac by autoheader.  */
 
-/* Define if you want to have sexy-looking background pixmaps. */
-#undef BG_IMAGE_FROM_FILE
-
 /* Define if you want 8 bit control sequences */
 #undef EIGHT_BIT_CONTROLS
 
diff --git a/configure b/configure
index 1b79b7c..232eb73 100755
--- a/configure
+++ b/configure
@@ -7760,12 +7760,6 @@ $as_echo "#define XRENDER 1" >>confdefs.h
 $as_echo "#define ENABLE_TRANSPARENCY 1" >>confdefs.h
 
   fi
-
-  if test x$support_pixbuf = xyes; then
-
-$as_echo "#define BG_IMAGE_FROM_FILE 1" >>confdefs.h
-
-  fi
 fi
 
 if test x$support_styles = xyes; then
diff --git a/configure.ac b/configure.ac
index d858d00..e88b37e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -645,10 +645,6 @@ if test x$support_image = xyes && test x$rxvt_have_xrender = xyes; then
   if test x$support_inheritpixmap = xyes; then
     AC_DEFINE(ENABLE_TRANSPARENCY, 1, Define if you want your background to use the parent window background)
   fi
-
-  if test x$support_pixbuf = xyes; then
-    AC_DEFINE(BG_IMAGE_FROM_FILE, 1, Define if you want to have sexy-looking background pixmaps.)
-  fi
 fi
 
 if test x$support_styles = xyes; then
diff --git a/doc/rxvt.1.man.in b/doc/rxvt.1.man.in
index c5e2dcb..56b6112 100644
--- a/doc/rxvt.1.man.in
+++ b/doc/rxvt.1.man.in
@@ -124,7 +124,7 @@
 .\" ========================================================================
 .\"
 .IX Title "@@RXVT_NAME@@ 1"
-.TH @@RXVT_NAME@@ 1 "2012-11-06" "@@RXVT_VERSION@@" "RXVT-UNICODE"
+.TH @@RXVT_NAME@@ 1 "2013-03-01" "@@RXVT_VERSION@@" "RXVT-UNICODE"
 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
 .\" way too many mistakes in technical documents.
 .if n .ad l
diff --git a/doc/rxvt.7.man.in b/doc/rxvt.7.man.in
index 7cd63d7..e5d5bc1 100644
--- a/doc/rxvt.7.man.in
+++ b/doc/rxvt.7.man.in
@@ -124,7 +124,7 @@
 .\" ========================================================================
 .\"
 .IX Title "@@RXVT_NAME@@ 7"
-.TH @@RXVT_NAME@@ 7 "2012-11-06" "@@RXVT_VERSION@@" "RXVT-UNICODE"
+.TH @@RXVT_NAME@@ 7 "2013-03-01" "@@RXVT_VERSION@@" "RXVT-UNICODE"
 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
 .\" way too many mistakes in technical documents.
 .if n .ad l
diff --git a/doc/rxvtc.1.man.in b/doc/rxvtc.1.man.in
index 22463b2..18666b2 100644
--- a/doc/rxvtc.1.man.in
+++ b/doc/rxvtc.1.man.in
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14)
+.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16)
 .\"
 .\" Standard preamble:
 .\" ========================================================================
@@ -124,7 +124,7 @@
 .\" ========================================================================
 .\"
 .IX Title "@@RXVT_NAME@@ 1"
-.TH @@RXVT_NAME@@ 1 "2012-01-21" "@@RXVT_VERSION@@" "RXVT-UNICODE"
+.TH @@RXVT_NAME@@ 1 "2013-03-01" "@@RXVT_VERSION@@" "RXVT-UNICODE"
 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
 .\" way too many mistakes in technical documents.
 .if n .ad l
diff --git a/doc/rxvtd.1.man.in b/doc/rxvtd.1.man.in
index d699175..291d787 100644
--- a/doc/rxvtd.1.man.in
+++ b/doc/rxvtd.1.man.in
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14)
+.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16)
 .\"
 .\" Standard preamble:
 .\" ========================================================================
@@ -124,7 +124,7 @@
 .\" ========================================================================
 .\"
 .IX Title "@@RXVT_NAME@@ 1"
-.TH @@RXVT_NAME@@ 1 "2012-01-21" "@@RXVT_VERSION@@" "RXVT-UNICODE"
+.TH @@RXVT_NAME@@ 1 "2013-03-01" "@@RXVT_VERSION@@" "RXVT-UNICODE"
 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
 .\" way too many mistakes in technical documents.
 .if n .ad l
diff --git a/libev/Changes b/libev/Changes
index 31fd9ea..00a03f1 100644
--- a/libev/Changes
+++ b/libev/Changes
@@ -6,13 +6,14 @@ TODO: faq, process a thing in each iteration
 TODO: dbeugging tips, ev_verify, ev_init twice
 TODO: ev_break for immediate exit (EVBREAK_NOW?)
 TODO: ev_feed_child_event
-
 TODO: document the special problem of signals around fork.
 TODO: store pid for each signal
 TODO: document file descriptor usage per loop
 TODO: store loop pid_t and compare isndie signal handler,store 1 for same, 2 for differign pid, clean up in loop_fork
 TODO: embed watchers need updating when fd changes
 TODO: document portbaility requirements for atomic pointer access
+
+4.15 Fri Mar  1 12:04:50 CET 2013
         - destroying a non-default loop would stop the global waitpid
           watcher (Denis Bilenko).
 	- queueing pending watchers of higher priority from a watcher now invokes
@@ -35,10 +36,12 @@ TODO: document portbaility requirements for atomic pointer access
 	- (ecb) add memory fence support for gcc-alpha (Christian Weisgerber).
         - work around some kernels losing file descriptors by leaking
           the kqueue descriptor in the child.
+        - work around linux inotify not reporting IN_ATTRIB changes for directories
+          in many cases.
         - include sys/syscall.h instead of plain syscall.h.
         - check for io watcher loops in ev_verify, check for the most
           common reported usage bug in ev_io_start.
-        - chose socket vs. WSASocket at compiletime using EV_USE_WSASOCKET.
+        - choose socket vs. WSASocket at compiletime using EV_USE_WSASOCKET.
         - always use WSASend/WSARecv directly on windows, hoping that this
           works in all cases (unlike read/write/send/recv...).
         - try to detect signals around a fork faster (test program by
@@ -47,8 +50,15 @@ TODO: document portbaility requirements for atomic pointer access
         - rename ev::embed::set to ev::embed::set_embed to avoid clashing
           the watcher base set (loop) method.
         - rewrite the async/signal pipe logic to always keep a valid fd, which
-          simplifies (and hopefuly correctifies :) the race checking
+          simplifies (and hopefully correctifies :) the race checking
           on fork, at the cost of one extra fd.
+        - add fat, msdos, jffs2, ramfs, ntfs and btrfs to the list of
+          inotify-supporting filesystems.
+        - move orig_CFLAGS assignment to after AC_INIT, as newer autoconf
+          versions ignore it before
+          (https://bugzilla.redhat.com/show_bug.cgi?id=908096).
+        - add some untested android support.
+        - enum expressions must be of type int (reported by Juan Pablo L).
 
 4.11 Sat Feb  4 19:52:39 CET 2012
 	- INCOMPATIBLE CHANGE: ev_timer_again now clears the pending status, as
@@ -242,7 +252,7 @@ TODO: document portbaility requirements for atomic pointer access
         - implement ev_suspend and ev_resume.
         - new EV_CUSTOM revents flag for use by applications.
         - add documentation section about priorities.
-        - add a glossary to the dcoumentation.
+        - add a glossary to the documentation.
         - extend the ev_fork description slightly.
         - optimize a jump out of call_pending.
 
diff --git a/libev/ev.c b/libev/ev.c
index ff8f090..e5bd5ab 100644
--- a/libev/ev.c
+++ b/libev/ev.c
@@ -359,6 +359,22 @@
 # define EV_HEAP_CACHE_AT EV_FEATURE_DATA
 #endif
 
+#ifdef ANDROID
+/* supposedly, android doesn't typedef fd_mask */
+# undef EV_USE_SELECT
+# define EV_USE_SELECT 0
+/* supposedly, we need to include syscall.h, not sys/syscall.h, so just disable */
+# undef EV_USE_CLOCK_SYSCALL
+# define EV_USE_CLOCK_SYSCALL 0
+#endif
+
+/* aix's poll.h seems to cause lots of trouble */
+#ifdef _AIX
+/* AIX has a completely broken poll.h header */
+# undef EV_USE_POLL
+# define EV_USE_POLL 0
+#endif
+
 /* on linux, we can use a (slow) syscall to avoid a dependency on pthread, */
 /* which makes programs even slower. might work on other unices, too. */
 #if EV_USE_CLOCK_SYSCALL
@@ -375,12 +391,6 @@
 
 /* this block fixes any misconfiguration where we know we run into trouble otherwise */
 
-#ifdef _AIX
-/* AIX has a completely broken poll.h header */
-# undef EV_USE_POLL
-# define EV_USE_POLL 0
-#endif
-
 #ifndef CLOCK_MONOTONIC
 # undef EV_USE_MONOTONIC
 # define EV_USE_MONOTONIC 0
@@ -507,7 +517,7 @@ struct signalfd_siginfo
 #define ECB_H
 
 /* 16 bits major, 16 bits minor */
-#define ECB_VERSION 0x00010002
+#define ECB_VERSION 0x00010003
 
 #ifdef _WIN32
   typedef   signed char   int8_t;
@@ -541,6 +551,15 @@ struct signalfd_siginfo
   #endif
 #endif
 
+/* work around x32 idiocy by defining proper macros */
+#if __x86_64 || _M_AMD64
+  #if __ILP32
+    #define ECB_AMD64_X32 1
+  #else
+    #define ECB_AMD64 1
+  #endif
+#endif
+
 /* many compilers define _GNUC_ to some versions but then only implement
  * what their idiot authors think are the "more important" extensions,
  * causing enormous grief in return for some better fake benchmark numbers.
@@ -2231,8 +2250,9 @@ void
 ev_feed_signal (int signum) EV_THROW
 {
 #if EV_MULTIPLICITY
+  EV_P;
   ECB_MEMORY_FENCE_ACQUIRE;
-  EV_P = signals [signum - 1].loop;
+  EV_A = signals [signum - 1].loop;
 
   if (!EV_A)
     return;
@@ -3895,7 +3915,10 @@ static void noinline stat_timer_cb (EV_P_ ev_timer *w_, int revents);
 static void noinline
 infy_add (EV_P_ ev_stat *w)
 {
-  w->wd = inotify_add_watch (fs_fd, w->path, IN_ATTRIB | IN_DELETE_SELF | IN_MOVE_SELF | IN_MODIFY | IN_DONT_FOLLOW | IN_MASK_ADD);
+  w->wd = inotify_add_watch (fs_fd, w->path,
+                             IN_ATTRIB | IN_DELETE_SELF | IN_MOVE_SELF | IN_MODIFY
+                             | IN_CREATE | IN_DELETE | IN_MOVED_FROM | IN_MOVED_TO
+                             | IN_DONT_FOLLOW | IN_MASK_ADD);
 
   if (w->wd >= 0)
     {
@@ -3909,10 +3932,16 @@ infy_add (EV_P_ ev_stat *w)
         w->timer.repeat = w->interval ? w->interval : DEF_STAT_INTERVAL;
       else if (!statfs (w->path, &sfs)
                && (sfs.f_type == 0x1373 /* devfs */
+                   || sfs.f_type == 0x4006 /* fat */
+                   || sfs.f_type == 0x4d44 /* msdos */
                    || sfs.f_type == 0xEF53 /* ext2/3 */
+                   || sfs.f_type == 0x72b6 /* jffs2 */
+                   || sfs.f_type == 0x858458f6 /* ramfs */
+                   || sfs.f_type == 0x5346544e /* ntfs */
                    || sfs.f_type == 0x3153464a /* jfs */
+                   || sfs.f_type == 0x9123683e /* btrfs */
                    || sfs.f_type == 0x52654973 /* reiser3 */
-                   || sfs.f_type == 0x01021994 /* tempfs */
+                   || sfs.f_type == 0x01021994 /* tmpfs */
                    || sfs.f_type == 0x58465342 /* xfs */))
         w->timer.repeat = 0.; /* filesystem is local, kernel new enough */
       else
diff --git a/libev/ev.h b/libev/ev.h
index a8973ab..c5d582e 100644
--- a/libev/ev.h
+++ b/libev/ev.h
@@ -205,33 +205,33 @@ struct ev_loop;
 /*****************************************************************************/
 
 #define EV_VERSION_MAJOR 4
-#define EV_VERSION_MINOR 11
+#define EV_VERSION_MINOR 15
 
 /* eventmask, revents, events... */
 enum {
-  EV_UNDEF    = 0xFFFFFFFF, /* guaranteed to be invalid */
-  EV_NONE     =       0x00, /* no events */
-  EV_READ     =       0x01, /* ev_io detected read will not block */
-  EV_WRITE    =       0x02, /* ev_io detected write will not block */
-  EV__IOFDSET =       0x80, /* internal use only */
-  EV_IO       =    EV_READ, /* alias for type-detection */
-  EV_TIMER    = 0x00000100, /* timer timed out */
+  EV_UNDEF    = (int)0xFFFFFFFF, /* guaranteed to be invalid */
+  EV_NONE     =            0x00, /* no events */
+  EV_READ     =            0x01, /* ev_io detected read will not block */
+  EV_WRITE    =            0x02, /* ev_io detected write will not block */
+  EV__IOFDSET =            0x80, /* internal use only */
+  EV_IO       =         EV_READ, /* alias for type-detection */
+  EV_TIMER    =      0x00000100, /* timer timed out */
 #if EV_COMPAT3
-  EV_TIMEOUT  =   EV_TIMER, /* pre 4.0 API compatibility */
-#endif
-  EV_PERIODIC = 0x00000200, /* periodic timer timed out */
-  EV_SIGNAL   = 0x00000400, /* signal was received */
-  EV_CHILD    = 0x00000800, /* child/pid had status change */
-  EV_STAT     = 0x00001000, /* stat data changed */
-  EV_IDLE     = 0x00002000, /* event loop is idling */
-  EV_PREPARE  = 0x00004000, /* event loop about to poll */
-  EV_CHECK    = 0x00008000, /* event loop finished poll */
-  EV_EMBED    = 0x00010000, /* embedded event loop needs sweep */
-  EV_FORK     = 0x00020000, /* event loop resumed in child */
-  EV_CLEANUP  = 0x00040000, /* event loop resumed in child */
-  EV_ASYNC    = 0x00080000, /* async intra-loop signal */
-  EV_CUSTOM   = 0x01000000, /* for use by user code */
-  EV_ERROR    = 0x80000000  /* sent when an error occurs */
+  EV_TIMEOUT  =        EV_TIMER, /* pre 4.0 API compatibility */
+#endif
+  EV_PERIODIC =      0x00000200, /* periodic timer timed out */
+  EV_SIGNAL   =      0x00000400, /* signal was received */
+  EV_CHILD    =      0x00000800, /* child/pid had status change */
+  EV_STAT     =      0x00001000, /* stat data changed */
+  EV_IDLE     =      0x00002000, /* event loop is idling */
+  EV_PREPARE  =      0x00004000, /* event loop about to poll */
+  EV_CHECK    =      0x00008000, /* event loop finished poll */
+  EV_EMBED    =      0x00010000, /* embedded event loop needs sweep */
+  EV_FORK     =      0x00020000, /* event loop resumed in child */
+  EV_CLEANUP  =      0x00040000, /* event loop resumed in child */
+  EV_ASYNC    =      0x00080000, /* async intra-loop signal */
+  EV_CUSTOM   =      0x01000000, /* for use by user code */
+  EV_ERROR    = (int)0x80000000  /* sent when an error occurs */
 };
 
 /* can be used to add custom fields to all watchers, while losing binary compatibility */
diff --git a/src/background.C b/src/background.C
index 2552596..b3886e8 100644
--- a/src/background.C
+++ b/src/background.C
@@ -30,7 +30,7 @@
 void
 rxvt_term::bg_destroy ()
 {
-# if ENABLE_TRANSPARENCY
+# if BG_IMAGE_FROM_ROOT
   delete root_img;
   root_img = 0;
 # endif
@@ -38,16 +38,13 @@ rxvt_term::bg_destroy ()
 # if BG_IMAGE_FROM_FILE
   fimage.destroy ();
 # endif
-
-  delete bg_img;
-  bg_img = 0;
 }
 
 bool
 rxvt_term::bg_window_size_sensitive ()
 {
-# if ENABLE_TRANSPARENCY
-  if (bg_flags & BG_IS_TRANSPARENT)
+# if BG_IMAGE_FROM_ROOT
+  if (root_img)
     return true;
 # endif
 
@@ -67,8 +64,8 @@ rxvt_term::bg_window_size_sensitive ()
 bool
 rxvt_term::bg_window_position_sensitive ()
 {
-# if ENABLE_TRANSPARENCY
-  if (bg_flags & BG_IS_TRANSPARENT)
+# if BG_IMAGE_FROM_ROOT
+  if (root_img)
     return true;
 # endif
 
@@ -257,7 +254,7 @@ rxvt_image::set_geometry (const char *geom, bool update)
 }
 
 void
-rxvt_term::get_image_geometry (rxvt_image &image, int &w, int &h, int &x, int &y)
+rxvt_term::render_image (rxvt_image &image)
 {
   int image_width = image.img->w;
   int image_height = image.img->h;
@@ -266,6 +263,11 @@ rxvt_term::get_image_geometry (rxvt_image &image, int &w, int &h, int &x, int &y
   int h_scale = min (image.h_scale, 32767 * 100 / parent_width);
   int v_scale = min (image.v_scale, 32767 * 100 / parent_height);
 
+  int w;
+  int h;
+  int x;
+  int y;
+
   w = h_scale * parent_width / 100;
   h = v_scale * parent_height / 100;
 
@@ -290,27 +292,13 @@ rxvt_term::get_image_geometry (rxvt_image &image, int &w, int &h, int &x, int &y
       x = make_align_position (image.h_align, parent_width, w);
       y = make_align_position (image.v_align, parent_height, h);
     }
-}
-
-bool
-rxvt_term::render_image (rxvt_image &image)
-{
-  int parent_width = szHint.width;
-  int parent_height = szHint.height;
-
-  int x = 0;
-  int y = 0;
-  int w = 0;
-  int h = 0;
-
-  get_image_geometry (image, w, h, x, y);
 
   if (!(image.flags & IM_ROOT_ALIGN)
       && (x >= parent_width
           || y >= parent_height
           || x + w <= 0
           || y + h <= 0))
-    return false;
+    return;
 
   rxvt_img *img = image.img->scale (w, h);
 
@@ -320,7 +308,7 @@ rxvt_term::render_image (rxvt_image &image)
     img->repeat_mode (RepeatNone);
   img->sub_rect (-x, -y, parent_width, parent_height)->replace (img);
 
-  if (bg_flags & BG_IS_VALID)
+  if (bg_img)
     img->draw (bg_img, PictOpOver, image.alpha * 1. / 0xffff);
 
   XRenderPictFormat *format = XRenderFindVisualFormat (dpy, visual);
@@ -328,8 +316,6 @@ rxvt_term::render_image (rxvt_image &image)
 
   delete bg_img;
   bg_img = img;
-
-  return true;
 }
 
 rxvt_image::rxvt_image ()
@@ -439,13 +425,13 @@ image_effects::set_shade (const char *shade_str)
   return false;
 }
 
-# if ENABLE_TRANSPARENCY
+# if BG_IMAGE_FROM_ROOT
 /*
  * Builds a pixmap of the same size as the terminal window that contains
  * the tiled portion of the root pixmap that is supposed to be covered by
  * our window.
  */
-bool
+void
 rxvt_term::render_root_image ()
 {
   /* root dimensions may change from call to call - but Display structure should
@@ -461,13 +447,10 @@ rxvt_term::render_root_image ()
   sx = parent_x;
   sy = parent_y;
 
-  if (!root_img)
-    return false;
-
   /* check if we are outside of the visible part of the virtual screen : */
   if (sx + parent_width <= 0 || sy + parent_height <= 0
       || sx >= root_width || sy >= root_height)
-    return 0;
+    return;
 
   while (sx < 0) sx += root_img->w;
   while (sy < 0) sy += root_img->h;
@@ -478,24 +461,22 @@ rxvt_term::render_root_image ()
     img->blur (root_effects.h_blurRadius, root_effects.v_blurRadius)->replace (img);
 
   if (root_effects.need_tint ())
-    tint_image (img, root_effects.tint, root_effects.tint_set, root_effects.shade);
+    {
+      rgba c (rgba::MAX_CC, rgba::MAX_CC, rgba::MAX_CC);
+
+      if (root_effects.tint_set)
+        root_effects.tint.get (c);
+      rxvt_img::nv factor = root_effects.shade / 100. - 1.;
+      img->shade (factor, c)->replace (img);
+    }
 
   XRenderPictFormat *format = XRenderFindVisualFormat (dpy, visual);
   img->convert_format (format, pix_colors [Color_bg])->replace (img);
 
   delete bg_img;
   bg_img = img;
-
-  return true;
 }
-
-void
-rxvt_term::bg_set_root_pixmap ()
-{
-  delete root_img;
-  root_img = rxvt_img::new_from_root (this);
-}
-# endif /* ENABLE_TRANSPARENCY */
+# endif /* BG_IMAGE_FROM_ROOT */
 
 void
 rxvt_term::bg_render ()
@@ -503,30 +484,26 @@ rxvt_term::bg_render ()
   if (bg_flags & BG_INHIBIT_RENDER)
     return;
 
-  bg_invalidate ();
-# if ENABLE_TRANSPARENCY
-  if (bg_flags & BG_IS_TRANSPARENT)
+  delete bg_img;
+  bg_img = 0;
+  bg_flags = 0;
+
+  if (!mapped)
+    return;
+
+# if BG_IMAGE_FROM_ROOT
+  if (root_img)
     {
-      /*  we need to re-generate transparency pixmap in that case ! */
-      if (render_root_image ())
-        bg_flags |= BG_IS_VALID;
+      render_root_image ();
+      bg_flags |= BG_IS_TRANSPARENT;
     }
 # endif
 
 # if BG_IMAGE_FROM_FILE
   if (fimage.img)
-    {
-      if (render_image (fimage))
-        bg_flags |= BG_IS_VALID;
-    }
+    render_image (fimage);
 # endif
 
-  if (!(bg_flags & BG_IS_VALID))
-    {
-      delete bg_img;
-      bg_img = 0;
-    }
-
   scr_recolour (false);
   bg_flags |= BG_NEEDS_REFRESH;
 
@@ -536,11 +513,9 @@ rxvt_term::bg_render ()
 void
 rxvt_term::bg_init ()
 {
-#if ENABLE_TRANSPARENCY
+#if BG_IMAGE_FROM_ROOT
   if (option (Opt_transparent))
     {
-      bg_set_transparent ();
-
       if (rs [Rs_blurradius])
         root_effects.set_blur (rs [Rs_blurradius]);
 
@@ -550,7 +525,7 @@ rxvt_term::bg_init ()
       if (rs [Rs_shade])
         root_effects.set_shade (rs [Rs_shade]);
 
-      bg_set_root_pixmap ();
+      rxvt_img::new_from_root (this)->replace (root_img);
       XSelectInput (dpy, display->root, PropertyChangeMask);
       rootwin_ev.start (display, display->root);
     }
@@ -566,37 +541,4 @@ rxvt_term::bg_init ()
 #endif
 }
 
-void
-rxvt_term::tint_image (rxvt_img *img, rxvt_color &tint, bool tint_set, int shade)
-{
-  rgba c (rgba::MAX_CC, rgba::MAX_CC, rgba::MAX_CC);
-
-  if (tint_set)
-    tint.get (c);
-
-  if (shade > 100)
-    {
-      c.r = c.r * (200 - shade) / 100;
-      c.g = c.g * (200 - shade) / 100;
-      c.b = c.b * (200 - shade) / 100;
-    }
-  else
-    {
-      c.r = c.r * shade / 100;
-      c.g = c.g * shade / 100;
-      c.b = c.b * shade / 100;
-    }
-
-  img->contrast (c.r, c.g, c.b, c.a);
-
-  if (shade > 100)
-    {
-      c.a = 0xffff;
-      c.r =
-      c.g =
-      c.b = 0xffff * (shade - 100) / 100;
-      img->brightness (c.r, c.g, c.b, c.a);
-    }
-}
-
 #endif /* HAVE_BG_PIXMAP */
diff --git a/src/command.C b/src/command.C
index ab1a4cd..82ad10a 100644
--- a/src/command.C
+++ b/src/command.C
@@ -943,7 +943,7 @@ rxvt_term::flush ()
 {
   flush_ev.stop ();
 
-#ifdef HAVE_BG_PIXMAP
+#ifdef HAVE_IMG
   if (bg_flags & BG_NEEDS_REFRESH)
     {
       bg_flags &= ~BG_NEEDS_REFRESH;
@@ -1474,7 +1474,7 @@ rxvt_term::x_cb (XEvent &ev)
             if (bg_window_position_sensitive ())
               {
                 want_position_change = true;
-                if (!(bg_flags & BG_IS_VALID))
+                if (bg_img == 0)
                   moved = true;
               }
 #endif
@@ -1531,19 +1531,14 @@ rxvt_term::x_cb (XEvent &ev)
 
       case MapNotify:
 #ifdef HAVE_BG_PIXMAP
-        /* This is needed specifically to fix the case of no window manager or a
-         * non-reparenting window manager. In those cases we never get first
-         * ConfigureNotify. Also that speeds startup under normal WM, by taking
-         * care of multiplicity of ConfigureNotify events arriving while WM does
-         * reparenting.
-         * We should not render background immediately, as there could be several
-         * ConfigureNotify's to follow. Lets take care of all of them in one scoop
-         * by scheduling background redraw as soon as we can, but giving a short
-         * bit of time for ConfigureNotifies to arrive.
-         * We should render background PRIOR to drawing any text, but AFTER all
-         * of ConfigureNotifys for the best results.
-         */
-        if (!(bg_flags & BG_IS_VALID))
+        // This is needed at startup for the case of no window manager
+        // or a non-reparenting window manager and also because we
+        // defer bg image updates if the window is not mapped. The
+        // short delay is to optimize for multiple ConfigureNotify
+        // events at startup when the window manager reparents the
+        // window, so as to perform the computation after we have
+        // received all of them.
+        if (bg_img == 0)
           update_background_ev.start (0.025);
 #endif
         mapped = 1;
@@ -1840,7 +1835,7 @@ rxvt_term::update_fade_color (unsigned int idx)
 #endif
 }
 
-#if ENABLE_TRANSPARENCY || ENABLE_PERL
+#if BG_IMAGE_FROM_ROOT || ENABLE_PERL
 void ecb_hot
 rxvt_term::rootwin_cb (XEvent &ev)
 {
@@ -1860,13 +1855,14 @@ rxvt_term::rootwin_cb (XEvent &ev)
         if (ev.xproperty.atom == xa[XA_XROOTPMAP_ID]
             || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID])
           {
-# if ENABLE_TRANSPARENCY
-            bg_set_root_pixmap ();
-            update_background ();
+#if BG_IMAGE_FROM_ROOT
+            if (option (Opt_transparent))
+              {
+                rxvt_img::new_from_root (this)->replace (root_img);
+                update_background ();
+              }
 #endif
-#if ENABLE_PERL
             HOOK_INVOKE ((this, HOOK_ROOTPMAP_CHANGE, DT_END));
-#endif
           }
 
         break;
@@ -3455,7 +3451,8 @@ rxvt_term::process_xterm_seq (int op, char *str, char resp)
       case URxvt_Color_border:
         process_color_seq (op, Color_border, str, resp);
         break;
-#if ENABLE_TRANSPARENCY
+
+#if BG_IMAGE_FROM_ROOT
       case URxvt_Color_tint:
         process_color_seq (op, Color_tint, str, resp);
         {
diff --git a/src/init.C b/src/init.C
index b503966..95cc777 100644
--- a/src/init.C
+++ b/src/init.C
@@ -521,7 +521,7 @@ static const char *const def_colorName[] =
 #ifdef RXVT_SCROLLBAR
     COLOR_SCROLLTROUGH,
 #endif
-#if ENABLE_TRANSPARENCY
+#if BG_IMAGE_FROM_ROOT
     NULL,
 #endif
 #if OFF_FOCUS_FADING
diff --git a/src/keyboard.C b/src/keyboard.C
index bbc203b..8d81712 100644
--- a/src/keyboard.C
+++ b/src/keyboard.C
@@ -82,12 +82,7 @@ compare_priority (keysym_t *a, keysym_t *b)
   int ca = ecb_popcount32 (a->state /* & OtherModMask */);
   int cb = ecb_popcount32 (b->state /* & OtherModMask */);
 
-  if (ca != cb)
-    return ca - cb;
-//else if (a->state != b->state) // this behavior is to be discussed
-//  return b->state - a->state;
-  else
-    return 0;
+  return ca - cb;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -183,15 +178,14 @@ keyboard_manager::register_done ()
 
   // now we know the size of each bucket
   // compute the index of each bucket
-  hash [0] = 0;
-  for (index = 0, i = 1; i < KEYSYM_HASH_BUCKETS; ++i)
+  for (index = 0, i = 0; i < KEYSYM_HASH_BUCKETS; ++i)
     {
-      index += hash_bucket_size [i - 1];
       hash [i] = index;
+      index += hash_bucket_size [i];
     }
 
   // and allocate just enough space
-  simplevec <keysym_t *> sorted_keymap (index + hash_bucket_size [i - 1], 0);
+  simplevec <keysym_t *> sorted_keymap (index, 0);
 
   memset (hash_bucket_size, 0, sizeof (hash_bucket_size));
 
diff --git a/src/keyboard.h b/src/keyboard.h
index f7c58ba..af18797 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -31,8 +31,8 @@
 #include "rxvtutil.h"
 
 #define KEYSYM_HASH_BITS        4       /* lowest #bits of keysym is used as hash key */
-#define KEYSYM_HASH_BUCKETS     (1<<KEYSYM_HASH_BITS)
-#define KEYSYM_HASH_MASK        (KEYSYM_HASH_BUCKETS-1)
+#define KEYSYM_HASH_BUCKETS     (1 << KEYSYM_HASH_BITS)
+#define KEYSYM_HASH_MASK        (KEYSYM_HASH_BUCKETS - 1)
 
 #define MetaMask                0x0100
 #define NumLockMask             0x0200
diff --git a/src/main.C b/src/main.C
index f16de2e..f03b563 100644
--- a/src/main.C
+++ b/src/main.C
@@ -170,7 +170,7 @@ rxvt_term::rxvt_term ()
 #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING)
   slip_wheel_ev.set       <rxvt_term, &rxvt_term::slip_wheel_cb>   (this);
 #endif
-#if ENABLE_TRANSPARENCY || ENABLE_PERL
+#if BG_IMAGE_FROM_ROOT || ENABLE_PERL
   rootwin_ev.set          <rxvt_term, &rxvt_term::rootwin_cb> (this),
 #endif
   scrollbar_ev.set        <rxvt_term, &rxvt_term::x_cb>       (this),
@@ -228,6 +228,10 @@ rxvt_term::~rxvt_term ()
   bg_destroy ();
 #endif
 
+#if HAVE_IMG
+  delete bg_img;
+#endif
+
   if (display)
     {
       selection_clear ();
@@ -237,9 +241,12 @@ rxvt_term::~rxvt_term ()
       im_destroy ();
 #endif
       scrollBar.destroy ();
-      if (gc)   XFreeGC (dpy, gc);
+
+      if (gc)
+        XFreeGC (dpy, gc);
 
       delete drawable;
+
       // destroy all windows
       if (parent)
         XDestroyWindow (dpy, parent);
@@ -313,7 +320,7 @@ rxvt_term::destroy ()
       im_ev.stop (display);
 #endif
       scrollbar_ev.stop (display);
-#if ENABLE_TRANSPARENCY || ENABLE_PERL
+#if BG_IMAGE_FROM_ROOT || ENABLE_PERL
       rootwin_ev.stop (display);
 #endif
       termwin_ev.stop (display);
@@ -1367,7 +1374,7 @@ rxvt_term::im_get_ic (const char *modifiers)
 
   set_environ (envv);
 
-  if (! ((p = XSetLocaleModifiers (modifiers)) && *p))
+  if (!((p = XSetLocaleModifiers (modifiers)) && *p))
     return false;
 
   input_method = display->get_xim (locale, modifiers);
@@ -1685,11 +1692,6 @@ rxvt_term::update_background ()
   if (update_background_ev.is_active ())
     return;
 
-  bg_invalidate ();
-
-  if (!mapped)
-    return;
-
   ev_tstamp to_wait = 0.5 - (ev::now () - bg_valid_since);
 
   if (to_wait <= 0.)
diff --git a/src/perl/background b/src/perl/background
index 46040dd..69fd559 100644
--- a/src/perl/background
+++ b/src/perl/background
@@ -819,6 +819,16 @@ Example: the same, but specify the colour by component.
       $_[1]->tint ($_[0])
    }
 
+=item shade $factor, $img
+
+Shade the image by the given factor.
+
+=cut
+
+   sub shade($$) {
+      $_[1]->shade ($_[0])
+   }
+
 =item contrast $factor, $img
 
 =item contrast $r, $g, $b, $img
diff --git a/src/rsinc.h b/src/rsinc.h
index 2906837..1483955 100644
--- a/src/rsinc.h
+++ b/src/rsinc.h
@@ -58,7 +58,7 @@
   def (preeditType)
   def (inputMethod)
 #endif
-#if ENABLE_TRANSPARENCY
+#if BG_IMAGE_FROM_ROOT
   def (transparent)
   def (shade)
   def (blurradius)
diff --git a/src/rxvt.h b/src/rxvt.h
index c90b9b7..8a6c895 100644
--- a/src/rxvt.h
+++ b/src/rxvt.h
@@ -77,10 +77,19 @@ typedef  int32_t tlen_t_; // specifically for use in the line_t structure
 # include <gdk-pixbuf/gdk-pixbuf.h>
 #endif
 
-#if defined(BG_IMAGE_FROM_FILE) || defined(ENABLE_TRANSPARENCY)
+#if XRENDER && (HAVE_PIXBUF || ENABLE_TRANSPARENCY)
 # define HAVE_BG_PIXMAP 1
 #endif
 
+#if HAVE_BG_PIXMAP
+# if HAVE_PIXBUF
+#  define BG_IMAGE_FROM_FILE 1
+# endif
+# if ENABLE_TRANSPARENCY
+#  define BG_IMAGE_FROM_ROOT 1
+# endif
+#endif
+
 #include <ecb.h>
 #include "encoding.h"
 #include "rxvtutil.h"
@@ -582,7 +591,7 @@ enum colour_list {
 #ifdef RXVT_SCROLLBAR
   Color_trough,
 #endif
-#if ENABLE_TRANSPARENCY
+#if BG_IMAGE_FROM_ROOT
   Color_tint,
 #endif
 #if OFF_FOCUS_FADING
@@ -1174,52 +1183,41 @@ struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen
   XComposeStatus  compose;
   static struct termios def_tio;
   row_col_t       oldcursor;
+
 #ifdef HAVE_BG_PIXMAP
   void bg_init ();
   void bg_destroy ();
 
-  enum {
-    BG_IS_VALID          = 1 << 0,
-
-    BG_IS_TRANSPARENT    = 1 << 1,
-    BG_NEEDS_REFRESH     = 1 << 2,
-    BG_INHIBIT_RENDER    = 1 << 3,
-  };
-
-  uint8_t bg_flags;
-
 # if BG_IMAGE_FROM_FILE
   rxvt_image fimage;
-  void get_image_geometry (rxvt_image &image, int &w, int &h, int &x, int &y);
-  bool render_image (rxvt_image &image);
+  void render_image (rxvt_image &image);
 # endif
 
-# if ENABLE_TRANSPARENCY
+# if BG_IMAGE_FROM_ROOT
   rxvt_img *root_img;
   image_effects root_effects;
 
-  void bg_set_transparent ()
-  {
-    bg_flags |= BG_IS_TRANSPARENT;
-  }
-  void bg_set_root_pixmap ();
-  bool render_root_image ();
+  void render_root_image ();
 # endif
 
-  void tint_image (rxvt_img *img, rxvt_color &tint, bool tint_set, int shade);
-
   ev_tstamp bg_valid_since;
 
-  rxvt_img *bg_img;
-
   bool bg_window_size_sensitive ();
   bool bg_window_position_sensitive ();
 
   void bg_render ();
-  void bg_invalidate ()
-  {
-    bg_flags &= ~BG_IS_VALID;
-  }
+#endif
+
+#ifdef HAVE_IMG
+  enum {
+    BG_IS_TRANSPARENT    = 1 << 1,
+    BG_NEEDS_REFRESH     = 1 << 2,
+    BG_INHIBIT_RENDER    = 1 << 3,
+  };
+
+  uint8_t bg_flags;
+
+  rxvt_img *bg_img;
 #endif
 
 #if ENABLE_OVERLAY
@@ -1283,7 +1281,7 @@ struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen
     XSelectInput (dpy, vt, vt_emask | vt_emask_perl | vt_emask_xim | vt_emask_mouse);
   }
 
-#if ENABLE_TRANSPARENCY || ENABLE_PERL
+#if BG_IMAGE_FROM_ROOT || ENABLE_PERL
   void rootwin_cb (XEvent &xev);
   xevent_watcher rootwin_ev;
 #endif
@@ -1487,7 +1485,9 @@ struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen
   void scr_blank_line (line_t &l, unsigned int col, unsigned int width, rend_t efs) const NOTHROW;
   void scr_blank_screen_mem (line_t &l, rend_t efs) const NOTHROW;
   void scr_kill_char (line_t &l, int col) const NOTHROW;
+  void scr_set_char_rend (line_t &l, int col, rend_t rend);
   int scr_scroll_text (int row1, int row2, int count) NOTHROW;
+  void copy_line (line_t &dst, line_t &src);
   void scr_reset ();
   void scr_release () NOTHROW;
   void scr_clear (bool really = false) NOTHROW;
@@ -1546,6 +1546,7 @@ struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen
   void scr_dump (int fd) NOTHROW;
 
   void selection_check (int check_more) NOTHROW;
+  void selection_changed () NOTHROW; /* sets want_refresh, corrects coordinates */
   void selection_request (Time tm, int selnum = Sel_Primary) NOTHROW;
   void selection_clear (bool clipboard = false) NOTHROW;
   void selection_make (Time tm);
diff --git a/src/rxvtimg.C b/src/rxvtimg.C
index 2042f22..d561e59 100644
--- a/src/rxvtimg.C
+++ b/src/rxvtimg.C
@@ -535,7 +535,7 @@ rxvt_img::blur (int rh, int rv)
   Display *dpy = s->dpy;
   int size = max (rh, rv) * 2 + 1;
   nv *kernel = (nv *)malloc (size * sizeof (nv));
-  XFixed *params = (XFixed *)malloc ((size + 2) * sizeof (XFixed));
+  XFixed *params = rxvt_temp_buf<XFixed> (size + 2);
   rxvt_img *img = new_empty ();
 
   XRenderPictureAttributes pa;
@@ -580,7 +580,6 @@ rxvt_img::blur (int rh, int rv)
     }
 
   free (kernel);
-  free (params);
 
   XRenderFreePicture (dpy, src);
   XRenderFreePicture (dpy, dst);
@@ -917,6 +916,40 @@ rxvt_img::tint (const rgba &c)
 }
 
 rxvt_img *
+rxvt_img::shade (nv factor, rgba c)
+{
+  clamp_it (factor, -1., 1.);
+  factor++;
+
+  if (factor > 1)
+    {
+      c.r = c.r * (2 - factor);
+      c.g = c.g * (2 - factor);
+      c.b = c.b * (2 - factor);
+    }
+  else
+    {
+      c.r = c.r * factor;
+      c.g = c.g * factor;
+      c.b = c.b * factor;
+    }
+
+  rxvt_img *img = this->tint (c);
+
+  if (factor > 1)
+    {
+      c.a = 0xffff;
+      c.r =
+      c.g =
+      c.b = 0xffff * (factor - 1);
+
+      img->brightness (c.r, c.g, c.b, c.a);
+    }
+
+  return img;
+}
+
+rxvt_img *
 rxvt_img::filter (const char *name, int nparams, nv *params)
 {
   composer cc (this);
diff --git a/src/rxvtimg.h b/src/rxvtimg.h
index 22fda84..fbd99d6 100644
--- a/src/rxvtimg.h
+++ b/src/rxvtimg.h
@@ -130,6 +130,7 @@ struct rxvt_img
   rxvt_img *rotate (int cx, int cy, nv phi);
   rxvt_img *convert_format (XRenderPictFormat *format, const rgba &bg);
   rxvt_img *tint (const rgba &c);
+  rxvt_img *shade (nv factor, rgba c = rgba (rgba::MAX_CC, rgba::MAX_CC, rgba::MAX_CC));
   rxvt_img *filter (const char *name, int nparams = 0, nv *params = 0);
   rxvt_img *muladd (nv mul, nv add); // general multiply and add, implemented as the biggest hack ever :/
 
diff --git a/src/rxvtperl.xs b/src/rxvtperl.xs
index 4d8709e..ce28ad9 100644
--- a/src/rxvtperl.xs
+++ b/src/rxvtperl.xs
@@ -59,6 +59,7 @@ typedef int		render_repeat_mode;
 #if HAVE_PIXBUF
 typedef GdkPixbuf *	urxvt__pixbuf;
 #endif
+#if HAVE_IMG
 typedef rxvt_img *	urxvt__img;
 typedef rxvt_img::nv	rxvt_img__nv;
 
@@ -107,6 +108,7 @@ parse_rgba (SV *sv, rxvt_screen *s = 0)
 }
 
 /////////////////////////////////////////////////////////////////////////////
+#endif
 
 static wchar_t *
 sv2wcs (SV *sv)
@@ -1879,7 +1881,7 @@ rxvt_term::screen_cur (...)
               {
                 THIS->selection.screen = THIS->current_screen;
 
-                THIS->want_refresh = 1;
+                THIS->selection_changed ();
                 THIS->refresh_check ();
               }
           }
@@ -2203,13 +2205,12 @@ rxvt_term::new_img_from_file (octet_string filename)
 
 #endif
 
-#if HAVE_BG_PIXMAP
-
 void
 rxvt_term::set_background (rxvt_img *img, bool border = false)
 	CODE:
-        THIS->bg_destroy ();
-        THIS->bg_flags &= ~(rxvt_term::BG_NEEDS_REFRESH | rxvt_term::BG_INHIBIT_RENDER | rxvt_term::BG_IS_TRANSPARENT);
+        delete THIS->bg_img;
+        THIS->bg_img = 0;
+        THIS->bg_flags = 0;
 
         if (img) // TODO: cannot be false
           {
@@ -2237,8 +2238,6 @@ rxvt_term::set_background (rxvt_img *img, bool border = false)
 
 #endif
 
-#endif
-
 #############################################################################
 # urxvt::overlay
 #############################################################################
@@ -2390,6 +2389,9 @@ rxvt_img::tint (SV *c)
 	C_ARGS: cc
 
 rxvt_img *
+rxvt_img::shade (rxvt_img::nv factor)
+
+rxvt_img *
 rxvt_img::filter (octet_string name, SV *params = &PL_sv_undef)
 	CODE:
         rxvt_img::nv *vparams = 0;
@@ -2397,20 +2399,18 @@ rxvt_img::filter (octet_string name, SV *params = &PL_sv_undef)
 
         if (SvOK (params))
 	  {
-            // we overlay rxvt_temp_buf, what a hack
-            assert (sizeof (rxvt_img::nv) >= sizeof (int));
-
             if (!SvROK (params) || SvTYPE (SvRV (params)) != SVt_PVAV)
               croak ("rxvt_img::filter: params must be an array reference with parameter values");
 
             nparams = av_len ((AV *)SvRV (params)) + 1;
-            vparams = rxvt_temp_buf<rxvt_img::nv> (nparams);
+            vparams = (rxvt_img::nv *)malloc (nparams * sizeof (rxvt_img::nv));
 
             for (int i = 0; i < nparams; ++i)
               vparams [i] = SvNV (*av_fetch ((AV *)SvRV (params), i, 1));
           }
 
         RETVAL = THIS->filter (name, nparams, vparams);
+        free (vparams);
 	OUTPUT:
         RETVAL
 
diff --git a/src/rxvttoolkit.C b/src/rxvttoolkit.C
index 545c3c5..ce9bf56 100644
--- a/src/rxvttoolkit.C
+++ b/src/rxvttoolkit.C
@@ -68,7 +68,7 @@ static const char *const xa_names[] =
   "WM_LOCALE_NAME",
   "XIM_SERVERS",
 #endif
-#if ENABLE_TRANSPARENCY || ENABLE_PERL
+#if BG_IMAGE_FROM_ROOT || ENABLE_PERL
   "_XROOTPMAP_ID",
   "ESETROOT_PMAP_ID",
 #endif
diff --git a/src/rxvttoolkit.h b/src/rxvttoolkit.h
index 48a58a4..369d8e7 100644
--- a/src/rxvttoolkit.h
+++ b/src/rxvttoolkit.h
@@ -68,7 +68,7 @@ enum {
   XA_WM_LOCALE_NAME,
   XA_XIM_SERVERS,
 #endif
-#if ENABLE_TRANSPARENCY || ENABLE_PERL
+#if BG_IMAGE_FROM_ROOT || ENABLE_PERL
   XA_XROOTPMAP_ID,
   XA_ESETROOT_PMAP_ID,
 #endif
diff --git a/src/screen.C b/src/screen.C
index 29b26fa..2589a08 100644
--- a/src/screen.C
+++ b/src/screen.C
@@ -152,6 +152,16 @@ rxvt_term::scr_kill_char (line_t &l, int col) const NOTHROW
   } while (col < ncol && l.t[col] == NOCHAR);
 }
 
+// set the rendition of a single wide character beginning at the given column
+void
+rxvt_term::scr_set_char_rend (line_t &l, int col, rend_t rend)
+{
+  do {
+    l.r[col] = rend;
+    col++;
+  } while (col < ncol && l.t[col] == NOCHAR);
+}
+
 /* ------------------------------------------------------------------------- *
  *                          SCREEN INITIALISATION                            *
  * ------------------------------------------------------------------------- */
@@ -190,6 +200,16 @@ rxvt_term::scr_alloc () NOTHROW
   row_buf   = swap_buf  + nrow;
 }
 
+void
+rxvt_term::copy_line (line_t &dst, line_t &src)
+{
+  scr_blank_screen_mem (dst, DEFAULT_RSTYLE);
+  dst.l = min (src.l, ncol);
+  memcpy (dst.t, src.t, sizeof (text_t) * dst.l);
+  memcpy (dst.r, src.r, sizeof (rend_t) * dst.l);
+  dst.f = src.f;
+}
+
 void ecb_cold
 rxvt_term::scr_reset ()
 {
@@ -232,8 +252,6 @@ rxvt_term::scr_reset ()
   line_t *prev_swap_buf  = swap_buf;
   line_t *prev_row_buf   = row_buf;
 
-  int common_col = min (prev_ncol, ncol);
-
   scr_alloc ();
 
   if (!prev_row_buf)
@@ -277,13 +295,8 @@ rxvt_term::scr_reset ()
 
       for (int row = min (nrow, prev_nrow); row--; )
         {
-          scr_blank_screen_mem (drawn_buf [row], DEFAULT_RSTYLE);
-          scr_blank_screen_mem (swap_buf  [row], DEFAULT_RSTYLE);
-
-          memcpy (drawn_buf [row].t, prev_drawn_buf [row].t, sizeof (text_t) * common_col);
-          memcpy (drawn_buf [row].r, prev_drawn_buf [row].r, sizeof (rend_t) * common_col);
-          memcpy (swap_buf  [row].t, prev_swap_buf  [row].t, sizeof (text_t) * common_col);
-          memcpy (swap_buf  [row].r, prev_swap_buf  [row].r, sizeof (rend_t) * common_col);
+          copy_line (drawn_buf [row], prev_drawn_buf [row]);
+          copy_line (swap_buf [row], prev_swap_buf [row]);
         }
 
       int p    = MOD (term_start + prev_nrow, prev_total_rows);  // previous row
@@ -388,10 +401,7 @@ rxvt_term::scr_reset ()
               line_t &src = prev_row_buf [MOD (term_start + row, prev_total_rows)];
               line_t &dst = row_buf [row];
 
-              scr_blank_screen_mem (dst, DEFAULT_RSTYLE);
-
-              memcpy (dst.t, src.t, sizeof (text_t) * common_col);
-              memcpy (dst.r, src.r, sizeof (rend_t) * common_col);
+              copy_line (dst, src);
             }
 
           for (int row = prev_nrow; row < nrow; row++)
@@ -1708,7 +1718,7 @@ rxvt_term::scr_rvideo_mode (bool on) NOTHROW
       rvideo_state = on;
 
       ::swap (pix_colors[Color_fg], pix_colors[Color_bg]);
-#ifdef HAVE_BG_PIXMAP
+#ifdef HAVE_IMG
       if (bg_img == 0)
 #endif
           XSetWindowBackground (dpy, vt, pix_colors[Color_bg]);
@@ -2034,12 +2044,10 @@ rxvt_term::scr_refresh () NOTHROW
   int16_t col, row,   /* column/row we're processing               */
           ocrow;      /* old cursor row                            */
   int i;              /* tmp                                       */
-#ifndef NO_CURSORCOLOR
-  rend_t cc1;         /* store colours at cursor position (s)      */
-#endif
-  rend_t *crp;        // cursor rendition pointer
   rend_t ccol1,  /* Cursor colour       */
          ccol2;  /* Cursor colour2      */
+  rend_t cur_rend;
+  int cur_col;
 
   want_refresh = 0;        /* screen is current */
 
@@ -2053,7 +2061,7 @@ rxvt_term::scr_refresh () NOTHROW
 
   unsigned int old_screen_flags = screen.flags;
   bool have_bg = 0;
-#ifdef HAVE_BG_PIXMAP
+#ifdef HAVE_IMG
   have_bg = bg_img != 0;
 #endif
   ocrow = oldcursor.row; /* is there an old outline cursor on screen? */
@@ -2088,10 +2096,10 @@ rxvt_term::scr_refresh () NOTHROW
         while (col && ROW(screen.cur.row).t[col] == NOCHAR)
           col--;
 
-        crp = &ROW(screen.cur.row).r[col];
+        cur_rend = ROW(screen.cur.row).r[col];
+        cur_col = col;
 
 #ifndef NO_CURSORCOLOR
-        cc1 = *crp & (RS_fgMask | RS_bgMask);
         if (ISSET_PIXCOLOR (Color_cursor))
           ccol1 = Color_cursor;
         else
@@ -2115,14 +2123,18 @@ rxvt_term::scr_refresh () NOTHROW
 
         if (focus)
           {
+            rend_t rend = cur_rend;
+
             if (option (Opt_cursorUnderline))
-              *crp ^= RS_Uline;
+              rend ^= RS_Uline;
             else
               {
-                *crp ^= RS_RVid;
-                *crp = SET_FGCOLOR (*crp, ccol1);
-                *crp = SET_BGCOLOR (*crp, ccol2);
+                rend ^= RS_RVid;
+                rend = SET_FGCOLOR (rend, ccol1);
+                rend = SET_BGCOLOR (rend, ccol2);
               }
+
+            scr_set_char_rend (ROW(screen.cur.row), cur_col, rend);
           }
       }
 
@@ -2451,17 +2463,7 @@ rxvt_term::scr_refresh () NOTHROW
   if (showcursor)
     {
       if (focus)
-        {
-          if (option (Opt_cursorUnderline))
-            *crp ^= RS_Uline;
-          else
-            {
-              *crp ^= RS_RVid;
-#ifndef NO_CURSORCOLOR
-              *crp = (*crp & ~ (RS_fgMask | RS_bgMask)) | cc1;
-#endif
-            }
-        }
+        scr_set_char_rend (ROW(screen.cur.row), cur_col, cur_rend);
       else if (oldcursor.row >= 0)
         {
           int cursorwidth = 1;
@@ -2534,7 +2536,7 @@ rxvt_term::scr_recolour (bool refresh) NOTHROW
 {
   bool transparent = false;
 
-#ifdef HAVE_BG_PIXMAP
+#ifdef HAVE_IMG
   if (bg_img != 0)
     {
 # if ENABLE_TRANSPARENCY
@@ -2695,6 +2697,20 @@ rxvt_term::selection_check (int check_more) NOTHROW
     CLEAR_ALL_SELECTION ();
 }
 
+void
+rxvt_term::selection_changed () NOTHROW
+{
+  line_t &r1 = ROW (selection.beg.row);
+  while (selection.beg.col >    0 && r1.t [selection.beg.col] == NOCHAR)
+    --selection.beg.col;
+
+  line_t &r2 = ROW (selection.end.row);
+  while (selection.end.col < r2.l && r2.t [selection.end.col] == NOCHAR)
+    ++selection.end.col;
+
+  want_refresh = 1;
+}
+
 /* ------------------------------------------------------------------------- */
 /*
  * Paste a selection direct to the command fd
@@ -3005,7 +3021,7 @@ rxvt_term::selection_start_colrow (int col, int row) NOTHROW
  */
 
 /* what do we want: spaces/tabs are delimiters or cutchars or non-cutchars */
-#define DELIMIT_TEXT(x) 		\
+#define DELIMIT_TEXT(x)		\
     (unicode::is_space (x) ? 2 : (x) <= 0xff && !!strchr (rs[Rs_cutchars], (x)))
 #define DELIMIT_REND(x)        1
 
@@ -3137,8 +3153,6 @@ rxvt_term::selection_extend_colrow (int32_t col, int32_t row, int button3, int b
     LEFT, RIGHT
   } closeto = RIGHT;
 
-  want_refresh = 1;
-
   switch (selection.op)
     {
       case SELECTION_INIT:
@@ -3327,6 +3341,8 @@ rxvt_term::selection_extend_colrow (int32_t col, int32_t row, int button3, int b
   if (selection.rect && selection.beg.col > selection.end.col)
     ::swap (selection.beg.col, selection.end.col);
 #endif
+
+  selection_changed ();
 }
 
 #if !ENABLE_MINIMAL
diff --git a/src/version.h b/src/version.h
index d2f7f72..d09491b 100644
--- a/src/version.h
+++ b/src/version.h
@@ -1,3 +1,3 @@
 // VERSION _must_ be \d.\d+
-#define VERSION "9.16"
-#define DATE	"2012-11-06"
+#define VERSION "9.17"
+#define DATE	"2013-03-01"
diff --git a/src/xdefaults.C b/src/xdefaults.C
index 856acaf..69acdd8 100644
--- a/src/xdefaults.C
+++ b/src/xdefaults.C
@@ -113,7 +113,7 @@ optList[] = {
               BOOL (Rs_scrollTtyOutput, NULL, "si",  Opt_scrollTtyOutput, Optflag_Reverse, "scroll-on-tty-output inhibit"),
               BOOL (Rs_scrollTtyKeypress, "scrollTtyKeypress", "sk", Opt_scrollTtyKeypress, 0, "scroll-on-keypress"),
               BOOL (Rs_scrollWithBuffer, "scrollWithBuffer", "sw", Opt_scrollWithBuffer, 0, "scroll-with-buffer"),
-#if ENABLE_TRANSPARENCY
+#if BG_IMAGE_FROM_ROOT
               BOOL (Rs_transparent, "inheritPixmap", "ip", Opt_transparent, 0, "inherit parent pixmap"),
               BOOL (Rs_transparent, "transparent", "tr", Opt_transparent, 0, "inherit parent pixmap"),
               STRG (Rs_color + Color_tint, "tintColor", "tint", "color", "tint color"),
@@ -197,9 +197,9 @@ optList[] = {
 #if BG_IMAGE_FROM_FILE
               RSTRG (Rs_path, "path", "search path"),
               STRG (Rs_backgroundPixmap, "backgroundPixmap", "pixmap", "file[;geom]", "background pixmap"),
-# if ENABLE_EWMH
+#endif
+#if ENABLE_EWMH
               STRG (Rs_iconfile, "iconFile", "icon", "file", "path to application icon image"),
-# endif
 #endif
               /* fonts: command-line option = resource name */
               STRG (Rs_font, "font", "fn", "fontname", "normal text font"),

-- 
Git repository for pkg-urxvt




More information about the Pkg-urxvt-maintainers mailing list