summaryrefslogtreecommitdiff
blob: 1ed8904f493bdd0d4e095c31d580ed2c665c66e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
secondary wheel support:
when using the mouse wheel, if you’re on secondary screen then no scrolling
will occur, and instead some (3, to be exact) “fake” keystrokes will be sent to
the running application.

patch by jacky
i.am.jack.mail@gmail.com
http://lists.schmorp.de/pipermail/rxvt-unicode/2011q4/001491.html

diff -r d5f9ea7306c4 -r cca1997c1a85 doc/rxvt.1.pod
--- a/doc/rxvt.1.pod	Wed Dec 21 22:59:04 2011 +0100
+++ b/doc/rxvt.1.pod	Wed Dec 21 23:01:28 2011 +0100
@@ -455,6 +455,11 @@
 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@@
@@ -1167,6 +1172,13 @@
 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@@
diff -r d5f9ea7306c4 -r cca1997c1a85 src/command.C
--- a/src/command.C	Wed Dec 21 22:59:04 2011 +0100
+++ b/src/command.C	Wed Dec 21 23:01:28 2011 +0100
@@ -2197,10 +2197,46 @@
                 }
               else
 # endif
+#ifndef NO_SECONDARY_SCREEN
                 {
-                  scr_page (v, i);
-                  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,
+                                            (v == UP) ? XK_Up : XK_Down);
+                       for (i = 0; i < 3; ++i)
+                         {
+                            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 (v, i);
+                       scrollBar.show (1);
+                    }
+#ifndef NO_SECONDARY_SCREEN
                 }
+#endif
             }
             break;
 #endif
diff -r d5f9ea7306c4 -r cca1997c1a85 src/optinc.h
--- a/src/optinc.h	Wed Dec 21 22:59:04 2011 +0100
+++ b/src/optinc.h	Wed Dec 21 23:01:28 2011 +0100
@@ -26,6 +26,7 @@
  def(cursorBlink)
  def(secondaryScreen)
  def(secondaryScroll)
+ def(secondaryWheel)
  def(pastableTabs)
  def(cursorUnderline)
 #if ENABLE_FRILLS
diff -r d5f9ea7306c4 -r cca1997c1a85 src/rsinc.h
--- a/src/rsinc.h	Wed Dec 21 22:59:04 2011 +0100
+++ b/src/rsinc.h	Wed Dec 21 23:01:28 2011 +0100
@@ -102,6 +102,7 @@
 #ifndef NO_SECONDARY_SCREEN
   def (secondaryScreen)
   def (secondaryScroll)
+  def (secondaryWheel)
 #endif
 #ifdef OFF_FOCUS_FADING
   def (fade)
diff -r d5f9ea7306c4 -r cca1997c1a85 src/xdefaults.C
--- a/src/xdefaults.C	Wed Dec 21 22:59:04 2011 +0100
+++ b/src/xdefaults.C	Wed Dec 21 23:01:28 2011 +0100
@@ -261,6 +261,7 @@
 #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