Jump to content

MouSetPtrShape (OS/2 1.x): Difference between revisions

From EDM2
Ak120 (talk | contribs)
mNo edit summary
Ak120 (talk | contribs)
mNo edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 2: Line 2:


==Syntax==
==Syntax==
  MouSetPtrShape (PtrBuffer, PtrDefRec, DeviceHandle)  
  MouSetPtrShape (PtrBuffer, PtrDefRec, DeviceHandle)


==Parameters==
==Parameters==
;PtrBuffer (PBYTE) - input : Address of a buffer containing the bit image used by the mouse device driver as the pointer shape for that session. The buffer consists of AND and XOR pointer masks in a format meaningful to the pointer draw device driver.
;PtrBuffer (PBYTE) - input: Address of a buffer containing the bit image used by the mouse device driver as the pointer shape for that session. The buffer consists of AND and XOR pointer masks in a format meaningful to the pointer draw device driver.
 
:For CGA compatible text modes (0, 1, 2, and 3) the following describes the AND and XOR pointer mask bit definitions for each character cell of the masks. Bit values are:
For CGA compatible text modes (0, 1, 2, and 3) the following describes the AND and XOR pointer mask bit definitions for each character cell of the masks. Bit values are:
::{|class="wikitable"
'''Bit       Description'''
!Bit||Description
15           Blinking
|-
14-12       Background color
|15||Blinking
11           Intensity
|-
10-8         Foreground color
|14-12||Background colour
7-0         Character  
|-
 
|11||Intensity
;PtrDefRec (PPTRSHAPE) - input : Address of the structure where the application stores the necessary data for the pointer draw device driver to build a row-by-column image for each bit plane for the current display mode. The pointer definition record structure follows:
|-
 
|10-8||Foreground colour
TotLength (USHORT) : The total length of the data necessary for the pointer draw device driver to build a row-by-column image for each bit plane for the current display mode.
|-
 
|7-0||Character
For all OS/2 system-supported modes, TotLength is specified in bytes and is equal to:
|}
 
;PtrDefRec (P[[PTRSHAPE]]) - input: Address of the structure where the application stores the necessary data for the pointer draw device driver to build a row-by-column image for each bit plane for the current display mode.
Mono & Text Modes            For text mode height and width must be 1, so length is always 4.
:'''Programming Note:''' For other custom displays and for the extended modes of the EGA attachment, it is possible to set the display to modes that require multiple bit planes. In these cases, the area sized by the row and column limits must be repeated for each bit plane supported in that mode. Consequently, the calling process must supply enough data to allow the mouse device driver to draw the pointer shape on all currently supported bit planes in that session. For text modes, row and column offset must equal 0.
;DeviceHandle (HMOU) - input: Contains the handle of the mouse device obtained from a previous MouOpen.
                TotLength = (height in chars) * (width in chars) * 2 * 2
                          = 1 * 1 * 2 * 2
                          = 4
Graphics Mode                Width-in-pels must be a multiple of 8.
                TotLength = (height in pels)*(width in pels)*(bits per pel)*2/8
Modes 4 and 5 (320 X 200)
                TotLength = (height) * (width) * 2 * 2 / 8
Mode 6 (640 X 200)
                TotLength = (height) * (width) * 1 * 2 / 8
Length calculations produce byte boundary buffer sizes.
           
col (USHORT) : Number of columns in the mouse shape. In graphics modes, this field contains the pel width (columns) of the mouse shape for the session and must be greater than or equal to 1. In text modes, col must equal 1.
 
row (USHORT) : Number of rows in the mouse shape. In graphics modes, this field contains the pel height (rows) of the mouse shape for the session and must be greater than or equal to 1. In text modes, row must equal 1.
 
coloffset (USHORT) : This value is returned by the mouse device driver to indicate the relative column offset within the pointer image. The value defines the center (hotspot) of the pointer image. This value is a signed number that represents either character or pel offset, depending on the display mode.  
 
rowoffset (USHORT) : This value is returned by the mouse device driver to indicate the relative row offset within the pointer image. The value defines the center (hotspot) of the pointer image. This value is a signed number that represents either character or pel offset, depending on the display mode.
 
