public inbox for cygwin-xfree@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin-xfree@cygwin.com
Subject: Re: considering modifier keys after gaining focus
Date: Sun, 21 Aug 2011 08:44:00 -0000 [thread overview]
Message-ID: <20110821084335.GA18237@calimero.vinschen.de> (raw)
In-Reply-To: <4E4A8D56.6010704@gmx.de>
On Aug 16 17:31, Oliver Schmidt wrote:
> Hi,
>
> I had the problem, that the state of the modifier keys was lost when
> a window is created (or raised).
>
> Example: in window A Ctrl + some key opens a window B, then in
> window B Ctrl + some other key triggers the next action. However
> after the opening of window B the Ctrl key has to be released and
> pressed again. If the user keeps the Ctrl key holding when the
> window B is opened, the next key press X will be interpreted as X
> and not as Ctrl+X.
>
> I send a patch to fix this problem with this email: I just extended
> the function winRestoreModeKeyStates in winkeybd.c to consider not
> only the mode switch key but also the modifiers Ctrl, Shift,
> Alt/AltGr by using the Windows function GetAsyncKeyState.
>
> This patch works fine for me.
>
> However one problem is unsolved: if the key combination for opening
> window B (in the above example) is an AltGr key combination, the
> GetAsyncKeyState will also report, that the Ctrl key is pressed,
> which is not true, since this is the well known Windows fake Ctrl_L
> :-(
>
> Any suggestions how to solve this?
At that time, doesn't GetAsyncKeyState (VK_RMENU) also return < 0?
So, shouldn't something along these lines do the trick:
BOOL ctrl = (GetAsyncKeyState (VK_CONTROL) < 0);
BOOL shift = (GetAsyncKeyState (VK_CONTROL) < 0);
BOOL alt = (GetAsyncKeyState (VK_CONTROL) < 0);
BOOL altlang = (GetAsyncKeyState (VK_CONTROL) < 0);
if (ctrl & altlang)
ctrl = FALSE;
if (WIN_XOR (internalKeyStates & ControlMask, ctrl)
winSendKeyEvent (KEY_LCtrl, ctrl);
if (WIN_XOR (internalKeyStates & ShiftMask, shift))
winSendKeyEvent (KEY_ShiftL, shift);
if (WIN_XOR (internalKeyStates & Mod1Mask, alt))
winSendKeyEvent (KEY_Alt, alt);
if (WIN_XOR (internalKeyStates & Mod5Mask, altlang))
winSendKeyEvent (KEY_AltLang, altlang);
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat
--
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/
next prev parent reply other threads:[~2011-08-21 8:44 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 [this message]
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
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=20110821084335.GA18237@calimero.vinschen.de \
--to=corinna-cygwin@cygwin.com \
--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).