Archives
 
 
 
  Special
 
 
 
  About Us
 
 
 

Newsletter
Free E-mail Newsletter from BYTE.com

 
    
           
Visit the home page Browse the four-year online archive Download platform-neutral CPU/FPU benchmarks Find information for advertisers, authors, vendors, subscribers Request free information on products written about or advertised in BYTE Submit a press release, or scan recent announcements Talk with BYTE's staff and readers about products and technologies

ArticlesThe Photon Architecture


June 1995 / Features / The Photon Architecture

Why the Photon Programming Model Is Important

It makes windowing programming and windowing behavior more consistent by depicting the behavior of processes and events important to programmers. By contrast, the Microsoft Windows programming model is less coherent. A process (each individual window) doesn't normally receive an event unless it's the active process (the one closest to the user). If you want other processes (other windows in the same application) to respond to events, Windows requires you to find a way to do this. The active window may collect an event and then pass it on to other windows, like prospectors panning for gold. If the first prospector (the process) finds a gold nugget, he or she keeps it; if it is fool's gold, he or she throws it back into the stream for the next prospector. Implemented in a process-by-proces s manner in Windows, this type of solution is natural behavior in Photon.

Event control like this is important for a handwriting-recognition program in a PDA or for data-acquisition and process-control applications. For example, you might want a user-initiated event to change the visual image of an instrument control and also have that event let a process-control driver send a signal to an electronic control.

Programmer's Notes

Programming for Photon centers on initially positioning a region, telling the Photon microkernel which types of events are relevant to the region and then dispatching based on the event received. Photon consists of a single X Window System-like API. The API may consist of four separate libraries: graphics; a Photon Window Manager, which is optional; AppBuilder, a visual C-code application development environment; and widget, the user-interface component. The windows manager can automatically control windows and regions created by applications. The wi ndow manager creates icons, and resizes and repositions process regions within event space.


Event space: conceptually where all Photon processes and events reside.

illustration_link (64 Kbytes)

Photon is not just another GUI. It is an event-driven system that waits for the user (or sometimes the system) to send a signal; it then redirects the signal to the appropriate process or processes. Photon developers control whether and how various processes respond to the same events. This control is a characteristic of Photon's architecture rather than being something that a developer must add. The Photon microkernel is also compact: about 24 KB of code plus 40 KB of data.

Process Regions

Application processes own regions that enable applications and device drivers to interact with the Photon event space. Applications and drivers differ only in how they respond to and generate events.

Every region has two properties that determine how it responds to events--sensitivity and opacity. If a region is sensitive to an event, the process that owns the region collects a copy of the event. If it's insensitive, the event is ignored. If the region is opaque, the event is clipped, or possibly changed in some manner (see the "Clipped Regions" icon). If transparent, the event passes through the region unaltered.

A region may be both sensitive and opaque, which allows the owning process to act as a filter. Such a process might collect a connected sequence of pen events: After a touch pen writes a word, the process performs handwriting recognition and then generates the equivalent keyboard events in the event space. Apple's Newton does handwriting recognition, but not with such a coherent model of operation.

Events

User-generated events begin at the user interface and travel to the root process. Events generated by data a cquisition devices and other outside sources begin at the process collecting them and travel to the user or to another process. Events may intersect with any process region.

Clipped Regions

As an event travels through coordinate space, a part of it may be clipped off by the opaque region of another process. The unclipped part continues through the event space. This means the region modified the event in some way. For example, a draw event travels through the event space and arrives at a graphics driver. Only the unclipped portion of the event will be drawn on screen.

Event Initiators


-- Keystrokes -- Mouse or touchscreen button input -- Mouse or touchscreen pointer movements -- Boundary crossings (moving a window to the foreground or background) -- Drag operations (cut, copy, and paste) -- Drawing functions

User Interface

The programs that run immediately in front of the user.

Device Drivers

These are the enablers of events in Photon. Mouse and keyboard drivers are input drivers; the graphics driver is an output driver. Device drivers run as user programs, which makes it possible to dynamically load drivers when you require them. You can have multiple drivers running in the same coordinate space. For example, multiple graphics drivers can display different portions of the visual output on different screens or even screens on other computers on a network. With Photon, you could drag an application from the screen of a desktop computer to the screen of a PDA.

Up to the Features section contentsGo to previous article: Windows for Control FreaksGo to next article: Get That DataSearchSend a comment on this articleSubscribe to BYTE or BYTE on CD-ROM   Copyright 
Flexible C++
Matthew Wilson
My approach to software engineering is far more pragmatic than it is theoretical--and no language better exemplifies this than C++.

more...

BYTE Digest

BYTE Digest editors every month analyze and evaluate the best articles from Information Week, EE Times, Dr. Dobb's Journal, Network Computing, Sys Admin, and dozens of other CMP publications—bringing you critical news and information about wireless communication, computer security, software development, embedded systems, and more!

Find out more

BYTE.com Store

BYTE CD-ROM
NOW, on one CD-ROM, you can instantly access more than 8 years of BYTE.
 
The Best of BYTE Volume 1: Programming Languages
The Best of BYTE
Volume 1: Programming Languages
In this issue of Best of BYTE, we bring together some of the leading programming language designers and implementors...

Copyright © 2005 CMP Media LLC, Privacy Policy, Your California Privacy rights, Terms of Service
Site comments: webmaster@byte.com
SDMG Web Sites: BYTE.com, C/C++ Users Journal, Dr. Dobb's Journal, MSDN Magazine, New Architect, SD Expo, SD Magazine, Sys Admin, The Perl Journal, UnixReview.com, Windows Developer Network