'''Programming Note:''' For other custom displays and for the extended modes of the EGA attachment, it is possible to set the display to modes that require multiple bit planes. In these cases, the area sized by the row and column limits must be repeated for each bit plane supported in that mode. Consequently, the calling process must supply enough data to allow the mouse device driver to draw the pointer shape on all currently supported bit planes in that session. For text modes, row and column offset must equal 0.  
 
; DeviceHandle (HMOU) - input : Contains the handle of the mouse device obtained from a previous MouOpen.  


==Return Code==
==Return Code==
rc (USHORT) - return
;rc (USHORT) - return:Return code descriptions are:
 
*0 NO_ERROR
Return code descriptions are:
*385 ERROR_MOUSE_NO_DEVICE
 
*387 ERROR_MOUSE_INV_PARMS
* 0         NO_ERROR
*466 ERROR_MOU_DETACHED
* 385       ERROR_MOUSE_NO_DEVICE  
*501 ERROR_MOUSE_NO_CONSOLE
* 387       ERROR_MOUSE_INV_PARMS  
*505 ERROR_MOU_EXTENDED_SG
* 466       ERROR_MOU_DETACHED  
* 501       ERROR_MOUSE_NO_CONSOLE  
* 505       ERROR_MOU_EXTENDED_SG


==Remarks==
==Remarks==
Line 72: Line 40:
The pointer shape is mapped by the Pointer Draw Device Driver and determined completely by the application. The height and width may vary from 1 through the pel size of the display screen. For restrictions concerning the Pointer Draw Device Driver, see IBM Operating System/2 Version 1.2 I/O Subsystems And Device Support Volume 1.  
The pointer shape is mapped by the Pointer Draw Device Driver and determined completely by the application. The height and width may vary from 1 through the pel size of the display screen. For restrictions concerning the Pointer Draw Device Driver, see IBM Operating System/2 Version 1.2 I/O Subsystems And Device Support Volume 1.  


==Example Code==
==Bindings==
=== C Binding===
===C===
<PRE>
<PRE>
typedef struct _PTRSHAPE {   /* moups */
typedef struct _PTRSHAPE { /* moups */
   USHORT cb;                 /* total length necessary to build
   USHORT cb;               /* total length necessary to build image */
                                  image */
   USHORT col;             /* # of columns in mouse shape */
   USHORT col;               /* # of columns in mouse shape */
   USHORT row;             /* number of rows in mouse shape */
   USHORT row;               /* number of rows in mouse shape */
   USHORT colHot;           /* column coordinate of pointer image hotspot */
   USHORT colHot;             /* column coordinate of pointer image
   USHORT rowHot;           /* row coordinate of pointer image hotspot */
                                  hotspot */
   USHORT rowHot;             /* row coordinate of pointer image
                                  hotspot */
} PTRSHAPE;
} PTRSHAPE;


Line 90: Line 55:
USHORT  rc = MouSetPtrShape(PtrBuffer, PtrDefRec, DeviceHandle);
USHORT  rc = MouSetPtrShape(PtrBuffer, PtrDefRec, DeviceHandle);


PBYTE           PtrBuffer;    /* Pointer shape buffer */
PBYTE     PtrBuffer;    /* Pointer shape buffer */
PPTRSHAPE       PtrDefRec;    /* Pointer definition record */
PPTRSHAPE PtrDefRec;    /* Pointer definition record */
HMOU             DeviceHandle;  /* Mouse device handle */
HMOU       DeviceHandle;  /* Mouse device handle */


USHORT           rc;            /* return code */
USHORT     rc;            /* return code */
</PRE>
</PRE>


===MASM Binding===
===MASM===
<PRE>
<PRE>
PTRSHAPE struc
PTRSHAPE struc
Line 117: Line 82:
Returns WORD
Returns WORD
</PRE>
</PRE>
==Related Functions==
*


[[Category:Mou]]
[[Category:Mou]]

Latest revision as of 22:18, 11 December 2019

This call allows a process to set the pointer shape and size to be used as the mouse device driver pointer image for all applications in a session.

