Docsity

Human Computer Interaction: Understanding UI Layer and Event-Driven Architecture, Lecture notes of Human-Computer Interaction Design

Toggle sidebar
bg1
MODULE No: 5
IT86A-HUMAN COMPUTER INTERACTION
ISABELA STATE UNIVERSITY – ILAGAN CAMPUS
Page | 70
USER INTERACE LAYER
Topic:
1. Understanding UI Layer and Its Execution Framework
2. Input and Output at the Low Level
3. Processing the Input and Generating Output
a. Events, UI Object and Event Handlers
b. Event Driven Program Structure
c. Output
Objectives:
• Discuss UI layer and framework
• Discuss Event Driven Input and Output Structures
• Demonstrate how UI frameworks operate according to
event driven
Content
1. Understanding the UI Layer and Its Execution Framework
Interactive applications are implemented and executed using
the user interface (UI) software layers (collectively the UI
layer). The UI layer refers to a set of software that
operates above the core operating system (and underneath the
application). It encapsulates and exposes system functions
for,
✓ Fluid input and output (I/O)
✓ Facilitation of development of I/O functionalities (in
the form of an application programming
interface/library [API] or toolkit)
✓ Run-time management of graphical applications and UI
elements often manifested as windows or graphical user
interface (GUI) elements (in the form of separate
application often called the window manager)
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Human Computer Interaction: Understanding UI Layer and Event-Driven Architecture and more Lecture notes Human-Computer Interaction Design in PDF only on Docsity!

IT86A-HUMAN COMPUTER INTERACTION

Page | 70 USER INTERACE LAYER Topic:

1. Understanding UI Layer and Its Execution Framework

2. Input and Output at the Low Level

3. Processing the Input and Generating Output

a. Events, UI Object and Event Handlers

b. Event Driven Program Structure

c. Output

Objectives:

• Discuss UI layer and framework

• Discuss Event Driven Input and Output Structures

• Demonstrate how UI frameworks operate according to

event driven

Content

1. Understanding the UI Layer and Its Execution Framework Interactive applications are implemented and executed using the user interface (UI) software layers (collectively the UI layer). The UI layer refers to a set of software that operates above the core operating system (and underneath the application). It encapsulates and exposes system functions for, ✓ Fluid input and output (I/O) ✓ Facilitation of development of I/O functionalities (in the form of an application programming interface/library [API] or toolkit) ✓ Run-time management of graphical applications and UI elements often manifested as windows or graphical user interface (GUI) elements (in the form of separate application often called the window manager)

IT86A-HUMAN COMPUTER INTERACTION

Page | 71 Since most interfaces are graphical, the UI layer uses a two- or three-dimensional (2-D or 3 - D) graphical system based on which GUI elements are implemented (lower part of Figure 5.1). The UI layer is largely composed of (a) an API for creating and managing the user interface elements (e.g., windows, buttons, menus) and (b) a window manager to allow users to operate and manage the applications through its own user interfaces. Figure 5.1 illustrates the UI layer as part of the system software in many computing platforms. The user interacts with the window/ GUI-based applications using various input and output devices. At the same time, aside from the general applications, the user interacts with the computer and manages multiple application windows/ tasks (e.g., resizing, focusing, cutting and pasting, etc.) using the (background running) window manager. The window manager is regarded as both an application and API. User applications are developed using the APIs that represent abstracted I/O-related functionalities of the UI layer, such as those for window managing (resizing, iconifying, dragging, copy and paste, etc.), GUI elements and widgets (windows, menus, buttons, etc.), and basic windowing (creating/destroying window, deactivating window, etc.). These APIs are abstracted from the even lower-level

IT86A-HUMAN COMPUTER INTERACTION

Page | 73 At a higher level, the I/O operation is often described in terms of events and event handlers, which is in fact an abstraction of the lower level interrupt mechanism. This is generally called the event-driven architecture in which programs are developed in terms of events (such as mouse clicks, gestures, keyboard input, etc.) and their corresponding handlers. Such information can be captured in the form of a table and used for efficient execution. Figure 5.2 shows the rather complicated interrupt mechanism abstracted into the form of a simple event handler table.

3. Processing the Input and Generating Output 1. Events, UI Objects, and Event Handlers The diagram in Figure 5.1 is the nominal software architecture for developing interactive computing systems. How does it work exactly? In other words, how is the user/device input processed, and how does the application (with the help of the UI layer) generate output? Central to its overall interworking are events, UI objects, and event handlers. The most basic UI object in today’s visually oriented UI system would be the window (or layer). A window is a rectangular portion of the screen associated with a given application that is used as a space and channel for interacting with the application. Other UI objects include buttons, menus, icons, forms, dialog boxes, text boxes, and so forth. These are often referred to as GUI objects or widgets. Most typically, GUI-based interactive applications would have a top window that includes all other UI objects or widgets that are logically and/ or spatially subordinate to it (Figure 5.3). With the current operating systems mostly supporting concurrency, separate windows/widgets for concurrent applications can coexist, overlapping with one another so that they can be switched to the current focus. That is, when there are multiple windows (and one mouse/keyboard), the user carries out an action to designate the active or current window in focus to which the input events will be channeled. Two major methods for focusing are (a) click-to-type and (b) move-to-type. In the former, the user has to

