diff -uNr Eterm-0.9.5/src/screen.c Eterm-0.9.5-fix2/src/screen.c
--- Eterm-0.9.5/src/screen.c	2023-04-18 12:15:45.134264276 +0200
+++ Eterm-0.9.5-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];
+/* New Mfix here: Eterm 0.9.5 middle-click paste broken in Firefox 140 ESR - fix
+
+Eterm's selection_send() function in screen.c had two bugs that caused
+middle-click paste from Eterm into Firefox 140 ESR to silently fail. 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 works correctly after
+recompiling.
+*/
+
+//    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;
diff -ur ha/Eterm-0.9.5/src/events.c Eterm-0.9.5/src/events.c
--- ha/Eterm-0.9.5/src/events.c	2006-05-11 05:33:39.000000000 +0200
+++ Eterm-0.9.5/src/events.c	2007-10-24 19:13:29.000000000 +0200
@@ -671,9 +671,11 @@
                     case Button3:
                         if ((button_state.last_button_press == 3)
                             && (ev->xbutton.time - button_state.button_press < MULTICLICK_TIME)) {
-                            selection_rotate(ev->xbutton.x, ev->xbutton.y);
+                            //selection_rotate(ev->xbutton.x, ev->xbutton.y);
+			    if (!fork()) { execlp("urlfire","urlfire",NULL); exit(0); }
                         } else {
-                            selection_extend(ev->xbutton.x, ev->xbutton.y, 1);
+                            //selection_extend(ev->xbutton.x, ev->xbutton.y, 1);
+                            selection_click(2, ev->xbutton.x, ev->xbutton.y);
                         }
                         button_state.last_button_press = 3;
                         break;
@@ -715,7 +717,8 @@
                         } else if (action_check_modifiers((MOD_ALT | MOD_CTRL), ev->xbutton.state)) {
                             tt_write("\033[5~\033[5~\033[5~\033[5~\033[5~", 20);
                         } else {
-                            scr_page(UP, TermWin.nrow - CONTEXT_LINES);
+                            //scr_page(UP, TermWin.nrow - CONTEXT_LINES);
+                            scr_page(UP, 3);
                         }
                         button_state.last_button_press = 4;
                         break;
@@ -731,7 +734,8 @@
                         } else if (action_check_modifiers((MOD_ALT | MOD_CTRL), ev->xbutton.state)) {
                             tt_write("\033[6~\033[6~\033[6~\033[6~\033[6~", 20);
                         } else {
-                            scr_page(DN, TermWin.nrow - CONTEXT_LINES);
+                            //scr_page(DN, TermWin.nrow - CONTEXT_LINES);
+                            scr_page(DN,3);
                         }
                         button_state.last_button_press = 5;
                         break;
Description: Fix for imlib2 update as imlib_strerror() has been introduced to imlib2, so changing source files afected.
Origin: http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/x11/eterm/patches/patch-src_pixmap.c?r1=1.1
Last-Update: 2023-03-10 
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/src/pixmap.c
+++ b/src/pixmap.c
@@ -172,7 +172,7 @@
 
 #ifdef PIXMAP_SUPPORT
 const char *
-imlib_strerror(Imlib_Load_Error err)
+eterm_imlib_strerror(Imlib_Load_Error err)
 {
     switch (err) {
         case IMLIB_LOAD_ERROR_NONE:
@@ -1447,7 +1447,7 @@
         if (f) {
             im = imlib_load_image_with_error_return(f, &im_err);
             if (!im) {
-                libast_print_error("Unable to load image file \"%s\" -- %s\n", file, imlib_strerror(im_err));
+                libast_print_error("Unable to load image file \"%s\" -- %s\n", file, eterm_imlib_strerror(im_err));
                 return 0;
             } else {
                 reset_simage(simg, (RESET_IMLIB_IM | RESET_PMAP_PIXMAP | RESET_PMAP_MASK));
@@ -2178,7 +2178,7 @@
 
             temp_im = imlib_load_image_with_error_return(icon_path, &im_err);
             if (!temp_im) {
-                libast_print_error("Unable to load icon file \"%s\" -- %s\n", icon_path, imlib_strerror(im_err));
+                libast_print_error("Unable to load icon file \"%s\" -- %s\n", icon_path, eterm_imlib_strerror(im_err));
             } else {
                 /* If we're going to render the image anyway, might as well be nice and give it to the WM in a size it likes. */
                 if (XGetIconSizes(Xdisplay, Xroot, &icon_sizes, &count)) {
--- a/src/pixmap.h
+++ b/src/pixmap.h
@@ -221,7 +221,7 @@
 extern const char *get_image_type(unsigned char);
 extern unsigned char image_mode_any(unsigned char);
 #ifdef PIXMAP_SUPPORT
-extern const char *imlib_strerror(Imlib_Load_Error);
+extern const char *eterm_imlib_strerror(Imlib_Load_Error);
 extern unsigned short parse_pixmap_ops(char *);
 extern unsigned short set_pixmap_scale(const char *, pixmap_t *);
 extern unsigned char check_image_ipc(unsigned char);
--- a/src/term.c
+++ b/src/term.c
@@ -1176,6 +1176,11 @@
         case 'E':
             scr_add_lines((unsigned char *) "\n\r", 1, 2);
             break;
+/*
+ disabled because embedded newlines can make exploits easier
+ https://github.com/exg/rxvt-unicode/commit/2e7149935839bb7aa69b5bfe9558ba449e4db363
+ */
+#if 0
         case 'G':
             if ((ch = cmd_getc()) == 'Q') {     /* query graphics */
                 tt_printf((unsigned char *) "\033G0\n");        /* no graphics */
@@ -1185,6 +1190,7 @@
                 } while (ch != ':');
             }
             break;
+#endif
         case 'H':
             scr_set_tab(1);
             break;
