public inbox for cygwin-xfree@sourceware.org
help / color / mirror / Atom feed
From: Oliver Schmidt <oschmidt-mailinglists@gmx.de>
To: cygwin-xfree@cygwin.com
Subject: Re: considering modifier keys after gaining focus
Date: Thu, 12 Jan 2012 12:38:00 -0000	[thread overview]
Message-ID: <4F0ED443.7020403@gmx.de> (raw)
In-Reply-To: <4F0ECFC5.7090903@gmx.de>


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/


      reply	other threads:[~2012-01-12 12:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-16 15:31 Oliver Schmidt
2011-08-21  8:44 ` Corinna Vinschen
2011-08-21 10:04   ` Oliver Schmidt
2012-01-08 15:23 ` Oliver Schmidt
2012-01-09 14:06   ` Jon TURNEY
2012-01-09 18:11     ` Oliver Schmidt
2012-01-10  9:47       ` Oliver Schmidt
2012-01-10 10:15         ` Oliver Schmidt
2012-01-11 17:16       ` Jon TURNEY
2012-01-12 12:19         ` Oliver Schmidt
2012-01-12 12:38           ` Oliver Schmidt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F0ED443.7020403@gmx.de \
    --to=oschmidt-mailinglists@gmx.de \
    --cc=cygwin-xfree@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).