Apps using G4P on macOS sometimes miss mouse clicks

I have a built couple of apps using G4P to create a GUI that run on Windows and also on macOS. When on the macOS I sometimes have to click a button several times before the app responds. It might be trying to choose an option in a dropdown list or clicking a button that calls a handler function.

In this screen recording from my Mac Mini running macOS Catalina it actually works fine until I click on the green Save Patches button. You can see that I have to click several times before the event handler is called and something actually happens:

macOS Test

For comparison, here’s the same test running on my Win10 PC. Everything works smoothly:

Windows 10 Test

Has anyone else noticed this when using the G4P library for Apple macOS apps?

What version of Processing and G4P are you using?
Are you using P2D or JavaMode (default)?

You are not comparing like-with-like, in Osx you are running an exported app and in Windows you are running it in the Processing IDE.

Try the sketch in Processing IDE on Osx and see if it makes a difference.

@quark, many thanks for your reply. I know the two comparisons were not like-for-like but I already knew that the problem is the same on OSx even when the sketch is run in Processing (see new video link below).

On OSx Processing is V3.5.4 and G4P is V4.3.6
On Windows it’s V3.5.4 and V4.3.8 so a difference there.

The code is written on the Windows machine and then transferred via iCloud to the Mac for exporting.

I am using Java mode.

Here’s the sketch running in Processing 3.5.4 on the Mac. This time notice that I had to click on the dropdown button twice before the list opened (not too bad) but then it took several clicks on the entry before it was registered by G4P. The two other button clicks worked fine this time. The behaviour is not consistent, sometimes everything works first click, other times it can take several clicks. The droplist seems to be the worst but maybe that’s because it is more annoying!

macOS test #2

I suggest you upgrade to G4P 4.3.8 on Osx and try again.

I just created a sketch with just a single droplist control and it worked fine for me using

  • Processing 3.5.4
  • G4P 4.3.8
  • Osx Monterey

I also decided to try a simpler sketch, written on OSx Catalina. I haven’t G4P updated to 4.3.8 yet.

Why does the droplist not collapse when I have chosen an option? This means that when I want to select a different option I have to click the list button again before it will register the new selection. This seems ‘unnatural’ when the user can still see the options in the list. No doubt I am missing something! EDIT: I was stupid. Forgot to put a background() call in draw().

G4P Simple Test Sketch

Spent over half an hour to discover the missing background only to come back and find you edited the post LOL

I’m so sorry! :smiling_face_with_tear:

I fixed the background Test Sketch Fixed

@quark: The app still misses many mouse clicks, both on the droplist button and when trying to select an option from the list :frowning_face: as you can see …

Test #3

I have tried your simple sketch and created some of my own but I can’t reproduce the problem you are experiencing so I have no idea whats causing it. Sorry.

Thanks for trying.

One of my users reports the same problem on his MacBook 2019 with OS Monterey so it’s not just me LOL.

To summarize

  • G4P appears to miss some mouse events
  • this happens in Osx but not Windows
  • it doesn’t happen on all systems using Osx


  • gets the system events from Processing rather than directly from the OS
  • executes the same source code not matter what OS is installed.

Although it is still possible G4P is source of the problem, it seems to me that is not the probable cause.

Sorry I can’t be more helpful.

@quark: Peter many thanks for this summary. It’ll maybe give me something to work on. If I discover anything useful I will post it here.