COMMENT @----------------------------------------------------------------------

	Copyright (c) GeoWorks 1989-1994 -- All Rights Reserved

PROJECT:	PC GEOS
FILE:		input.def

DECLARER:	Kernel

DESCRIPTION:
	This file defines keyboard constants

	$Id: input.def,v 1.1 97/04/04 14:23:02 newdeal Exp $

------------------------------------------------------------------------------@

SetDef	__INPUT

include char.def
include graphics.def
UseLib  hwr.def			; for InkPoint

StartKernel

;-----------------------------------------------------------------------------
;		PC GEOS Character Value codes
;-----------------------------------------------------------------------------

if DBCS_PCGEOS

;-----------------------------------------------------------------------------
;	DBCS -- All characters are part of the Chars etype.
;		Under Unicode, 0xe000 - 0xf7ff is a private use zone
;		We use 0xee00-0xeeff for non-printable keys.
;		We use 0xef00-0xefff for special UI functions.
;-----------------------------------------------------------------------------
CharSet			etype	byte
CS_LATIN_1		enum CharSet, 0x00
CS_CONTROL_HB		enum CharSet, 0xee
CS_UI_FUNCS_HB		enum CharSet, 0xef

else
;-----------------------------------------------------------------------------
;		SBCS
;-----------------------------------------------------------------------------

CharacterSet etype byte
CS_BSW		enum CharacterSet, 0x00	;Extended BSW set (printable) (Chars)
CS_CONTROL	enum CharacterSet, 0xff	;Control codes (non-printable) (VChar)
		
CS_UI_FUNCS 	enum CharacterSet, 0xfe ;Special UI functions, not actually key
					;presses, defined in ui.def (UChar)

CS_CALCULATOR	enum CharacterSet, 0xfd ;calc functions (scientific)

VC_ISANSI	= CS_BSW
VC_ISCTRL	= CS_CONTROL
VC_ISUI		= CS_UI_FUNCS
VC_ISCALC	= CS_CALCULATOR		;Calculator functions (CChar)


; The following represent the low byte of the character value
; only when the high byte is CS_CONTROL:

VChar etype byte

VC_NULL			enum VChar, 0x0	;NULL
VC_CTRL_A		enum VChar, 0x1	;<ctrl>-A
VC_CTRL_B		enum VChar, 0x2	;<ctrl>-B
VC_CTRL_C		enum VChar, 0x3	;<ctrl>-C
VC_CTRL_D		enum VChar, 0x4	;<ctrl>-D
VC_CTRL_E		enum VChar, 0x5	;<ctrl>-E
VC_CTRL_F		enum VChar, 0x6	;<ctrl>-F
VC_CTRL_G		enum VChar, 0x7	;<ctrl>-G
VC_CTRL_H		enum VChar, 0x8	;<ctrl>-H
VC_CTRL_I		enum VChar, 0x9	;<ctrl>-I
VC_CTRL_J		enum VChar, 0xa	;<ctrl>-J
VC_CTRL_K		enum VChar, 0xb	;<ctrl>-K
VC_CTRL_L		enum VChar, 0xc	;<ctrl>-L
VC_CTRL_M		enum VChar, 0xd	;<ctrl>-M
VC_CTRL_N		enum VChar, 0xe	;<ctrl>-N
VC_CTRL_O		enum VChar, 0xf	;<ctrl>-O
VC_CTRL_P		enum VChar, 0x10	;<ctrl>-P
VC_CTRL_Q		enum VChar, 0x11	;<ctrl>-Q
VC_CTRL_R		enum VChar, 0x12	;<ctrl>-R
VC_CTRL_S		enum VChar, 0x13	;<ctrl>-S
VC_CTRL_T		enum VChar, 0x14	;<ctrl>-T
VC_CTRL_U		enum VChar, 0x15	;<ctrl>-U
VC_CTRL_V		enum VChar, 0x16	;<ctrl>-V
VC_CTRL_W		enum VChar, 0x17	;<ctrl>-W
VC_CTRL_X		enum VChar, 0x18	;<ctrl>-X
VC_CTRL_Y		enum VChar, 0x19	;<ctrl>-Y
VC_CTRL_Z		enum VChar, 0x1a	;<ctrl>-Z
VC_ESCAPE		enum VChar, 0x1b	;ESC

; Extended keyboard codes -- those normally in ASCII ctrl set
; CTRL <key> sequences pressed by user will also be mapped here.

