Synergy-core: Escape from touch bar does not work on server

Created on 14 Feb 2017  路  9Comments  路  Source: symless/synergy-core

Operating Systems

Server: macOS Sierra (10.12.3)
Client: macOS Sierra on a MBP Touch (10.12.3)

Synergy Version

1.8.7

Steps to reproduce bug

  1. Establish a connection
  2. Open any program in Server machine.
  3. With the correct focus placed, press Escape (from the Touch bar).

(It doesn't relay the escape call).

bug

Most helpful comment

I am sure this is a hack and not the proper way to fix this, but the following "fix" is working for me. So I am going to run with it until someone who knows more than me can do it right.

File: src/lib/platform/OSXScreen.mm
Function: OSXScreen::handleCGInputEvent

Change:

if (screen->m_isOnScreen) {
        return event;
    } else {
        return NULL;
    }

to

if (screen->m_isOnScreen || type == 0x1d) {
        return event;
    } else {
        return NULL;
    }

I know next to nothing about this, but it appears that if you go ahead and allow the return of these type 29 (0x1D) events, even if the focus isn't on the local screen, then further processing of that event happens and the normal keydown and keyup events get produced for things like the touch bar escape and function keys.

All 9 comments

We're aware of this issue and we'll be working on reslving it soon.
For now, however, the workaround will be to use a keyboard with a physical ESC key.

A second workaround is to re-map an existing physical key to be the ESC key (CAPS LOCK is a popular choice).

I am sure this is a hack and not the proper way to fix this, but the following "fix" is working for me. So I am going to run with it until someone who knows more than me can do it right.

File: src/lib/platform/OSXScreen.mm
Function: OSXScreen::handleCGInputEvent

Change:

if (screen->m_isOnScreen) {
        return event;
    } else {
        return NULL;
    }

to

if (screen->m_isOnScreen || type == 0x1d) {
        return event;
    } else {
        return NULL;
    }

I know next to nothing about this, but it appears that if you go ahead and allow the return of these type 29 (0x1D) events, even if the focus isn't on the local screen, then further processing of that event happens and the normal keydown and keyup events get produced for things like the touch bar escape and function keys.

Just thought I would follow up after a couple work days using the changes I made to
src/lib/platform/OSXScreen.mm

It is working great with no negative repercussions with my machines....

After doing some more research on Quartz events I think that not trapping the 0x1D (unclassified gesture) event is the way to go. When that event isn't trapped then the other events (keyup, keydown) are produced. So, I think my "hack" is closer to the correct fix than I originally had thought it might be.

So Dustin's solution been posted for awhile and cross-referenced here: https://symless.com/forums/topic/3138-macos-touch-bar-soft-keys-not-transmitting/

Any guide on when the will be in a release build. I had no luck building it myself in Sierra when following these instructions: https://github.com/symless/synergy/wiki/Compiling#Mac_OS_X_1010_and_above

@arnisandy Have you had any luck? Sorry I didn't notice your post over a month ago. I am happy to zip up my compile if you would like and get it to you.

No problem, but no luck on the compile. I tried the new Beta 2 hoping that it might be fixed, but it's just buggy in general, being a beta. I was going to sit tight to see if it sorted itself out. So far I just remapped my caps lock key. No worries as I've found a way to cope.

Thanks, though!

As an overall commentary on the TouchBar, I find it rather useless besides Synergy's issues with it. I wish I could have gotten a 15" MacBook w/o it. I've configured it to not change with apps (to keep the old key layout all the time). With Synergy, when switching screens to another OS, the TouchBar (in it's default configuration) will keep the virtual key configuration for the last active app on the Mac. This means unless you are in the Mac screen it wouldn't be very useful on the other OS screen, even if it did send the keys (save the escape). Maybe Synergy can change the app to fall back to the default key layout when the mouse cursor is moved to another screen.
Longer term, here's hoping Apple realizes it was a gimmick and deprecates it.

I was wondering about the beta, thanks.

@simpsond Could you please submit a PR for your fix?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bigbear3001 picture bigbear3001  路  4Comments

ColinCreamer picture ColinCreamer  路  5Comments

jasonfisherjlf picture jasonfisherjlf  路  4Comments

sangwoo-joh picture sangwoo-joh  路  4Comments

spacepluk picture spacepluk  路  5Comments