Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Remove code that forces lowercase text in console #6

Closed
wants to merge 2 commits into from

Conversation

adonaldson
Copy link
Contributor

I was experiencing a strange issue in OSX ezQuake, where I wasn't able to SHOUT AT PEOPLE INGAME. IT WAS REALLY STRANGE.

I had a wee dig about in the code and found this line. From the looks of it it's deliberately converting the text to lowercase, but I can't see why.

Anyway, this works for me and I can't figure out any fallout, so I thought I'd share.

(Background: http://www.quakeworld.nu/forum/viewtopic.php?id=5569)

@tonegz
Copy link

tonegz commented Dec 14, 2011

Apparently someone discovered that their binds break if capslock gets
pressed accidentally, so they decided to force lowercase everything.
Your patch will let you type uppercase letters, but what about binds
when capslock is on?

A better way to fix this should be to use Key_EventEx instead of
Key_Event and pass the keycode (lowercased) as first parameter and the
character (non-lowercased) as second.

Tonik.

On 12/14/2011 11:36 PM, Andrew Donaldson wrote:

I was experiencing a strange issue in OSX ezQuake, where I wasn't able to SHOUT AT PEOPLE INGAME. IT WAS REALLY STRANGE.

I had a wee dig about in the code and found this line. From the looks of it it's deliberately converting the text to lowercase, but I can't see why.

Anyway, this works for me and I can't figure out any fallout, so I thought I'd share.

(Background: http://www.quakeworld.nu/forum/viewtopic.php?id=5569)

You can merge this Pull Request by running:

git pull https://github.com/dies-el/ezquake-source osx_uppercase_bug

Or you can view, comment on it, or merge it online at:

#6

-- Commit Summary --

  • fix: Remove code that forces lowercase text in console

-- File Changes --

M osx/sys_osx.m (13)

-- Patch Links --

https://github.com/ezQuake/ezquake-source/pull/6.patch
https://github.com/ezQuake/ezquake-source/pull/6.diff


Reply to this email directly or view it on GitHub:
#6

@fzwoch
Copy link
Contributor

fzwoch commented Dec 14, 2011

Apparently there seems to be a difference in behavior whether the symbol WITH_KEYMAP is defined or not. At least in Key_Event() there is difference how Key_EventEx() is called from there.

I have no idea what would be the correct thing to do here on osx. Do we support keymap? It is defined by default on osx. Maybe things magically will work when you undefine it. Probably the WITH_KEYMAP feature should be fixed? :-)

@tonegz
Copy link

tonegz commented Dec 14, 2011

On Windows at least, WITH_KEYMAP is a legacy of the times when we didn't
understand how to handle textual keyboard input properly. We'd get a
key code from the OS and turn it into a character using a hard-wired
table, or -- heres's what WITH_KEYMAP does -- one loaded from a file, so
in theory you can make your own keyboard layout, completely independent
from the one your OS uses. To be honest this is vastly overkill for a
game engine where you're supposed to be running around fragging people.

The one correct solution, and I hope it's currently the default one in
ezQuake, is to use a hardwired "US" layout for ingame bindings, but get
Unicode characters from the OS when the user types text in the console.
For instance, if you have "bind w +forward" in your config, pressing the
second key to the right of TAB will always make you run forward in game,
no matter where on Earth you are, but when typing in the console, that
very key may produce a z or Z if you use the French AZERTY keyboard.

To my knowledge, this philosophy only really works in Windows right
now. If you think you can achieve the same in the Mac port, godspeed to
you. And don't worry about loadable layouts.

Tonik.

On 12/15/2011 01:13 AM, Florian Zwoch wrote:

Apparently there seems to be a difference in behavior whether the symbol WITH_KEYMAP is defined or not. At least in Key_Event() there is difference how Key_EventEx() is called from there.

I have no idea what would be the correct thing to do here on osx. Do we support keymap? It is defined by default on osx. Maybe things magically will work when you undefined it. Probably the WITH_KEMAP feature should be fixed? :-)


Reply to this email directly or view it on GitHub:
#6 (comment)

@adonaldson
Copy link
Contributor Author

This change allows the user to type LOUDLY and still trigger binds. I'm not sure of the performance impact of having a conditional here, or using tolower().

@fzwoch
Copy link
Contributor

fzwoch commented Dec 15, 2011

Does it make more sense to just:

#ifndef WITH_KEYMAP
if (myCharacter >= 'A' && myCharacter <= 'Z')
myCharacter += 'a' - 'A';
#endif

And remove WITH_KEYMAP from the preprocessor defines? Maybe #ifdef instead of #ifndef - I lost track of it which is recommended. But hopefully you get the idea..

@adonaldson
Copy link
Contributor Author

I'll have another look at this.

(Note to self: https://github.com/ezQuake/ezquake-source/blob/master/keys.c#L2358-2368 )

@fzwoch
Copy link
Contributor

fzwoch commented Dec 15, 2011

I have simply removed the WITH_KEYMAP preprocessor define and it seems to restore the availability to write upper case letters.. please try and report.

@adonaldson
Copy link
Contributor Author

Cool. I'll give this a bash later. I would have done this myself but I wasn't sure of the function of WITH_KEYMAP on OSX (despite the thorough explanation above).

@adonaldson
Copy link
Contributor Author

Works for me. When will the next OSX release be?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants