diff -Nru rxvt-unicode-9.22/debian/changelog rxvt-unicode-9.22/debian/changelog
--- rxvt-unicode-9.22/debian/changelog	2018-01-05 19:28:33.000000000 +0300
+++ rxvt-unicode-9.22/debian/changelog	2018-03-11 20:03:14.000000000 +0300
@@ -1,3 +1,10 @@
+rxvt-unicode (9.22-3.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Better wheel scrolling
+
+ -- u <vi@teknik.io>  Sun, 11 Mar 2018 20:03:14 +0300
+
 rxvt-unicode (9.22-3) unstable; urgency=medium
 
   * Remove obsolete config file /etc/metu-methods/rxvt (Closes: #886388)
diff -Nru rxvt-unicode-9.22/debian/patches/17_clear.diff rxvt-unicode-9.22/debian/patches/17_clear.diff
--- rxvt-unicode-9.22/debian/patches/17_clear.diff	1970-01-01 03:00:00.000000000 +0300
+++ rxvt-unicode-9.22/debian/patches/17_clear.diff	2018-03-11 20:00:03.000000000 +0300
@@ -0,0 +1,62 @@
+diff --git a/src/command.C b/src/command.C
+index d212764..b1a5ab1 100644
+--- a/src/command.C
++++ b/src/command.C
+@@ -2913,6 +2913,10 @@ rxvt_term::process_csi_seq ()
+       return;
+     }
+ 
++  /* remember the current row on position change, in case there's a clear screen
++   * right after, so that we can add "preserve" the buffer (e.g. on ^L) */
++  static int old_row = -1, was_moved = 0;
++  
+   switch (ch)
+     {
+         /*
+@@ -2976,6 +2980,12 @@ rxvt_term::process_csi_seq ()
+ 
+       case CSI_CUP:		/* 8.3.21: (1,1) CURSOR POSITION */
+       case CSI_HVP:		/* 8.3.64: (1,1) CHARACTER AND LINE POSITION */
++        /* if moving to row 1, remember current row in case a clear screen comes next */
++        if (nargs == 1 && arg[0] == 1 && current_screen == 0)
++          {
++            was_moved = 1;
++            old_row = screen.cur.row;
++          }
+         scr_gotorc (arg[0] - 1, nargs < 2 ? 0 : (arg[1] - 1), 0);
+         break;
+ 
+@@ -2987,6 +2997,16 @@ rxvt_term::process_csi_seq ()
+         break;
+ 
+       case CSI_ED:		/* 8.3.40: (0) ERASE IN PAGE */
++        if (was_moved)
++          {
++            /* this is most likely a ^L, so we'll go back to where we where before
++             * the position change, add a screen of empty lines, then move back
++             * on top. that way the (scrolling) buffer will be preserved */
++            scr_gotorc (old_row, 0, 0);
++            for (int i = nrow - 1; i > 0; --i)
++                scr_add_lines (L"\r\n", 2);
++            scr_gotorc (0, 0, 0);
++          }
+         scr_erase_screen (arg[0]);
+         break;
+ 
+@@ -3135,6 +3155,16 @@ rxvt_term::process_csi_seq ()
+       default:
+         break;
+     }
++    if (was_moved > 0)
++      {
++        if (was_moved > 1)
++          {
++            was_moved = 0;
++            old_row = -1;
++          }
++        else
++          ++was_moved;
++      }
+ }
+ /*}}} */
+ 
diff -Nru rxvt-unicode-9.22/debian/patches/18_secondaryWheel.diff rxvt-unicode-9.22/debian/patches/18_secondaryWheel.diff
--- rxvt-unicode-9.22/debian/patches/18_secondaryWheel.diff	1970-01-01 03:00:00.000000000 +0300
+++ rxvt-unicode-9.22/debian/patches/18_secondaryWheel.diff	2018-03-11 20:03:14.000000000 +0300
@@ -0,0 +1,119 @@
+Index: rxvt-unicode-9.22/doc/rxvt.1.pod
+===================================================================
+--- rxvt-unicode-9.22.orig/doc/rxvt.1.pod
++++ rxvt-unicode-9.22/doc/rxvt.1.pod
+@@ -430,6 +430,11 @@ B<secondaryScreen>.
+ Turn on/off secondary screen scroll (default enabled); resource
+ B<secondaryScroll>.
+ 
++=item B<-ssw>|B<+ssw>
++
++Turn on/off secondary screen wheel support (default disabled); resource
++B<secondaryWheel>.
++
+ =item B<-hold>|B<+hold>
+ 
+ Turn on/off hold window after exit support. If enabled, @@RXVT_NAME@@
+@@ -1052,6 +1057,13 @@ option is enabled, scrolls on the second
+ scrollback buffer and, when secondaryScreen is off, switching
+ to/from the secondary screen will instead scroll the screen up.
+ 
++=item B<secondaryWheel:> I<boolean>
++
++Turn on/off secondary wheel (default disabled). If enabled, when on
++secondary screen, using the mouse wheel will not scroll in the buffer
++but instead send 3 "fake" keystrokes (Up/Down arrow) to the running
++application (allows e.g. natural scrolling in B<man>, B<less>, etc).
++
+ =item B<hold>: I<boolean>
+ 
+ Turn on/off hold window after exit support. If enabled, @@RXVT_NAME@@
+Index: rxvt-unicode-9.22/src/command.C
+===================================================================
+--- rxvt-unicode-9.22.orig/src/command.C
++++ rxvt-unicode-9.22/src/command.C
+@@ -2239,10 +2239,46 @@ rxvt_term::button_release (XButtonEvent
+                 }
+               else
+ # endif
++#ifndef NO_SECONDARY_SCREEN
+                 {
+-                  scr_page (dirn, lines);
+-                  scrollBar.show (1);
++                  /* on SECONDARY screen, we send "fake" UP/DOWN keys instead
++                   * (this allows to scroll within man, less, etc) */
++                  if (option (Opt_secondaryWheel) && current_screen != PRIMARY)
++                    {
++                       XKeyEvent event;
++                       event.display     = ev.display;
++                       event.window      = ev.window;
++                       event.root        = ev.root;
++                       event.subwindow   = ev.subwindow;
++                       event.time        = ev.time;
++                       event.x           = ev.x;
++                       event.y           = ev.y;
++                       event.x_root      = ev.x_root;
++                       event.y_root      = ev.y_root;
++                       event.same_screen = ev.same_screen;
++                       event.state       = 0;
++                       event.keycode     = XKeysymToKeycode(ev.display,
++                                            (dirn == UP) ? XK_Up : XK_Down);
++                       for ( ; lines > 0; --lines)
++                         {
++                            event.type = KeyPress;
++                            XSendEvent (event.display, event.window, True,
++                                        KeyPressMask, (XEvent *) &event);
++                            event.type = KeyRelease;
++                            XSendEvent (event.display, event.window, True,
++                                        KeyPressMask, (XEvent *) &event);
++                          }
++                    }
++                  /* on PRIMARY screen, we scroll in the buffer */
++                  else
++#endif
++                    {
++                       scr_page (dirn, lines);
++                       scrollBar.show (1);
++                    }
++#ifndef NO_SECONDARY_SCREEN
+                 }
++#endif
+             }
+             break;
+ #endif
+Index: rxvt-unicode-9.22/src/optinc.h
+===================================================================
+--- rxvt-unicode-9.22.orig/src/optinc.h
++++ rxvt-unicode-9.22/src/optinc.h
+@@ -27,6 +27,7 @@
+  def(cursorBlink)
+  def(secondaryScreen)
+  def(secondaryScroll)
++ def(secondaryWheel)
+  def(pastableTabs)
+  def(cursorUnderline)
+ #if ENABLE_FRILLS
+Index: rxvt-unicode-9.22/src/rsinc.h
+===================================================================
+--- rxvt-unicode-9.22.orig/src/rsinc.h
++++ rxvt-unicode-9.22/src/rsinc.h
+@@ -104,6 +104,7 @@
+ #ifndef NO_SECONDARY_SCREEN
+   def (secondaryScreen)
+   def (secondaryScroll)
++  def (secondaryWheel)
+ #endif
+ #if OFF_FOCUS_FADING
+   def (fade)
+Index: rxvt-unicode-9.22/src/xdefaults.C
+===================================================================
+--- rxvt-unicode-9.22.orig/src/xdefaults.C
++++ rxvt-unicode-9.22/src/xdefaults.C
+@@ -267,6 +267,7 @@ optList[] = {
+ #ifndef NO_SECONDARY_SCREEN
+               BOOL (Rs_secondaryScreen, "secondaryScreen", "ssc", Opt_secondaryScreen, 0, "enable secondary screen"),
+               BOOL (Rs_secondaryScroll, "secondaryScroll", "ssr", Opt_secondaryScroll, 0, "enable secondary screen scroll"),
++              BOOL (Rs_secondaryWheel, "secondaryWheel", "ssw", Opt_secondaryWheel, 0, "enable secondary screen wheel"),
+ #endif
+ #if ENABLE_PERL
+               RSTRG (Rs_perl_lib, "perl-lib", "string"), //, "colon-separated directories with extension scripts"),TODO
diff -Nru rxvt-unicode-9.22/debian/patches/series rxvt-unicode-9.22/debian/patches/series
--- rxvt-unicode-9.22/debian/patches/series	2018-01-04 21:46:13.000000000 +0300
+++ rxvt-unicode-9.22/debian/patches/series	2018-03-11 20:01:55.000000000 +0300
@@ -7,3 +7,5 @@
 14_install_urxvt-font-size.diff
 15_perl_path.diff
 16_no_terminfo.diff
+17_clear.diff
+18_secondaryWheel.diff
