DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 514BAqUA1388120 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 514BAqUA1388120 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=nKmazckB X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DB4563858408 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1738667451; bh=Mx8OLSS4vBFyZoLPvvk2mngY1T993G/ffReMqUtxypo=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=nKmazckBoPGkcWxgP7yCQSvEh0I4yAOSPIrZHNNkLhJXkIzh7mo89FXMh4+WR+vck 43kqRebrR3hyVr72EO0/8a5xaTetkO6iW4kxWRgrqaYaI6Hs07ICV7t4/DTWu+vMbZ q9atPe6YrBN5yfaC0HHcBjcM0sAr+MGhLGBWIXeA= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A3D2A3858D20 Date: Tue, 4 Feb 2025 12:10:29 +0100 To: cygwin AT cygwin DOT com Subject: Re: [mintty] Problem of the control key on focus change Message-ID: Mail-Followup-To: cygwin AT cygwin DOT com References: <20250127201721 DOT 2f31acf76d494f5e13652537 AT nifty DOT ne DOT jp> <48d156ec-a609-498a-9e97-2f49f1719bc4 AT towo DOT net> <21f98e05-7de6-41b0-9470-375c840fcb5f AT towo DOT net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <21f98e05-7de6-41b0-9470-375c840fcb5f@towo.net> X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Corinna Vinschen via Cygwin Reply-To: cygwin AT cygwin DOT com Cc: Corinna Vinschen Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" Hi Thomas, On Jan 30 21:59, Thomas Wolff via Cygwin wrote: > > 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 for your description. I'm running mintty with OldAltGrDetection=2 for a couple of days now and didn't have any problems. I assume the complicated detection cases you're working on don't show up in my workflow. 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