Gentoo Archives: gentoo-commits

From: Marek Szuba <marecki@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: x11-terms/rxvt-unicode/, x11-terms/rxvt-unicode/files/
Date: Thu, 31 Dec 2020 14:53:02
Message-Id: 1609426369.01fa0495e04575b2295bfb0afe2164caba7511e4.marecki@gentoo
1 commit: 01fa0495e04575b2295bfb0afe2164caba7511e4
2 Author: Marek Szuba <marecki <AT> gentoo <DOT> org>
3 AuthorDate: Thu Dec 31 14:45:19 2020 +0000
4 Commit: Marek Szuba <marecki <AT> gentoo <DOT> org>
5 CommitDate: Thu Dec 31 14:52:49 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=01fa0495
7
8 x11-terms/rxvt-unicode: Optionally support xterm SGR 1006 mouse extension
9
10 Needed in order for mouse tracking to work properly in large terminals,
11 for all applications which do not the urxvt 1015 extension (and not many
12 do). Relies on a third-party patch (ported from AUR, and extended to make
13 this feature dependent on a build-time flag, by the bug reporter), as
14 upstream allegedly refused to implement this.
15
16 Suggested-by: Oscar L <oscar_bugs <AT> nym.hush.com>
17 Closes: https://bugs.gentoo.org/761787
18 Signed-off-by: Marek Szuba <marecki <AT> gentoo.org>
19
20 .../rxvt-unicode-9.22-sgr-mouse-mode-flag.patch | 165 +++++++++++++++++++++
21 x11-terms/rxvt-unicode/metadata.xml | 3 +
22 x11-terms/rxvt-unicode/rxvt-unicode-9.22-r7.ebuild | 112 ++++++++++++++
23 3 files changed, 280 insertions(+)
24
25 diff --git a/x11-terms/rxvt-unicode/files/rxvt-unicode-9.22-sgr-mouse-mode-flag.patch b/x11-terms/rxvt-unicode/files/rxvt-unicode-9.22-sgr-mouse-mode-flag.patch
26 new file mode 100644
27 index 00000000000..3f6f5d90618
28 --- /dev/null
29 +++ b/x11-terms/rxvt-unicode/files/rxvt-unicode-9.22-sgr-mouse-mode-flag.patch
30 @@ -0,0 +1,165 @@
31 +diff --git a/config.h.in b/config.h.in
32 +index 914d606..b869bfb 100644
33 +--- a/config.h.in
34 ++++ b/config.h.in
35 +@@ -9,6 +9,9 @@
36 + /* Define if you want handling for rarely used but handy features */
37 + #undef ENABLE_FRILLS
38 +
39 ++/* Define if you want support for SGR mouse mode 1006 */
40 ++#undef ENABLE_SGRMOUSE
41 ++
42 + /* Define if you can embed a perl interpreter */
43 + #undef ENABLE_PERL
44 +
45 +diff --git a/configure.ac b/configure.ac
46 +index 0da3b59..c8b9c80 100644
47 +--- a/configure.ac
48 ++++ b/configure.ac
49 +@@ -76,6 +76,7 @@ AC_SEARCH_LIBS(gethostbyname, nsl)
50 + AC_SEARCH_LIBS(socket, socket)
51 +
52 + support_frills=yes
53 ++support_sgrmouse=yes
54 + support_inheritpixmap=yes
55 + support_fading=yes
56 + support_keepscrolling=yes
57 +@@ -109,6 +110,7 @@ AC_ARG_ENABLE(everything,
58 + [
59 + if test x$enableval = xno; then
60 + support_frills=no
61 ++ support_sgrmouse=no
62 + support_inheritpixmap=no
63 + support_fading=no
64 + support_keepscrolling=no
65 +@@ -137,6 +139,7 @@ AC_ARG_ENABLE(everything,
66 + fi
67 + if test x$enableval = xyes; then
68 + support_frills=yes
69 ++ support_sgrmouse=yes
70 + support_inheritpixmap=yes
71 + support_fading=yes
72 + support_keepscrolling=yes
73 +@@ -359,6 +362,12 @@ AC_ARG_ENABLE(frills,
74 + support_frills=$enableval
75 + fi])
76 +
77 ++AC_ARG_ENABLE(sgrmouse,
78 ++ [ --enable-sgrmouse enable support for SGR mouse mode 1006],
79 ++ [if test x$enableval = xyes -o x$enableval = xno; then
80 ++ support_sgrmouse=$enableval
81 ++ fi])
82 ++
83 + AC_ARG_ENABLE(keepscrolling,
84 + [ --enable-keepscrolling enable continual scrolling on scrollbar arrow press],
85 + [if test x$enableval = xyes -o x$enableval = xno; then
86 +@@ -666,6 +675,9 @@ fi
87 + if test x$support_frills = xyes; then
88 + AC_DEFINE(ENABLE_FRILLS, 1, Define if you want handling for rarely used but handy features)
89 + fi
90 ++if test x$support_sgrmouse = xyes; then
91 ++ AC_DEFINE(ENABLE_SGRMOUSE, 1, Define if you want support for SGR mouse mode 1006)
92 ++fi
93 + if test x$support_mousewheel = xyes; then
94 + AC_DEFINE(MOUSE_WHEEL, 1, Define to use wheel events (button4 and button5) to scroll)
95 + fi
96 +diff --git a/src/command.C b/src/command.C
97 +index 7b79f51..a62ef87 100644
98 +--- a/src/command.C
99 ++++ b/src/command.C
100 +@@ -1282,6 +1282,13 @@ rxvt_term::mouse_report (XButtonEvent &ev)
101 + int button_number, key_state = 0;
102 + int x, y;
103 + int code = 32;
104 ++ bool mode_sgr = false;
105 ++
106 ++#if ENABLE_SGRMOUSE
107 ++ if (priv_modes & PrivMode_ExtMouseSgr) mode_sgr = true;
108 ++#endif
109 ++
110 ++ if (mode_sgr) code = 0;
111 +
112 + x = Pixel2Col (ev.x) + 1;
113 + y = Pixel2Row (ev.y) + 1;
114 +@@ -1296,11 +1303,18 @@ rxvt_term::mouse_report (XButtonEvent &ev)
115 + code += 32;
116 + }
117 +
118 +- if (MEvent.button == AnyButton)
119 ++ if (!(mode_sgr) && MEvent.button == AnyButton)
120 + button_number = 3;
121 + else
122 + {
123 +- button_number = MEvent.button - Button1;
124 ++ if (ev.type == MotionNotify) {
125 ++ if (ev.state & Button1Mask) button_number = 0;
126 ++ else if (ev.state & Button2Mask) button_number = 1;
127 ++ else if (ev.state & Button3Mask) button_number = 2;
128 ++ else return;
129 ++ } else {
130 ++ button_number = ev.button - Button1;
131 ++ }
132 + /* add 0x3D for wheel events, like xterm does */
133 + if (button_number >= 3)
134 + button_number += 64 - 3;
135 +@@ -1361,6 +1375,15 @@ rxvt_term::mouse_report (XButtonEvent &ev)
136 + wint_t (32 + x),
137 + wint_t (32 + y));
138 + else
139 ++#endif
140 ++#if ENABLE_SGRMOUSE
141 ++ if (mode_sgr)
142 ++ tt_printf ("\033[<%d;%d;%d%c",
143 ++ code + button_number + key_state,
144 ++ x,
145 ++ y,
146 ++ (ev.type == ButtonRelease ? 'm' : 'M'));
147 ++ else
148 + #endif
149 + tt_printf ("\033[M%c%c%c",
150 + code + button_number + key_state,
151 +@@ -2904,7 +2927,7 @@ rxvt_term::process_csi_seq ()
152 + scr_soft_reset ();
153 +
154 + static const int pm_h[] = { 7, 25 };
155 +- static const int pm_l[] = { 1, 3, 4, 5, 6, 9, 66, 1000, 1001, 1005, 1015, 1049 };
156 ++ static const int pm_l[] = { 1, 3, 4, 5, 6, 9, 66, 1000, 1001, 1002, 1003, 1005, 1006, 1015, 1049 };
157 +
158 + process_terminal_mode ('h', 0, ecb_array_length (pm_h), pm_h);
159 + process_terminal_mode ('l', 0, ecb_array_length (pm_l), pm_l);
160 +@@ -3710,6 +3733,9 @@ rxvt_term::process_terminal_mode (int mode, int priv ecb_unused, unsigned int na
161 + { 1003, PrivMode_MouseAnyEvent },
162 + #if ENABLE_FRILLS
163 + { 1005, PrivMode_ExtModeMouse },
164 ++#endif
165 ++#if ENABLE_SGRMOUSE
166 ++ { 1006, PrivMode_ExtMouseSgr },
167 + #endif
168 + { 1010, PrivMode_TtyOutputInh }, // rxvt extension
169 + { 1011, PrivMode_Keypress }, // rxvt extension
170 +diff --git a/src/rxvt.h b/src/rxvt.h
171 +index 5c7cf66..2ffd3fb 100644
172 +--- a/src/rxvt.h
173 ++++ b/src/rxvt.h
174 +@@ -645,6 +645,7 @@ enum {
175 + #define PrivMode_ExtModeMouse (1UL<<23) // xterm pseudo-utf-8 hack
176 + #define PrivMode_ExtMouseRight (1UL<<24) // xterm pseudo-utf-8, but works in non-utf-8-locales
177 + #define PrivMode_BlinkingCursor (1UL<<25)
178 ++#define PrivMode_ExtMouseSgr (1UL<<27) // sgr mouse extension
179 +
180 + #define PrivMode_mouse_report (PrivMode_MouseX10|PrivMode_MouseX11|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent)
181 +
182 +diff --git a/src/xdefaults.C b/src/xdefaults.C
183 +index 894aa8d..e5952b7 100644
184 +--- a/src/xdefaults.C
185 ++++ b/src/xdefaults.C
186 +@@ -359,6 +359,9 @@ static const char optionsstring[] = "options: "
187 + #if defined(ENABLE_FRILLS)
188 + "frills,"
189 + #endif
190 ++#if defined(ENABLE_SGRMOUSE)
191 ++ "sgrmouse,"
192 ++#endif
193 + #if defined(SELECTION_SCROLLING)
194 + "selectionscrolling,"
195 + #endif
196
197 diff --git a/x11-terms/rxvt-unicode/metadata.xml b/x11-terms/rxvt-unicode/metadata.xml
198 index e088706493d..b2f262896f2 100644
199 --- a/x11-terms/rxvt-unicode/metadata.xml
200 +++ b/x11-terms/rxvt-unicode/metadata.xml
201 @@ -21,6 +21,9 @@
202 <flag name="iso14755">Enable ISO-14755 support</flag>
203 <flag name="mousewheel">Enable scrolling via mouse wheel or buttons 4 and 5</flag>
204 <flag name="perl">Enable perl script support. You can still disable this at runtime with -pe ""</flag>
205 +<flag name="sgrmouse">Enable unofficial support for the xterm SGR 1006 mouse-tracking extension.
206 + Needed to properly support mouse events for terminals with more than 223
207 + rows or columns, in applications not supporting the urxvt 1015 extension.</flag>
208 <flag name="unicode3">Use 21 instead of 16 bits to represent unicode characters</flag>
209 <flag name="utmp">Enable utmp support</flag>
210 <flag name="wtmp">Enable wtmp support</flag>
211
212 diff --git a/x11-terms/rxvt-unicode/rxvt-unicode-9.22-r7.ebuild b/x11-terms/rxvt-unicode/rxvt-unicode-9.22-r7.ebuild
213 new file mode 100644
214 index 00000000000..3f1cb44b6c4
215 --- /dev/null
216 +++ b/x11-terms/rxvt-unicode/rxvt-unicode-9.22-r7.ebuild
217 @@ -0,0 +1,112 @@
218 +# Copyright 1999-2020 Gentoo Authors
219 +# Distributed under the terms of the GNU General Public License v2
220 +
221 +EAPI=7
222 +
223 +inherit autotools desktop systemd
224 +
225 +COLOUR_PATCH_NAME="${PN}-9.22_24-bit-color_cpixl-20201108.patch"
226 +
227 +DESCRIPTION="rxvt clone with xft and unicode support"
228 +HOMEPAGE="http://software.schmorp.de/pkg/rxvt-unicode.html"
229 +SRC_URI="http://dist.schmorp.de/rxvt-unicode/Attic/${P}.tar.bz2
230 + https://dev.gentoo.org/~marecki/dists/${PN}/${COLOUR_PATCH_NAME}.xz"
231 +
232 +LICENSE="GPL-3"
233 +SLOT="0"
234 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris"
235 +IUSE="-24-bit-color 256-color blink fading-colors +font-styles gdk-pixbuf iso14755 +mousewheel
236 + +perl -sgrmouse startup-notification unicode3 +utmp +wtmp xft"
237 +
238 +RESTRICT="test"
239 +
240 +RDEPEND=">=sys-libs/ncurses-5.7-r6:=
241 + media-libs/fontconfig
242 + x11-libs/libX11
243 + x11-libs/libXrender
244 + gdk-pixbuf? ( x11-libs/gdk-pixbuf )
245 + kernel_Darwin? ( dev-perl/Mac-Pasteboard )
246 + perl? ( dev-lang/perl:= )
247 + startup-notification? ( x11-libs/startup-notification )
248 + xft? ( x11-libs/libXft )"
249 +DEPEND="${RDEPEND}
250 + x11-base/xorg-proto"
251 +BDEPEND="virtual/pkgconfig"
252 +
253 +PATCHES=(
254 + "${FILESDIR}"/${PN}-9.06-case-insensitive-fs.patch
255 + "${FILESDIR}"/${PN}-9.21-xsubpp.patch
256 + "${FILESDIR}"/${PN}-9.22-sgr-mouse-mode-flag.patch
257 + "${WORKDIR}"/${COLOUR_PATCH_NAME}
258 +)
259 +DOCS=(
260 + Changes
261 + README.FAQ
262 + doc/README.xvt
263 + doc/changes.txt
264 + doc/etc/${PN}.term{cap,info}
265 + doc/rxvt-tabbed
266 +)
267 +
268 +src_prepare() {
269 + default
270 +
271 + # kill the rxvt-unicode terminfo file - #192083
272 + sed -i -e "/rxvt-unicode.terminfo/d" doc/Makefile.in || die "sed failed"
273 +
274 + eautoreconf
275 +}
276 +
277 +src_configure() {
278 + # --enable-everything goes first: the order of the arguments matters
279 + econf --enable-everything \
280 + $(use_enable 24-bit-color) \
281 + $(use_enable 256-color) \
282 + $(use_enable blink text-blink) \
283 + $(use_enable fading-colors fading) \
284 + $(use_enable font-styles) \
285 + $(use_enable gdk-pixbuf pixbuf) \
286 + $(use_enable iso14755) \
287 + $(use_enable mousewheel) \
288 + $(use_enable perl) \
289 + $(use_enable sgrmouse) \
290 + $(use_enable startup-notification) \
291 + $(use_enable unicode3) \
292 + $(use_enable utmp) \
293 + $(use_enable wtmp) \
294 + $(use_enable xft)
295 +}
296 +
297 +src_compile() {
298 + default
299 +
300 + sed -i \
301 + -e 's/RXVT_BASENAME = "rxvt"/RXVT_BASENAME = "urxvt"/' \
302 + "${S}"/doc/rxvt-tabbed || die
303 +}
304 +
305 +src_install() {
306 + default
307 +
308 + systemd_douserunit "${FILESDIR}"/urxvtd.service
309 +
310 + make_desktop_entry urxvt rxvt-unicode utilities-terminal \
311 + "System;TerminalEmulator"
312 +}
313 +
314 +pkg_postinst() {
315 + if use 24-bit-color; then
316 + ewarn
317 + ewarn "You have enabled 24-bit colour support in ${PN}, which is UNOFFICIAL and INCOMPLETE."
318 + ewarn "You may or may not encounter visual glitches or stability issues. When in doubt,"
319 + ewarn "rebuild =${CATEGORY}/${PF} with USE=-24-bit-color (the default setting)."
320 + ewarn
321 + fi
322 +
323 + if use sgrmouse; then
324 + ewarn
325 + ewarn "Support for the SGR 1006 mouse extension in ${PN} is UNOFFICIAL and provided as-is."
326 + ewarn "When in doubt, rebuild =${CATEGORY}/${PF} with USE=-sgrmouse (the default setting)."
327 + ewarn
328 + fi
329 +}