Giter Site home page Giter Site logo

Comments (9)

janten avatar janten commented on August 17, 2024 1

Thank you again for your bug report and insightful comments. I think you are right that simply checking for the presence of the ctrl modifier was not enough. I have built a new version which explicitly checks that only ctrl and a numeric key are pressed. Could you please download the updated Keypad Layout and give it a test? I plan to release this as Keypad Layout 1.6 once I have your feedback on this.

from keypad-layout.

janten avatar janten commented on August 17, 2024

Can anyone confirm this? Taking a screenshot with ctrl + cmd + shift + 4 works for me when Keypad Layout 1.5 is running on macOS 10.12.6.

from keypad-layout.

mariusk avatar mariusk commented on August 17, 2024

from keypad-layout.

janten avatar janten commented on August 17, 2024

Can you report this to Apple as a macOS bug and post the Radar ID? I will merge your workaraound if this is not fixed in the final release of 10.13.

from keypad-layout.

mariusk avatar mariusk commented on August 17, 2024

If I understand it I can. You're saying that normally that function would normally not be called with the kCGEventFlagMaskControl if shift is also pressed? My workaround simply just checks if shift is also pressed, and if so skips activating the rest of your placement code. But I really know very little about these APIs, and without further understanding I doubt I'm able to write a good bug report.

from keypad-layout.

mariusk avatar mariusk commented on August 17, 2024

In theory this could also be a bug in your software, where the evaluation order of hooks into keypresses have changed somewhat with 10.13, and that if worked previously by pure chance. But again, I know little about this.

from keypad-layout.

janten avatar janten commented on August 17, 2024

Specifically checking for the shift key or even all keys the the program should not react to seems to be an odd requirement. That's why I think we are using the API correctly here. A bug report at Apple would be our best chance to see if the change in 10.13 is intended or accidental. I am no longer a registered developer, so I cannot create the bug report myself.

from keypad-layout.

mariusk avatar mariusk commented on August 17, 2024

I'm not sure I agree. Your hotkeyCallback simply checks if the ctrl key is depressed together with a number key (ctrl-numberkey). If so, you "steal" the event, if not you pass it on to the next application.

So imagine another application doing the same, like the built in cmd-shift-control-numberkey for grabbing stuff from the screen. It checks specifically for all those keys (cmd, shift, control + numberkey), and only grabs the event if everything matches.

If your application ONLY checks for the cmd-numberkey sequence and nothing else, if YOUR application is "in front" of the built in application checking for all the keys, the built in application will never receive any events. Which is pretty much the bug as I've described it.

My workaround is lazy; I just add one additional requirement (that the shift key is not depressed), but in theory I should check for all of them (to avoid stealing somebody else who might have hooked onto cmd-control-numberkey for instance).

If my understanding is correct, the application as is works by chance on older macOS releases, simply because the system checks for cmd-shift-control-numberkey BEFORE the event gets passed to your app. The order might have changed in 10.13, where they run it by user applications BEFORE system applications, and that perfectly explains what is happening.

Which is why I can't report it as a bug until I have some additional information about why this bug isn't in this app itself.

from keypad-layout.

mariusk avatar mariusk commented on August 17, 2024

Seems to work great, good job!

from keypad-layout.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.