Syntax

MouSetPtrShape (PtrBuffer, PtrDefRec, DeviceHandle)

Parameters

PtrBuffer (PBYTE) - input
Address of a buffer containing the bit image used by the mouse device driver as the pointer shape for that session. The buffer consists of AND and XOR pointer masks in a format meaningful to the pointer draw device driver.
For CGA compatible text modes (0, 1, 2, and 3) the following describes the AND and XOR pointer mask bit definitions for each character cell of the masks. Bit values are:
Bit Description
15 Blinking
14-12 Background colour
11 Intensity
10-8 Foreground colour
7-0 Character
PtrDefRec (PPTRSHAPE) - input
Address of the structure where the application stores the necessary data for the pointer draw device driver to build a row-by-column image for each bit plane for the current display mode.
Programming Note: For other custom displays and for the extended modes of the EGA attachment, it is possible to set the display to modes that require multiple bit planes. In these cases, the area sized by the row and column limits must be repeated for each bit plane supported in that mode. Consequently, the calling process must supply enough data to allow the mouse device driver to draw the pointer shape on all currently supported bit planes in that session. For text modes, row and column offset must equal 0.
DeviceHandle (HMOU) - input
Contains the handle of the mouse device obtained from a previous MouOpen.

Return Code

rc (USHORT) - return
Return code descriptions are:
  • 0 NO_ERROR
  • 385 ERROR_MOUSE_NO_DEVICE
  • 387 ERROR_MOUSE_INV_PARMS
  • 466 ERROR_MOU_DETACHED
  • 501 ERROR_MOUSE_NO_CONSOLE
  • 505 ERROR_MOU_EXTENDED_SG

Remarks

An application passes a data image to the mouse device driver that the mouse driver applies to the screen whenever the logical pointer position is not located in the application-defined collision area. The application synchronizes use of the screen with the mouse driver by way of MouRemovePtr and MouDrawPtr.

The pointer shape is dependent on the display device driver used to support the display device. OS/2 supports text and graphics modes. These modes are restricted to modes 0 through 7, depending on the display device. Character modes (modes 0, 1, 2, 3, and 7) support the pointer cursor only as a reverse block character. This reverse block character has a character height and width equal to 1.

The pointer shape is mapped by the Pointer Draw Device Driver and determined completely by the application. The height and width may vary from 1 through the pel size of the display screen. For restrictions concerning the Pointer Draw Device Driver, see IBM Operating System/2 Version 1.2 I/O Subsystems And Device Support Volume 1.

Bindings

C

typedef struct _PTRSHAPE { /* moups */
  USHORT cb;               /* total length necessary to build image */
  USHORT col;              /* # of columns in mouse shape */
  USHORT row;              /* number of rows in mouse shape */
  USHORT colHot;           /* column coordinate of pointer image hotspot */
  USHORT rowHot;           /* row coordinate of pointer image hotspot */
} PTRSHAPE;

#define INCL_MOU

USHORT  rc = MouSetPtrShape(PtrBuffer, PtrDefRec, DeviceHandle);

PBYTE      PtrBuffer;     /* Pointer shape buffer */
PPTRSHAPE  PtrDefRec;     /* Pointer definition record */
HMOU       DeviceHandle;  /* Mouse device handle */

USHORT     rc;            /* return code */

MASM

PTRSHAPE struc
  moups_cb      dw  ? ;total length necessary to build image
  moups_col     dw  ? ;# of columns in mouse shape
  moups_row     dw  ? ;number of rows in mouse shape
  moups_colHot  dw  ? ;column coordinate of pointer image hotspot
  moups_rowHot  dw  ? ;row coordinate of pointer image hotspot
PTRSHAPE ends

EXTRN  MouSetPtrShape:FAR
INCL_MOU            EQU 1

PUSH@  OTHER   PtrBuffer     ;Pointer shape buffer
PUSH@  OTHER   PtrDefRec     ;Pointer definition record
PUSH   WORD    DeviceHandle  ;Mouse device handle
CALL   MouSetPtrShape

Returns WORD