Miscellaneous Plug-in Interfaces

This topic provides information about the use of miscellaneous plug-ins in the non-ScreenPlay variant.

Variant: Non-ScreenPlay. Target audience: Device creators.

Purpose

This document details a number of use cases that a developer may wish to use in order to use plug-ins with other interfaces. For example MWsWindow, MWsMemoryRelease, MWsPluginManager and MWsIniFile. In addition, there is a use case on a plug-in installing a new animation/redraw scheduler.

Introduction

The Window Server now provides some minor extensions to existing object provider interfaces, together with the some new object provider extension interfaces. The interfaces covered by the use cases in this document are:

  • MWsWindow – an interface through which windows can be examined

  • MWsMemoryRelease – an interface which enables plug-ins to cooperate with WSERV by releasing memory when requested (for example, caches)

  • MWsPluginManager – enables plug-ins to request services from other plug-ins

  • MWsIniFile – enables plug-ins to read the WSINI.INI file

Each of these new interfaces inherits from the existing MWsObjectProvider interface, and they are made available through the object provider mechanism. In other words, each interface has an associated “type id”, and the interface is obtained by calling MWsObjectProvider::ResolveObjectInterface(<type id>) on an appropriate object provider. In the case where a plug-in wants to request the interface, the object provider will be WSERV’s MWsGraphicDrawerEnvironment, which is passed to plug-ins during their construction.

In addition there is also a use case detailing how a plug-in can install a new animation/redraw scheduler.

Setup and configuration requirements

Loading plug-ins

All specified plug-ins are loaded by WSERV, or the default plug-ins are loaded if none are specified.

The plug-ins to be loaded are specified in the WSINI.INI file using a line such as the following:

PLUGINS FLICKERBUFFER STD DEFAULTFADER

Each plug-in can then have its own section in the WSINI.INI file in which ID, TYPE, and DATA parameters can be specified. These are as follows:

  • ID is a UID, used to search for <uid>.dll.

  • TYPE is a type, used to search for DLLs of that type. This can be used if no UID is specified.

  • DATA can be used to pass arbitrary data to a plug-in.

A typical section might look like this:

[FLICKERBUFFER]
ID 0x10285A2C

Additional preconditions

The following are additional preconditions for every use case in this document:

Plug-in uses MWsWindow interface

Pre-conditions

The plug-in has registered itself as an MWsEventHandler by calling MWsGraphicDrawerEnvironment::RegisterWsEventHandler()

Process

WSERV publishes EWindowClosing event.

The Event Handler receives EWindowClosing event.

The Event Handler obtains MWsWindow* for window that is closing by calling TWsCREvent::Window() .

The Event Handler obtains the size and position of the window that is closing using MWsWindow functions. This could then be used by a render stage to perform a window closing transition, for example.

Plug-in uses MWsMemoryRelease interface

Preconditions

The plug-in has registered itself as a memory release by calling MWsGraphicDrawerEnvironment::RegisterMemoryRelease(MWsMemoryRelease*)

Process

WSERV discovers that it is short of memory.

WSERV notifies all registered memory release objects. It requests them to ReleaseMemory(TMemoryReleaseLevel) passing in a level representing the importance - for instance tidy, unimportant or anything.

Memory release object releases memory - for example, a cache.

If insufficient memory is released, WSERV could try again with higher level of importance.

Plug-in uses MWsPluginManager interface

The MWsPluginManager interface can be used for plug-ins to gain access to extension interfaces defined by other plug-ins – for example, a bitmap cache.

Preconditions

A plug-in object implementing a custom extension interface (for example a bitmap cache) has been loaded, based on instructions in WSINI.INI.

Process

WSERV calls into the plug-in code. For example, this could be the render stage factory.

The plug-in calls MWsGraphicsDrawerEnvironment::ResolveObjectInterface(EMWsPluginManager)

The Environment returns a MWsPluginManager* interface

The plug-in calls MWsPluginManager::ResolvePluginInterface(<BITMAP CACHE UID>)

The plug-in manager returns MWsBitmapCache* object.

Plug-in uses MWsIniFile interface

Process

WSERV calls into plug-in code. For example, it could call into the render stage factory to create a render stage.

The plug-in wants to read some WSINI.INI file variables for configuration purposes.

The plug-in calls MWsGraphicsDrawerEnvironment::ResolveObjectInterface(EMWsIniFile)

The graphic drawer environment returns MWsIniFile* interface

The plug-in calls MWsIniFile::FindVar(<PARAMETERS>) to find the value of the variable it is interested in.

Plug-in installs new animation/redraw scheduler

Process

WSERV calls into the plug-in code. For instance, it could call into a CRP or the render stage factory.

The plug-in constructs a concrete instance of its own custom MWsAnimationScheduler subclass.

The plug-in calls MWsGraphicsDrawerEnvironment::SetCustomAnimationScheduler(MWsAnimationScheduler*), passing in the custom scheduler.

Subsequent scheduling uses the custom scheduler created by the plug-in.