Recent

Author Topic: Lazarus Apps and Mac Accessibility  (Read 2891 times)

Wilko500

  • Full Member
  • ***
  • Posts: 122
Lazarus Apps and Mac Accessibility
« on: April 14, 2024, 11:56:41 pm »
This is a question about running Lazarus Apps on MacOs. Using LazMouseAndKeyInput KeyPress function invokes the Mac Accessibility features thus needs permission.

I am experimenting with LazMouseAndKeyInput.  I started with the example in the Lazarus Install folder /lazarus/components/example.  Great, it works! Then I created my own program and after the first compile it too worked ( I granted permission when prompted by the OS).  Then after the second compile it did not.  Program runs but there is no key input.

So far I have discovered that the keypress function is being suppressed by the Security & Privacy Accessibility function.  On first run a message is popped up asking for permission to be granted.  But after it is granted subsequent runs within Lazarus also fail to provide key input.  Yet additional project1's are added to the accessibility panel but there is no way of telling what or where those project1's are located nor which project they belong to.

I think that each compile generates some kind of signature that is recognised by the OS as different thus not permitted.  This is a giant pain for developing in Lazarus.

I wonder if any MacOs developers can provide any insight into how to control this behaviour.  Maybe a way to disable MacOs for asking for Accessibility permission?
MacBook Pro mid 2015 with OS Monterey 12.7.6
FPC 3.2.3 Lazarus 3.7
FPC 3.2.2 Lazarus 3.4

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2032
  • Former Delphi 1-7, 10.2 user
Re: Lazarus Apps and Mac Accessibility
« Reply #1 on: May 05, 2024, 09:51:54 am »
While I have not encountered your particular issue when recompiling programs, it may be related to this issue in which case first delete the old program before recompiling which you should be able to do in Project Options > Compiler Options > Compiler Commands - "execute before" command (it needs to be an executable file, so a simple Bourne shell script with appropriate permissions should work).

Wilko500

  • Full Member
  • ***
  • Posts: 122
Re: Lazarus Apps and Mac Accessibility
« Reply #2 on: May 05, 2024, 10:58:06 am »
Thank you for your insight. I’ll check out your suggestion.
MacBook Pro mid 2015 with OS Monterey 12.7.6
FPC 3.2.3 Lazarus 3.7
FPC 3.2.2 Lazarus 3.4

 

TinyPortal © 2005-2018