DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 50UKxMwi3478222
Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com
Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com
DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 50UKxMwi3478222
Authentication-Results: delorie.com;
	dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=TyQuCTsM
X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BE2B73858C78
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1738270761;
	bh=Sgzbaw5akSvTJU7o8vFkMLP1+D1nmWm27yMQSAsHHjE=;
	h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe:
	 List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
	 From;
	b=TyQuCTsMiA6LFfIJ2fbizz4yOBe+oJqkuvG8Hn13bageCO67gM9eeX8v78BPknOjk
	 IwM1hndxzLX5VLrbn5JcdzGhlyaJNYxCozciLK2Q86GQOJi//W1pBqJBPIHnmk5AaF
	 6a+8NsWvr0TypMi8GpI1SgbATAcLrUZpCT0Mhi9o=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D3E043858C53
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D3E043858C53
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1738270725; cv=none;
 b=rF0ymzTbQwwwGuphz1Ss/IM2qcYXqN2tM2LfZMrQt2pShUyORz7Tchfy2CTVaEQWsK8WzXgQKOzipLIJ1c/zYhuXbfj8TaZdXOP6AbHy1yIoEUP4JRfNrJa6P9bvIycw+CDSP2azcK+kAtQ7Y7u0eX1mt2dsIo+BXvYQ+sVdlkQ=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
 t=1738270725; c=relaxed/simple;
 bh=GPLUkeGLqSIOt6WbGM2ZxHC/4u9z90n+kcTkLhqbNfo=;
 h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From;
 b=GxzxG6DiicpukTvQf7jRGqnyjfZZopAgbEYKpicxrfd2pahaHstlCOVCD7Fss1qzF27atPp6G6riuPyUBVHFssuczh61CaKHmf2Ct329mxo3bl2hvtsd9tNKujdAbiA7vHzNRPkkPt55CsoHU6NUUkXahtvcFjP8V5hXP/jl32M=
ARC-Authentication-Results: i=1; server2.sourceware.org
X-UI-Sender-Class: 55c96926-9e95-11ee-ae09-1f7a4046a0f6
Message-ID: <21f98e05-7de6-41b0-9470-375c840fcb5f@towo.net>
Date: Thu, 30 Jan 2025 21:59:14 +0100
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [mintty] Problem of the control key on focus change
To: cygwin@cygwin.com
References: <20250127201721.2f31acf76d494f5e13652537@nifty.ne.jp>
 <48d156ec-a609-498a-9e97-2f49f1719bc4@towo.net>
 <Z5ibxnnSFMYTrzVn@calimero.vinschen.de>
Autocrypt: addr=towo@towo.net; keydata=
 xsDNBGNaf3QBDACVevqudcTSevLThXKQPU1QpaDxtGuYjtwmr7i9wXxVGih4Y4oxOJN4PYlu
 KBX9IVAI4651dA+xYtXuyIkWOPZWyyzkGKavQOn3Q7dk09oj7bh2IwOndpxXXde337D408EQ
 bQEGbMHr9lOWhSAideowzgCeFIvGTf2AovbPh97HpexJn1/HCRiRAhTNlrkS1DByUgCAeEMK
 fEr6aGM/Ou29MT+eTnQwOIZTnl9Z9LxM2FtqqMH3MycC7I2OoW3XXhuL8BPQdyJUjWa0/J11
 Oo5jFkRXtWenIns6jGn18oW72jnDmo9jXwwS+iZWAV6Y51nhD7jSC+3xs9ORmPCdtHUSpTr1
 zh67UueUJ3DUUNVuA25Hn/9EJMJ2L60BGUEr88NEB6pcZhmcwdkurAQeYT6t+frzBz2ct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1uVcM5o75DjV8DrqYruN2FMUF
 Jta311uOBbnCaUXtkl1I9dPe0k/26itiX51jDV0V25v6TyhAVFcSUTaPfgqRG9fjzMR5UNBs/
 W0bUpfyz5VlwxYuVDwRJiH7VfbFGzpDpeAF7ojM+TZ/RhOQpV0TfXsJC5c8nRRrp28ghEDIst
 uFsVLLGY1TSk48k0ai5/DFveElcOAScZ6IxrP9diZ67Cd7FbyUEE9ZHUVk+h4w0us5QQghdOr
 jY/jI90Dw6U1PUWL9ubFTUz9Yo5Qaajd6W5Njvun5+BemCzfvj6wwLuOB4mJn76rVCp9EN6SF
 tJeNn23046a7dDjh44DTuybNL3Ofd4iniXVdeODrHQV+zrzzuKCWJR4=
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.30
Precedence: list
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
From: Thomas Wolff via Cygwin <cygwin@cygwin.com>
Reply-To: Thomas Wolff <towo@towo.net>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: cygwin-bounces~archive-cygwin=delorie.com@cygwin.com
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie.com@cygwin.com>


