## Presentation Device Driver Reference for OS/2

[prev][next][parent][TOC]

### MoveCursorBlock

Display drivers must export an entry point for the MoveCursorBlock table. This table contains information about the display driver's MoveCursor routine (code) and data areas. The table values are checked after the display driver is initialized. This allows the driver to determine the correct values.

      typedef struct _MCDESCRIPTION {
          PVOID    pMoveCursor;
          ULONG    ulCodeLength;
          PVOID    pCursorData;
          ULONG    ulDataLength;
      } MCDESCRIPTION;
      typedef MCDESCRIPTION * PMCDESCRIPTION;

The fields in the MCDESCRIPTION data structure are described below:

pMoveCursor Flat address of the MoveCursor routine in the display driver.
ulCodeLength Length in bytes of the MoveCursor routine
pCursorData Flat address of the data area used by the MoveCursor routine
ulDataLength Length in bytes of the data area used by the MoveCursor routine

This routine supports calls from the system timer (at interrupt time). The strategy for the MoveCursor routine is that the pointer is checked and, if necessary, redrawn or excluded at timed intervals.

The PMDD.SYS physical device driver creates a privilege level 0 alias for the data address and passes the alias to the routine in the EAX register when MoveCursor is called at interrupt time. Therefore, all data addressing within the routine must be performed relative to this address.

At entry to the MoveCursor routine, the stack contains the following:

    VOID MoveCursor(LONG abs_x, LONG abs_y, PVOID pCursorData)

Using the C calling convention, the stack contains two LONGs, which hold the X- and Y-coordinates of the cursor hot spot, and a PVOID that is a pointer to the cursor data area that is valid in the current context. All references to this data area must be done relative to the address passed in . If the X- and Y-coordinates are set to 0x80000000, this signifies a CheckCursor call.

Regular timer interrupts give the presentation driver an opportunity to check whether the pointer is valid. For example, the driver can check the following:

Have new X- and Y- coordinates been set?
Is the pointer excluded because of a drawing operation? If so, has that operation been completed?
Is the pointer currently visible (although it should be excluded) because it is in an area that is being redrawn?

At the end of the MoveCursor routine, a check is performed to see if a new location was given for the pointer while it was being drawn. If the pointer has moved again, it must be drawn at the new location or be excluded because it has moved into the protection rectangle. This implies that the routine needs to track both real (X,Y) and pointer (X,Y) coordinates.