Input (part 2: input models)

Similar documents
Fall UI Design and Implementation 1

UI Software Organization

Input: Implementing Interaction Techniques as Finite State Machines

Event Dispatch. Interactor Tree Lightweight vs. Heavyweight Positional Dispatch Focus Dispatch. 2.4 Event Dispatch 1

Event Dispatch. Interactor Tree Lightweight vs. Heavyweight Positional Dispatch Focus Dispatch. Event Architecture. A pipeline: Event Capture

User Interaction. User Interaction. Input devices. Input devices. Input devices GUIs and GUI design Event-driven programming 3D interaction

Event Dispatch. Dispatching events to windows and widgets.

Model-view-controller View hierarchy Observer

Graphical User Interface (GUI)

MOBILE COMPUTING 1/20/18. How many of you. CSE 40814/60814 Spring have implemented a command-line user interface?

Graphical User Interface (GUI)

Organization of User Interface Software

Asynchronous Programming

Widget. Widget is a generic name for parts of an interface that have their own behaviour. e.g., buttons, progress bars, sliders, drop-down

CS 4300 Computer Graphics

(Refer Slide Time: 02.06)

GUI Software Architecture

Windows and Events. created originally by Brian Bailey

CMSC434. Introduction to Human-Computer Interaction. Week 10 Lecture 16 Mar 29, 2016 Engineering Interfaces II. Jon

Lecture 9: UI Software Architecture. Fall UI Design and Implementation 1

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming

Karlen Communications Add Accessible PowerPoint Placeholders. Karen McCall, M.Ed.

Excel Basics Rice Digital Media Commons Guide Written for Microsoft Excel 2010 Windows Edition by Eric Miller

Part 1: Understanding Windows XP Basics

ORGANIZING YOUR ARTWORK WITH LAYERS

Past: Making physical memory pretty

CPSC 213. Introduction to Computer Systems. I/O Devices, Interrupts and DMA. Unit 2a Oct 27, 29, 31. Winter Session 2014, Term 1

We will talk about Alt-Tab from the usability perspective. Think about: - Is it learnable? - Is it efficient? - What about errors and safety?

Input: Interaction Techniques

You ll notice at the bottom of the file menu there is a list of recently opened files. You can click a file name in the list to re-open that file.

Input part 3: Interaction Techniques

(Refer Slide Time 00:01:09)

GUI s and Keyboards. Larry Rudolph March 13, Pervasive Computing MIT SMA 5508 Spring 2006 Larry Rudolph

Java GUI Testing Tools

Binary Trees

!! What is virtual memory and when is it useful? !! What is demand paging? !! When should pages in memory be replaced?

Graphical User Interfaces 2

Exploring Processing

Lab 4. Out: Friday, February 25th, 2005

Fall UI Design and Implementation 1

Citrix Connectivity Help. Table of Contents

Let s Make a Front Panel using FrontCAD

Programming Robots with ROS, Morgan Quigley, Brian Gerkey & William D. Smart

Example Programs. COSC 3461 User Interfaces. GUI Program Organization. Outline. DemoHelloWorld.java DemoHelloWorld2.java DemoSwing.

This quiz is closed book, closed notes. You have 80 minutes to complete it. Your name:

SCHEME 7. 1 Introduction. 2 Primitives COMPUTER SCIENCE 61A. October 29, 2015

GUI Program Organization. Sequential vs. Event-driven Programming. Sequential Programming. Outline

Getting Started with HCA and Insteon

CS 251 Intermediate Programming GUIs: Event Listeners

CS370 Operating Systems

AADL Graphical Editor Design

CS 465 Program 4: Modeller

implementation support

SubArctic UI Toolkit User's Manual St. Paul Release (Beta version 0.8e) Table of Contents

MicroSurvey Users: How to Report a Bug

PHOTOSHOP New File. To create a new file, select File > New and a dialog box will open.

Instructions for Crossword Assignment CS130

What is a Fraction? Fractions. One Way To Remember Numerator = North / 16. Example. What Fraction is Shaded? 9/16/16. Fraction = Part of a Whole

CSE502: Computer Architecture CSE 502: Computer Architecture

PROJECT 6: PINTOS FILE SYSTEM. CS124 Operating Systems Winter , Lecture 25

Getting Started with HCA and X10

Basic Computer and Mouse Skills Windows 10

Input part 3: Implementing Interaction Techniques

Arduino IDE Friday, 26 October 2018

COPYRIGHTED MATERIAL. Starting Strong with Visual C# 2005 Express Edition

Midterm Exam, October 24th, 2000 Tuesday, October 24th, Human-Computer Interaction IT 113, 2 credits First trimester, both modules 2000/2001

Get comfortable using computers

SlickEdit Gadgets. SlickEdit Gadgets

UI Toolkits. HCID 520 User Interface Software & Technology

Extensible Input Handling in the subarctic Toolkit

Processes and Non-Preemptive Scheduling. Otto J. Anshus

