
             The Presentation Manager Single Input Queue
             ===========================================

                                 by

                            Aidon Jennery


The Single Input Queue Fix (SIQFix) enhances performance in OS/2's
Presentation Manager focus switching system.  The focus switching
system brings windows to the foreground and opens or closes windows.
In short, this system ensures that input goes to the window that the
user intended.

Before the SIQFix, the focus switching procedure required, in all
cases, that the window with focus respond to messages before the new
target window receives its messages and gains focus.  If the thread
for the window losing focus is busy doing other work , then the PM
user interface would hang until that thread could process those
messages.  This could hang the user interface for some time while the
user waits or hits Ctrl-Esc.  Ctrl-Esc would set a timer that would
invoke "The application is not responding" dialog and give the user
the opportunity to terminate the offending application.  Sometimes,
for a variety of reasons, the application would not terminate and the
user would be left with an inoperable system due to this suspension of
the user interface.

The SIQFix attempts to alleviate this problem by allowing a set amount
of time for the window losing focus to respond to those messages.
That is, the thread would be dedicated to receiving the "lose focus"
messages before going off to another task.  If the thread processes
the messages within that time, then focus switching occurs as before.
However, if the window does not respond, and a user operation causes
the focus switch (Ctrl-Esc, Alt-Esc or a mouse click on another
window), then the message queue for that window is marked as "bad".
The system literally "rips away" focus from the bad window and gives
it to the new focus window.  If the thread starts processing messages
from its "bad" queue, then the queue is marked as good and the
previously bad window processes the messages that it would have in a
normal loss of focus.

The SIQFix also provides a few other advantages.  It will prevent the
user from trying to switch focus to a window whose queue has been
marked as bad and will also repaint the "bad" windows with an inactive
border and, in some cases, with the default window color.  In
addition, if the user tries to close an application from the task list
that has been marked "bad", then a DosKillProcess forcefully
terminates it.  Before the fix, PM would just send it a WM_QUIT
message (the message used to close applications that are not marked as
"bad").

The SIQFix will be available on future OS/2 product fixpaks.  By
default, the SIQFix is set to off so the system behaves as before.
You can activate the SIQFix by adding the following statement to
CONFIG.SYS.

SET PM_ASYNC_FOCUS_CHANGE=ON

This will enable the SIQFix giving a window 2 seconds (2000 ms) to
respond to the lose focus messages.  To set a custom time-out (for a
time-out of 5000 ms or 5 seconds as an example), use the following
statement:

SET PM_ASYNC_FOCUS_CHANGE=ON 5000

In this manner, you can tune the SIQFix to the system load and normal
application responsiveness.  To disable the SIQFix, just remove the
line from CONFIG.SYS or change it to:

SET PM_ASYNC_FOCUS_CHANGE=OFF


As development of OS/2
continues, we will enhance the SIQFix to address other types of user
interface hangs to provide a more responsive, robust and reliable
operating system.



Aidon Jennery is an Advisory Programmer on IBM's OS/2 Window
Management Development team.

