libcurses keycodes wrong?

Anything QL Software or Programming Related.
User avatar
XorA
Site Admin
Posts: 1633
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

libcurses keycodes wrong?

Post by XorA »

Another day another curses bug, the keyboards listed in curses.h seem to be wrong for at least backspace and cursor keys.

Here is the patch I plan to push to my repo unless someone screams its obviously wrong (and explains why).
Subject: [PATCH] INCLUDE_curses.h : correct keycodes

BACKSPACE
LEFT
RIGHT
UP
DOWN

all appear to be wrong in the file.

Signed-off-by: Graeme Gregory <graeme@xora.org.uk>
---
INCLUDE_curses.h | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/INCLUDE_curses.h b/INCLUDE_curses.h
index cf56f49..48262ce 100644
--- a/INCLUDE_curses.h
+++ b/INCLUDE_curses.h
@@ -80,12 +80,12 @@ typedef unsigned long chtype;
#define ACS_BLOCK (_acs_ch['0'])
#endif
#define KEY_BREAK 0401
-#define KEY_DOWN 0402
-#define KEY_UP 0403
-#define KEY_LEFT 0404
-#define KEY_RIGHT 0405
+#define KEY_DOWN 0330
+#define KEY_UP 0320
+#define KEY_LEFT 0300
+#define KEY_RIGHT 0310
#define KEY_HOME 0406
-#define KEY_BACKSPACE 0407
+#define KEY_BACKSPACE 0302
#define KEY_F0 0410
#define KEY_F(n) (KEY_F0+(n))
#define KEY_DL 0510
--
2.30.2


User avatar
NormanDunbar
Forum Moderator
Posts: 2477
Joined: Tue Dec 14, 2010 9:04 am
Location: Buckie, Scotland
Contact:

Re: libcurses keycodes wrong?

Post by NormanDunbar »

I might be wrong, it happens, but your 32 bytes might be the USB communications -- if your keyboard is or emulates USB of course.

Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
User avatar
XorA
Site Admin
Posts: 1633
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

Re: libcurses keycodes wrong?

Post by XorA »

I hate to put an end to another pointless discussion, but QL doesnt have USB or Wayland!


User avatar
Peter
Font of All Knowledge
Posts: 2434
Joined: Sat Jan 22, 2011 8:47 am

Re: libcurses keycodes wrong?

Post by Peter »

XorA wrote:Here is the patch I plan to push to my repo unless someone screams its obviously wrong (and explains why).
Thanks for spotting this. But how can the patch make it's way to where the C68 library is usually downloaded?


User avatar
NormanDunbar
Forum Moderator
Posts: 2477
Joined: Tue Dec 14, 2010 9:04 am
Location: Buckie, Scotland
Contact:

Re: libcurses keycodes wrong?

Post by NormanDunbar »

XorA wrote:I hate to put an end to another pointless discussion, but QL doesnt have USB or Wayland!
I knew that! :D Brane2 was talking about Linux, so I'm assuming he's using an emulator.

Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
User avatar
XorA
Site Admin
Posts: 1633
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

Re: libcurses keycodes wrong?

Post by XorA »

Peter wrote:
XorA wrote:Here is the patch I plan to push to my repo unless someone screams its obviously wrong (and explains why).
Thanks for spotting this. But how can the patch make it's way to where the C68 library is usually downloaded?
When I push it Ill prod Dilwyn and he will likely put it on his page in C68 section.


User avatar
XorA
Site Admin
Posts: 1633
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

Re: libcurses keycodes wrong?

Post by XorA »

XorA wrote:
Peter wrote:
XorA wrote:Here is the patch I plan to push to my repo unless someone screams its obviously wrong (and explains why).
Thanks for spotting this. But how can the patch make it's way to where the C68 library is usually downloaded?
When I push it Ill prod Dilwyn and he will likely put it on his page in C68 section.
the full file in QL compatible zip I mean!


User avatar
dilwyn
Mr QL
Posts: 3087
Joined: Wed Dec 01, 2010 10:39 pm

Re: libcurses keycodes wrong?

Post by dilwyn »

XorA wrote:
XorA wrote:
Peter wrote: Thanks for spotting this. But how can the patch make it's way to where the C68 library is usually downloaded?
When I push it Ill prod Dilwyn and he will likely put it on his page in C68 section.
the full file in QL compatible zip I mean!
Remember to "prod" me when it's ready, or I'll only forget :oops:


User avatar
Peter
Font of All Knowledge
Posts: 2434
Joined: Sat Jan 22, 2011 8:47 am

Re: libcurses keycodes wrong?

Post by Peter »

NormanDunbar wrote:I might be wrong, it happens, but your 32 bytes might be the USB communications -- if your keyboard is or emulates USB of course.
Sounds likely. USB keyboard report packets can be up to 8 bytes in size (containing up to 6 scancodes), but some implementations use only the first three or four bytes. In that case, modifier key status comes first, then a reseverd byte, then one or two scancodes. (Beware scancodes differ from PS/2 - otherwise a QL implementation for USB keyboards would be a little easier.)


User avatar
XorA
Site Admin
Posts: 1633
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

Re: libcurses keycodes wrong?

Post by XorA »

The codes do appear to be the same as the ones in Linux
#define KEY_DOWN 0402 /* down-arrow key */
#define KEY_UP 0403 /* up-arrow key */
#define KEY_LEFT 0404 /* left-arrow key */
#define KEY_RIGHT 0405 /* right-arrow key */
#define KEY_HOME 0406 /* home key */
#define KEY_BACKSPACE 0407 /* backspace key */
So I am assuming the include file is a direct copy of unix version and not been adapted for QL


Post Reply