IT86A-HUMAN COMPUTER INTERACTION

Page | 74 explicitly click on the window before making input into it (regardless of the mouse position, the last object that was clicked on will be the one in focus), and in the latter, the window over which the mouse cursor hovers becomes the focus. The move-to-type method is generally regarded as less convenient because of the likelihood of unintended focus change due to accidental mouse movements.

IT86A-HUMAN COMPUTER INTERACTION

Page | 76 (e.g., in the case of an event activated by a mouse or a stylus). These events are put into a queue by the operating system (or the windowing system) and dispatched (or dequeued), e.g., according to the current focus (to be directed to the target program or process), to invoke its corresponding handler. Note that an event does not necessarily correspond exactly just to an individual physical input. The stream of raw inputs may be filtered and processed to form/find meaningful input sequences from the current context. For instance, a sequence of raw inputs may form a meaningful event such as a double-click command, keyboard commands with modifiers (e.g., ctrl- alt-del), and mouse enter/exit commands (e.g., detection of mouse cursor leaving a particular window). Figure 5.5 shows the two-tier event-queuing system in greater detail. There is the system-level event- queuing system that dispatches the events at the top application level. Each application or process also typically manages its own event queue, dispatching them to its own UI objects. The proper event is captured by the UI object as it traverses down the application’s hierarchical UI structure, e.g., from top to bottom. Figures 5.4 and 5.5 illustrate this process. Then the event handler (also sometimes called

IT86A-HUMAN COMPUTER INTERACTION

Page | 77 the callback function) associated with the UI object is activated in response to the event that is captured. The events do not necessarily have to be generated externally by the interaction devices; indeed, sometimes they are generated internally for special purposes (these are sometimes called the pseudo- events). For instance, when a window is resized, in addition to the resizing event itself, the internal content of the window must be redrawn, and the same goes for the other windows occluded or newly revealed by the resized window. Special pseudo-events are enqueued and conveyed to the respective applications/windows. In the case of resizing/hiding/activating and redrawing of windows, it is the individual application’s responsibility, rather than the window manager’s, to update its display contents, because only the respective applications have the knowledge of how to update their content. Thus a special redraw pseudo-event is sent to the application with information about which region is to be updated (Figure 5.6). The window content might need to be redrawn not because of the window management commands such as resizing and window activation, but due to the needs of the application itself, which can generate special pseudo-events for redrawing parts of its own window. More generally, UI objects can generate pseudo-events for creating chain effects. For example, when a scroll bar is moved, both the window content and the scroll bar position have to be updated

IT86A-HUMAN COMPUTER INTERACTION

Page | 79

3. Output Interactive behavior that is purely computational will simply be carried out by executing the event-handler procedure. However, response to an event or application behavior is often manifested by explicit visual, aural, and haptic/tactile output as well. In many cases, the event handlers only compute for the

IT86A-HUMAN COMPUTER INTERACTION

Page | 80 response behavior and for needed changes in data or new output in a chosen modality (e.g., visual, aural, haptic, tactile, etc.). A separate step for refreshing the display based on the changed screen data is called as the last part of the event-processing loop. Analogous processes will be called for sending commands to output devices of other modalities as well (see the last line in Figure 5.7). Sometimes, with multimodal output, the outputs in different modalities need to be synchronized (e.g., output visual and aural feedback at the same, or nearly the same, time). However, not many interactive programming frameworks or toolkits offer provisions for such a situation. While internal computation takes relatively little time (in most cases), processing and sending the new/changed data to the display devices can take a significant amount of time. For instance, a heavy use of 3 - D graphic objects can be computationally expensive (e.g., on a mobile device without a graphics subsystem), and this can become a bottleneck in the event-processing loop, thereby reducing interactivity. Thus sometimes rendering and sensing parts can be separated into independent threads and processed at different rates to ensure realtime interactivity. Summary In this chapter, we looked at the inner workings of the general underlying software structure (UI layer or UI execution framework) on which interactive programs operate. Most UI frameworks operate in similar ways according to an event-driven structure. The hardware input devices generate events that are conveyed to the software interfaces (i.e., UI objects), and they are processed to produce output by the event-handling codes. The UI layer sitting above the operating system (OS) provides the computational framework for such an event-driven processing model and makes useful abstractions of the lower OS details for easier and intuitive interactive software and interface development.