Squeak Class Documentation category index | class index  
 
InputSensor
  category: Kernel-Processes
  superclass: Object
  subclasses: EventSensor

I represent an interface to the user input devices. There is at least one instance of me named Sensor in the system.

instance methods
  accessing
  eventQueue
eventQueue:

  cursor
  currentCursor
currentCursor:
cursorPoint
cursorPoint:
peekPosition

  initialize
  flushEvents
shutDown
startUp

  joystick
  joystickButtons:
joystickOn:
joystickXY:
testJoystick:

  keyboard
  flushKeyboard
kbdTest
keyboard
keyboardPeek
keyboardPressed

  modifier keys
  anyModifierKeyPressed
commandKeyPressed
controlKeyPressed
leftShiftDown
macOptionKeyPressed
rawMacOptionKeyPressed
shiftPressed

  mouse
  anyButtonPressed
blueButtonPressed
mousePoint
noButtonPressed
peekButtons
peekMousePt
redButtonPressed
waitButton
waitButtonOrKeyboard
waitClickButton
waitNoButton
yellowButtonPressed

  private
  buttons
characterForKeycode:
primCursorLocPut:
primCursorLocPutAgain:
primInterruptSemaphore:
primKbdNext
primKbdPeek
primMouseButtons
primMousePt
primReadJoystick:
primSetInterruptKey:
primTabletGetParameters:
primTabletRead:

  tablet
  hasTablet
tabletExtent
tabletPoint
tabletPressure
tabletTimestamp

  user interrupts
  inputProcess
installInterruptWatcher
interruptWatcherProcess
setInterruptKey:
userInterruptWatcher

class methods
  public
  default
startUp

instance methods
  accessing top  
 

eventQueue


 

eventQueue:


  cursor top  
 

currentCursor

The current cursor is maintained in class Cursor.


 

currentCursor:

The current cursor is maintained in class Cursor.


 

cursorPoint

Answer a Point indicating the cursor location.


 

cursorPoint:

Set aPoint to be the current cursor location.


 

peekPosition


  initialize top  
 

flushEvents

Do nothing


 

shutDown


 

startUp


  joystick top  
 

joystickButtons:


 

joystickOn:


 

joystickXY:


 

testJoystick:

Sensor testJoystick: 3


  keyboard top  
 

flushKeyboard

Remove all characters from the keyboard buffer.


 

kbdTest

Sensor kbdTest


 

keyboard

Answer the next character from the keyboard.


 

keyboardPeek

Answer the next character in the keyboard buffer without removing it, or nil if it is empty.


 

keyboardPressed

Answer true if keystrokes are available.


  modifier keys top  
 

anyModifierKeyPressed

ignore, however, the shift keys 'cause that's not REALLY a command key


 

commandKeyPressed

Answer whether the command key on the keyboard is being held down.


 

controlKeyPressed

Answer whether the control key on the keyboard is being held down.


 

leftShiftDown

Answer whether the shift key on the keyboard is being held down. The name of this message is a throwback to the Alto, which had independent left and right shift keys.


 

macOptionKeyPressed

Answer whether the option key on the Macintosh keyboard is being held down. Macintosh specific.


 

rawMacOptionKeyPressed

Answer whether the option key on the Macintosh keyboard is being held down. Macintosh specific. Clients are discouraged from calling this directly, since it circumvents bert's attempt to eradicate option-key checks


 

shiftPressed

Answer whether the shift key on the keyboard is being held down.


  mouse top  
 

anyButtonPressed

Answer whether a mouse button is being pressed.


 

blueButtonPressed

Answer whether only the blue mouse button is being pressed. This is the third mouse button or cmd+click on the Mac.


 

mousePoint

Answer a Point indicating the coordinates of the current mouse location.


 

noButtonPressed

Answer whether any mouse button is not being pressed.


 

peekButtons


 

peekMousePt


 

redButtonPressed

Answer true if the red mouse button is being pressed. This is the first mouse button.


 

waitButton

Wait for the user to press any mouse button and then answer with the
current location of the cursor.


 

waitButtonOrKeyboard

