Files
vt1200/xie/docs/dec/xie23-src/include/XInput.h
T
arti d8d54bb990 feat(xie): a client-chosen XIE image is displayed on the VT1200
The XIE path now runs end to end: XieCreateImage -> XieCreatePhoto ->
XiePutTile -> XieExport(photomap -> depth-1 pixmap) -> XCopyArea(pixmap ->
window), and the client's tile appears on screen at the client's own window
position, pixel-exact.

TWO FAULTS BEHIND THE LONG DEAD END

1. Device model (harness/mame/vt1200.cpp, opt-in VT1200_ACCEL=1).  The
   accelerator's output port 0x5600200 returns the pixel stream the firmware
   pushed into the FIFO -- the firmware then stores it into the drawable itself
   (file 0x125528: MOVE *B6,*B1 ; ADDK 0x10,B1).  The FIFO read pointer was
   never reset between transfers, so consecutive exports read stale words and
   the same fill produced 759 then 516 set pixels.  Reset m_fifo_in/out on the
   data-register write; the export is now deterministic.

2. Measurement, not the device.
   - dwt/screenshot.py without --real reads 1024x1024 at a 128-byte row stride,
     but the VR319 default programs 1280x1024 at a 2048-bit (256-byte) pitch.
     That is the "shifted" picture; --real is the correct read.
   - The earlier "0 differing bytes over 128 KiB" VRAM comparison stepped peek
     by 1024 *bit* addresses, so it scanned rows 0..63 only -- never the window
     at rows 200..263.  Over the real raster the white/black diff is 576 bytes
     spanning exactly those rows.
   - New instrument: decclient does a server-side XGetImage readback of the
     pixmap and window and counts set pixels.  That separated "the server never
     drew it" from "the framebuffer view is wrong".

EVIDENCE (reproduced twice, the second time from a fresh machine)

  no export vs 0xFF : 4096 / 4096 pixels differ
  no export vs 0x00 :    0 / 4096   (the window background is black)
  0xFF      vs 0x00 : 4096 / 4096
  0xAA      vs 0x0F : 2048 / 4096   (the two stripe phases)

Tile byte 0xAA reproduces as 1-pixel vertical stripes, 0x0F as 4-pixel, with
no shear -- so the placement is right and the pixels are the client's.

Contents: xie/ holds DEC XIE 2.3 headers, 84 man pages and complete
client+server source; a libXie.a and decclient built from DEC's own code; the
XIE probes; and evidence/ with every measurement, including explicit
retractions of the earlier wrong readings (VRAM_IDENTICAL_FOR_BOTH_FILLS and
friends).  xie/evidence/XIE_IMAGE_DISPLAYED.md is the report; frames are in
xie/evidence/png/.

The accelerator model stays opt-in: it answers the status poll and relays the
pixel stream, but performs no compositing, so it is a stand-in and the verified
default configuration is unchanged (a no-env run still parks in the level-0
diagnostics menu at PC=3FDCE400).
2026-11-01 23:22:25 +02:00

850 lines
25 KiB
C

