Commit graph

81 commits

Author SHA1 Message Date
Sander van Dijk
0c28e5a03e keys.c: Allow SetBinding() to really clear a key, instead of binding it to the empty string.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1087 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-10-05 20:48:27 +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
4b011d6285 input: Remove unneeded key_repeats array, some input grab tuning.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1083 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-10-05 16:35:59 +00:00
Sander van Dijk
2c177df399 input: Minor addition to r1077.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1079 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-10-02 19:34:33 +00:00
Sander van Dijk
1ab2cbde9b input: Support for "plain" numpad keys in the menu/console (still todo: numpad translation).
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1078 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-10-02 19:21:52 +00:00
Sander van Dijk
8d0cb0086a input: More text input restructuring.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1077 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-10-02 19:00:42 +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
ad7ac7caf6 Revert r1073.
I read that comment as "bindings for these keys won't execute when in the menu", but it should be read as "no new bindings can be made for these keys through the bindings sub-menu", which is actually correct.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1074 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-30 06:18:31 +00:00
Sander van Dijk
ddf7f188d1 keys.c: Correct a typo in a comment.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1073 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-29 18:33:20 +00:00
Sander van Dijk
f30f590ec7 keys.c: Remove shift interpretation.
This never really belonged in keys.c (should have been handled in the backend instead), but now that we have separated Key_Event()/Char_Event() this no longer serves any purpose at all.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1072 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-29 18:31:41 +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
c8da3f1f61 Rename some functions for consistency.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1064 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-23 02:19:57 +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
Ozkan Sezer
c80fbd9629 allow KP_ENTER to function as K_ENTER in menus, console, etc., after r1042.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1058 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-22 06:21:06 +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
f7276bc483 keys.c: Key_ConsoleBindable: add a better check for "general bindability".
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1046 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-21 01:59:36 +00:00
Sander van Dijk
362deedf20 keys.c: Key_ConsoleBindable: special-case key 0, since it essentially means "no key".
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1044 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-20 23:04:41 +00:00
Sander van Dijk
3be5b16965 keys.c Key_ConsoleBindable(): add sanity check
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1043 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-20 22:45:52 +00:00
Sander van Dijk
b5628dbe2f keys.c Key_Event(): add sanity check
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1038 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-20 14:27:32 +00:00
Sander van Dijk
a21d18a4ec menu: Add Char_Event support for the textfields in the menu.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1030 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-13 16:13:16 +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
1c9666f049 keys.c: Simplify Key_ConsoleBindable.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1028 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-13 08:06:04 +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
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
Sander van Dijk
1e522abb2d keys.c: K_BACKSPACE (127) is a non printable character.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1021 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-12 20:23:20 +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
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
5e4849c61f replace all ctype.h functions/macros and strcasecmp/strncasecmp()
by locale-insensitive versions, new header q_ctype.h.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@868 af15c1b1-3010-417e-b628-4374ebc0bcbd
2013-09-25 17:01:40 +00:00
Ozkan Sezer
e0f9f533f3 keys.c (Key_Message): move backspace handling before non-printable
check. (the functionality doesn't change. from tyrquake git repo.)
minor tidy-up.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@843 af15c1b1-3010-417e-b628-4374ebc0bcbd
2013-04-02 21:40:48 +00:00
Sander van Dijk
13b0df70d4 keys.c: comment correction
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@837 af15c1b1-3010-417e-b628-4374ebc0bcbd
2013-03-02 18:21:28 +00:00
Sander van Dijk
64f3091f05 rename the modestate_t enum items
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@805 af15c1b1-3010-417e-b628-4374ebc0bcbd
2013-02-13 19:07:19 +00:00
Sander van Dijk
103f041614 remove "type" from "viddef_t", use "modestate" instead
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@804 af15c1b1-3010-417e-b628-4374ebc0bcbd
2013-02-13 19:01:26 +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
cf30d683d0 renamed Key_ForceDest to Key_UpdateForDest. added M_Menu_Main_f()
prototype to menu.h. minor tidy-ups.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@775 af15c1b1-3010-417e-b628-4374ebc0bcbd
2012-10-23 08:44:20 +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
Ozkan Sezer
9a78c9e829 some merges from uhexen2: clean up some crap in long chat line support.
do not set messagemode when not really connected. made chat_buffer[] and
chat_bufferlen static to keys.c. console.c uses new Key_GetChatBuffer()
and Key_GetChatMsgLen() accessor functions. renamed team_message global
to chat_team as in qw/q2. added Key_EndChat() as a new helper. called
Key_EndChat() from within CL_Disconnect() to not get stuck in chat mode.
now that key_message is guaranteed to be set only in game mode, removed
its cases from Key_ForceDest(). several other cleanups.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@771 af15c1b1-3010-417e-b628-4374ebc0bcbd
2012-10-21 09:55:16 +00:00
Sander van Dijk
73aee2dd56 Another approach to fixing mouse grab/key_dest
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@770 af15c1b1-3010-417e-b628-4374ebc0bcbd
2012-10-15 19:53:07 +00:00
Ozkan Sezer
0d53e0f959 moved cfg_unbindall and its registration to cl_main.c. moved the
config.cfg write of unbindall to Key_WriteBindings().

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@768 af15c1b1-3010-417e-b628-4374ebc0bcbd
2012-10-12 07:33:11 +00:00
Ozkan Sezer
d972015b80 removed unnecessary m_keys_bind_grab check from autorepeats.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@764 af15c1b1-3010-417e-b628-4374ebc0bcbd
2012-10-07 13:15:15 +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
3be0ae496c gl_vidsdl.c: minor improvement to bpp list creation
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@752 af15c1b1-3010-417e-b628-4374ebc0bcbd
2012-09-30 21:11:39 +00:00
Ozkan Sezer
53c55f6bd3 further Key_Console() cleanup. made Shift-Ins to paste text like Ctrl-v.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@750 af15c1b1-3010-417e-b628-4374ebc0bcbd
2012-09-30 12:55:09 +00:00
Sander van Dijk
f2a2cd3fcf Style
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@749 af15c1b1-3010-417e-b628-4374ebc0bcbd
2012-09-30 08:23:00 +00:00
Ozkan Sezer
a3f4bdbbab include arch_def.h in keys.c
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@747 af15c1b1-3010-417e-b628-4374ebc0bcbd
2012-09-28 22:24:27 +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
ddfc90fd36 moved clipboard pasting code into new PasteToConsole() helper procedure
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@744 af15c1b1-3010-417e-b628-4374ebc0bcbd
2012-09-27 14:00:12 +00:00
Ozkan Sezer
6254e22a29 keys.c (Key_Console): several cleanups from uhexen2. replaced in-place
strcpy() calls by proper memmove() calls. activated (and fixed) Ctrl-V
text pasting support from OS clipboard (only works on windows for now.)

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@742 af15c1b1-3010-417e-b628-4374ebc0bcbd
2012-09-27 13:11:36 +00:00
Sander van Dijk
ba5856c2fb keys.c: don't be case-sensitive about ctrl-c
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@739 af15c1b1-3010-417e-b628-4374ebc0bcbd
2012-09-27 12:22:51 +00:00