From: Ofir Cohen <ofircohenn@gmail.com>
To: Hannes Domani <ssbssa@yahoo.de>
Cc: "gdb@sourceware.org" <gdb@sourceware.org>
Subject: Re: building gdb with TUI support on Windows
Date: Tue, 30 Dec 2014 20:10:00 -0000 [thread overview]
Message-ID: <CAHOBVAexTx8HHVR8rOTvCjTWt9za_USKBDw7WY-xgJNgVw0dfg@mail.gmail.com> (raw)
In-Reply-To: <2166009.2872410.1419966905934.JavaMail.yahoo@jws11122.mail.ir2.yahoo.com>
Hi Hannes,
Holy smokes, just tested and it works ;-)
Thanks a lot for sharing this useful patch.
Sorry for the ignorance, but what does this keypad mode mean and what
is its role?
Moreover, is this default behavior intended?
(as both PDCurses and true libncurses fail, each in its own (unique?) way).
Bonus question: in your opinion, is screen clear possible on Windows? (CTRL+L)
Thanks a lot again,
you've just made my debugging experience way more fun and productive!
- Ofir Cohen
On 30 December 2014 at 21:15, Hannes Domani <ssbssa@yahoo.de> wrote:
> Ofir Cohen <ofircohenn@gmail.com> schrieb am 16:28 Montag, 29.Dezember 2014:
>> Hi Hannes,
>> Thanks again for the reply =].
>>
>> > You are aware that with the arrow keys in TUI mode you move in the source
>> window, and not in the history?
>>
>> Yes, ofc, I'm therefore moving the window focus from source to the
>> interpreter's CLI window (Ctrl+x, o),
>> and only then issue the arrow up/down/left/right commands.
>> Unfortunately, it doesn't work, I have to get out of TUI mode (Ctrl+x,
>> a), to make the arrow keys respond.
>>
>> On Linux, when you do the above mentioned steps, it works flawlessly.
>>
>> A shallow investigation, debugging of gdb with gdb, showed that
>> wgetch() function (deep in the call-stack, invoked indirectly by
>> stdin_event_handler), is blocking and doesn't return when the
>> arrow-keys are issued.
>>
>> When gdb is not in TUI mode, however, getch() is called instead,
>> returns promptly and issues
>> the associated dispatch handler.
>
> I figured out the problem here.
> When the CLI get the focus, the keypad is disabled. This means wgetch()
> should return special keys as escape sequences (like getch() does), and not
> as a single value (e.g. KEY_LEFT).
> pdcurses instead ignores special keys completely if keypad is disabled.
>
> I've made the following changes to recreate this behavior for some keys:
>
> --- a/pdcurses/getch.c 2008-07-13 18:08:18.000000000 +0200
> +++ b/pdcurses/getch.c 2014-12-30 16:46:45.604498500 +0100
> @@ -2,6 +2,11 @@
>
> #include <curspriv.h>
>
> +#ifdef _WIN32
> +#include <windows.h>
> +extern HANDLE pdc_con_in;
> +#endif
> +
> RCSID("$Id: getch.c,v 1.72 2008/07/13 16:08:18 wmcbrine Exp $")
>
> /*man-start**************************************************************
> @@ -238,7 +243,55 @@
> /* filter special keys if not in keypad mode */
>
> if (!win->_use_keypad)
> + {
> +#ifdef _WIN32
> + char backhalf = 0;
> + switch (key)
> + {
> + case KEY_UP:
> + backhalf = 'H';
> + break;
> + case KEY_DOWN:
> + backhalf = 'P';
> + break;
> + case KEY_LEFT:
> + backhalf = 'K';
> + break;
> + case KEY_RIGHT:
> + backhalf = 'M';
> + break;
> + case KEY_HOME:
> + backhalf = 'G';
> + break;
> + case KEY_END:
> + backhalf = 'O';
> + break;
> + case KEY_DC:
> + backhalf = 'S';
> + break;
> + case KEY_IC:
> + backhalf = 'R';
> + break;
> + }
> + if (backhalf)
> + {
> + INPUT_RECORD ir;
> + ir.EventType = KEY_EVENT;
> + ir.Event.KeyEvent.bKeyDown = TRUE;
> + ir.Event.KeyEvent.dwControlKeyState = 0;
> + ir.Event.KeyEvent.uChar.UnicodeChar = backhalf;
> + ir.Event.KeyEvent.wRepeatCount = 1;
> + ir.Event.KeyEvent.wVirtualKeyCode = backhalf;
> + ir.Event.KeyEvent.wVirtualScanCode =
> + MapVirtualKey(backhalf, MAPVK_VK_TO_VSC);
> + DWORD written;
> + WriteConsoleInput(pdc_con_in, &ir, 1, &written);
> + return 0xe0;
> + }
> +#endif
> +
> key = -1;
> + }
>
> /* filter mouse events; translate mouse clicks in the slk
> area to function keys */
next prev parent reply other threads:[~2014-12-30 20:10 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-26 0:13 Ofir Cohen
2014-12-26 8:04 ` Eli Zaretskii
2014-12-27 13:53 ` Ofir Cohen
[not found] ` <CAHOBVAdux2M9aRnkJh1hDm_9VCTD6kVzWkF2fjj84qy8UJuh7w@mail.gmail.com>
2014-12-27 14:13 ` Eli Zaretskii
2014-12-27 14:40 ` Hannes Domani
2014-12-27 18:32 ` Eli Zaretskii
2014-12-28 13:58 ` Hannes Domani
2014-12-28 16:41 ` Ofir Cohen
2014-12-28 17:09 ` Hannes Domani
2014-12-28 23:34 ` Ofir Cohen
2014-12-29 0:41 ` Hannes Domani
2014-12-29 15:28 ` Ofir Cohen
[not found] ` <946370725.2390231.1419869855237.JavaMail.yahoo@jws11110.mail.ir2.yahoo.com>
2014-12-29 16:20 ` Hannes Domani
2014-12-30 19:15 ` Hannes Domani
2014-12-30 20:10 ` Ofir Cohen [this message]
2014-12-30 20:39 ` Hannes Domani
2014-12-31 16:34 ` Eli Zaretskii
2015-01-01 12:28 ` Hannes Domani
2015-01-01 15:42 ` Eli Zaretskii
2014-12-31 21:12 ` Ofir Cohen
2015-01-01 14:26 ` Hannes Domani
2015-01-01 15:14 ` Ofir Cohen
2015-01-01 15:47 ` Eli Zaretskii
2015-01-01 16:33 ` Ofir Cohen
2015-01-01 16:42 ` Eli Zaretskii
2015-01-01 16:48 ` Joel Sherrill
2015-01-01 17:18 ` Eli Zaretskii
[not found] ` <CAHOBVAcF824319G6O_LfJBYAQP3M0-LbhAV_d=SrR6jM4=0k5w@mail.gmail.com>
[not found] ` <83d26ybcap.fsf@gnu.org>
2015-01-02 0:32 ` Ofir Cohen
2014-12-28 18:38 ` Sergio Durigan Junior
2014-12-29 2:43 ` Joel Brobecker
2014-12-29 3:15 ` Joel Sherrill
2014-12-29 3:21 ` Joel Brobecker
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=CAHOBVAexTx8HHVR8rOTvCjTWt9za_USKBDw7WY-xgJNgVw0dfg@mail.gmail.com \
--to=ofircohenn@gmail.com \
--cc=gdb@sourceware.org \
--cc=ssbssa@yahoo.de \
/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