31.1.5 Localized Input State

The only differing point in this model over win3 or pm is that input ownership is assigned at user input time – when the input is created – instead of when the input is read out of the system queue (win3 model). This change in the order of event processing affects the function significantly, mostly because multiple apps may be processing input simultaneously (input backlog, for example). This means all those input-synchronized states (like keyboard state, focus state, mouse capture state, active state, etc) can no longer be input-synchronized globally. It would be worthless for one of the applications if two applications called SetCapture simultaneously, for example. There are much better examples.

For this reason, each thread has its own input-synchronized state information. In other words, each thread has its own input-synchronized picture of what the mouse capture is, what the active window is, which window has the focus, etc.

The input system splits up input states into two camps (and they are different kinds of state):

Local thread based state (thread synchronized state) This state reflects this thread's current input synchronized state, and refers to objects owned by this thread only.

focus window

active window

capture window

key state table, etc.

User synchronized state. This state reflects what the user sees, which is:

Which window is on top

Which window is active

Which window is receiving input

These are very different kinds of state. `User synchronized state' is simply which application the user has told the system to direct input to. Thread synchronized state is that state local to that thread only. Thread states change as that thread processes its own input.

The user's job is to direct input at any application on the screen. The system's job is to ensure that the user can do this. An application itself is usually only concerned with its localized state (whether it has the focus, whether it is active, etc). An app is almost never interested in which window the user is directing input to. Therefore, the current host of functions will set/return thread specific input-synchronized state only.