Changing How the Keyboard Works in Windows 7

1 5,9,2,7,6,10,4,3,8,1 The first number (5) is automatically the first number of the sorted list

ECE 550D Fundamentals of Computer Systems and Engineering. Fall 2017

Introduction to Spreadsheets

Lecture 10: Input, Interaction & callbacks. CITS 3003 Graphics & Animation

FACULTY AND STAFF COMPUTER FOOTHILL-DE ANZA. Office Graphics

MIDIPoet -- User's Manual Eugenio Tisselli

BE PROACTIVE USE REACTIVE

Object-Oriented Analysis and Design Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology-Kharagpur

Chapter 5 - Input / Output

Human Computer Interaction Lecture 08 [ Implementation Support ] Implementation support

6.033 Spring 2015 Lecture #11: Transport Layer Congestion Control Hari Balakrishnan Scribed by Qian Long

Customize Your Environment

Getting Started with HCA and UPB

Carrara Enhanced Remote Control (ERC)

EXCEL + POWERPOINT. Analyzing, Visualizing, and Presenting Data-Rich Insights to Any Audience KNACK TRAINING

CSE 331 Software Design & Implementation

The NetBeans IDE is a big file --- a minimum of around 30 MB. After you have downloaded the file, simply execute the file to install the software.

Week 5, continued. This is CS50. Harvard University. Fall Cheng Gong

UI Toolkits. HCID 520 User Interface Software & Technology

B+ Tree Review. CSE332: Data Abstractions Lecture 10: More B Trees; Hashing. Can do a little better with insert. Adoption for insert

Java GUI Design: the Basics

9 Using Appearance Attributes, Styles, and Effects

BONE CONTROLLER ASSET VERSION 0.1 REV 1

CPS221 Lecture: Threads

CS301 - Data Structures Glossary By

All Paging Schemes Depend on Locality. VM Page Replacement. Paging. Demand Paging

COMP asynchronous buses April 5, 2016

Discussion 2C Notes (Week 9, March 4) TA: Brian Choi Section Webpage:

Transcription:

Input (part 2: input models)

Dealing with diversity Saw lots of diversity in devices actual details of devices (e.g., device drivers) is a real pain how do we deal with the diversity? Need a model (abstraction) for input like file systems abstract disks higher level & device independent 2

Logical device approach One approach logical devices A logical device is characterized by its software interface (only) the set of values it returns Rest of semantics (how it operates) fixed by category of device or left to the particular device 3

Logical device approach Fixed set of categories old Core Graphics standard had 6 keyboard, locator, valuator, button pick, stroke If actual device is missing, device is simulated in software valuator => simulated slider 3D locator => 3 knobs 1st step towards today s interactors 4

Logical device approach Abstraction provided by logical device model is good But abstracts away too many details (some are important) example: mouse vs. pen on palm pilot Both are locators What s the big difference? 5

Not a success but.. Still useful to think in terms of what information is returned Categorization of devices useful Two broad classes emerged Event devices Sampled devices 6

Categorization of devices Event devices Time of input is determined by user Best example: button When activated, creates an event record (record of significant action) 7

Categorization of devices Sampled devices Time of input is determined by the program Best example: valuator or locator Value is constantly updated Might best think of as continuous Program asks for current value when it needs it 8

A unified model Anybody see a way to do both major types of devices in one model? 9

A unified model: the event model Model everything as events Sampled devices are handled with incremental change events Each measurable change in value produces an event containing the new value Program can keep track of the current value if it wants to sample 10

Simulating sampling under the event model of input Can cause problems lots of little events Can fall behind if doing a lot of computation/redraw for every event machines are fast, blah blah blah but can get behind (sampling provided built in throttling) 11

The event input model Almost all systems now use this An event is an indication that something potentially significant has just happened in our case user action on input device but, can be generalized 12

The event input model Event records are data structures (or objects) that record relevant facts about an event generally just called events Event records often passed to an event handler routine sometimes just encode relevant facts in parameters instead of event record Terminology redux: Swing calls these event handlers listeners; in other systems they are callbacks 13

Relevant facts What do we need to know about each event? 14

Relevant facts What Where When Value Additional Context 15

What What (exactly) caused the event e.g., left mouse button went down for method based systems this may be implicit in what handler gets called 16

Where Where was the primary locator (mouse) when event happened x,y position also, inside what window, object, etc. this is specific to GUIs, but it;s critical e.g., can t tell what mouse button down means without this 17

When When did the event occur Typically are dealing with events from the (hopefully recent) past queued until program can get to them In absolute time or relative to some start point Hopefully at resolution of 10s of ms important for e.g., double-clicks 18

Value Input value e.g., ASCII value of key press e.g., value of valuator some inputs don t have a value e.g. button press 19

Additional context Status of important buttons shift, control, and other modifiers possibly the mouse buttons 20

