diff options
author | James Booth <boothj5@gmail.com> | 2016-09-19 23:40:45 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2016-09-19 23:40:45 +0100 |
commit | 0aa758cbfb0ec50b3d2eb6024515442882cdf63c (patch) | |
tree | 1ae80b6e29b9b99f828f910dddc912bbb3e10bf8 /src/command | |
parent | c4d3f19d94e94bb08136e9ecc95ccdad0c76a81d (diff) | |
download | profani-tty-0aa758cbfb0ec50b3d2eb6024515442882cdf63c.tar.gz |
Add /inputwin top|bottom command
closes #853
Diffstat (limited to 'src/command')
-rw-r--r-- | src/command/cmd_ac.c | 13 | ||||
-rw-r--r-- | src/command/cmd_defs.c | 17 | ||||
-rw-r--r-- | src/command/cmd_funcs.c | 16 | ||||
-rw-r--r-- | src/command/cmd_funcs.h | 1 |
4 files changed, 43 insertions, 4 deletions
diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c index cedcadee..917d9db2 100644 --- a/src/command/cmd_ac.c +++ b/src/command/cmd_ac.c @@ -194,6 +194,7 @@ static Autocomplete blocked_ac; static Autocomplete tray_ac; static Autocomplete presence_ac; static Autocomplete presence_setting_ac; +static Autocomplete inputwin_ac; void cmd_ac_init(void) @@ -735,6 +736,10 @@ cmd_ac_init(void) autocomplete_add(presence_setting_ac, "all"); autocomplete_add(presence_setting_ac, "online"); autocomplete_add(presence_setting_ac, "none"); + + inputwin_ac = autocomplete_new(); + autocomplete_add(inputwin_ac, "top"); + autocomplete_add(inputwin_ac, "bottom"); } void @@ -998,6 +1003,7 @@ cmd_ac_reset(ProfWin *window) autocomplete_reset(tray_ac); autocomplete_reset(presence_ac); autocomplete_reset(presence_setting_ac); + autocomplete_reset(inputwin_ac); autocomplete_reset(script_ac); if (script_show_ac) { @@ -1120,6 +1126,7 @@ cmd_ac_uninit(void) autocomplete_free(tray_ac); autocomplete_free(presence_ac); autocomplete_free(presence_setting_ac); + autocomplete_free(inputwin_ac); } static char* @@ -1200,8 +1207,8 @@ _cmd_ac_complete_params(ProfWin *window, const char *const input) } } - gchar *cmds[] = { "/prefs", "/disco", "/room", "/autoping" }; - Autocomplete completers[] = { prefs_ac, disco_ac, room_ac, autoping_ac }; + gchar *cmds[] = { "/prefs", "/disco", "/room", "/autoping", "/inputwin" }; + Autocomplete completers[] = { prefs_ac, disco_ac, room_ac, autoping_ac, inputwin_ac }; for (i = 0; i < ARRAY_SIZE(cmds); i++) { result = autocomplete_param_with_ac(input, cmds[i], completers[i], TRUE); @@ -1250,7 +1257,7 @@ _cmd_ac_complete_params(ProfWin *window, const char *const input) g_hash_table_insert(ac_funcs, "/sendfile", _sendfile_autocomplete); g_hash_table_insert(ac_funcs, "/blocked", _blocked_autocomplete); g_hash_table_insert(ac_funcs, "/tray", _tray_autocomplete); - g_hash_table_insert(ac_funcs, "/presence", _presence_autocomplete); + g_hash_table_insert(ac_funcs, "/presence", _presence_autocomplete); int len = strlen(input); char parsed[len+1]; diff --git a/src/command/cmd_defs.c b/src/command/cmd_defs.c index c98b9bf3..ffc9e901 100644 --- a/src/command/cmd_defs.c +++ b/src/command/cmd_defs.c @@ -1302,6 +1302,23 @@ static struct cmd_t command_defs[] = CMD_NOEXAMPLES }, + { "/inputwin", + parse_args, 1, 1, &cons_inputwin_setting, + CMD_NOSUBFUNCS + CMD_MAINFUNC(cmd_inputwin) + CMD_TAGS( + CMD_TAG_UI) + CMD_SYN( + "/inputwin top", + "/inputwin bottom") + CMD_DESC( + "Where to display the input window.") + CMD_ARGS( + { "top", "Show the input window at the top of the screen." }, + { "bottom", "Show the input window at the bottom of the screen." }) + CMD_NOEXAMPLES + }, + { "/notify", parse_args_with_freetext, 0, 4, NULL, CMD_NOSUBFUNCS diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index f4b597c0..d8562194 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -1662,7 +1662,7 @@ cmd_theme(ProfWin *window, const char *const command, gchar **args) } else { ui_hide_all_room_rosters(); } - ui_redraw(); + ui_resize(); cons_show("Loaded theme: %s", args[1]); } else { cons_show("Couldn't find theme: %s", args[1]); @@ -5523,6 +5523,20 @@ cmd_inpblock(ProfWin *window, const char *const command, gchar **args) } gboolean +cmd_inputwin(ProfWin *window, const char *const command, gchar **args) +{ + if ((g_strcmp0(args[0], "top") == 0) || (g_strcmp0(args[0], "bottom") == 0)) { + prefs_set_string(PREF_INPUTWIN, args[0]); + ui_resize(); + cons_show("Set input window position to %s", args[0]); + } else { + cons_bad_cmd_usage(command); + } + + return TRUE; +} + +gboolean cmd_log(ProfWin *window, const char *const command, gchar **args) { char *subcmd = args[0]; diff --git a/src/command/cmd_funcs.h b/src/command/cmd_funcs.h index 4d0f4a86..cae68f59 100644 --- a/src/command/cmd_funcs.h +++ b/src/command/cmd_funcs.h @@ -149,6 +149,7 @@ gboolean cmd_wrap(ProfWin *window, const char *const command, gchar **args); gboolean cmd_time(ProfWin *window, const char *const command, gchar **args); gboolean cmd_resource(ProfWin *window, const char *const command, gchar **args); gboolean cmd_inpblock(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_inputwin(ProfWin *window, const char *const command, gchar **args); gboolean cmd_encwarn(ProfWin *window, const char *const command, gchar **args); gboolean cmd_script(ProfWin *window, const char *const command, gchar **args); gboolean cmd_export(ProfWin *window, const char *const command, gchar **args); |