Opened 12 years ago

Closed 12 years ago

Last modified 5 months ago

#8696 closed patch

EVENTS: Event Key Codes

Reported by: SF/mthreepwood Owned by: fingolfin
Priority: normal Component: Ports
Keywords: Cc:
Game:

Description

This patch adds a KeyCode enum (as discussed in -devel). It's *highly* based off of SDL_keysym.h. But, I didn't touch the ascii values yet. So, at the very least this is a start.

Also, I'm not sure if other backends will be broken as I have no way to test them. I had to change a few lines in sdl/events.cpp and default-events.cpp (just casting).

I did not change the engines to use this feature yet.

Ticket imported from: #1740493. Ticket imported from: patches/801.

Attachments (1)

Keycodes.diff (6.5 KB) - added by SF/mthreepwood 12 years ago.
Patch

Download all attachments as: .zip

Change History (5)

Changed 12 years ago by SF/mthreepwood

Attachment: Keycodes.diff added

Patch

comment:1 Changed 12 years ago by fingolfin

Owner: set to fingolfin

comment:2 Changed 12 years ago by fingolfin

Looks good. Although I'd prefer a KEYCODE / KEYSYM prefix for the enums, so I changed it accordingly.

It would be nice to also start a table with "ascii" enums. By all means, *not* a complete one, and don't change the type of the "ascii" field (it's fine as it is, and in most cases people are fine using constants like 'a' etc., too). The main use for these "ascii" enums would be to define some "extended" ascii values, namely, those for the F1-F9 keys (see SDL's event.cpp). Then modify mapKey to use those.

On the long run, we probably should get rid of these hacked pseudo-ascii codes for the F-keys, by changing code that relies on them to use the keycode instead. But for the time being we need them, I am afraid.

comment:3 Changed 12 years ago by fingolfin

Status: newclosed

comment:4 Changed 5 months ago by digitall

Component: Ports
Note: See TracTickets for help on using tickets.