Example: Swing events Reuses and borrows heavily from AWT (it has to) A pretty generic / typical event model Lots (and lots) of hierarchy. Example: java.lang.object java.util.eventobject Object getsource() java.awt.awtevent int getid() java.awt.event.componentevent Component getcomponent() java.awt.event.inputevent int getmodifiers(); long getwhen() java.awt.event.mouseevent int getbutton(); int getclickcount(); Point getpoint();... 21

Common methods in Swing events What getid() -- code for kind of event getclickcount() -- mouse only, indicates double-click, etc. Where getsource(), getcomponent() -- component that event is in getx(), gety(), getpoint() -- location relative to that component When getwhen() -- timestamp in milliseconds Value getkeychar(), getkeycode() -- get information about keypresses (for example) getmodifiers() -- were shift, ctrl, meta,... held down? 22

Extending the event model Events can extend past simple user inputs Extra processing of raw events to get higher level events window / object enter & exit list selection rearrangement of the interactor hierarchy Can extend to other things of significance arrival of network traffic 23

Extending the event model Window systems typically introduce a number of events window enter/exit region enter/exit system tracks mouse internally so code acts only at significant points Redraw / damage events Resize & window move events 24

Synchronization and events The user and the system inherently operate in parallel asynchronously Means different programming model for applications (asynchronous callbacks) Means special work for toolkit/window system implementations This is a producer consumer problem user produces events system consumes them 25

Synchronization and events Need to deal with asynchrony both parties need to operate when they can but can t apply concurrency control techniques to people How do we handle this? 26

Synchronization and events Use a queue (buffer) between Producer Buffer Consumer As long as buffer doesn t overflow, producer does not need to block Consumer operates on events when it can 27

Implications of queued events We are really operating on events from the past hopefully the recent past But sampled input is from the present mixing them can cause problems e.g. inaccurate position at end of drag 28

Using events from an event queue Basic paradigm of event driven program can be summed up with one prototypical control flow Will see several variations, but all on the same theme 29

Using events from an event queue Main_event_loop() init(); set_input_interests(); repeat evt = wait_for_event(); case evt of dispatch evt -- send to some object end case; redraw_screen(); until done; 30

Using events from an event queue Very stylized code in fact, generally you don t even get to write it often only provide system with routines/methods to call for dispatch repeat evt = wait_for_event(); user_object.handle_event(evt); redraw_screen(); until done; 31

Using events from an event queue Two big questions: What object(s) gets the event? What does it do with it? Interpret it based on what the event is, what the object is, and what state the object is in 32

Dispatch strategies: what object gets the event Simple approach lowest object in interactor tree that overlaps the position in event gets it if that object doesn t want it, try its parent, etc. Bottom first dispatch strategy 33

Dispatch strategies: what object gets the event Can also do top-first root gets it has chance to act on it, or modify it then gives to overlapping child has another chance to act on it if child (and its children) doesn t take it more flexible (get top-first & bottom-first) 34

But a problem with fixed dispatch strategies like this Does this work for everything? 35

But a problem with fixed dispatch strategies like this Does this work for everything? What about key strokes? Should these be dispatched based on cursor location? Probably not Probably want them to go to current text focus 36

Two major ways to dispatch events Positional dispatch Event goes to an object based on position of the event Focus-based dispatch Event goes to a designated object (the current focus) no matter where the mouse is pointing 37

Question Would mouse events be done by focus or positional dispatch? 38

Question & answer Would mouse events be done by focus or positional dispatch? It depends painting: use positional dragging an object: need focus (why?) 39

Dragging an object needs focus dispatch Why? What if we have a big jump? Object New mouse position Previous mouse position Cursor now outside the object and it doesn t get the next event! 40

Positional and focus based dispatch Will need both Will need a flexible way to decide which one is right will see this again later, for now just remember that sometimes we need one, sometimes another 41

Positional dispatch If we are dispatching positionally, need a way to tell what object(s) are under a location Picking 42

Picking Probably don t want to pick on the basis of a point (single pixel) Why? 43

Picking Probably don t want to pick on the basis of a point (single pixel) Why? Because it requires a lot of accuracy Instead may want to pick anything within a small region around the cursor 44

Implementing pick Possible to apply a clipping algorithm small clip region around cursor pick anything that is not completely clipped away 45

Implementing pick Better is a recursive pick traversal Walk down the object tree Each object does a local test customized to its shape, state (enabled or not), and semantics Also tests its children recursively 46

Pick ambiguity Classic problem, what if multiple things picked? Two types Hierarchical ambiguity are we picking the door knob, the door, the house, or the neighborhood? 47

Pick ambiguity Spatial ambiguity Which door are we picking? 48

Solutions for pick ambiguity No silver bullet, but two possible solutions Strong typing (use dialog state) Not all kinds of objects make sense to pick at a given time Turn off pickability for unacceptable objects reject pick during traversal 49

Solutions for pick ambiguity Get the user involved direct choice typically slow and tedious pick one, but let the user reject it and/or easily back out of it often better feedback is critical 50

51