ref: 40db9d5361e9283b53c368eca2f66f0db32cbdd9
parent: fad4eb92fbe9bed64060b1b7958d953c6ed67267
author: 23hiro <[email protected]>
date: Sun Apr 10 21:30:20 EDT 2016
gux-x11: Alt key: if alt was pressed during focusout send a second alt to get out of composition mode on focusin.
--- a/gui-x11/x11.c
+++ b/gui-x11/x11.c
@@ -129,6 +129,7 @@
static uchar map7to8[128][2];
static Colormap xcmap; /* Default shared colormap */
+static int focusarm; /* on focusin undo alt when pressed during focus out by sending second alt */
extern int mousequeue;
/* for copy/paste, lifted from plan9ports */
@@ -302,6 +303,9 @@
Button4MotionMask|
Button5MotionMask|
ExposureMask|
+ EnterWindowMask|
+ LeaveWindowMask|
+ FocusChangeMask|
StructureNotifyMask;
XSelectInput(xkmcon, xdrawable, mask);
@@ -729,6 +733,13 @@
{
KeySym k;
+ if(e->xany.type == FocusIn && focusarm){
+ focusarm=0;
+ kbdkey(Kalt, 0);
+ kbdkey(Kalt, 1);
+ return;
+ }
+
/*
* I tried using XtGetActionKeysym, but it didn't seem to
* do case conversion properly
@@ -869,6 +880,14 @@
if(k == NoSymbol) {
return;
}
+
+ if(k==Kalt && e->xany.type == KeyPress)
+ if(focusarm == 0)
+ focusarm=2;
+ else
+ focusarm=0;
+ else if(focusarm && e->xany.type == KeyPress)
+ focusarm--;
kbdkey(k, e->xany.type == KeyPress);
}