- change keyboard focus to a shell widget.
void XmtFocusShell(Widget w)
void XmtSetFocusToShell(Widget w)
void XmtWarpToShell(Widget w)
void XmtMoveShellToPointer(Widget w)
- The shell widget that is to have keyboard focus assigned to it, or any
descendant of that widget. The specified shell should be a TopLevelShell,
not an XmDialogShell.
provide three different techniques for
assigning keyboard focus to a given shell widget. Unfortunately, none of these
techniques will work appropriately in all circumstances.
is a wrapper function that lets the user choose,
through an application resource, which technique should be used.
assigns keyboard focus to the shell by calling
. This works well with ``click-to type'' window
managers, such as mwm
, but doesn't work well with ``pointer focus''
window managers like twm
, because it leaves the desktop in an
inconsistent state with the pointer in one window and keyboard focus in
also calls XSetInputFocus()
, but first moves the
mouse pointer to the center of the specified shell widget with
. This works well with window managers like twm
but moving the pointer like this can be a very confusing thing to do.
takes another approach-it moves the shell to the
pointer, rather than the pointer to the shell. Like XmtWarpToShell()
it also calls XSetInputFocus()
. Moving a shell like this is probably
more confusing than moving the pointer is, but can work well if the shell
widget was previously iconified.
All of these functions deiconify the specified shell, if necessary, and raise it
to the top of the window stack.
Since none of the above three functions will be appropriate for all users or all
lets the user or the system administrator choose
how focus should be assigned by setting the focusStyle
resource. The table lists the legal values of focusStyle
meanings. If mwm
is running (i.e., if XmIsMotifWMRunning()
) then the default value for focusShell
. Otherwise the default value is none
, since none of the
focus methods is always appropriate in this case.
||Deiconify and raise only; don't attempt to set focus.
You should almost always use XmtFocusShell()
in your applications instead
of the more specialized functions that it calls. This will make your
applications more customizable and portable.
Remember that the user can also move keyboard focus between windows with the
window manager. You should only call these functions in direct response to a
user request to move the focus-if you reassign focus unexpectedly you will
make the user feel that they have lost control of their desktop. A good time
to call XmtFocusShell()
is when the user has selected a window from a
menu in your application.
Chapter 15, Working with the Window Manager