On Fri, 23 Jun 2017 01:50:32 +0200
Marc Lehmann <[email protected]> wrote:

> On Wed, Jun 21, 2017 at 07:46:25PM +0100, Rastislav Barlik
> <[email protected]> wrote:
> > So in order to have the same behavior in urxvt, the simplest option
> > would be to change vtwheel to check for mouse reporting and not to
> > do key-press simulation when it's turned on, but as far as I know,
> > mouse reporting is not exposed to the perl extensions.  
> 
> Yes, it should be exported. The patch is also quite nice (thanks for
> not forgetting the documentation!), but could you make a patch that
> exposes priv_modes instead and exports the PrivMode_* constants
> instead (by adding them to the const_iv array)? That would export all
> those flags to extensions and would use the same API as C++, wehich
> is what we normally expose in these cases.
> 

Thank you for the suggestions. Exporting the whole priv_modes is
actually much better. I've attached the patch.

--
Rastislav Barlik
From: Rastislav Barlik <[email protected]>
Date: Sat, 24 Jun 2017 15:14:33 +0100
Subject: [PATCH] Export the state of DEC private modes

---
 src/rxvtperl.xs | 32 ++++++++++++++++++++++++++++++++
 src/urxvt.pm    | 22 ++++++++++++++++++++++
 2 files changed, 54 insertions(+)

diff --git a/src/rxvtperl.xs b/src/rxvtperl.xs
index 0489f24..3438a8f 100644
--- a/src/rxvtperl.xs
+++ b/src/rxvtperl.xs
@@ -1022,6 +1022,36 @@ BOOT:
     const_iv (XIMDontChange),
 #   endif
 #   endif
+
+    /* DEC private modes */
+    const_iv(PrivMode_132),
+    const_iv(PrivMode_132OK),
+    const_iv(PrivMode_rVideo),
+    const_iv(PrivMode_relOrigin),
+    const_iv(PrivMode_Screen),
+    const_iv(PrivMode_Autowrap),
+    const_iv(PrivMode_aplCUR),
+    const_iv(PrivMode_aplKP),
+    const_iv(PrivMode_HaveBackSpace),
+    const_iv(PrivMode_BackSpace),
+    const_iv(PrivMode_ShiftKeys),
+    const_iv(PrivMode_VisibleCursor),
+    const_iv(PrivMode_MouseX10),
+    const_iv(PrivMode_MouseX11),
+    const_iv(PrivMode_scrollBar),
+    const_iv(PrivMode_TtyOutputInh),
+    const_iv(PrivMode_Keypress),
+    const_iv(PrivMode_smoothScroll),
+    const_iv(PrivMode_vt52),
+    const_iv(PrivMode_LFNL),
+    const_iv(PrivMode_MouseBtnEvent),
+    const_iv(PrivMode_MouseAnyEvent),
+    const_iv(PrivMode_BracketPaste),
+    const_iv(PrivMode_ExtModeMouse),
+    const_iv(PrivMode_ExtMouseRight),
+    const_iv(PrivMode_BlinkingCursor),
+    const_iv(PrivMode_mouse_report),
+    const_iv(PrivMode_Default),
   };
 
   for (civ = const_iv + ecb_array_length (const_iv); civ > const_iv; civ--)
@@ -1422,6 +1452,7 @@ rxvt_term::ModLevel3Mask ()
            ModNumLockMask = 2
            current_screen = 3
            hidden_cursor  = 4
+           priv_modes     = 5
 	CODE:
         switch (ix)
           {
@@ -1434,6 +1465,7 @@ rxvt_term::ModLevel3Mask ()
 #else
             case 4: RETVAL = 0;                    break;
 #endif
+            case 5: RETVAL = THIS->priv_modes;     break;
           }
         OUTPUT:
         RETVAL
diff --git a/src/urxvt.pm b/src/urxvt.pm
index 3dcf702..816317d 100644
--- a/src/urxvt.pm
+++ b/src/urxvt.pm
@@ -514,6 +514,18 @@ SelectionNotify, ColormapNotify, ClientMessage, MappingNotify
 
 Various constants for use in X calls and event processing.
 
+=item urxvt::PrivMode_132, PrivMode_132OK, PrivMode_rVideo, PrivMode_relOrigin,
+PrivMode_Screen, PrivMode_Autowrap, PrivMode_aplCUR, PrivMode_aplKP,
+PrivMode_HaveBackSpace, PrivMode_BackSpace, PrivMode_ShiftKeys,
+PrivMode_VisibleCursor, PrivMode_MouseX10, PrivMode_MouseX11,
+PrivMode_scrollBar, PrivMode_TtyOutputInh, PrivMode_Keypress,
+PrivMode_smoothScroll, PrivMode_vt52, PrivMode_LFNL, PrivMode_MouseBtnEvent,
+PrivMode_MouseAnyEvent, PrivMode_BracketPaste, PrivMode_ExtModeMouse,
+PrivMode_ExtMouseRight, PrivMode_BlinkingCursor, PrivMode_mouse_report,
+PrivMode_Default
+
+Constants for checking DEC private modes.
+
 =back
 
 =head2 RENDITION
@@ -1693,6 +1705,16 @@ Returns the currently displayed screen (0 primary, 1 secondary).
 
 Returns whether the cursor is currently hidden or not.
 
+=item $priv_modes = $term->priv_modes
+
+Returns a bitset with the state of DEC private modes.
+
+Example:
+
+  if ($term->priv_modes & urxvt::PrivMode_mouse_report) {
+      # mouse reporting is turned on
+  }
+
 =item $view_start = $term->view_start ([$newvalue])
 
 Returns the row number of the topmost displayed line. Maximum value is
-- 
2.13.1

_______________________________________________
rxvt-unicode mailing list
[email protected]
http://lists.schmorp.de/mailman/listinfo/rxvt-unicode

Reply via email to