[OSX] OnChar repeat action not working for some keys? Topic is solved

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
jbattle
Knows some wx things
Knows some wx things
Posts: 31
Joined: Mon Oct 01, 2007 8:48 pm
Location: Austin, TX

[OSX] OnChar repeat action not working for some keys?

Post by jbattle » Sun Feb 03, 2019 7:25 am

In my application (an old computer emulator), holding down most keys results in a repeated OnChar event. That all works on wxwin, but on wxmac, only some keys repeat! I could understand of had some menu shortcut keys mapped or something, but that isn't the case.

I then ran the samples/keyboard application, without modification, and confirmed that some keys don't repeat the OnChar event (though I believe OnCharHook always repeats). The letter "A" can be ignore in that application because it is an accelerator key. These are the keys which repeat:

c e i l n o s u y z ~ - = (back) (tab) [ ] \ , . / (space) (left, right, up, down arrows)

None of the others do (I didn't test the numeric keypad).

Can anyone confirm that they see this too on wxmac, using the samples/keyboard.cpp demo app?

I'm running wx-3.1.2, on a mojove osx OS, on a mac mini, built using clang --version:
Apple LLVM version 10.0.0 (clang-1000.10.44.4)
Target: x86_64-apple-darwin18.2.0

Can anyone think of a reason this is happening?

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 3351
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: [OSX] OnChar repeat action not working for some keys?

Post by ONEEYEMAN » Tue Feb 05, 2019 4:02 pm

Hi,
You might have more responce if you send an e-mail to wx-users google groups ML.
If you do please include complete configure line and the OSX version you are testing on.

Also, I (personally) fiind it hard to believe that lower-case "c" can be repeated, while upper-case "C" can not.

Did you ret to trace the calls in both cases?

Thank you.

jbattle
Knows some wx things
Knows some wx things
Posts: 31
Joined: Mon Oct 01, 2007 8:48 pm
Location: Austin, TX

Re: [OSX] OnChar repeat action not working for some keys?

Post by jbattle » Tue Feb 05, 2019 7:21 pm

ONEYEEMAN,

My list of characters didn't mean to imply that none of the upper case characters came though. It was saying only those keys worked (eg, c and C both repeat, i and I, etc), I didn't see the point of listing both, but now I see it wasn't clear.

I'll try the other forum too.

Thanks

jbattle
Knows some wx things
Knows some wx things
Posts: 31
Joined: Mon Oct 01, 2007 8:48 pm
Location: Austin, TX

Re: [OSX] OnChar repeat action not working for some keys?

Post by jbattle » Wed Feb 06, 2019 7:22 am

I did post in the other forum, and ended up figuring out the problem after playing the samples/text application. Although I posted the answer there, I'm posting a short version of it here in case someone searches and finds this forum.

OS X has a feature where holding down a key with a long press will cause the OS to pop up a dialog showing alternative accented versions of that base letter. The user can then use a number or the mouse to select the alternative. This pop up happens only for keys which have alternatives, such as a, c, e, i, o, s, and a few others. My app doesn't get the pop up, but somehow this manifests as those chars get auto repeat, but the ones which don't have alternatives don't get auto-repeat.

Ideally, there would be some API to disable this feature for a given app, but if it exists I couldn't find it.

The unfortunate "solution" is to globally disable this feature. This is done by typing this command into a command line prompt:

defaults write -g ApplePressAndHoldEnabled -bool false

Post Reply