Client's keybindings and window management
------------------------------------------
-In the client's default window configuration, the window appearing on the left
-sports a list of keybindings available globally, and additionally via the window
-selected as active.
-
-Hit "W" (per default keybindings) to switch the "active" window to a view that
-allows changing its geometry. One more hit on "W" switches the window to a view
-that allows changing its window-specific keybindings. The global keybindings can
-be changed in the "Global keys" window, those of the window geometry
-configuration in the "Window geometry keys" window, and those of the
-window-specific keybindings configuration in the "Window keybinding keys"
-window; by default, these three windows are not visible, but may be turned on by
-(per default keybindings) hitting the "F6", "F7" and "F8" keys.
+Multiple windows may fill the screen. One of these will be selected as "active"
+– identified by dollar signs enclosing its title. Active windows may come with
+window-specific keybindings. Furthermore, global keybindings are available no
+matter what window is selected.
+
+Hit "W" (per default global keybindings) to switch the active window to a view
+that allows changing its geometry. One more hit on "W" switches the window to a
+view that sports (and allows changing its) window-specific keybindings. (One
+further "W" will return the window to its default, "normal" view.) The global
+keybindings are visible (and can be changed) in the "Set global keys" window,
+those of the window geometry configuration in the "Set window geometry keys"
+window, and those of the window-specific keybindings configuration in the "Set
+window keybinding keys" window; by default, the latter two are not visible, but
+may be turned on by (per default keybindings) hitting the keys "F6" and "F7".
Keybindings and default window selection / visibilities / geometries are read
from the textfile ./confclient/interface_conf by default, or by another one
-
KEYBINDINGS 'global'
KEY 81 quit
KEY 87 winconf
KEY 269 to_g_keywin
KEY 270 to_wg_keywin
KEY 271 to_wk_keywin
-KEY 272 to_a_keywin
KEYBINDINGS 'wingeom'
KEY 258 shift_f
KEY 261 map_r
KEY 46 map_c
KEY 70 to_autofocus
-
-WINDOW a
-NAME 'Active window`s keys'
-BREAK 0
-WIDTH 22
-HEIGHT -8
KEY 269 to_g_keywin
KEY 270 to_wg_keywin
KEY 271 to_wk_keywin
-KEY 272 to_a_keywin
KEY 87 winconf
KEY 62 cyc_win_f
KEY 60 cyc_win_b
KEY 261 map_r
KEY 46 map_c
KEY 70 to_autofocus
-
-WINDOW a
-NAME 'Active window`s keys'
-BREAK 0
-WIDTH 22
-HEIGHT -8
KEY 269 to_g_keywin
KEY 270 to_wg_keywin
KEY 271 to_wk_keywin
-KEY 272 to_a_keywin
KEY 87 winconf
KEY 62 cyc_win_f
KEY 60 cyc_win_b
KEY 261 map_r
KEY 46 map_c
KEY 70 to_autofocus
-
-WINDOW a
-NAME 'Active window`s keys'
-BREAK 0
-WIDTH 22
-HEIGHT -8
-
KEY 269 to_g_keywin
KEY 270 to_wg_keywin
KEY 271 to_wk_keywin
-KEY 272 to_a_keywin
KEY 87 winconf
KEY 62 cyc_win_f
KEY 60 cyc_win_b
KEY 261 map_r
KEY 46 map_c
KEY 70 to_autofocus
-
-WINDOW a
-NAME 'Active window`s keys'
-BREAK 0
-WIDTH 22
-HEIGHT -8
-
KEY 269 to_g_keywin
KEY 270 to_wg_keywin
KEY 271 to_wk_keywin
-KEY 272 to_a_keywin
KEY 87 winconf
KEY 62 cyc_win_f
KEY 60 cyc_win_b
BREAK 0
WIDTH 13
HEIGHT -8
-
-WINDOW a
-NAME 'Active window`s keys'
-BREAK 0
-WIDTH 22
-HEIGHT -8
#include "../common/rexit.h" /* exit_err(), exit_trouble() */
#include "../common/try_malloc.h" /* try_malloc() */
#include "keybindings.h" /* struct KeyBindingDB, get_keyname_to_keycode() */
-#include "windows.h" /* yx_uint16, Win, get_win_by_id() */
+#include "windows.h" /* yx_uint16, Win */
#include "world.h" /* global world */
static void add_text_with_linebreaks(struct Win * win, char * text);
static void draw_text_from_bottom(struct Win * win, char * text);
-/* Return a properly formatted keybinding list line for "kb". */
-static char * get_kb_line(struct KeyBinding * kb);
-
/* Draw from line "start" on config view for keybindings defined at "kb". */
static void draw_keybinding_config(struct Win * win, struct KeyBindingDB * kbdb,
uint16_t offset);
-static char * get_kb_line(struct KeyBinding * kb)
-{
- char * keyname = get_keyname_to_keycode(kb->keycode);
- uint16_t size = strlen(keyname) + 3 + strlen(kb->command->dsc_long) + 1;
- char * kb_line = try_malloc(size, __func__);
- int test = sprintf(kb_line, "%s - %s", keyname, kb->command->dsc_long);
- exit_trouble(test < 0, __func__, "sprintf");
- free(keyname);
- return kb_line;
-}
-
-
-
static void draw_keybinding_config(struct Win * win, struct KeyBindingDB * kbdb,
uint16_t offset)
{
}
win->center.y = win->winmap_size.y;
}
- char * kb_line = get_kb_line(&kbdb->kbs[kb_n]);
+ struct KeyBinding kb = kbdb->kbs[kb_n];
+ char * keyname = get_keyname_to_keycode(kb.keycode);
+ uint16_t size = strlen(keyname) + 3 + strlen(kb.command->dsc_long) + 1;
+ char * kb_line = try_malloc(size, __func__);
+ int test = sprintf(kb_line, "%s - %s", keyname, kb.command->dsc_long);
+ exit_trouble(test < 0, __func__, "sprintf");
+ free(keyname);
add_line(win, kb_line, attri, &offset, (kbdb->n_of_kbs == kb_n + 1));
free(kb_line);
}
-extern void draw_win_active_windows_keys(struct Win * win)
-{
- struct Win * win_active = get_win_by_id(world.winDB.active);
- struct KeyBindingDB * kbdb = &win_active->kb;
- if (1 == win_active->view)
- {
- kbdb = &world.kb_wingeom;
- }
- else if (2 == win_active->view)
- {
- kbdb = &world.kb_winkeys;
- }
- uint16_t offset = 0;
- if (0 == kbdb->n_of_kbs)
- {
- add_line(win, "(none)", 0, &offset, 0);
- return;
- }
- uint8_t kb_n;
- for (kb_n = 0; kb_n < kbdb->n_of_kbs; kb_n++)
- {
- char * kb_line = get_kb_line(&kbdb->kbs[kb_n]);
- add_line(win, kb_line, 0, &offset, (0 == kb_n + 1));
- free(kb_line);
- }
-
-}
-
-
-
extern void draw_win_keybindings_global(struct Win * win)
{
win->center.y = world.kb_global.select;
/* Declare hard-coded paths and values here. */
world.path_commands = "confclient/commands";
world.path_interface = "confclient/interface_conf";
- world.winDB.legal_ids = "012cilma";
+ world.winDB.legal_ids = "012cilm";
char * path_server_in = "server/in";
char * path_server_out = "server/out";
#include "../common/try_malloc.h" /* try_malloc() */
#include "draw_wins.h" /* draw_winconf_geometry(), draw_winconf_keybindings(),
* draw_win_inventory(), draw_win_info(), draw_win_log(),
- * draw_win_active_windows_keys(), draw_win_map(),
* draw_win_keybindings_winconf_keybindings(),
* draw_win_keybindings_winconf_geometry(),
- * draw_win_keybindings_global()
+ * draw_win_keybindings_global(), draw_win_map()
*/
#include "wincontrol.h" /* toggle_window() */
#include "world.h" /* world */
if ( match_func(c, &f, 'c', draw_win_inventory)
|| match_func(c, &f, 'i', draw_win_info)
|| match_func(c, &f, 'l', draw_win_log)
- || match_func(c, &f, 'a', draw_win_active_windows_keys)
|| match_func(c, &f, 'm', draw_win_map)
|| match_func(c, &f, '0', draw_win_keybindings_global)
|| match_func(c, &f, '1', draw_win_keybindings_winconf_geometry)