Wait for the user to press either any mouse button or any key.
Answer the current cursor location or nil if a keypress occured.


 

waitClickButton

Wait for the user to click (press and then release) any mouse button and
then answer with the current location of the cursor.


 

waitNoButton

Wait for the user to release any mouse button and then answer with the
current location of the cursor.


 

yellowButtonPressed

Answer whether only the yellow mouse button is being pressed. This is the second mouse button or option+click on the Mac.


  private top  
 

buttons


 

characterForKeycode:

Map the given keycode to a Smalltalk character object. Encoding:
A keycode is 12 bits: <4 modifer bits><8 bit ISO character>
Modifier bits are: <command><option><control><shift>


 

primCursorLocPut:

If the primitive fails, try again with a rounded point.


 

primCursorLocPutAgain:

Do nothing if primitive is not implemented.


 

primInterruptSemaphore:

Primitive. Install the argument as the semaphore to be signalled whenever the user presses the interrupt key. The semaphore will be signaled once each time the interrupt key is pressed.


 

primKbdNext


 

primKbdPeek


 

primMouseButtons


 

primMousePt

Primitive. Poll the mouse to find out its position. Return a Point. Fail if
event-driven tracking is used instead of polling. Optional. See Object
documentation whatIsAPrimitive.


 

primReadJoystick:

Return the joystick input word for the joystick with the given index in the range [1..16]. Returns zero if the index does not correspond to a currently installed joystick.


 

primSetInterruptKey:

Primitive. Register the given keycode as the user interrupt key. The low byte of the keycode is the ISO character and its next four bits are the Smalltalk modifer bits <cmd><opt><ctrl><shift>.


 

primTabletGetParameters:

Answer the pen tablet parameters. For parameters that differ from cursor to cursor, answer those associated with the cursor having the given index. Answer nil if there is no pen tablet. The parameters are:
1. tablet width, in tablet units
2. tablet height, in tablet units
3. number of tablet units per inch
4. number of cursors (pens, pucks, etc; some tablets have more than one)
5. this cursor index
6. and 7. x scale and x offset for scaling tablet coordintes (e.g., to fit the screen)
8. and 9. y scale and y offset for scaling tablet coordintes (e.g., to fit the screen)
10. number of pressure levels
11. presure threshold needed close pen tip switch
12. number of pen tilt angles


 

primTabletRead:

Answer the pen tablet data for the cursor having the given index. Answer nil if there is no pen tablet. The data is:
1. index of the cursor to which this data applies
2. timestamp of the last state chance for this cursor
3., 4., and 5. x, y, and z coordinates of the cursor (z is typically 0)
6. and 7. xTilt and yTilt of the cursor; (signed)
8. type of cursor (0 = unknown, 1 = pen, 2 = puck, 3 = eraser)
9. cursor buttons
10. cursor pressure, downward
11. cursor pressure, tangential
12. flags


  tablet top  
 

hasTablet

Answer true if there is a pen tablet available on this computer.


 

tabletExtent

Answer the full tablet extent in tablet coordinates.


 

tabletPoint

Answer the current position of the first tablet pointing device (pen, puck, or eraser) in tablet coordinates.


 

tabletPressure

Answer the current pressure of the first tablet pointing device (pen, puck, or eraser), a number between 0.0 (no pressure) and 1.0 (max pressure)


 

tabletTimestamp

Answer the time (in tablet clock ticks) at which the tablet's primary pen last changed state. This can be used in polling loops; if this timestamp hasn't changed, then the pen state hasn't changed either.


  user interrupts top  
 

inputProcess

For non-event image compatibility


 

installInterruptWatcher

Initialize the interrupt watcher process. Terminate the old process if any.


 

interruptWatcherProcess

Answer my interrupt watcher process, if any


 

setInterruptKey:

Register the given keycode as the user interrupt key.


 

userInterruptWatcher

Wait for user interrupts and open a notifier on the active process when one occurs.


class methods
  public top  
 

default

Answer the default system InputSensor, Sensor.


 

startUp

This message is sent to registered classes when the system is coming up.