VC_BACKSPACE	=	VC_CTRL_H
VC_TAB		=	VC_CTRL_I
VC_LF		=	VC_CTRL_J
VC_ENTER	=	VC_CTRL_M
VC_BLANK		enum VChar, 0x20	;space

; Numeric keypad keys

VC_NUMPAD_ENTER		enum VChar, 0xd	;* only on PS/2 keyboards
VC_NUMPAD_DIV		enum VChar, '/'	;* only on PS/2 keyboards
VC_NUMPAD_MULT		enum VChar, '*'
VC_NUMPAD_PLUS		enum VChar, '+'
VC_NUMPAD_MINUS		enum VChar, '-'
VC_NUMPAD_PERIOD	enum VChar, '.'
VC_NUMPAD_0		enum VChar, '0'
VC_NUMPAD_1		enum VChar, '1'
VC_NUMPAD_2		enum VChar, '2'
VC_NUMPAD_3		enum VChar, '3'
VC_NUMPAD_4		enum VChar, '4'
VC_NUMPAD_5		enum VChar, '5'
VC_NUMPAD_6		enum VChar, '6'
VC_NUMPAD_7		enum VChar, '7'
VC_NUMPAD_8		enum VChar, '8'
VC_NUMPAD_9		enum VChar, '9'

; Extended keyboard codes -- non-ASCII

VC_F1			enum VChar, 0x80	; Function keys
VC_F2			enum VChar, 0x81
VC_F3			enum VChar, 0x82
VC_F4			enum VChar, 0x83
VC_F5			enum VChar, 0x84
VC_F6			enum VChar, 0x85
VC_F7			enum VChar, 0x86
VC_F8			enum VChar, 0x87
VC_F9			enum VChar, 0x88
VC_F10			enum VChar, 0x89
VC_F11			enum VChar, 0x8a	;* only on PS/2 keyboards
VC_F12			enum VChar, 0x8b	;* only on PS/2 keyboards
VC_F13			enum VChar, 0x8c	;* non-standard key
VC_F14			enum VChar, 0x8d	;* non-standard key
VC_F15			enum VChar, 0x8e	;* non-standard key
VC_F16			enum VChar, 0x8f	;* non-standard key

VC_UP			enum VChar, 0x90	;Cursor keys
VC_DOWN			enum VChar, 0x91
VC_RIGHT		enum VChar, 0x92
VC_LEFT			enum VChar, 0x93
VC_HOME			enum VChar, 0x94	;Scroll commands
VC_END			enum VChar, 0x95
VC_PREVIOUS		enum VChar, 0x96	;page up
VC_NEXT			enum VChar, 0x97	;page down
VC_INS			enum VChar, 0x98	;INS
VC_DEL			enum VChar, 0x9a	;DEL

VC_PRINTSCREEN		enum VChar, 0x9b	;* from <shift>-NUMPAD_MULT
						;Appears as key only on PS/2
VC_PAUSE		enum VChar, 0x9c	;* from <ctrl>-NUMLOCK
						;  Appears as key only on PS/2
VC_BREAK		enum VChar, 0x9e	;* from  <ctrl>- or <alt>-combo
						;  with various keys
VC_SYSTEMRESET		enum VChar, 0x9f	; <ctrl>-<alt>-<del> combo

; Joystick control keys (0xa0 - 0xa9)

VC_JOYSTICK_0		enum VChar, 0xa0	; joystick 0 degrees
VC_JOYSTICK_45		enum VChar, 0xa1	; joystick 45 degrees
VC_JOYSTICK_90		enum VChar, 0xa2	; joystick 90 degrees
VC_JOYSTICK_135		enum VChar, 0xa3	; joystick 135 degrees
VC_JOYSTICK_180		enum VChar, 0xa4	; joystick 180 degrees
VC_JOYSTICK_225		enum VChar, 0xa5	; joystick 225 degrees
VC_JOYSTICK_270		enum VChar, 0xa6	; joystick 270 degrees
VC_JOYSTICK_315		enum VChar, 0xa7	; joystick 315 degrees
VC_FIRE_BUTTON_1	enum VChar, 0xa8	; fire button #1
VC_FIRE_BUTTON_2	enum VChar, 0xa9	; fire button #2

VC_PREV_BUTTON		enum VChar, 0xb0	; PREV key, if supported
VC_NEXT_BUTTON		enum VChar, 0xb1	; NEXT key, if supported

