Xojo Conferences

Platforms to show: All Mac Windows Linux Cross-Platform

CarbonMonitorEventsMBS class

Type Topic Plugin Version macOS Windows Linux Console & Web iOS
class Carbon Events MBS MacCF Plugin 4.3 Yes No No Yes, macOS only No
Function: A class for receiving events sent to the application while monitoring events.
The CarbonMonitorEventsMBS class is a special class used to monitor user input events across all processes. When such a class is listening, the Carbon Event Manager examines the event type for user input event types, such as mouse-down, mouse-up, key-down, and so forth. It then requests that the WindowServer make copies of any of these events that are sent to any process, and deliver them to the current process also. These events are queued into the main thread's event queue, and during normal event dispatching are sent directly to the event handlers installed on the event monitor class. Monitored events are not sent through the normal event dispatching path for the current process; they will pass through the event dispatcher target, and will then be sent directly to the event monitor target.

Handlers installed on the event monitor class will only receive events when the current application is inactive. When the current application is active, all event flow occurs through the event dispatcher target, and no events are sent to the event monitor target.

Currently, the event monitor supports the following event kinds: kEventRawKeyDown, kEventRawKeyUp, kEventRawKeyRepeat, kEventRawKeyModifiersChanged, kEventMouseDown, kEventMouseUp, kEventMouseMoved, kEventMouseDragged, kEventMouseWheelMoved, kEventTabletPoint, and kEventTabletProximity.

Note that both Carbon and Cocoa password edit text controls enable a secure input mode while the focus is on the control, which prevents keyboard events from being passed to other applications. This prevents the monitoring event target from being used to sniff password keystrokes.

For added security, GetEventMonitorTarget requires that "Enable access for assistive devices" be checked in the Universal Access preference pane in order to monitor RawKeyDown, RawKeyUp, and RawKeyRepeat events. If this control is not checked, you can still install handlers for these events on the event monitor class, but no events of these types will be sent to your handler. Administrator privileges are required to enable this feature.

Accessibility made need to be turned on. On Mac OS X 10.9 this may not work in debug apps, but only in build apps after second launch.

Feedback, Comments & Corrections

This class has no sub classes.

Some examples which use this class:

The items on this page are in the following plugins: MBS MacCF Plugin.

CarbonHotKeyMBS   -   CarbonSystemEventsMBS

MBS Xojo Plugins