stweil / OSXvnc

VNC Server for macOS
GNU General Public License v3.0
198 stars 64 forks source link

Keyboard does not work if run at Login Screen #38

Closed romanprocopie closed 4 years ago

romanprocopie commented 5 years ago

I am running OSXVnc at login screen with the help of a launchd plist file. It is loaded as follows The mouse works fine, however when I press a key, it will be ignore and the following message apears in the OSXVNC log file

2019-07-03 16:45:04.175 OSXvnc-server[338:3465] pid(338)/euid(0) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!

stweil commented 5 years ago

Thank you for reporting this problem. I will have a look on this as soon as my free time permits, but cannot promis a quick solution. If anybody else has a working fix, a pull request would be welcome.

romanprocopie commented 5 years ago

Seems to happen during an Aqua session too, only selected keys are pressed, like Enter and Space, just fyi

stweil commented 5 years ago

Some hints for debugging this: https://indiestack.com/2018/08/let-it-rip/.

romanprocopie commented 4 years ago

aye, got to that too. So it writes that message anyway, regardless of which session it is run. I was able to trace it down to the fact that during the LoginScreen session the vncSourceRef is null, so CGEventCreateKeyboardEvent gets the source as null.

That is set in VNCServer.rfbRunning, trying to make sense out of that method, but not quite there yet.

After that it logs "No Event Source -- Using 10.3 API"

Just tested it on 10.13 thinking it might be a Mojave problem, but same thing

romanprocopie commented 4 years ago

Hi

I seem to have got a solution for this. It is the same symptoms as described in issue #1. I have been able to sort it by changing the XCode project to include the linker flags that make CGEventPost work when run in a LoginWindow context. This is suggested in a stackoverflow post mentioned in the issue #1 chat.

I cannot seem to be able to push my own branch to create a pull request, what's the best way to proceed here ?

romanprocopie commented 4 years ago

PR done from a fork

stweil commented 4 years ago

I merged your pull request #39, so hopefully this issue is fixed.