XView object handles. For xv_get(), only the XView object handle should be passed as
an argument. It will return a ptr to the callback function.
SERVER_EXTERNAL_XEVENT_PROC and SERVER_EXTERNAL_XEVENT_MASK can be set in any
order. Each attribute can be temporarily disabled then re-enabled later without having to set
the other attribute. Setting the first argument of SERVER_EXTERNAL_XEVENT_PROC to NULL
will disable the callback for the object specified as the second argument.
The callback set using SERVER_EXTERNAL_XEVENT_PROC may be called back for an X event
that was not specified using SERVER_EXTERNAL_XEVENT_MASK. The reason being is that
other objects within the toolkit or application may select for X events on the same window.
When these events are delivered, it is difficult to map the X event back to X masks, in turn
making it difficult to determine who selected them. Thus the toolkit lets the application
determine if it wants to use the event or not.
6.12 Soft Function Keys and Virtual Keyboards
This section describes the soft function keys and virtual keyboards.
OPEN LOOK encourages
applications to use the function keys for tasks specific to the individual application. The soft
function key labels are configurable for each application and provide application-specific
labels for the function keys. Soft function keys allow “function keys” to be selected from an
on-screen panel using the mouse. Thus, the number of function keys an application uses is
not tied to a particular keyboard, since the on-screen window can display all the function
keys. A pop-up window shows the function keys with labels configured specifically for the
window that has the keyboard focus.
Virtual keyboards allow users to configure the keyboard to match any of the supported inter-
national keyboards. For detailed descriptions of the soft function keys and Virtual keyboards
features, refer to Chapter 14 in the OPEN LOOK GUI Functional Specification.
6.12.1 Soft Function Keys
Provided an application does not use hard-wired function key bindings, the soft function keys
feature provides a portable method for labeling, displaying and selecting an application’s
function keys. To display the function keys, a user selects “Function Keys” from the
Workspace menu under Utilities. The function keys window appears at the bottom of the
screen as shown in Figure 6-1.
Figure 6-1. A sample function keys window
140 XView Programming Manual
When the input focus changes to a window that uses the function keys, the function keys
window is updated to reflect the new set of functions (only if the application is using the soft
function keys). If an application uses more functions than a particular keyboard provides, it
is the application’s responsibility to provide a “More” label on one of the function keys.
When the “More” key is selected, the application should show the additional labels for the
remaining functions keys, as is shown in Figure 6-2.
Figure 6-2. Sample function keys window with a MORE key
Labels for the soft function keys are specified using the WIN_SOFT_FNKEY_LABELS attribute.
The following example shows how to set soft function keys for a canvas application:
canvas = (Canvas) xv_create (frame,CANVAS,
CANVAS_X_PAINT_WINDOW,TRUE,
NULL);
xv_set(canvas_paint_window(canvas),
WIN_FNSOFT_KEY_LABELS,"Red\nGreen\nBlue\nMaroon\nOrchid\n
Violet\nMagenta\nCoral\nTurquoise\n
Yellow\nBrick\nBlack\n",
WIN_EVENT_PROC, my_Event_proc,
NULL);
The value for the WIN_SOFT_FNKEY_LABELS is a string of 12 labels, with each label
separated by \n.” In this example, whenever the canvas gets the input focus, the soft func-
tion key labels are updated to “Red, Green, Blue . . . .”
Individual applications maintain the banks of labels for their soft function keys. The “More”
key indicates to the application that it is necessary to update the WIN_SOFT_FNKEY_LABELS
value. XView provides the method for labeling the soft function keys on the screen. The
application needs to provide the functionality for each of the function keys whose labels it
defines.
An application that uses more than 12 function keys should label the 12th function key
“More.” When the application receives notification that the 12th function key or the 12th
function key button on the screen has been selected, then WIN_SOFT_FNKEY_LABELS should
be reset to change the labels for the additional function keys. The new bank should also have
a “More” key to toggle back to the first bank, or to the next bank of function keys if one is
available. The application also needs to adjust its response to reflect the “new” function
keys, corresponding to the new labels.
Handling Input
Handling Input 141
6.12.2 Virtual Keyboards
Virtual keyboards are an XView feature that allows users to reconfigure their keyboards.
Keyboards can be logically configured to any of the international keyboards supported by
OpenWindows.
6.12.2.1 Multiple language support
Pressing the Language key, R2 by default, presents the user with a choice of all the supported
international keyboards (the key binding for the language key is defined by the OpenWin-
dows.KeyboardCommands.Translate resource.) A set of soft function keys allows a
user to select a Virtual keyboard. When a keyboard is selected from the function keys, the
keybindings are displayed on-screen as is shown in Figure 6-3.
Figure 6-3. Sample virtual keyboard binding
Selecting a character set and the Set key from the soft function keys binds a character set to
the physical keyboard. Holding down the Language key and typing temporarily binds the
currently selected character set to the physical keyboard. When the Language key is released,
the currently set character set is restored.
6.13 The Mouseless Model
The mouseless input model allows users to run applications on an OPEN LOOK desktop with-
out using a mouse. Thus, XView gives two options for the locator device: first, the standard
mouse or other locator device, and alternatively, the mouseless model, which lets the user
navigate between and select objects on the desktop using keyboard commands.
This section covers the mouseless model implementation, including:
Mouseless model semantic actions.
Keyboard command resource binding.
142 XView Programming Manual
The resource OpenWindows.KeyboardCommands controls the level of mouseless opera-
tion. This resource may have one of three values:
SunView1 Defines only those keyboard commands that were present using SunView1.
This is the default setting and defines actions for basic operations such as
CUT, COPY, and PASTE.
Basic Enables the SunView1 commands, plus the mouseless model Local Naviga-
tion and Text Editing commands. Using this setting, only objects that nor-
mally take the input focus will accept input focus.
Full Enables all mouseless model keyboard commands and depending on the
application or window manager enables display of the special mouseless
model Location Cursor which indicates the current pointer position. Using
this setting, all objects that can normally be manipulated with the mouse
can accept input focus. Thus, actions that are normally performed with the
mouse and its buttons may be performed using the keyboard instead.
When the mouseless model is in use (OpenWindows.KeyboardCommands set to Full),
applications are responsible for displaying the Location Cursor. The Location Cursor is
described in detail in Section 6.13.4.
6.13.1 Keyboard Command Mapping
Each mouseless keyboard command is assigned an XView semantic action, each of which
has an
ACTION_
prefix. Appendix C, Mouseless Model Keyboard Mappings, lists all of the
mouseless semantic actions and the corresponding event ID for each semantic action.
Depending on the value of the resource OpenWindows.KeyboardCommands, which
determines the level of mouseless operation, some or all of these mouseless semantic events
are handled internally by XView packages, by the window manager, or by individual applica-
tion programs.
Most of the mouseless keyboard commands are mapped to a combination of a modifier key
and a standard key. As described earlier in this chapter, the modifier keys include the left and
right Shift keys, the Control key, and the Meta key. The Alt key is also a modifier key for the
mouseless model (on some X servers, Alt is mapped to Meta). Sun Type-4 keyboard map-
ping, several mouseless keyboard commands map directly to unmodified
ASCII characters.
These unmodified commands are defined with the semantic action ACTION_NULL_EVENT.
Table 6-2 shows the mouseless keyboard commands that are mapped to
ACTION_NULL_EVENT
. The contents of the specified XView variable contain the value of the
specified resource. To process one of these commands, check to see if the event_id of the
Event equals the value of one of the XView variables. If so, then the event will be
translated to the corresponding ACTION_ command.
Handling Input
Handling Input 143
Table 6-2. Mouseless Keyboard Commands with Action
ACTION_NULL_EVENT
Default
Command Resource Value XView Variable
CANCEL keyboard.cancel Escape xv_iso_cancel
DEFAULT_ACTION keyboard.defaultAction Return xv_iso_default
_action
INPUT_FOCUS_HELP keyboard.inputFocusHelp ? xv_iso_input
_focus_help
NEXT_ELEMENT keyboard.nextElement Tab xv_iso_next
_element
SELECT keyboard.select Space xv_iso_select
XView mouseless semantic action names are also mapped to provide SunView1 keyboard
functions under XView. Most of the SunView1 navigation and editing commands do not
conflict with the mouseless model. However, there are a few commands that do conflict.
Table 6-3 shows the SunView1 commands that conflict with the mouseless model.
Table 6-3. SunView1 Commands That Conflict with the Mouseless Model
Key Combination SunView1 Command Mouseless Command Resolution
Ctrl-Tab SELECT_FIELD_FORWARD NEXT_ELEMENT Moved
Shift-Ctrl-Tab SELECT_FIELD_BACKWARD PREVIOUS_ELEMENT Moved
Shift-Ctrl-/ GO_WORD_BACKWARD INPUT_FOCUS_HELP Moved
Home GO_DOCUMENT_START LINE_START Moved
End GO_DOCUMENT_END LINE_END Moved
PgUp (R9) GO_PAGE_BACKWARD PANE_START Dropped
PgDn (R15) GO_PAGE_FORWARD PANE_END Dropped
Shift-Up UP SELECT_UP Moved
Shift-Down DOWN SELECT_DOWN Moved
Shift-Left LEFT SELECT_LEFT Moved
Shift-Right RIGHT SELECT_RIGHT Moved
The values in the “Resolution” field have the following meaning:
Dropped means that the specified SunView1 functionality is not available in XView.
Moved means that the SunView1 functionality is available in XView, but a different key
combination is used than in SunView1.
144 XView Programming Manual

Get Volume 7A: XView Programming Manual now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.