public inbox for cygwin-xfree@sourceware.org
help / color / mirror / Atom feed
From: Mark Lillibridge <mark.lillibridge@hp.com>
To: dennis.comeaux@gmail.com
Cc: cygwin-xfree@cygwin.com
Subject: Re: bug report/suggested temp. patch: handling bursts of sent keys
Date: Sat, 23 Jan 2010 22:02:00 -0000 [thread overview]
Message-ID: <201001232202.o0NM2HAl027114@mailhub-pa1.hpl.hp.com> (raw)
In-Reply-To: <6b9bc6ee1001230517v73231f5cma1503fa473a5d11c@mail.gmail.com> (message from Dennis Comeaux on Sat, 23 Jan 2010 08:17:13 -0500)
Dennis wrote:
> Hi Mark.
>
> I am a bit new to this list, but not THAT new to programming. If you don't
> know how many keystrokes you need to have a buffer for, then you have 2
> choices:
>
> 1. Have a ridiculously huge buffer.
> 2. Setup a dynamic array.
>
> Using a 25000 character buffer seems like overkill. But mieq.c is probably
> reading just from the Operating Systems' keyboard buffer.
>
> You may need to write an input function to feed mieq.c and somehow link to
> it. Sadly, that level of coding is beyond my abilities.
Option 1 would be a temporary patch. Browsing through the source
code, keypresses/releases come one at a time in via window messages to
the following routine in hw/xwin/winwndproc.c:
/*
* Called by winWakeupHandler
* Processes current Windows message
*/
LRESULT CALLBACK
winWindowProc (HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam)
{
...
case WM_SYSKEYDOWN:
case WM_KEYDOWN:
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
break;
...
/* Translate Windows key code to X scan code */
winTranslateKey (wParam, lParam, &iScanCode);
/* Ignore repeats for CapsLock */
if (wParam == VK_CAPITAL)
lParam = 1;
/* Send the key event(s) */
for (i = 0; i < LOWORD(lParam); ++i)
winSendKeyEvent (iScanCode, TRUE);
return 0;
winSendKeyEvent in turn lives in hw/xwin/winkeybd.c:
/*
* Take a raw X key code and send an up or down event for it.
*
* Thanks to VNC for inspiration, though it is a simple function.
*/
void
winSendKeyEvent (DWORD dwKey, Bool fDown)
{
EventListPtr events;
int i, nevents;
/*
* When alt-tabing between screens we can get phantom key up messages
* Here we only pass them through it we think we should!
*/
if (g_winKeyState[dwKey] == FALSE && fDown == FALSE) return;
/* Update the keyState map */
g_winKeyState[dwKey] = fDown;
GetEventList(&events);
nevents = GetKeyboardEvents(events, g_pwinKeyboard, fDown ? KeyPress : KeyRele
ase, dwKey + MIN_KEYCODE);
for (i = 0; i < nevents; i++)
mieqEnqueue(g_pwinKeyboard, events[i].event);
#if CYGDEBUG
ErrorF("winSendKeyEvent: dwKey: %d, fDown: %d, nEvents %d\n",
dwKey, fDown, nevents);
#endif
}
Note the call to mieqEnqueue there.
I am not a Windows programmer. Can someone tell me if it's okay for
winWindowProc to block? In particular, could we make it block until the
mieq queue is not full?
- Mark
--
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:[~2010-01-23 22:02 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <201001102040.o0AKenLB010951@mailhub-pa1.hpl.hp.com>
2010-01-19 18:18 ` Mark Lillibridge
2010-01-19 20:16 ` Larry Hall (Cygwin X)
[not found] ` <6b9bc6ee1001230517v73231f5cma1503fa473a5d11c@mail.gmail.com>
2010-01-23 22:02 ` Mark Lillibridge [this message]
2010-01-31 23:34 ` Mark Lillibridge
2010-02-01 3:50 ` Bengt-Arne Fjellner
2010-02-08 15:53 ` Jon TURNEY
2010-02-13 20:24 ` Mark Lillibridge
2010-02-23 17:05 ` Jon TURNEY
2010-03-20 16:32 ` Mark Lillibridge
2010-03-29 18:40 ` Jon TURNEY
2010-04-12 23:52 ` Mark Lillibridge
2010-04-13 14:14 ` Jon TURNEY
2010-04-18 19:46 ` Mark Lillibridge
2010-04-19 17:33 ` Jon TURNEY
2010-01-22 19:23 Mark Lillibridge
-- strict thread matches above, loose matches on Subject: below --
2010-01-12 18:45 Mark Lillibridge
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=201001232202.o0NM2HAl027114@mailhub-pa1.hpl.hp.com \
--to=mark.lillibridge@hp.com \
--cc=cygwin-xfree@cygwin.com \
--cc=dennis.comeaux@gmail.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).