From 56c0c533e3f2d8b01be16eecdafa39dc6ebb4e32 Mon Sep 17 00:00:00 2001 From: James Booth Date: Thu, 8 Sep 2016 00:36:11 +0100 Subject: [PATCH 1/7] Disable C plugins on Cygwin --- configure.ac | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/configure.ac b/configure.ac index d0f6ee14..ab395741 100644 --- a/configure.ac +++ b/configure.ac @@ -96,19 +96,23 @@ else fi # c -LT_INIT -if test "x$enable_plugins" = xno; then +if test "x$PLATFORM" = xcygwin; then AM_CONDITIONAL([BUILD_C_API], [false]) -elif test "x$enable_c_plugins" != xno; then - AC_CHECK_LIB([dl], [main], - [AM_CONDITIONAL([BUILD_C_API], [true]) LIBS="$LIBS -ldl" AC_DEFINE([HAVE_C], [1], [C support])], - [AS_IF( - [test "x$enable_c_plugins" = xyes], - [AC_MSG_ERROR([dl library needed to run C plugins])], - [AM_CONDITIONAL([BUILD_C_API], [false])]) - ]) else - AM_CONDITIONAL([BUILD_C_API], [false]) + LT_INIT + if test "x$enable_plugins" = xno; then + AM_CONDITIONAL([BUILD_C_API], [false]) + elif test "x$enable_c_plugins" != xno; then + AC_CHECK_LIB([dl], [main], + [AM_CONDITIONAL([BUILD_C_API], [true]) LIBS="$LIBS -ldl" AC_DEFINE([HAVE_C], [1], [C support])], + [AS_IF( + [test "x$enable_c_plugins" = xyes], + [AC_MSG_ERROR([dl library needed to run C plugins])], + [AM_CONDITIONAL([BUILD_C_API], [false])]) + ]) + else + AM_CONDITIONAL([BUILD_C_API], [false]) + fi fi # threading From af53ca8f6c63fe58f60958cedd53b3ef469fd37f Mon Sep 17 00:00:00 2001 From: Dmitry Podgorny Date: Thu, 8 Sep 2016 11:44:06 +0300 Subject: [PATCH 2/7] configure.ac: remove outdated xml parser info --- configure.ac | 1 - 1 file changed, 1 deletion(-) diff --git a/configure.ac b/configure.ac index ab395741..5c26bbca 100644 --- a/configure.ac +++ b/configure.ac @@ -309,7 +309,6 @@ echo "AM_CFLAGS : $AM_CFLAGS" echo "AM_CPPFLAGS : $AM_CPPFLAGS" echo "AM_LDFLAGS : $AM_LDFLAGS" echo "LIBS : $LIBS" -echo "XML Parser : $PARSER" echo "Install themes : $THEMES_INSTALL" echo "Themes path : $THEMES_PATH" echo "Icons path : $ICONS_PATH" From 8b83e79992b6dcd1f3b905bb0d41f53ba574a311 Mon Sep 17 00:00:00 2001 From: James Booth Date: Tue, 13 Sep 2016 00:47:54 +0100 Subject: [PATCH 3/7] Remove -fv flags from autoreconf --- bootstrap.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bootstrap.sh b/bootstrap.sh index 9b6b39f7..abae7294 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,3 +1,4 @@ #!/bin/sh -autoreconf -fiv +mkdir -p m4 +autoreconf -i $@ From 6d274ba846caea15be4f9089235a72000f59a5eb Mon Sep 17 00:00:00 2001 From: James Booth Date: Wed, 14 Sep 2016 22:13:06 +0100 Subject: [PATCH 4/7] Release 0.5.0 --- Makefile.am | 2 +- configure.ac | 2 +- install-all.sh | 216 ------------------------------------------------- 3 files changed, 2 insertions(+), 218 deletions(-) delete mode 100755 install-all.sh diff --git a/Makefile.am b/Makefile.am index 3e4473c3..754e2deb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -186,7 +186,7 @@ themes_sources = themes/* icons_sources = icons/* -script_sources = bootstrap.sh configure-debug install-all.sh +script_sources = bootstrap.sh configure-debug man_sources = docs/profanity.1 diff --git a/configure.ac b/configure.ac index 5c26bbca..5c20b9ff 100644 --- a/configure.ac +++ b/configure.ac @@ -26,7 +26,7 @@ AS_CASE([$host_os], [cygwin], [PLATFORM="cygwin"], [PLATFORM="nix"]) -PACKAGE_STATUS="development" +PACKAGE_STATUS="release" ### Get git branch and revision if in development if test "x$PACKAGE_STATUS" = xdevelopment; then diff --git a/install-all.sh b/install-all.sh deleted file mode 100755 index 37e3c9de..00000000 --- a/install-all.sh +++ /dev/null @@ -1,216 +0,0 @@ -#!/bin/bash - -set -o errtrace - -STATUS=development - -error_handler() -{ - ERR_CODE=$? - echo "Error $ERR_CODE with command '$BASH_COMMAND' on line ${BASH_LINENO[0]}. Exiting." - exit $ERR_CODE - -} - -trap error_handler ERR - -debian_prepare() -{ - echo - echo Profanity installer ... updating apt repositories - echo - sudo apt-get update - - echo - echo Profanity installer... installing dependencies - echo - sudo apt-get -y install git automake autoconf libssl-dev libexpat1-dev libncursesw5-dev libglib2.0-dev libnotify-dev libcurl3-dev libxss-dev libotr5-dev libreadline-dev libtool libgpgme11-dev libgtk2.0-dev autoconf-archive - -} - -fedora_prepare() -{ - echo - echo Profanity installer... installing dependencies - echo - - sudo dnf -y install gcc git autoconf automake openssl-devel expat-devel ncurses-devel glib2-devel libnotify-devel libcurl-devel libXScrnSaver-devel libotr-devel readline-devel libtool gpgme-devel gtk2-devel autoconf-archive -} - -opensuse_prepare() -{ - echo - echo Profanity installer...installing dependencies - echo - sudo zypper -n in gcc git automake make autoconf libopenssl-devel expat libexpat-devel ncurses-devel glib2-devel libnotify-devel libcurl-devel libXScrnSaver-devel libotr-devel readline-devel libtool libgpgme-devel autoconf-archive -} - -centos_prepare() -{ - echo - echo Profanity installer...installing dependencies - echo - - sudo yum -y install epel-release - sudo yum -y install git - sudo yum -y install gcc autoconf automake cmake - sudo yum -y install openssl-devel expat-devel ncurses-devel glib2-devel libnotify-devel libcurl-devel libXScrnSaver-devel libotr-devel readline-devel libtool gpgme-devel autoconf-archive -} - -cygwin_prepare() -{ - echo - echo Profanity installer... installing dependencies - echo - - if ! command -v apt-cyg &>/dev/null; then cyg_install_apt_cyg; fi - if [ -n "$CYG_MIRROR" ]; then - apt-cyg -m $CYG_MIRROR install git make gcc-core m4 automake autoconf pkg-config openssl-devel libexpat-devel zlib-devel libncursesw-devel libglib2.0-devel libcurl-devel libidn-devel libssh2-devel libkrb5-devel openldap-devel libgcrypt-devel libreadline-devel libgpgme-devel libtool libpcre-devel libisl10 libcloog-isl4 autoconf-archive - else - apt-cyg install git make gcc-core m4 automake autoconf pkg-config openssl-devel libexpat-devel zlib-devel libncursesw-devel libglib2.0-devel libcurl-devel libidn-devel libssh2-devel libkrb5-devel openldap-devel libgcrypt-devel libreadline-devel libgpgme-devel libtool libpcre-devel libisl10 libcloog-isl4 autoconf-archive - - fi -} - -install_lib_mesode() -{ - echo - echo Profanity installer... installing libmesode - echo - git clone https://github.com/boothj5/libmesode.git - cd libmesode - ./bootstrap.sh - ./configure --prefix=$1 - make - sudo make install - - cd .. -} - -install_profanity() -{ - echo - echo Profanity installer... installing Profanity - echo - if [ "${STATUS}" = "development" ]; then - ./bootstrap.sh - fi - ./configure - make - sudo make install -} - -cyg_install_apt_cyg() -{ - echo - echo Profanity installer... installing apt-cyg - echo - wget https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg - #wget --no-check-certificate https://raw.github.com/boothj5/apt-cyg/master/apt-cyg - #wget http://apt-cyg.googlecode.com/svn/trunk/apt-cyg - chmod +x apt-cyg - mv apt-cyg /usr/local/bin/ - -} -cyg_install_lib_mesode() -{ - echo - echo Profanity installer... installing libmesode - echo - git clone https://github.com/boothj5/libmesode.git - cd libmesode - ./bootstrap.sh - ./bootstrap.sh # second call seems to fix problem on cygwin - ./configure --prefix=/usr - make - make install - - cd .. -} - -cyg_install_profanity() -{ - echo - echo Profanity installer... installing Profanity - echo - if [ "${STATUS}" = "development" ]; then - ./bootstrap.sh - fi - ./configure - make - make install -} - -cleanup() -{ - echo - echo Profanity installer... cleaning up - echo - - echo Removing libmesode repository... - rm -rf libmesode - - echo - echo Profanity installer... complete! - echo - echo Type \'profanity\' to run. - echo -} - -while getopts m: opt -do - case "$opt" in - m) CYG_MIRROR=$OPTARG;; - esac -done - -OS=`uname -s` -DIST=unknown - -if [ "${OS}" = "Linux" ]; then - if [ -f /etc/fedora-release ]; then - DIST=fedora - elif [ -f /etc/debian_version ]; then - DIST=debian - elif [ -f /etc/centos-release ]; then - DIST=centos - elif [ -f /etc/os-release ]; then - DIST=opensuse - fi -else - echo $OS | grep -i cygwin - if [ "$?" -eq 0 ]; then - DIST=cygwin - fi -fi - -case "$DIST" in -unknown) echo The install script will not work on this OS. - echo Try a manual install instead. - exit - ;; -fedora) fedora_prepare - install_lib_mesode /usr - install_profanity - ;; -debian) debian_prepare - install_lib_mesode /usr - install_profanity - ;; -opensuse) opensuse_prepare - install_lib_mesode /usr/local - sudo /sbin/ldconfig - install_profanity - ;; -centos) centos_prepare - install_lib_mesode /usr - sudo ldconfig - install_profanity - ;; -cygwin) cygwin_prepare - cyg_install_lib_mesode - cyg_install_profanity - ;; -esac - -cleanup From 751d9624c3802f019a298d000fd35fcede52c08e Mon Sep 17 00:00:00 2001 From: James Booth Date: Fri, 16 Sep 2016 00:03:23 +0100 Subject: [PATCH 5/7] Set to development version 0.5.1 --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 5c20b9ff..3b0ad0be 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. -AC_INIT([profanity], [0.5.0], [boothj5web@gmail.com]) +AC_INIT([profanity], [0.5.1], [boothj5web@gmail.com]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_SRCDIR([src/main.c]) @@ -26,7 +26,7 @@ AS_CASE([$host_os], [cygwin], [PLATFORM="cygwin"], [PLATFORM="nix"]) -PACKAGE_STATUS="release" +PACKAGE_STATUS="development" ### Get git branch and revision if in development if test "x$PACKAGE_STATUS" = xdevelopment; then From c4d3f19d94e94bb08136e9ecc95ccdad0c76a81d Mon Sep 17 00:00:00 2001 From: James Booth Date: Mon, 19 Sep 2016 00:27:28 +0100 Subject: [PATCH 6/7] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 64c9b1ef..a0fd02e6 100644 --- a/README.md +++ b/README.md @@ -15,3 +15,5 @@ Homepage: http://www.profanity.im Chat room: profanitydev@conference.jabber.org Mailing List: https://groups.google.com/forum/#!forum/profanitydev + +Plugins repository: https://github.com/boothj5/profanity-plugins From 0aa758cbfb0ec50b3d2eb6024515442882cdf63c Mon Sep 17 00:00:00 2001 From: James Booth Date: Mon, 19 Sep 2016 23:40:45 +0100 Subject: [PATCH 7/7] Add /inputwin top|bottom command closes #853 --- src/command/cmd_ac.c | 13 ++++++-- src/command/cmd_defs.c | 17 +++++++++++ src/command/cmd_funcs.c | 16 +++++++++- src/command/cmd_funcs.h | 1 + src/config/preferences.c | 5 ++++ src/config/preferences.h | 1 + src/config/theme.c | 4 ++- src/ui/console.c | 9 ++++++ src/ui/inputwin.c | 9 +++++- src/ui/statusbar.c | 16 ++++++++-- src/ui/titlebar.c | 18 +++++++++++- src/ui/ui.h | 1 + src/ui/window.c | 57 ++++++++++++++++++++++++++++++------ tests/unittests/ui/stub_ui.c | 1 + theme_template | 1 + themes/bios | 1 + themes/boothj5 | 1 + themes/boothj5_slack | 1 + themes/complex | 1 + themes/forest | 3 ++ themes/original | 3 ++ themes/simple | 1 + 22 files changed, 162 insertions(+), 18 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]); @@ -5522,6 +5522,20 @@ cmd_inpblock(ProfWin *window, const char *const command, gchar **args) return TRUE; } +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) { 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); diff --git a/src/config/preferences.c b/src/config/preferences.c index 2cd5e304..de75008e 100644 --- a/src/config/preferences.c +++ b/src/config/preferences.c @@ -1211,6 +1211,7 @@ _get_group(preference_t pref) case PREF_RESOURCE_MESSAGE: case PREF_ENC_WARN: case PREF_INPBLOCK_DYNAMIC: + case PREF_INPUTWIN: case PREF_TLS_SHOW: case PREF_CONSOLE_MUC: case PREF_CONSOLE_PRIVATE: @@ -1443,6 +1444,8 @@ _get_key(preference_t pref) return "resource.message"; case PREF_INPBLOCK_DYNAMIC: return "inpblock.dynamic"; + case PREF_INPUTWIN: + return "inputwin.position"; case PREF_ENC_WARN: return "enc.warn"; case PREF_PGP_LOG: @@ -1571,6 +1574,8 @@ _get_default_string(preference_t pref) case PREF_CONSOLE_PRIVATE: case PREF_CONSOLE_CHAT: return "all"; + case PREF_INPUTWIN: + return "bottom"; default: return NULL; } diff --git a/src/config/preferences.h b/src/config/preferences.h index 621b1760..67f3e1e4 100644 --- a/src/config/preferences.h +++ b/src/config/preferences.h @@ -132,6 +132,7 @@ typedef enum { PREF_RESOURCE_TITLE, PREF_RESOURCE_MESSAGE, PREF_INPBLOCK_DYNAMIC, + PREF_INPUTWIN, PREF_ENC_WARN, PREF_PGP_LOG, PREF_TLS_CERTPATH, diff --git a/src/config/theme.c b/src/config/theme.c index 0133b1f6..d4494e58 100644 --- a/src/config/theme.c +++ b/src/config/theme.c @@ -150,6 +150,8 @@ theme_init(const char *const theme_name) g_hash_table_insert(defaults, strdup("roster.room.trigger"), strdup("green")); g_hash_table_insert(defaults, strdup("roster.room.mention"), strdup("green")); g_hash_table_insert(defaults, strdup("occupants.header"), strdup("yellow")); + + _load_preferences(); } gboolean @@ -427,7 +429,7 @@ _load_preferences(void) _set_string_preference("roster.rooms.by", PREF_ROSTER_ROOMS_BY); _set_string_preference("roster.private", PREF_ROSTER_PRIVATE); _set_string_preference("roster.count", PREF_ROSTER_COUNT); - + _set_string_preference("inputwin.position", PREF_INPUTWIN); if (g_key_file_has_key(theme, "ui", "occupants.size", NULL)) { gint occupants_size = g_key_file_get_integer(theme, "ui", "occupants.size", NULL); diff --git a/src/ui/console.c b/src/ui/console.c index 80f854c3..3b99e58e 100644 --- a/src/ui/console.c +++ b/src/ui/console.c @@ -1534,6 +1534,7 @@ cons_show_ui_prefs(void) cons_beep_setting(); cons_flash_setting(); cons_splash_setting(); + cons_inputwin_setting(); cons_wrap_setting(); cons_winstidy_setting(); cons_time_setting(); @@ -1751,6 +1752,14 @@ cons_inpblock_setting(void) } } +void +cons_inputwin_setting(void) +{ + char *pos = prefs_get_string(PREF_INPUTWIN); + cons_show("Input window postion (/inputwin) : %s", pos); + prefs_free_string(pos); +} + void cons_log_setting(void) { diff --git a/src/ui/inputwin.c b/src/ui/inputwin.c index fb7c0b4a..29bf04c4 100644 --- a/src/ui/inputwin.c +++ b/src/ui/inputwin.c @@ -282,7 +282,14 @@ _inp_win_update_virtual(void) { int wrows, wcols; getmaxyx(stdscr, wrows, wcols); - pnoutrefresh(inp_win, 0, pad_start, wrows-1, 0, wrows-1, wcols-2); + char *pos = prefs_get_string(PREF_INPUTWIN); + if (g_strcmp0(pos, "top") == 0) { + pnoutrefresh(inp_win, 0, pad_start, 0, 0, 0, wcols-2); + } else { + pnoutrefresh(inp_win, 0, pad_start, wrows-1, 0, wrows-1, wcols-2); + } + prefs_free_string(pos); + } static void diff --git a/src/ui/statusbar.c b/src/ui/statusbar.c index 6a1a72e9..9b87ecdc 100644 --- a/src/ui/statusbar.c +++ b/src/ui/statusbar.c @@ -89,7 +89,13 @@ create_status_bar(void) int bracket_attrs = theme_attrs(THEME_STATUS_BRACKET); - status_bar = newwin(1, cols, rows-2, 0); + char *pos = prefs_get_string(PREF_INPUTWIN); + if (g_strcmp0(pos, "top") == 0) { + status_bar = newwin(1, cols, rows-1, 0); + } else { + status_bar = newwin(1, cols, rows-2, 0); + } + prefs_free_string(pos); wbkgd(status_bar, theme_attrs(THEME_STATUS_TEXT)); wattron(status_bar, bracket_attrs); mvwprintw(status_bar, 0, cols - 34, _active); @@ -122,7 +128,13 @@ status_bar_resize(void) int bracket_attrs = theme_attrs(THEME_STATUS_BRACKET); - mvwin(status_bar, rows-2, 0); + char *pos = prefs_get_string(PREF_INPUTWIN); + if (g_strcmp0(pos, "top") == 0) { + mvwin(status_bar, rows-1, 0); + } else { + mvwin(status_bar, rows-2, 0); + } + prefs_free_string(pos); wresize(status_bar, 1, cols); wbkgd(status_bar, theme_attrs(THEME_STATUS_TEXT)); wattron(status_bar, bracket_attrs); diff --git a/src/ui/titlebar.c b/src/ui/titlebar.c index 701c01c2..90775ce7 100644 --- a/src/ui/titlebar.c +++ b/src/ui/titlebar.c @@ -67,7 +67,13 @@ create_title_bar(void) { int cols = getmaxx(stdscr); - win = newwin(1, cols, 0, 0); + char *pos = prefs_get_string(PREF_INPUTWIN); + if (g_strcmp0(pos, "top") == 0) { + win = newwin(1, cols, 1, 0); + } else { + win = newwin(1, cols, 0, 0); + } + prefs_free_string(pos); wbkgd(win, theme_attrs(THEME_TITLE_TEXT)); title_bar_console(); title_bar_set_presence(CONTACT_OFFLINE); @@ -101,6 +107,16 @@ title_bar_resize(void) { int cols = getmaxx(stdscr); + werase(win); + + char *pos = prefs_get_string(PREF_INPUTWIN); + if (g_strcmp0(pos, "top") == 0) { + mvwin(win, 1, 0); + } else { + mvwin(win, 0, 0); + } + prefs_free_string(pos); + wresize(win, 1, cols); wbkgd(win, theme_attrs(THEME_TITLE_TEXT)); diff --git a/src/ui/ui.h b/src/ui/ui.h index 9db4fe33..7a2dc95a 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -317,6 +317,7 @@ void cons_reconnect_setting(void); void cons_autoping_setting(void); void cons_autoconnect_setting(void); void cons_inpblock_setting(void); +void cons_inputwin_setting(void); void cons_show_contact_online(PContact contact, Resource *resource, GDateTime *last_activity); void cons_show_contact_offline(PContact contact, char *resource, char *status); void cons_theme_properties(void); diff --git a/src/ui/window.c b/src/ui/window.c index 277ce4e6..a8f9ec63 100644 --- a/src/ui/window.c +++ b/src/ui/window.c @@ -616,13 +616,32 @@ win_update_virtual(ProfWin *window) } else { subwin_cols = win_roster_cols(); } - pnoutrefresh(layout->base.win, layout->base.y_pos, 0, 1, 0, rows-3, (cols-subwin_cols)-1); - pnoutrefresh(layout->subwin, layout->sub_y_pos, 0, 1, (cols-subwin_cols), rows-3, cols-1); + char *pos = prefs_get_string(PREF_INPUTWIN); + if (g_strcmp0(pos, "top") == 0) { + pnoutrefresh(layout->base.win, layout->base.y_pos, 0, 2, 0, rows-2, (cols-subwin_cols)-1); + pnoutrefresh(layout->subwin, layout->sub_y_pos, 0, 2, (cols-subwin_cols), rows-2, cols-1); + } else { + pnoutrefresh(layout->base.win, layout->base.y_pos, 0, 1, 0, rows-3, (cols-subwin_cols)-1); + pnoutrefresh(layout->subwin, layout->sub_y_pos, 0, 1, (cols-subwin_cols), rows-3, cols-1); + } + prefs_free_string(pos); } else { - pnoutrefresh(layout->base.win, layout->base.y_pos, 0, 1, 0, rows-3, cols-1); + char *pos = prefs_get_string(PREF_INPUTWIN); + if (g_strcmp0(pos, "top") == 0) { + pnoutrefresh(layout->base.win, layout->base.y_pos, 0, 2, 0, rows-2, cols-1); + } else { + pnoutrefresh(layout->base.win, layout->base.y_pos, 0, 1, 0, rows-3, cols-1); + } + prefs_free_string(pos); } } else { - pnoutrefresh(window->layout->win, window->layout->y_pos, 0, 1, 0, rows-3, cols-1); + char *pos = prefs_get_string(PREF_INPUTWIN); + if (g_strcmp0(pos, "top") == 0) { + pnoutrefresh(window->layout->win, window->layout->y_pos, 0, 2, 0, rows-2, cols-1); + } else { + pnoutrefresh(window->layout->win, window->layout->y_pos, 0, 1, 0, rows-3, cols-1); + } + prefs_free_string(pos); } } @@ -633,7 +652,13 @@ win_refresh_without_subwin(ProfWin *window) getmaxyx(stdscr, rows, cols); if ((window->type == WIN_MUC) || (window->type == WIN_CONSOLE)) { - pnoutrefresh(window->layout->win, window->layout->y_pos, 0, 1, 0, rows-3, cols-1); + char *pos = prefs_get_string(PREF_INPUTWIN); + if (g_strcmp0(pos, "top") == 0) { + pnoutrefresh(window->layout->win, window->layout->y_pos, 0, 2, 0, rows-2, cols-1); + } else { + pnoutrefresh(window->layout->win, window->layout->y_pos, 0, 1, 0, rows-3, cols-1); + } + prefs_free_string(pos); } } @@ -647,13 +672,27 @@ win_refresh_with_subwin(ProfWin *window) if (window->type == WIN_MUC) { ProfLayoutSplit *layout = (ProfLayoutSplit*)window->layout; subwin_cols = win_occpuants_cols(); - pnoutrefresh(layout->base.win, layout->base.y_pos, 0, 1, 0, rows-3, (cols-subwin_cols)-1); - pnoutrefresh(layout->subwin, layout->sub_y_pos, 0, 1, (cols-subwin_cols), rows-3, cols-1); + char *pos = prefs_get_string(PREF_INPUTWIN); + if (g_strcmp0(pos, "top") == 0) { + pnoutrefresh(layout->base.win, layout->base.y_pos, 0, 2, 0, rows-2, (cols-subwin_cols)-1); + pnoutrefresh(layout->subwin, layout->sub_y_pos, 0, 2, (cols-subwin_cols), rows-2, cols-1); + } else { + pnoutrefresh(layout->base.win, layout->base.y_pos, 0, 1, 0, rows-3, (cols-subwin_cols)-1); + pnoutrefresh(layout->subwin, layout->sub_y_pos, 0, 1, (cols-subwin_cols), rows-3, cols-1); + } + prefs_free_string(pos); } else if (window->type == WIN_CONSOLE) { ProfLayoutSplit *layout = (ProfLayoutSplit*)window->layout; subwin_cols = win_roster_cols(); - pnoutrefresh(layout->base.win, layout->base.y_pos, 0, 1, 0, rows-3, (cols-subwin_cols)-1); - pnoutrefresh(layout->subwin, layout->sub_y_pos, 0, 1, (cols-subwin_cols), rows-3, cols-1); + char *pos = prefs_get_string(PREF_INPUTWIN); + if (g_strcmp0(pos, "top") == 0) { + pnoutrefresh(layout->base.win, layout->base.y_pos, 0, 2, 0, rows-2, (cols-subwin_cols)-1); + pnoutrefresh(layout->subwin, layout->sub_y_pos, 0, 2, (cols-subwin_cols), rows-2, cols-1); + } else { + pnoutrefresh(layout->base.win, layout->base.y_pos, 0, 1, 0, rows-3, (cols-subwin_cols)-1); + pnoutrefresh(layout->subwin, layout->sub_y_pos, 0, 1, (cols-subwin_cols), rows-3, cols-1); + } + prefs_free_string(pos); } } diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c index 928000a3..d4c30698 100644 --- a/tests/unittests/ui/stub_ui.c +++ b/tests/unittests/ui/stub_ui.c @@ -445,6 +445,7 @@ void cons_reconnect_setting(void) {} void cons_autoping_setting(void) {} void cons_autoconnect_setting(void) {} void cons_inpblock_setting(void) {} +void cons_inputwin_setting(void) {} void cons_tray_setting(void) {} void cons_show_contact_online(PContact contact, Resource *resource, GDateTime *last_activity) diff --git a/theme_template b/theme_template index 20393bab..2afadf3f 100644 --- a/theme_template +++ b/theme_template @@ -138,3 +138,4 @@ pgp.char= console.muc= console.chat= console.private= +inputwin.position= diff --git a/themes/bios b/themes/bios index ad582d7e..ea854036 100644 --- a/themes/bios +++ b/themes/bios @@ -130,3 +130,4 @@ otr.char=@ pgp.char=% tls.show=true console.muc=first +inputwin.position=bottom diff --git a/themes/boothj5 b/themes/boothj5 index bb1f8d27..5fa069b5 100644 --- a/themes/boothj5 +++ b/themes/boothj5 @@ -137,3 +137,4 @@ tls.show=true console.muc=first console.chat=all console.private=all +inputwin.position=bottom diff --git a/themes/boothj5_slack b/themes/boothj5_slack index e7f1a571..d0121c1d 100644 --- a/themes/boothj5_slack +++ b/themes/boothj5_slack @@ -133,3 +133,4 @@ tls.show=true console.muc=first console.chat=all console.private=all +inputwin.position=bottom diff --git a/themes/complex b/themes/complex index 258a7776..78a01c27 100644 --- a/themes/complex +++ b/themes/complex @@ -58,3 +58,4 @@ tls.show=true console.muc=all console.chat=all console.private=all +inputwin.position=bottom diff --git a/themes/forest b/themes/forest index d466eda1..95fc3ad9 100644 --- a/themes/forest +++ b/themes/forest @@ -75,3 +75,6 @@ roster.room.mention=bold_green roster.room.trigger=bold_green occupants.header=bold_green receipt.sent=bold_black + +[ui] +inputwin.position=top diff --git a/themes/original b/themes/original index 33e54fb3..a5e450ef 100644 --- a/themes/original +++ b/themes/original @@ -75,3 +75,6 @@ roster.room.mention=green roster.room.trigger=green occupants.header=yellow receipt.sent=red + +[ui] +inputwin.position=bottom diff --git a/themes/simple b/themes/simple index b63017ab..9e387049 100644 --- a/themes/simple +++ b/themes/simple @@ -45,3 +45,4 @@ tls.show=false console.muc=first console.chat=first console.private=first +inputwin.position=bottom