; Shift Keys  (0xe0 - 0xe7)

VC_LALT			enum VChar, 0xe0
VC_RALT			enum VChar, 0xe1
VC_LCTRL		enum VChar, 0xe2
VC_RCTRL		enum VChar, 0xe3
VC_LSHIFT		enum VChar, 0xe4
VC_RSHIFT		enum VChar, 0xe5
VC_SYSREQ		enum VChar, 0xe6	;* Not on base PC keyboard.
						;  On PS/2 keyboards, is
						;  accessed via ALT PRINTSCREEN
VC_ALT_GR		enum VChar, 0xe7

; Toggle state keys (0xe8 - 0xeb)

VC_CAPSLOCK		enum VChar, 0xe8
VC_NUMLOCK		enum VChar, 0xe9
VC_SCROLLLOCK		enum VChar, 0xea

; More extended keyboard codes -- non-ASCII (0xec - 0xef)
VC_LWIN			enum VChar, 0xec
VC_RWIN			enum VChar, 0xed
VC_MENU			enum VChar, 0xee

; Extended state keys (0xf0 - 0xf7)


; Invalid key

VC_INVALID_KEY		enum VChar, 0xff

;-----------------------------------------------------------------------------

;
;  Scientific calculator functions.  They represent the low byte
;  of a character when the high byte is CS_CALCULATOR.
;
CChar	etype	byte
CC_SQRT			enum	CChar, 0x00		; square root
CC_INVERSE		enum	CChar, 0x01		; 1/x
CC_DIFFER		enum	CChar, 0x02		; x != y
CC_STACK		enum	CChar, 0x03
CC_LAST			enum	CChar, 0x04
CC_STO			enum	CChar, 0x05		; memory store
CC_RCL			enum	CChar, 0x06		; memory recall
CC_PLUS_MINUS		enum	CChar, 0x07		; +/-

;-----------------------------------------------------------------------------

endif	; (not) DBCS_PCGEOS

; CharFlags