/*
* *****************************************************************
* * *
* * Copyright (c) Digital Equipment Corporation, 1991, 1994 *
* * *
* * All Rights Reserved. Unpublished rights reserved under *
* * the copyright laws of the United States. *
* * *
* * The software contained on this media is proprietary to *
* * and embodies the confidential technology of Digital *
* * Equipment Corporation. Possession, use, duplication or *
* * dissemination of the software and media is authorized only *
* * pursuant to a valid written license from Digital Equipment *
* * Corporation. *
* * *
* * RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure *
* * by the U.S. Government is subject to restrictions as set *
* * forth in Subparagraph (c)(1)(ii) of DFARS 252.227-7013, *
* * or in FAR 52.227-19, as applicable. *
* * *
* *****************************************************************
*/
/*
* HISTORY
*/
/* $Header: /usr/sde/x11/rcs/x11/src/./extensions/include/XInput.h,v 1.2 91/12/15 12:42:16 devrcs Exp $ */
/************************************************************
Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, California, and the
Massachusetts Institute of Technology, Cambridge, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Hewlett-Packard or MIT not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
/* Definitions used by the library and client */
#ifndef _XINPUT_H_
#define _XINPUT_H_
#ifndef _XLIB_H_
#include <X11/Xlib.h>
#endif
#ifndef _XI_H_
#include "XI.h"
#endif
#define _deviceKeyPress 0
#define _deviceKeyRelease 1
#define _deviceButtonPress 0
#define _deviceButtonRelease 1
#define _deviceMotionNotify 0
#define _deviceFocusIn 0
#define _deviceFocusOut 1
#define _proximityIn 0
#define _proximityOut 1
#define _deviceStateNotify 0
#define _deviceMappingNotify 1
#define _changeDeviceNotify 2
#define FindTypeAndClass(d,type,_class,classid,offset) \
{ int i; XInputClassInfo *ip; \
type = 0; _class = 0; \
for (i=0, ip= ((XDevice *) d)->classes; \
i< ((XDevice *) d)->num_classes; \
i++, ip++) \
if (ip->input_class == classid) \
{type = ip->event_type_base + offset; \
_class = ((XDevice *) d)->device_id << 8 | type;}}
#define DeviceKeyPress(d,type,_class) \
FindTypeAndClass(d, type, _class, KeyClass, _deviceKeyPress)
#define DeviceKeyRelease(d,type,_class) \
FindTypeAndClass(d, type, _class, KeyClass, _deviceKeyRelease)
#define DeviceButtonPress(d,type,_class) \
FindTypeAndClass(d, type, _class, ButtonClass, _deviceButtonPress)
#define DeviceButtonRelease(d,type,_class) \
FindTypeAndClass(d, type, _class, ButtonClass, _deviceButtonRelease)
#define DeviceMotionNotify(d,type,_class) \
FindTypeAndClass(d, type, _class, ValuatorClass, _deviceMotionNotify)
#define DeviceFocusIn(d,type,_class) \
FindTypeAndClass(d, type, _class, FocusClass, _deviceFocusIn)
#define DeviceFocusOut(d,type,_class) \
FindTypeAndClass(d, type, _class, FocusClass, _deviceFocusOut)
#define ProximityIn(d,type,_class) \
FindTypeAndClass(d, type, _class, ProximityClass, _proximityIn)
#define ProximityOut(d,type,_class) \
FindTypeAndClass(d, type, _class, ProximityClass, _proximityOut)
#define DeviceStateNotify(d,type,_class) \
FindTypeAndClass(d, type, _class, OtherClass, _deviceStateNotify)
#define DeviceMappingNotify(d,type,_class) \
FindTypeAndClass(d, type, _class, OtherClass, _deviceMappingNotify)
#define ChangeDeviceNotify(d,type,_class) \
FindTypeAndClass(d, type, _class, OtherClass, _changeDeviceNotify)
#define DevicePointerMotionHint(d,type,_class) \
{ _class = ((XDevice *) d)->device_id << 8 | _devicePointerMotionHint;}
#define DeviceButton1Motion(d,type,_class) \
{ _class = ((XDevice *) d)->device_id << 8 | _deviceButton1Motion;}
#define DeviceButton2Motion(d,type,_class) \
{ _class = ((XDevice *) d)->device_id << 8 | _deviceButton2Motion;}
#define DeviceButton3Motion(d,type,_class) \
{ _class = ((XDevice *) d)->device_id << 8 | _deviceButton3Motion;}
#define DeviceButton4Motion(d,type,class) \
{ _class = ((XDevice *) d)->device_id << 8 | _deviceButton4Motion;}
#define DeviceButton5Motion(d,type,_class) \
{ _class = ((XDevice *) d)->device_id << 8 | _deviceButton5Motion;}
#define DeviceButtonMotion(d,type,class) \
{ _class = ((XDevice *) d)->device_id << 8 | _deviceButtonMotion;}
#define DeviceOwnerGrabButton(d,type,_class) \
{ _class = ((XDevice *) d)->device_id << 8 | _deviceOwnerGrabButton;}
#define DeviceButtonPressGrab(d,type,_class) \
{ _class = ((XDevice *) d)->device_id << 8 | _deviceButtonGrab;}
#define NoExtensionEvent(d,type,_class) \
{ _class = ((XDevice *) d)->device_id << 8 | _noExtensionEvent;}
#define BadDevice(dpy,error) _xibaddevice(dpy, &error)
#define BadClass(dpy,error) _xibadclass(dpy, &error)
#define BadEvent(dpy,error) _xibadevent(dpy, &error)
#define BadMode(dpy,error) _xibadmode(dpy, &error)
#define DeviceBusy(dpy,error) _xidevicebusy(dpy, &error)
/***************************************************************
*
* DeviceKey events. These events are sent by input devices that
* support input class Keys.
* The location of the X pointer is reported in the coordinate
* fields of the x,y and x_root,y_root fields.
*
*/
typedef struct
{
int type; /* of event */
unsigned long serial; /* # of last request processed */
Bool send_event; /* true if from SendEvent request */
Display *display; /* Display the event was read from */
Window window; /* "event" window reported relative to */
XID deviceid;
Window root; /* root window event occured on */
Window subwindow; /* child window */
Time time; /* milliseconds */
int x, y; /* x, y coordinates in event window */
int x_root; /* coordinates relative to root */
int y_root; /* coordinates relative to root */
unsigned int state; /* key or button mask */
unsigned int keycode; /* detail */
Bool same_screen; /* same screen flag */
unsigned int device_state; /* device key or button mask */
unsigned char axes_count;
unsigned char first_axis;
int axis_data[6];
} XDeviceKeyEvent;
typedef XDeviceKeyEvent XDeviceKeyPressedEvent;
typedef XDeviceKeyEvent XDeviceKeyReleasedEvent;
/*******************************************************************
*
* DeviceButton events. These events are sent by extension devices
* that support input class Buttons.
*
*/
typedef struct {
int type; /* of event */
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if from a SendEvent request */
Display *display; /* Display the event was read from */
Window window; /* "event" window reported relative to */
XID deviceid;
Window root; /* root window that the event occured on */
Window subwindow; /* child window */
Time time; /* milliseconds */
int x, y; /* x, y coordinates in event window */
int x_root; /* coordinates relative to root */
int y_root; /* coordinates relative to root */
unsigned int state; /* key or button mask */
unsigned int button; /* detail */
Bool same_screen; /* same screen flag */
unsigned int device_state; /* device key or button mask */
unsigned char axes_count;
unsigned char first_axis;
int axis_data[6];
} XDeviceButtonEvent;
typedef XDeviceButtonEvent XDeviceButtonPressedEvent;
typedef XDeviceButtonEvent XDeviceButtonReleasedEvent;
/*******************************************************************
*
* DeviceMotionNotify event. These events are sent by extension devices
* that support input class Valuators.
*
*/
typedef struct
{
int type; /* of event */
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if from a SendEvent request */
Display *display; /* Display the event was read from */
Window window; /* "event" window reported relative to */
XID deviceid;
Window root; /* root window that the event occured on */
Window subwindow; /* child window */
Time time; /* milliseconds */
int x, y; /* x, y coordinates in event window */
int x_root; /* coordinates relative to root */
int y_root; /* coordinates relative to root */
unsigned int state; /* key or button mask */
char is_hint; /* detail */
Bool same_screen; /* same screen flag */
unsigned int device_state; /* device key or button mask */
unsigned char axes_count;
unsigned char first_axis;
int axis_data[6];
} XDeviceMotionEvent;
/*******************************************************************
*
* DeviceFocusChange events. These events are sent when the focus
* of an extension device that can be focused is changed.
*
*/
typedef struct
{
int type; /* of event */
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if from a SendEvent request */
Display *display; /* Display the event was read from */
Window window; /* "event" window reported relative to */
XID deviceid;
int mode; /* NotifyNormal, NotifyGrab, NotifyUngrab */
int detail;
/*
* NotifyAncestor, NotifyVirtual, NotifyInferior,
* NotifyNonLinear,NotifyNonLinearVirtual, NotifyPointer,
* NotifyPointerRoot, NotifyDetailNone
*/
Time time;
} XDeviceFocusChangeEvent;
typedef XDeviceFocusChangeEvent XDeviceFocusInEvent;
typedef XDeviceFocusChangeEvent XDeviceFocusOutEvent;
/*******************************************************************
*
* ProximityNotify events. These events are sent by those absolute
* positioning devices that are capable of generating proximity information.
*
*/
typedef struct
{
int type; /* ProximityIn or ProximityOut */
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window window;
XID deviceid;
Window root;
Window subwindow;
Time time;
int x, y;
int x_root, y_root;
unsigned int state;
Bool same_screen;
unsigned int device_state; /* device key or button mask */
unsigned char axes_count;
unsigned char first_axis;
int axis_data[6];
} XProximityNotifyEvent;
typedef XProximityNotifyEvent XProximityInEvent;
typedef XProximityNotifyEvent XProximityOutEvent;
/*******************************************************************
*
* DeviceStateNotify events are generated on EnterWindow and FocusIn
* for those clients who have selected DeviceState.
*
*/
typedef struct
{
#if defined(__cplusplus) || defined(c_plusplus)
unsigned char c_class;
#else
unsigned char class;
#endif
unsigned char length;
} XInputClass;
typedef struct {
int type;
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window window;
XID deviceid;
Time time;
int num_classes;
char data[64];
} XDeviceStateNotifyEvent;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
unsigned char c_class;
#else
unsigned char class;
#endif
unsigned char length;
unsigned char num_valuators;
unsigned char mode;
int valuators[6];
} XValuatorStatus;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
unsigned char c_class;
#else
unsigned char class;
#endif
unsigned char length;
short num_keys;
char keys[32];
} XKeyStatus;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
unsigned char c_class;
#else
unsigned char class;
#endif
unsigned char length;
short num_buttons;
char buttons[32];
} XButtonStatus;
/*******************************************************************
*
* DeviceMappingNotify event. This event is sent when the key mapping,
* modifier mapping, or button mapping of an extension device is changed.
*
*/
typedef struct {
int type;
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window window; /* unused */
XID deviceid;
Time time;
int request; /* one of MappingModifier, MappingKeyboard,
MappingPointer */
int first_keycode;/* first keycode */
int count; /* defines range of change w. first_keycode*/
} XDeviceMappingEvent;
/*******************************************************************
*
* ChangeDeviceNotify event. This event is sent when an
* XChangeKeyboard or XChangePointer request is made.
*
*/
typedef struct {
int type;
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window window; /* unused */
XID deviceid;
Time time;
int request; /* NewPointer or NewKeyboard */
} XChangeDeviceNotifyEvent;
/*******************************************************************
*
* Control structures for input devices that support input class
* Feedback. These are used by the XGetFeedbackControl and
* XChangeFeedbackControl functions.
*
*/
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
XID c_class;
#else
XID class;
#endif
int length;
XID id;
} XFeedbackState;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
XID c_class;
#else
XID class;
#endif
int length;
XID id;
int click;
int percent;
int pitch;
int duration;
int led_mask;
int global_auto_repeat;
char auto_repeats[32];
} XKbdFeedbackState;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
XID c_class;
#else
XID class;
#endif
int length;
XID id;
int accelNum;
int accelDenom;
int threshold;
} XPtrFeedbackState;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
XID c_class;
#else
XID class;
#endif
int length;
XID id;
int resolution;
int minVal;
int maxVal;
} XIntegerFeedbackState;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
XID c_class;
#else
XID class;
#endif
int length;
XID id;
int max_symbols;
int num_syms_supported;
KeySym *syms_supported;
} XStringFeedbackState;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
XID c_class;
#else
XID class;
#endif
int length;
XID id;
int percent;
int pitch;
int duration;
} XBellFeedbackState;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
XID c_class;
#else
XID class;
#endif
int length;
XID id;
int led_values;
int led_mask;
} XLedFeedbackState;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
XID c_class;
#else
XID class;
#endif
int length;
XID id;
} XFeedbackControl;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
XID c_class;
#else
XID class;
#endif
int length;
XID id;
int accelNum;
int accelDenom;
int threshold;
} XPtrFeedbackControl;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
XID c_class;
#else
XID class;
#endif
int length;
XID id;
int click;
int percent;
int pitch;
int duration;
int led_mask;
int led_value;
int key;
int auto_repeat_mode;
} XKbdFeedbackControl;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
XID c_class;
#else
XID class;
#endif
int length;
XID id;
int num_keysyms;
KeySym *syms_to_display;
} XStringFeedbackControl;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
XID c_class;
#else
XID class;
#endif
int length;
XID id;
int int_to_display;
} XIntegerFeedbackControl;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
XID c_class;
#else
XID class;
#endif
int length;
XID id;
int percent;
int pitch;
int duration;
} XBellFeedbackControl;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
XID c_class;
#else
XID class;
#endif
int length;
XID id;
int led_mask;
int led_values;
} XLedFeedbackControl;
/*******************************************************************
*
* Device control structures.
*
*/
typedef struct {
XID control;
int length;
} XDeviceControl;
typedef struct {
XID control;
int length;
int first_valuator;
int num_valuators;
int *resolutions;
} XDeviceResolutionControl;
typedef struct {
XID control;
int length;
int num_valuators;
int *resolutions;
int *min_resolutions;
int *max_resolutions;
} XDeviceResolutionState;
/*******************************************************************
*
* An array of XDeviceList structures is returned by the
* XListInputDevices function. Each entry contains information
* about one input device. Among that information is an array of
* pointers to structures that describe the characteristics of
* the input device.
*
*/
typedef struct _XAnyClassinfo *XAnyClassPtr;
typedef struct _XAnyClassinfo {
#if defined(__cplusplus) || defined(c_plusplus)
XID c_class;
#else
XID class;
#endif
int length;
} XAnyClassInfo;
typedef struct _XDeviceInfo *XDeviceInfoPtr;
typedef struct _XDeviceInfo
{
XID id;
Atom type;
char *name;
int num_classes;
int use;
XAnyClassPtr inputclassinfo;
} XDeviceInfo;
typedef struct _XKeyInfo *XKeyInfoPtr;
typedef struct _XKeyInfo
{
#if defined(__cplusplus) || defined(c_plusplus)
XID c_class;
#else
XID class;
#endif
int length;
unsigned short min_keycode;
unsigned short max_keycode;
unsigned short num_keys;
} XKeyInfo;
typedef struct _XButtonInfo *XButtonInfoPtr;
typedef struct _XButtonInfo {
#if defined(__cplusplus) || defined(c_plusplus)
XID c_class;
#else
XID class;
#endif
int length;
short num_buttons;
} XButtonInfo;
typedef struct _XAxisInfo *XAxisInfoPtr;
typedef struct _XAxisInfo {
int resolution;
int min_value;
int max_value;
} XAxisInfo;
typedef struct _XValuatorInfo *XValuatorInfoPtr;
typedef struct _XValuatorInfo
{
#if defined(__cplusplus) || defined(c_plusplus)
XID c_class;
#else
XID class;
#endif
int length;
unsigned char num_axes;
unsigned char mode;
unsigned long motion_buffer;
XAxisInfoPtr axes;
} XValuatorInfo;
/*******************************************************************
*
* An XDevice structure is returned by the XOpenDevice function.
* It contains an array of pointers to XInputClassInfo structures.
* Each contains information about a class of input supported by the
* device, including a pointer to an array of data for each type of event
* the device reports.
*
*/
typedef struct {
unsigned char input_class;
unsigned char event_type_base;
} XInputClassInfo;
typedef struct {
XID device_id;
int num_classes;
XInputClassInfo *classes;
} XDevice;
/*******************************************************************
*
* The following structure is used to return information for the
* XGetSelectedExtensionEvents function.
*
*/
typedef struct {
XEventClass event_type;
XID device;
} XEventList;
/*******************************************************************
*
* The following structure is used to return motion history data from
* an input device that supports the input class Valuators.
* This information is returned by the XGetDeviceMotionEvents function.
*
*/
typedef struct {
Time time;
int *data;
} XDeviceTimeCoord;
/*******************************************************************
*
* Device state structure.
* This is returned by the XQueryDeviceState request.
*
*/
typedef struct {
XID device_id;
int num_classes;
XInputClass *data;
} XDeviceState;
/*******************************************************************
*
* Note that the mode field is a bitfield that reports the Proximity
* status of the device as well as the mode. The mode field should
* be OR'd with the mask DeviceMode and compared with the values
* Absolute and Relative to determine the mode, and should be OR'd
* with the mask ProximityState and compared with the values InProximity
* and OutOfProximity to determine the proximity state.
*
*/
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
unsigned char c_class;
#else
unsigned char class;
#endif
unsigned char length;
unsigned char num_valuators;
unsigned char mode;
int *valuators;
} XValuatorState;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
unsigned char c_class;
#else
unsigned char class;
#endif
unsigned char length;
short num_keys;
char keys[32];
} XKeyState;
typedef struct {
#if defined(__cplusplus) || defined(c_plusplus)
unsigned char c_class;
#else
unsigned char class;
#endif
unsigned char length;
short num_buttons;
char buttons[32];
} XButtonState;
/*******************************************************************
*
* Function definitions.
*
*/
XDevice *XOpenDevice();
XDeviceInfo *XListInputDevices();
XDeviceTimeCoord *XGetDeviceMotionEvents();
KeySym *XGetDeviceKeyMapping();
XModifierKeymap *XGetDeviceModifierMapping();
XFeedbackState *XGetFeedbackControl();
XExtensionVersion *XGetExtensionVersion();
XDeviceState *XQueryDeviceState();
XEventClass *XGetDeviceDontPropagateList();
#endif /* _XINPUT_H_ */