How to deal with OSX service cancellation?

Services start in the context of the application. For example, one service can widely format text in the insert panel and paste it into the application that requested it.

Is it possible for the service to get a reference to the parent of NSUndoManager and change its cancellation history?

+4
source share
1 answer

Services are launched in the context of the application, conceptually, but they are not actually executed in this application process.

The ability of the target application is canceled. If the service inserts something into the application, it will send a -paste: message to the responder chain of the application window of the target application itself. If the endogenous paste operation in the target application is canceled, I expect that the exogenous paste operation will also be canceled. Similarly, if the application does not support cancellation for paste operations, I would not expect the patch with service sources to be canceled.

Services are isolated from the target file cabinet application, as described here . They will not be able to get NSUndoManager from the application (or any other object) - think about what a huge, gaping security hole that will be! You can probably send AppleEvent to the application from the system service, but more on that.

0
source

Source: https://habr.com/ru/post/1395062/


All Articles