On Sun, Mar 29, 2026 at 10:56:01AM +0200, Pavel Sanda wrote:
> I am attaching a patch fixing the situation, the technical analysis is within
> the patch.
The patch is attached. P
diff -uNr Eterm-0.9.5/src/screen.c Eterm-0.9.5-fix2/src/screen.c
--- Eterm-0.9.6/src/screen.c 2023-04-18 12:15:45.134264276 +0200
+++ Eterm-0.9.6-fix2/src/screen.c 2026-03-26 11:38:52.039159190 +0100
@@ -3313,7 +3313,26 @@
selection_send(XSelectionRequestEvent * rq)
{
XEvent ev;
- long target_list[2];
+/* Eterm 0.9.6 middle-click paste broken in Firefox 140 ESR - fix
+
+Eterm's selection_send() function in screen.c has two bugs related to the fail
+of middle-click paste from Eterm into Firefox 140 ESR. First, the
+TARGETS response did not advertise UTF8_STRING, only XA_STRING. Second and more
+critically, the XChangeProperty call for the TARGETS response used rq->target
+as the property type instead of XA_ATOM. The ICCCM spec requires TARGETS to be
+returned as type XA_ATOM, and Firefox 140 enforces this strictly while older
+apps did not. The fix is to add UTF8_STRING to the advertised targets list and
+change the XChangeProperty type argument from rq->target to XA_ATOM. After this
+fix, declare the target list as Atom target_list[3] with explicit Atom casts.
+Middle-click paste from Eterm to Firefox 140 ESR starts to work correctly after
+addressing the XChangeProperty issue.
+*/
+
+// long target_list[2];
+ //Mfix
+ unsigned long target_list[3]; /* was 2, now 3 */
+ Atom utf8_string;
+ utf8_string = XInternAtom(Xdisplay, "UTF8_STRING", False);
ev.xselection.type = SelectionNotify;
ev.xselection.property = None;
@@ -3326,7 +3345,10 @@
if (rq->target == props[PROP_SELECTION_TARGETS]) {
target_list[0] = props[PROP_SELECTION_TARGETS];
target_list[1] = XA_STRING;
- XChangeProperty(Xdisplay, rq->requestor, rq->property, rq->target,
+ target_list[2] = utf8_string; //Mfix
+// XChangeProperty(Xdisplay, rq->requestor, rq->property, rq->target,
+ //Mfix
+ XChangeProperty(Xdisplay, rq->requestor, rq->property, XA_ATOM,
32, PropModeReplace, (unsigned char *) target_list,
(sizeof(target_list) / sizeof(target_list[0])));
ev.xselection.property = rq->property;