6.13.2 Mouseless Model Resources
Each Mouseless semantic action mapping and its corresponding key binding is determined by
the value of a resource. The default key bindings are based on the Sun Type-4 keyboard. The
bindings occur when applications are initialized and xv_init() reads the resource names.
Appendix C, Mouseless Model Keyboard Mappings, lists all of the Mouseless resources,
grouped according to the values loaded for the three different mouseless model modes: Sun-
View1, Basic, and Full. Section 6, Command-line Arguments and XView Resources, in the
XView Reference Manual, lists all XView resources alphabetically (all the mouseless
resources begin with OpenWindows.KeyboardCommand.) Mouseless model resources
use the following naming conventions:
OpenWindows.KeyboardCommand. XViewSemanticAction
XViewSemanticAction is the name of the XView semantic action without its ACTION_ prefix
(note that the capitalization for the action is also changed and the underscore characters “_”
are deleted). For example:
OpenWindows.KeyboardCommand.JumpRight: period+Ctrl
corresponds to binding the semantic action ACTION_JUMP_RIGHT to period modified by the
Control character.
Each resource may define several mappings for an individual action. Multiple mappings are
separated by “,” and have the following general format:
mapping[,mapping...]
The following resource definition is an example:
OpenWindows.KeyboardCommand.FindBackward: F+Meta,L9+Shift
Each Mouseless mapping is of the form:
KeysymName[+Modifier . . . ]
In other words, each mapping is separated by a comma, and if the keysym is modified, then
each modifier is separated by a plus sign. A modifier is either “Shift,” “Ctrl,” “Alt,” or
“Meta.”
When an alphabetic character is the keysym, the case of the KeysymName is important. For
uppercase characters, use the uppercase alphabetic keysyms, for example L, instead of the
lowercase with a “Shift” modifier. When an alphabetic character is not modified by shift, then
use the lowercase alphabetic keysym (for example, l+Meta). Do not list unmodified
ASCII
keyboard commands should not be listed.
6.13.3 Using the Mouseless Model
If the keyboard is used to control the locator, then the window manager, XView packages,
and your XView applications handle the keyboard’s mouseless semantic events. This section
describes the roles of the window manager and the individual XView applications.
Handling Input
Handling Input 145
6.13.3.1 The role of the window manager
Using the mouseless model, the window manager intercepts the following actions:
• Actions that change the input focus between windows or to the workspace.
• Actions that accelerate window menu operations.
• Actions that toggle the pushpin.
These three categories include the actions shown in Table 6-4.
Table 6-4. Mouseless Actions Handled by the Window Manager
Back Front
Open Close
Dismiss Window Properties
Toggle Pushpin Go To Workspace
Refresh Quit
Move Resize
Full Size Restore size
Next Window Previous Window
Last Window Next Application
Previous Application Bring Up Window Menu
Jump Input Focus To Mouse Jump To Workspace Background
Bring Up Workspace Menu?
6.13.3.2 Application responsibilities
Applications are responsible for displaying the location cursor and for handling navigation in
canvases (for example, non-text data panes). Interaction with the location cursor is described
in the following section. The semantic action,
ACTION_PANE_BACKGROUND (JumpToPane-
Background), also needs to be handled by XView applications.
Applications can use the unmodified ASCII keyboard commands that are intercepted by the
mouseless model by accessing the appropriate XView variables as shown in Table 6-2.
6.13.4 The Location Cursor
The Location Cursor is a borderless frame subwindow that indicates the locator position
when the mouseless model is set to Basic or Full. When the location cursor is moved to a
new pane and it is assigned the same colormap segment and background color as that pane.
The location cursor is created when the frame is created.
146 XView Programming Manual
Frame subwindows access the handle of the Location Cursor window with the following call:
xv_get(frame, FRAME_FOCUS_WIN)
Initially, the Location Cursor is created unmapped (XV_SHOW is FALSE). When a frame
subwindow receives a KBD_USE, it calls the function frame_kbd_use().
frame_kbd_use() sets the FRAME_FOCUS_WIN’s colormap segment (WIN_CMS) and back-
ground color (WIN_BACKGROUND_COLOR) to be the same as the subwindow. If the subwin-
dow then needs to display the Location Cursor, it sets the WIN_PARENT for the
FRAME_FOCUS_WIN to its paint window. It also needs to position the XV_X and XV_Y to the
appropriate position and then set
XV_SHOW to TRUE.
Note that text fields and panes have a caret to indicate input focus and position, so they
would not display the Location Cursor window. The XV_X and XV_Y coordinates are relative
to the subwindow’s paint window. When a subwindow receives KBD_DONE, it sets the
XV_SHOW to FALSE for the FRAME_FOCUS_WIN.
The Location Cursor either points up or to the right. This is controlled by setting
FRAME_FOCUS_DIRECTION on the frame to either of the values FRAME_FOCUS_UP or
FRAME_FOCUS_RIGHT.
On pop-up menus, it is the application’s responsibility to pass a valid x,y coordinate in the
event structure when the event is the keyboard MENU command, as in the following:
(event_action(event) == ACTION_MENU && !event_is_button(event))
This action is necessary because the ACTION_MENU could be the result of a key press, in
which case the cursor could be anywhere on the screen.
6.13.5 Events
Since keyboard events have a dual role when using the mouseless model, applications must
use semantic actions instead of event ID’s to control their application. This is required since
an ASCII event ID could also be a mouseless semantic action.
6.14 Using Accelerators
Accelerators permit applications to define notify procedures that are called for specific
events. For example, a particular key combination might be used to quit the application. For
Version 3.2, XView supports Menu accelerators. Refer to Appendix D of Version 3.2 and the
File Chooser for details on using menu accelerators.
To implement window-level accelerators, use the attributes FRAME_ACCELERATOR and
FRAME_X_ACCELERATOR. These attributes are set on the frame containing the window where
the accelerator is defined. FRAME_ACCELERATOR associates an accelerator with an event
code. FRAME_X_ACCELERATOR associates an accelerator with an X keysym.
Handling Input
Handling Input 147
The first value for the attribute FRAME_ACCELERATOR is the event code for an unmodified key
(not shifted) that when combined with the Meta modifier, forms the key sequence for the
accelerator. Similarly, the first value for the attribute FRAME_X_ACCELERATOR is an X
keysym instead of an event code.
The second value for both FRAME_ACCELERATOR and FRAME_X_ACCELERATOR is the acceler-
ator notify routine to call when the accelerator is used. This routine is a user-defined call-
back with the following form:
void
accelerator_notify_proc(value, event)
Xv_opaque value;
Event *event;
The parameter value is the value passed as the third argument to FRAME_ACCELERATOR or
FRAME_X_ACCELERATOR. In this example, the value is an Xv_opaque that passed to the
accelerator notify procedure. Usually this is an XView object handle. For example, if you
want to accelerate a PANEL_BUTTON, if you set value to the button item handle, then you
could set the accelerator notify procedure to be the same as the button’s notify procedure as
in the following example:
xv_set(frame,
FRAME_ACCELERATOR, ’b’, file_btn_notify_proc, file_button,
NULL);
For accelerators to work, you need to set OpenWindows.KeyboardCommands to Full.
For more details on setting this resource, refer to Section 6.13, “The Mouseless Model.”
NOTE
Certain key combinations are reserved for semantic actions within XView and
should not be used for accelerators. These key combinations are listed in
Appendix C, Mouseless Model Keyboard Mappings.
148 XView Programming Manual
This page intentionally left blank
to preserve original page counts.
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.