|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.|
XmtSetFocusToShell(), XmtWarpToShell(), and XmtMoveShellToPointer() provide three different techniques for assigning keyboard focus to a given shell widget. Unfortunately, none of these techniques will work appropriately in all circumstances. XmtFocusShell() is a wrapper function that lets the user choose, through an application resource, which technique should be used.
XmtSetFocusToShell() assigns keyboard focus to the shell by calling XSetInputFocus(). This works well with click-to type window managers, such as mwm, but doesnt 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 another.
XmtWarpToShell() also calls XSetInputFocus(), but first moves the mouse pointer to the center of the specified shell widget with XWarpPointer(). This works well with window managers like twm, but moving the pointer like this can be a very confusing thing to do.
XmtMoveShellToPointer() 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 sites, XmtFocusShell() lets the user or the system administrator choose how focus should be assigned by setting the focusStyle application resource. The table lists the legal values of focusStyle and their meanings. If mwm is running (i.e., if XmIsMotifWMRunning() returns True) then the default value for focusShell is focus. Otherwise the default value is none, since none of the focus methods is always appropriate in this case.
focusStyle XmtFocusShell() Action none Deiconify and raise only; dont attempt to set focus. focus Call XmtSetFocusToShell(). warp Call XmtWarpToShell(). move Call XmtMoveShellToPointer().
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 Windows menu in your application.
Chapter 15, Working with the Window Manager, XmtDeiconifyShell(), XmtRaiseShell().
|Xmt||XMTFOCUSSHELL (3)||Motif Tools|