CharFlags	record
	CF_STATE_KEY:1		;Set if state key (shift/toggle modifier)
	:2
	CF_EXTENDED:1		;TRUE: extended key
	CF_TEMP_ACCENT:1	;Set if temporary accent char
	CF_FIRST_PRESS:1	;Set if initial key press
	CF_REPEAT_PRESS:1	;Set if repeated key press
	CF_RELEASE:1		;Set if key release (may be
				; set in conjunction with the
				; other two, by monitors or
				; UI to lessen # of events)
CharFlags	end


; Toggle State

ToggleState	record
    TS_SHIFTSTICK:1		; SHIFT STICKY-NESS
    TS_ALTSTICK:1		; ALT STICKY-NESS
    TS_CTRLSTICK:1		; CTRL STICKY-NESS
    TS_FNCTSTICK:1		; FNCT STICKY-NESS
		:1		;  errr....
    TS_CAPSLOCK:1		; CAPS LOCK status
    TS_NUMLOCK:1		; NUM LOCK status
    TS_SCROLLLOCK:1		; SCROLL LOCK status
ToggleState	end

if DBCS_PCGEOS

; Format of a keyboard shortcut, as used by the keyboard driver.
;   KS_ALT, KS_CTRL and KS_SHIFT means the keypress must have the
;   corresponding modifiers held down. KS_PHYSICAL means match the key,
;   not the character value. (this basically means ignore CAPSLOCK and
;   NUMLOCK, as the other modifiers still must match).
;   KS_CHAR_SET is the upper four bits of the Chars value.  What this
;   means is that shortcuts can only be defined with characters with
;   a value of the form 0x0### (ie. bits 12-15 are 0).  An exception
;   is made for CS_CONTROL (0xee##).  This means shortcuts cannot
;   be set on Thai (0xe00-0xe7f) and Lao (0xe80-0xeff) characters.

KeyboardShortcut	record
    KS_PHYSICAL:1		;TRUE: match key, not character
    KS_ALT:1			;TRUE: <ALT> must be pressed
    KS_CTRL:1			;TRUE: <CTRL> must be pressed
    KS_SHIFT:1			;TRUE: <SHIFT> must be pressed
    KS_CHAR	Chars:12	;bits 0-11 of Chars
KeyboardShorcut	end

else

; Format of a keyboard shortcut, as used by the keyboard driver.
;   KS_ALT, KS_CTRL and KS_SHIFT means the keypress must have the
;   corresponding modifiers held down. KS_PHYSICAL means match the key,
;   not the character value. (this basically means ignore CAPSLOCK and
;   NUMLOCK, as the other modifiers still must match). KS_CHAR_SET is
;   the lower four bits of the CharacterSet, specifying whether the
;   character is a control character or a printable character. KS_CHAR
;   is the character itself, either in Chars or VChar.

KeyboardShortcut	record
    KS_PHYSICAL:1		;TRUE: match key, not character
    KS_ALT:1			;TRUE: <ALT> must be pressed
    KS_CTRL:1			;TRUE: <CTRL> must be pressed
    KS_SHIFT:1			;TRUE: <SHIFT> must be pressed
    KS_CHAR_SET:4		;lower four bits of CharacterSet
    KS_CHAR	Chars:8		;character itself (Char or VChar)
KeyboardShorcut	end

endif

Button etype byte
BUTTON_0 enum Button
BUTTON_1 enum Button
BUTTON_2 enum Button
BUTTON_3 enum Button

ButtonInfo	record
	BI_PRESS:1
	BI_DOUBLE_PRESS:1
	BI_B3_DOWN:1
	BI_B2_DOWN:1
	BI_B1_DOWN:1
	BI_B0_DOWN:1
	BI_BUTTON Button:2
ButtonInfo	end

;
; State of modifiers as passed to MSG_{BUTTON,PTR,KBD_CHAR,DRAG}
; For those methods, these are the bits not used up in translation
; (eg. if 'E' was returned, the 'shift' modifiers will not be marked)
;
; NOTE: These must be the bits specified (0-7)
;
ShiftState	record
    SS_LALT:1		;Set if left ALT modifier
    SS_RALT:1		;Set if right ALT modifier
    SS_LCTRL:1		;Set if left CTRL modifier
    SS_RCTRL:1		;Set if right CTRL modifier
    SS_LSHIFT:1		;Set if left SHIFT  modifier
    SS_RSHIFT:1		;Set if right SHIFT modifier
    SS_FIRE_BUTTON_1:1	;Set if fire button1 modifier
    SS_FIRE_BUTTON_2:1	;Set if fire button1 modifier
ShiftState	end

;
; Data block format for GWNT_INK notification.
;
InkHeader	struct
	IH_count	word
	; The # ink points collected
	;

	IH_bounds	Rectangle
	; The bounds of the ink on the screen.
	;

	IH_destination	optr
	; The destination of the ink. Objects can use this to determine whether
	; the ink was sent to them directly, or just because it overlapped
	; the screen (actually, this is just a hack so the ink object can
	; handle the case where the active tool is the eraser, but the bonehead
	; user enters ink by drawing on the primary and then overlapping the
	; ink object). This field is set by the flow object.

	IH_reserved	dword
	; Reserved for future use.
	;

	IH_data		label	Point
InkHeader	ends

;
; Flags passed on the stack to gesture callback routine by input manager
; (see UserCreateInkDestinationInfo).
;
GestureCallbackFlags	record
	GCF_FIRST_CALL:1
	;If set, this is the first time the gesture callback routine has
	; been called for this set of user input
	GCF_NUM_STROKES:15
	;The # strokes in the input
GestureCallbackFlags	end

;
; Data block format for GWNT_INK_DIGITIZER_COORDS notification.
;
InkDigitizerCoordsHeader	struct
	IDCH_count	word
	; The number of digitizer coordinates collected

	IDCH_destination	optr
	; The destination of the ink. Objects can use this to determine whether
	; the ink was sent to them directly, or just because it overlapped
	; the screen (actually, this is just a hack so the ink object can
	; handle the case where the active tool is the eraser, but the bonehead
	; user enters ink by drawing on the primary and then overlapping the
	; ink object). This field is set by the flow object.

	IDCH_reserved	dword
	; Reserved for future use.

	IDCH_data	label	InkPoint
InkDigitizerCoordsHeader	ends

;
; sent out to GCNSLT_SCREEN_SAVER_NOTIFICATIONS
;
ScrSaverState record
	SSS_ENABLED:1
	; Set if screen saver is enabled, i.e. allowed to be used.

	SSS_ACTIVE:1
	; Set if screen saver is currently active

	:6
ScrSaverState end


EndKernel
