- Allow the user to specify an alternate modifier for Meta. Typically, Linux
  has Meta and Alt both mapped to Mod1, so this option defaults to Mod1Mask.
---
 config.def.h | 7 +++++++
 x.c          | 4 ++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/config.def.h b/config.def.h
index b18f42e..45146f1 100644
--- a/config.def.h
+++ b/config.def.h
@@ -170,6 +170,13 @@ static unsigned int defaultattr = 11;
  */
 static uint forcemousemod = ShiftMask;
 
+/*
+ * The modifier to be interpreted as Meta (e.g., for purposes of sending
+ * "\033<key>"). Defaults to Mod1Mask, which is typically Alt in Linux X11
+ * modifier configurations.
+ */
+static uint metamod = Mod1Mask;
+
 /*
  * Internal mouse shortcuts.
  * Beware that overloading Button1 will disable the selection.
diff --git a/x.c b/x.c
index d73152b..da54d69 100644
--- a/x.c
+++ b/x.c
@@ -415,7 +415,7 @@ mousereport(XEvent *e)
 
        if (!IS_SET(MODE_MOUSEX10)) {
                code += ((state & ShiftMask  ) ?  4 : 0)
-                     + ((state & Mod1Mask   ) ?  8 : 0) /* meta key: alt */
+                     + ((state & metamod    ) ?  8 : 0) /* meta key: alt */
                      + ((state & ControlMask) ? 16 : 0);
        }
 
@@ -1876,7 +1876,7 @@ kpress(XEvent *ev)
        /* 3. composed string from input method */
        if (len == 0)
                return;
-       if (len == 1 && e->state & Mod1Mask) {
+       if (len == 1 && e->state & metamod) {
                if (IS_SET(MODE_8BIT)) {
                        if (*buf < 0177) {
                                c = *buf | 0x80;
-- 
2.47.2


Reply via email to