Am 28.01.2025 um 09:56 schrieb Corinna Vinschen via Cygwin:
> On Jan 28 00:50, Thomas Wolff via Cygwin wrote:
>> Am 27.01.2025 um 12:17 schrieb Takashi Yano via Cygwin:
>>> Hi Thomas,
>>>
>>> A few days ago, Corinna asked me to check a problem of TTY.
>>> The problem is as follows.
>>>
>>> Reproduce steps:
>>> (1) Open mintty.
>>> (2) Open another mintty.
>>> (3) Place the second mintty window over the first one.
>>> (4) Hold ctrl key down.
>>> (5) Press 'd' key while holding ctrl key. The second mintty
>>>       window will be closed. Keep ctrl key still hold down.
>>> (6) Now the first mintty window is focused. Then press 'd' key
>>>       while holding ctrl key down.
>>> (7) The first mintty window will not logout but displays 'd'.
>>>
>>> I checked the pty and found the pty in the first mintty
>>> receives just 'd' but not Ctrl-D from mintty. In other words,
>>> fhandler_pty_master::write() is called with 'd'. So I suspect it
>>> might be a problem of mintty. Therefore, I tried old version
>>> of mintty. The results are:
>>>
>>> ...
>>>
>> Hi Takashi,
>> sorry this was attributed to pty, it is an issue of mintty I was aware
>> of which appeared in 3.7.2.
>> More precisely, it slipped in with
>> be73970877a99548aeeab60a2572ffb04b695066 "revise AltGr handling to
>> support flexible right-Alt+left-Ctrl combinations (#1266)", as a
>> trade-off for what I meant to be a final fix for control modifier
>> handling. I guess I hadn't considered it serious enough to reopen the
>> issue for another workaround. To be reconsidered...
> I just had a look into that commit and saw the description of a hidden
> option OldAltGrDetection right at the start.  Looks like
> OldAltGrDetection=2 is a temporary workaround for the problem.  What's
> the drawback of using it?
I've uploaded a fix to the github repository and tried to find an answer
to your question but couldn't yet...
Some background information: root cause of the trouble is Windows'
insane handling of the AltGr modifier and its failure to assign a
distinct virtual keycode to it. Instead it provides left-Control and
right-Alt key events, both with the same timestamp. That alone is a bit
tricky to detect as both Control and Alt are modifiers on their own.
Worse, software handling of AltGr detection or (in the case of remote
desktop software) generation often deviates from this scheme and even
Windows' own onscreen keyboard is buggy about this. Mintty has a number
of workarounds to handle that. Also, basically in a terminal emulator
the expectation is to handle all of Control, Alt etc and also their
combinations properly. For a example, on a keyboard where AltGr+q is
'@', Control+AltGr+q should be ^@, Alt+AltGr+q should be ESC @, and
Control+Alt+AltGr+q should be ESC ^@. All this is accomplished by
mintty. Together with the workarounds mentioned above, this is a
delicate area and I hope the fix found now interworks well with all such
software.
Thomas

>
> Thanks,
> Corinna
>


-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple
