Subscribing to Event Notifications using ADLX

ADLX has an event notification mechanism specific to each ADLX domain, but the event notification in all the domains use the same approach.

The application implements a listener interface as defined in the ADLX SDK. An instance of the listener interface is passed to ADLX to register for notification when the respective settings are changed.

When a change occurs, ADLX calls the method in this listener instance and passes the new settings as parameters.

When events notifications are no longer required by the application, the application unregisters the listener instance from ADLX, and the instance of the listener interface can be destroyed by the application.

Example: The Desktop domain provides notifications when there is a change to the desktop list.

Use the ADLX event notification management functionality when programming a new application, or when programming an existing application that uses ADL. The mechanism remains the same for all the programming languages, but there are language-specific differences in implementation.

You can program an application to get notified about changes such as when desktops are:

  • Created

  • Removed

  • Changed – Size settings

  • Changed – Location settings

To program an application to receive desktop list change notification,

  1. Implement, and then create an instance of the implemented IADLXDesktopListChangedListener interface.

    Note: The ADLX Desktop List Changed Listener instance is passed to ADLX and must exist for the entire duration of the application’s desktop list changed event registration.

  2. Call IADLXSystem::GetDesktopServices in the ADLX System interface.

    Result: Gets the IADLXDesktopServices interface.

  3. Call IADLXDesktopServices::GetDesktopChangedHandling in the ADLX Desktop Services interface.

    Result: Gets the IADLXDesktopChangedHandling interface.

  4. Pass the ADLX Desktop List Changed Listener instance as the parameter into IADLXDesktopChangedHandling::AddDesktopListEventListener .

    Note: When a change to the desktop occurs, the OnDesktopListChanged is called into the ADLX Desktop List Changed Listener instance, with the new desktop list as the IADLXDesktopList parameter.

To unsubscribe the Desktop List Changed notification:

  1. Unregister the ADLX Desktop List Changed Listener instance from ADLX using RemoveDesktopListEventListener .

  2. Discard the desktop list changed listener instance after the registration is removed.

    Note: Other ADLX domains that support event subscription use the same mechanism for event notifications.

For more information, for C++ see Receiving Events Notifications C++ samples .

For C see Receiving Events Notifications C samples .

For C# see DisplayEvents C# samples .

For Java see DisplayEvents Java samples .

For Python see DisplayEvents Python samples .