From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4068 invoked by alias); 12 Jan 2012 12:38:44 -0000 Received: (qmail 3956 invoked by uid 22791); 12 Jan 2012 12:38:43 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mailout-de.gmx.net (HELO mailout-de.gmx.net) (213.165.64.22) by sourceware.org (qpsmtpd/0.43rc1) with SMTP; Thu, 12 Jan 2012 12:38:30 +0000 Received: (qmail invoked by alias); 12 Jan 2012 12:38:28 -0000 Received: from bastian.ppi.de (EHLO [192.168.103.48]) [194.180.18.1] by mail.gmx.net (mp034) with SMTP; 12 Jan 2012 13:38:28 +0100 Message-ID: <4F0ED443.7020403@gmx.de> Date: Thu, 12 Jan 2012 12:38:00 -0000 From: Oliver Schmidt User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 MIME-Version: 1.0 To: cygwin-xfree@cygwin.com Subject: Re: considering modifier keys after gaining focus References: <4E4A8D56.6010704@gmx.de> <4F09B4D4.4070905@gmx.de> <4F0AF463.5050707@dronecode.org.uk> <4F0B2DC8.9030706@gmx.de> <4F0DC3DF.8000802@dronecode.org.uk> <4F0ECFC5.7090903@gmx.de> In-Reply-To: <4F0ECFC5.7090903@gmx.de> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cygwin-xfree-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-xfree-owner@cygwin.com Reply-To: cygwin-xfree@cygwin.com Mail-Followup-To: cygwin-xfree@cygwin.com X-SW-Source: 2012-01/txt/msg00017.txt.bz2 On 1/12/2012 1:19 PM, Oliver Schmidt wrote: > On 1/11/2012 6:16 PM, Jon TURNEY wrote: >> Hm... on looking at this again, isn't that code you are adding checking the >> internal state of non-latching modifiers bogus? If we release all keys on >> WM_KILLFOCUS, then the non-latching modifiers will always be clear when the >> WM_SETFOCUS occurs, so we will always generate the keypress for the modifier. > > Yes, my patch also generates key release events for modifiers despite > the fact, that all modifier have been released after the xserver looses > the window focus. When writing the patch, I wasn't sure if this is > always the case, so I made the code a little bit more "robust" in the > sense that it tries to correct the modifier keys in any case (so it will > always work, even if something goes wrong in other code locations). My answer is perhaps a little bit unexact. To be more precise: + BOOL ctrl = (GetAsyncKeyState (VK_CONTROL) < 0); + if (WIN_XOR (internalKeyStates & ControlMask, ctrl)) + winSendKeyEvent (KEY_LCtrl, ctrl); The above code fragment will send a key press event for the ctrl key, if the current "real" ctrl modifier state is pressed and differs from the xserver's internal key state for ControlMask. It will send a key release event for the ctrl key, if the current "real" ctrl modifier state is "not pressed" and differs from the xserver's internal key state for ControlMask. Best regards, Oliver -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://x.cygwin.com/docs/ FAQ: http://x.cygwin.com/docs/faq/