[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Alt+Key, Panels and Mouse events
From: |
Thomas Dickey |
Subject: |
Re: Alt+Key, Panels and Mouse events |
Date: |
Thu, 3 Aug 2006 19:24:15 -0400 (EDT) |
On Wed, 2 Aug 2006, Sadrul H Chowdhury wrote:
Hi.
(1) I am trying to have shortcut keys like Alt+n, Alt+p etc. to trigger some
events in my application. However, it seems the keys produce different codes
in different terminals. For example, these are the codes I get:
Key Xterm mrxvt/urxvt
Alt+a 195 161 27 97
Alt+b 195 162 27 98
Alt+c 195 163 27 99
looks as if xterm is running in UTF-8 mode. There are a large number of
possibilities for xterm's keyboard settings. It can also generate the
codes you've listed for rxvt, for instance.
What would be the best way to handle the keystrokes for all terminals? (The
program I used is given at the end)
It depends on what you're trying to do. Unless you specify the terminal
configuration, all you can count on is ASCII text and possibly some
function keys.
(2) I have several WINDOWs on screen, each on its own PANEL. I want to dump
the contents of the screen in text/HTML format on some event. Is there a way
I can get the contents of (row, column) without knowing what window/panel is
being displayed at that position? I am aware of inch-family of functions.
But they ask for a WINDOW, and I am not sure which WINDOW is on top at that
moment at that position.
your application has to keep track of that.
(3) To deal with mouse-events, when I click on a position, is there any way
to know which PANEL/WINDOW is being shown at that position? This would solve
(2) I think.
no - again, your application has to keep track of the window that
corresponds to a given location.
Thanks.
Sadrul
/*** CODE ***/
#include <ncurses.h>
int main()
{
int key;
initscr();
noecho();
while ((key = getch()))
{
printf("%d ", key);
refresh();
}
endwin();
return 0;
}
/*** CODE END ***/
--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net