Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ mouse(dev) — Sprite KS.390

Media Vault

Software Library

Restoration Projects

Artifacts Sought

MOUSE  —  Devices

NAME

mouse − Devices used to read mouse and keyboard events for window systems

SYNOPSIS

#include <dev/mouse.h>
 

DESCRIPTION

Mouse devices are used by window systems to communicate with the raw keyboard and mouse.  Each read kernel call on a mouse device returns one or more structures of the following format: typedef struct {
    int flags;
    int key;
    int deltaX;
    int deltaY;
    unsigned int time; } Mouse_Event; The buffer specified to a read kernel call must be large enough to hold at least one Mouse_Event.  The flags field is an OR-ed combination of the following bit masks:

MOUSE_EVENTMeans that a mouse button was pressed or released, or the mouse moved. 

KEYBOARD_EVENTMeans that a key was pressed or released on the keyboard.  Only one of MOUSE_EVENT or KEYBOARD_EVENT will be set in any particular event. 

KEY_UPThis bit is only relevant for keyboard events.  If set, it implies that the key was released;  otherwise, the key was pressed. 

For mouse events, the key field contains a bit mask indicating which mouse buttons are currently depressed.  The deltaX and deltaY fields indicate how much the mouse has moved (in pixels) since the last mouse-related event.  The time field gives the value of a free-running millisecond clock at the time the event occurred.  The time value has no absolute significance, but is useful in comparing times from different events. 

For keyboard events, the key field gives the number of a key on the keyboard.  The numbers are keyboard-specific, and are usually different than the ASCII values represented by the keys.  The KEY_UP mask bit indicates whether the given key just went up or down.  For ideal keyboards, such as those on most Sun workstations, separate up and down events occur for each key.  For less-than-ideal keyboards, such as DEC’s LK201, down events occur for all keys, but up events only occur for a few keys such as shift.  The deltaX and deltaY fields have no significance for keyboard events, and time is the same as for mouse events. 

Writing to a mouse device has machine-specific effects.  On Suns, characters written to a mouse device are transmitted to the keyboard and perform the following special functions, depending on the value of the character:

KBD_RESET (1) Reset the keyboard. 

KBD_BELL_ON (2) Turn on the bell.  It will stay on until the KBD_BELL_OFF character is transmitted. 

KBD_BELL_OFF (3) Turn off the bell. 

KBD_CLICK_ON (10)
Generate a click on each keystroke.

KBD_CLICK_OFF (11)
Stop clicking on each keystroke.

No device-specific IO-control operations are defined for mouse devices. 
 

KEYWORDS

event, keyboard, mouse, window system

Sprite version 1.0  —  June 25, 1989

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026