Commit Graph

64 Commits

Author SHA1 Message Date
Eric Wasylishen f607f1b4eb in_sdl: change DBEUG_INPUT preprocessor check to an "in_debugkeys" cvar to make it easier to debug unusual keyboards
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1114 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-10-14 18:31:49 +00:00
Sander van Dijk 13cfd00787 input: Remove some of stuff obsoleted by r1110.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1112 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-10-14 17:10:34 +00:00
Eric Wasylishen 3cb6f871f1 in_sdl.c: make key debug logging more verbose
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1111 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-10-14 04:03:16 +00:00
Eric Wasylishen 1b6abd0e04 in_sdl.c, key.c: Fixes agreed on with Sander:
1. Remove Key_IgnoreTextInput(), and simple always send a Char_Event when
we receive TEXTINPUT (SDL2) or the unicode field of a KEYDOWN event is
filled (SDL1.).
2. Remove handling of K_KP_* in the menu/console, since they cannot be
relied on to not also send text (see issue described above). The handling
of K_KP_ENTER can stay, since we do know that it never sends text.
3. Remove the interpretation hack for the numpad, since it will no longer
be needed (and doesn't currently work for SDL2 anyway); if a numpad key
generates text we will handle it (because of "1"), if not then it will
simply be if ignored (because of "2”).

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1110 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-10-14 03:30:44 +00:00
Eric Wasylishen aeb4ed86d2 in_sdl: remove lastKeyDown hack
was no longer needed and was causing issues typing underscores (US keyboard layout) on Linux/SDL2 where SDL_TEXTINPUT is delivered before the SDL_KEYDOWN.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1109 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-10-13 03:21:47 +00:00
Eric Wasylishen bd07399747 in_sdl: add some debug logging for key events (only if DEBUG_INPUT is defined)
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1108 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-10-13 03:21:40 +00:00
Ozkan Sezer 039fdaad6f minor whitespace adjustments
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1101 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-10-11 19:11:40 +00:00
Sander van Dijk 1440636ec6 input: Move fullscreen and console toggle from in_sdl.c to keys.c.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1096 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-10-11 08:49:45 +00:00
Sander van Dijk 42c708a1e1 in_sdl.c: rewrite TEXTINPUT handling a bit again.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1094 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-10-08 20:03:05 +00:00
Sander van Dijk db68976877 in_sdl: Remove commented-out m_filter code and a misleading comment.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1093 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-10-08 18:57:55 +00:00
Sander van Dijk c23a0197d6 Rename some (recently added) functions.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1092 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-10-08 18:30:17 +00:00
Sander van Dijk 5e73eb18a4 in_sdl.c: Workaround for broken SDL2 numlock state.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1091 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-10-07 06:15:16 +00:00
Sander van Dijk eaa33b20b6 in_sdl.c: Fix numpad translation with SDL 1.2.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1090 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-10-06 20:47:35 +00:00
Sander van Dijk 745c643ef2 input: Some more tuning.
* in_sdl.c: Remove the over-zealous "no events for unknown keys" checks introduced in r1085. Events for unknown keys can be useful for "press any key" situations.
* keys.c: In input grab mode, update the "lastkey" member only for key down events.
* keys.c/console.c: Adapt input grab mode to properly support catching "any key" presses.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1089 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-10-06 06:09:42 +00:00
Sander van Dijk 045cf968de in_sdl.c: Inline IN_IsNumpadKey().
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1088 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-10-05 21:02:25 +00:00
Sander van Dijk 5ca58d55b0 input: Minor tuning.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1086 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-10-05 19:03:48 +00:00
Sander van Dijk 14f5275a2c input: Implement numpad translation in text input mode.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1085 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-10-05 18:21:58 +00:00
Sander van Dijk e4575839a9 input: Fix SDL2 mouse wheel up/down behaviour.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1081 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-10-05 15:25:31 +00:00
Sander van Dijk 856f94fac8 input: Some text input restructuring in preparation of numpad translation support.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1075 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-30 19:29:58 +00:00
Sander van Dijk cebef615e5 input: Rework the text/non-text input mode handling.
Before, "gamekey" was the special case, now "textmode" is. We are now more precise about when we activate "textmode", e.g. we only do this when the console, messagemode, or a textfield in the menu are active. The trigger for doing this was this line on the "SDL_StartTextInput" page of the SDL2 wiki: "On some platforms using this function activates the screen keyboard.". Although we currenly support no such platform, it's good te be prepared, and what we do now is more correct anyway.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1066 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-23 19:10:02 +00:00
Sander van Dijk 46e003557a in_sdl.c: rewrite TEXTINPUT handling a bit.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1063 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-23 02:15:46 +00:00
Ozkan Sezer b9032b7815 copyright years, general tidy-up, remove unused d_ifacea.h.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1059 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-22 08:55:46 +00:00
Eric Wasylishen 3be35611b5 Correct the buttonremap table for SDL2 so K_MOUSE4/K_MOUSE5 work.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1056 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-22 03:32:19 +00:00
Sander van Dijk 5989e7136d Minor cleanups.
in_keys.c: Key_ConsoleBindable: remove redundant check, this is now handled by Key_KeynumToString/Key_StringToKeynum.
in_sdl.c: IN_SendKeyEvents: use a single method for checking whether we have a keydown or keyup event.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1047 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-21 02:10:14 +00:00
Sander van Dijk c21ea8687e in_sdl.c: Restructure the SDL1 backend a bit.
Tested on Linux and Windows with various keyboard layouts. This fixes some text input weirdness on Windows.

Before, we always used the "unicode" field (if available) of SDL's keydown events to overrule the "sym" field with which Key_Event() is called. However, the "unicode" field is only filled for keydown events, so this meant that our keyup events didn't always match their corresponding keydown events. With the introduction of Char_Event(), we can now use the "unicode" field for textinput only, and call Key_Event() with the non-overruled "sym" field. This has the benefit that keyup events now match keydown events, and that we can get rid of several ugly hacks (some platform specific ifdef's and some control character handling).

Note: the translation of the numpad keys to other keys when not in "gamekey" mode was dropped, because otherwise a numpad key could trigger (for intstance) both a textinput and a cursor movement in the console. This is arguably cleaner anyway.



git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1042 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-20 22:41:44 +00:00
Sander van Dijk 8ad4f6b437 in_sdl.c: SDL2: skip over UTF-8 multibyte characters.
Before, we stopped processing at the first byte of a multibyte character, now we skip over the bytes of a multibyte character and continue. This will probably not have a noticeable effect, but it's arguably more correct.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1040 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-20 17:46:23 +00:00
Sander van Dijk d690b1e38a input: Add a function Key_GameKey to separate the input driver layer a bit more.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1029 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-13 09:39:51 +00:00
Sander van Dijk bd58d1c1b8 input: Some more console-toggle-key tuning.
Partial revert of r1024, since the lastKeyDown stuff is actually needed for SDL2 when the keyboard layout has a printable character that isn't '`' or '~' on the default console-toggle-key (the one below 'Esc'). Instead of hardcoding it though, it is now determined by a new Key_ConsoleBindable function. This makes sure that we don't write an unwanted character into the console as a side effect of opening/closing it, but it still does allow the user to type '`' and '~' in chat messages.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1027 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-13 07:53:31 +00:00
Sander van Dijk d687676d5a input: Some cleanup regarding the special treatment of '`' and '~' in the console.
This was hardcoded in in_sdl.c, now it is handled by Char_Console() itself, like it is in Key_Event().


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1024 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-13 01:34:02 +00:00
Sander van Dijk 3b539b156c in_sdl: SDL1: don't send '`' or '~' to the console.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1023 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-12 21:01:28 +00:00
Sander van Dijk da5ee0c612 input: remove the USE_SDL2 check from keys.c.
Instead, make the backend responsible for calling either or both
of Key_Event and Char_Event under the appropriate circumstances.
For SDL2 this means no change, for SDL1 this means call both when
a key is pressed, but call only Key_Event when a key is released.



git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1022 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-12 20:37:05 +00:00
Eric Wasylishen f44d44d419 Revamp SDL2 key handling, based on how ioquake3 does it.
- Reverted the addition of the interpret_shift param to Key_Event
- Now, SDL_KEYUP/SDL_KEYDOWN are converted from SDL scancodes to quake keys, and passed directly to Key_Event with no extra conditions / logic
- When SDL2 is used, Key_Console/Key_Message no longer convert keys to characters to insert in the typing buffer, but all other functionality is unchanged
- SDL_TEXTINPUT calls a new function, Char_Event. This calls either Char_Console/Char_Message depending on the keydest. These just insert the typed text into the buffer

This is cleaner than before because it maintains a clear separation between key presses and characters, whereas the old code was converting characters from SDL_TEXTINPUT back into fake keys and then feeding those into Key_Event. This also fixes Ctrl+C / Ctrl+V not working in the console

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1020 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-12 04:27:54 +00:00
Sander van Dijk dc4799f48a in_sdl.c: Rename the mouse filter functions for consistency.
Also surround the SDL version by "#if defined(USE_SDL2)" and "#endif", this
suppresses an unused function warning when building for SDL1. (Building for
SDL2 still gives an unused variable "modstate" warning though.)


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1002 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-08 20:29:16 +00:00
Eric Wasylishen 24f4a2dab4 SDL2 support, if USE_SDL2 defined.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@987 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-05 19:34:43 +00:00
Steven d0cef2769f Enable wheel mouse in console (used to scroll up and down).
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@884 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-01-04 07:18:43 +00:00
Ozkan Sezer 9ea0212280 updated arch_def.h and net_sys.h from uhexen2. adjusted users accordingly.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@793 af15c1b1-3010-417e-b628-4374ebc0bcbd
2013-01-07 17:30:17 +00:00
Ozkan Sezer 9f8b2dfc0d added IN_UpdateForKeydest() as a new helper who does stuff if the
key_dest changes matter to the keyboard driver, e.g. sending KP_
key decisions, or SDL unicode stuff. we run it every frame either
before Sys_SendKeyEvents() or from within Key_ForceDest() for now.
(merged from uhexen2.)

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@773 af15c1b1-3010-417e-b628-4374ebc0bcbd
2012-10-21 11:33:10 +00:00
Sander van Dijk d27dcc2bf8 some more minor changes to accomodate r761
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@763 af15c1b1-3010-417e-b628-4374ebc0bcbd
2012-10-07 12:46:57 +00:00
Sander van Dijk 95d20d835f revert (most of) r521, r756 and r759. Alter "gamekey" handling a bit to compensate.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@761 af15c1b1-3010-417e-b628-4374ebc0bcbd
2012-10-06 18:09:23 +00:00
Ozkan Sezer 408c366096 in_sdl.c (IN_SendKeyEvents): fixed major thinko in SDLK_WORLD_xx
change from yesterday's r746.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@748 af15c1b1-3010-417e-b628-4374ebc0bcbd
2012-09-29 14:50:54 +00:00
Ozkan Sezer 285cb42cc3 * keys.c: added K_COMMAND as a new key. added Cmd+V as a Mac special
case for paste request.
* keys.h: added K_COMMAND as a new key (170 for now).
* in_sdl.c (IN_SendKeyEvents): translate SDLK_LMETA/SDLK_RMETA as
  K_COMMAND. ignore unhandled SDLK_WORLD_* international characters.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@746 af15c1b1-3010-417e-b628-4374ebc0bcbd
2012-09-28 21:41:31 +00:00
Ozkan Sezer 5c7187f96d finetuning of r736 & 738
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@740 af15c1b1-3010-417e-b628-4374ebc0bcbd
2012-09-27 12:55:03 +00:00
Sander van Dijk 65d2186fb8 Some finetuning of r736.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@738 af15c1b1-3010-417e-b628-4374ebc0bcbd
2012-09-27 12:19:19 +00:00
Sander van Dijk c745a202af in_sdl.c: Fix control-character handling.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@736 af15c1b1-3010-417e-b628-4374ebc0bcbd
2012-09-27 10:41:07 +00:00
Ozkan Sezer 50e014d050 Updated support for building the OSX versions using Makefile.darwin. Do
not rely on sdl-config on OSX Framework builds, define new SDL_FRAMEWORK
and NO_SDL_CONFIG preprocessor macros to indicate that and include SDL.h
with the "SDL" subdirectory name included. Add new libmad and ogg/vorbis
headers and static and dynamic libraries for macosx. Xcode project files
need further updating.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@699 af15c1b1-3010-417e-b628-4374ebc0bcbd
2012-08-16 04:51:41 +00:00
Ozkan Sezer 5a2a7d96a7 * keys.h: renamed KP_* key macros to K_KP_*.
* key.c (Key_ClearStates): Instead of clearing all key's down state
  and repeat count, run KeyEvent(k,false) keys in down state, which
  will already clear those states for them. This also helps getting
  rid of several actions bound to keypad keys. Minor cleanups.
* gl_vidsdl.c (ClearAllStates): Removed code triggering every key
  with a release event, because we just changed Key_ClearStates() to
  do that for the necessary keys.
* in_sdl.c: Minor cleanups. Made K_KP_5 to send '5' when not in game
  mode, regardless of the numlock status. Moved prev_gamekey to top
  level and call SDL_EnableUNICODE() correctly.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@686 af15c1b1-3010-417e-b628-4374ebc0bcbd
2012-06-25 11:20:38 +00:00
Sander van Dijk ae26d97744 in_sdl.c: Add missing KP_NUMLOCK key event.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@685 af15c1b1-3010-417e-b628-4374ebc0bcbd
2012-06-10 06:09:50 +00:00
Sander van Dijk 5a98449c03 Small update to r683.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@684 af15c1b1-3010-417e-b628-4374ebc0bcbd
2012-06-08 20:06:40 +00:00
Sander van Dijk 13b3ce9f25 Re-introduce KP_* syms, but only "in-game".
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@683 af15c1b1-3010-417e-b628-4374ebc0bcbd
2012-06-08 19:27:12 +00:00
Sander van Dijk f35069fd1e in_sdl.c: invert the behaviour of numlock (numbers when on, not when off)
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@659 af15c1b1-3010-417e-b628-4374ebc0bcbd
2012-04-20 20:23:55 +00:00