mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Allow vertical positioning of all windows
This commit is contained in:
parent
3983ee1d6b
commit
d3cc5bd7ed
@ -20,6 +20,7 @@ core_sources = \
|
||||
src/ui/ui.h src/ui/window.c src/ui/window.h src/ui/core.c \
|
||||
src/ui/titlebar.c src/ui/statusbar.c src/ui/inputwin.c \
|
||||
src/ui/titlebar.h src/ui/statusbar.h src/ui/inputwin.h \
|
||||
src/ui/screen.h src/ui/screen.c \
|
||||
src/ui/console.c src/ui/notifier.c \
|
||||
src/ui/win_types.h \
|
||||
src/ui/window_list.c src/ui/window_list.h \
|
||||
|
@ -194,7 +194,7 @@ static Autocomplete blocked_ac;
|
||||
static Autocomplete tray_ac;
|
||||
static Autocomplete presence_ac;
|
||||
static Autocomplete presence_setting_ac;
|
||||
static Autocomplete inputwin_ac;
|
||||
static Autocomplete winpos_ac;
|
||||
|
||||
void
|
||||
cmd_ac_init(void)
|
||||
@ -737,9 +737,9 @@ cmd_ac_init(void)
|
||||
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");
|
||||
winpos_ac = autocomplete_new();
|
||||
autocomplete_add(winpos_ac, "up");
|
||||
autocomplete_add(winpos_ac, "down");
|
||||
}
|
||||
|
||||
void
|
||||
@ -1003,7 +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(winpos_ac);
|
||||
|
||||
autocomplete_reset(script_ac);
|
||||
if (script_show_ac) {
|
||||
@ -1126,7 +1126,7 @@ cmd_ac_uninit(void)
|
||||
autocomplete_free(tray_ac);
|
||||
autocomplete_free(presence_ac);
|
||||
autocomplete_free(presence_setting_ac);
|
||||
autocomplete_free(inputwin_ac);
|
||||
autocomplete_free(winpos_ac);
|
||||
}
|
||||
|
||||
static char*
|
||||
@ -1207,8 +1207,8 @@ _cmd_ac_complete_params(ProfWin *window, const char *const input)
|
||||
}
|
||||
}
|
||||
|
||||
gchar *cmds[] = { "/prefs", "/disco", "/room", "/autoping", "/inputwin" };
|
||||
Autocomplete completers[] = { prefs_ac, disco_ac, room_ac, autoping_ac, inputwin_ac };
|
||||
gchar *cmds[] = { "/prefs", "/disco", "/room", "/autoping", "/titlebar", "/mainwin", "/statusbar", "/inputwin" };
|
||||
Autocomplete completers[] = { prefs_ac, disco_ac, room_ac, autoping_ac, winpos_ac, winpos_ac, winpos_ac, winpos_ac };
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(cmds); i++) {
|
||||
result = autocomplete_param_with_ac(input, cmds[i], completers[i], TRUE);
|
||||
|
@ -1302,20 +1302,71 @@ static struct cmd_t command_defs[] =
|
||||
CMD_NOEXAMPLES
|
||||
},
|
||||
|
||||
{ "/titlebar",
|
||||
parse_args, 1, 1, &cons_winpos_setting,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_titlebar)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_UI)
|
||||
CMD_SYN(
|
||||
"/titlebar up",
|
||||
"/titlebar down")
|
||||
CMD_DESC(
|
||||
"Move the title bar.")
|
||||
CMD_ARGS(
|
||||
{ "up", "Move the title bar up the screen." },
|
||||
{ "down", "Move the title bar down the screen." })
|
||||
CMD_NOEXAMPLES
|
||||
},
|
||||
|
||||
{ "/mainwin",
|
||||
parse_args, 1, 1, &cons_winpos_setting,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_mainwin)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_UI)
|
||||
CMD_SYN(
|
||||
"/mainwin up",
|
||||
"/mainwin down")
|
||||
CMD_DESC(
|
||||
"Move the main window.")
|
||||
CMD_ARGS(
|
||||
{ "up", "Move the main window up the screen." },
|
||||
{ "down", "Move the main window down the screen." })
|
||||
CMD_NOEXAMPLES
|
||||
},
|
||||
|
||||
{ "/statusbar",
|
||||
parse_args, 1, 1, &cons_winpos_setting,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_statusbar)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_UI)
|
||||
CMD_SYN(
|
||||
"/statusbar up",
|
||||
"/statusbar down")
|
||||
CMD_DESC(
|
||||
"Move the status bar.")
|
||||
CMD_ARGS(
|
||||
{ "up", "Move the status bar up the screen." },
|
||||
{ "down", "Move the status bar down the screen." })
|
||||
CMD_NOEXAMPLES
|
||||
},
|
||||
|
||||
{ "/inputwin",
|
||||
parse_args, 1, 1, &cons_inputwin_setting,
|
||||
parse_args, 1, 1, &cons_winpos_setting,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_inputwin)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_UI)
|
||||
CMD_SYN(
|
||||
"/inputwin top",
|
||||
"/inputwin bottom")
|
||||
"/inputwin up",
|
||||
"/inputwin down")
|
||||
CMD_DESC(
|
||||
"Where to display the input window.")
|
||||
"Move 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." })
|
||||
{ "up", "Move the input window up the screen." },
|
||||
{ "down", "Move the input window down the screen." })
|
||||
CMD_NOEXAMPLES
|
||||
},
|
||||
|
||||
|
@ -5522,17 +5522,135 @@ cmd_inpblock(ProfWin *window, const char *const command, gchar **args)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_titlebar(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
if (g_strcmp0(args[0], "up") == 0) {
|
||||
gboolean result = prefs_titlebar_pos_up();
|
||||
if (result) {
|
||||
ui_resize();
|
||||
cons_winpos_setting();
|
||||
cons_show("");
|
||||
} else {
|
||||
cons_show("Could not move title bar up.");
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
if (g_strcmp0(args[0], "down") == 0) {
|
||||
gboolean result = prefs_titlebar_pos_down();
|
||||
if (result) {
|
||||
ui_resize();
|
||||
cons_winpos_setting();
|
||||
cons_show("");
|
||||
} else {
|
||||
cons_show("Could not move title bar down.");
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
cons_bad_cmd_usage(command);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_mainwin(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
if (g_strcmp0(args[0], "up") == 0) {
|
||||
gboolean result = prefs_mainwin_pos_up();
|
||||
if (result) {
|
||||
ui_resize();
|
||||
cons_winpos_setting();
|
||||
cons_show("");
|
||||
} else {
|
||||
cons_show("Could not move main window up.");
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
if (g_strcmp0(args[0], "down") == 0) {
|
||||
gboolean result = prefs_mainwin_pos_down();
|
||||
if (result) {
|
||||
ui_resize();
|
||||
cons_winpos_setting();
|
||||
cons_show("");
|
||||
} else {
|
||||
cons_show("Could not move main window down.");
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
cons_bad_cmd_usage(command);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_statusbar(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
if (g_strcmp0(args[0], "up") == 0) {
|
||||
gboolean result = prefs_statusbar_pos_up();
|
||||
if (result) {
|
||||
ui_resize();
|
||||
cons_winpos_setting();
|
||||
cons_show("");
|
||||
} else {
|
||||
cons_show("Could not move status bar up.");
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
if (g_strcmp0(args[0], "down") == 0) {
|
||||
gboolean result = prefs_statusbar_pos_down();
|
||||
if (result) {
|
||||
ui_resize();
|
||||
cons_winpos_setting();
|
||||
cons_show("");
|
||||
} else {
|
||||
cons_show("Could not move status bar down.");
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
cons_bad_cmd_usage(command);
|
||||
|
||||
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]);
|
||||
if (g_strcmp0(args[0], "up") == 0) {
|
||||
gboolean result = prefs_inputwin_pos_up();
|
||||
if (result) {
|
||||
ui_resize();
|
||||
cons_show("Set input window position to %s", args[0]);
|
||||
cons_winpos_setting();
|
||||
cons_show("");
|
||||
} else {
|
||||
cons_bad_cmd_usage(command);
|
||||
cons_show("Could not move input window up.");
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
if (g_strcmp0(args[0], "down") == 0) {
|
||||
gboolean result = prefs_inputwin_pos_down();
|
||||
if (result) {
|
||||
ui_resize();
|
||||
cons_winpos_setting();
|
||||
cons_show("");
|
||||
} else {
|
||||
cons_show("Could not move input window down.");
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
cons_bad_cmd_usage(command);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -149,6 +149,9 @@ 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_titlebar(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_mainwin(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_statusbar(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);
|
||||
|
@ -143,7 +143,7 @@ prefs_load(void)
|
||||
prefs_free_string(value);
|
||||
}
|
||||
|
||||
// move pre 0.5.0 titlebar settings to wintitle
|
||||
// move pre 0.6.0 titlebar settings to wintitle
|
||||
if (g_key_file_has_key(prefs, PREF_GROUP_UI, "titlebar.show", NULL)) {
|
||||
gboolean show = g_key_file_get_boolean(prefs, PREF_GROUP_UI, "titlebar.show", NULL);
|
||||
g_key_file_set_boolean(prefs, PREF_GROUP_UI, "wintitle.show", show);
|
||||
@ -155,7 +155,6 @@ prefs_load(void)
|
||||
g_key_file_remove_key(prefs, PREF_GROUP_UI, "titlebar.goodbye", NULL);
|
||||
}
|
||||
|
||||
|
||||
_save_prefs();
|
||||
|
||||
boolean_choice_ac = autocomplete_new();
|
||||
@ -1062,6 +1061,469 @@ prefs_get_room_notify_triggers(void)
|
||||
return result;
|
||||
}
|
||||
|
||||
ProfWinPlacement*
|
||||
prefs_create_profwin_placement(int titlebar, int mainwin, int statusbar, int inputwin)
|
||||
{
|
||||
ProfWinPlacement *placement = malloc(sizeof(ProfWinPlacement));
|
||||
placement->titlebar_pos = titlebar;
|
||||
placement->mainwin_pos = mainwin;
|
||||
placement->statusbar_pos = statusbar;
|
||||
placement->inputwin_pos = inputwin;
|
||||
|
||||
return placement;
|
||||
}
|
||||
|
||||
void
|
||||
prefs_free_win_placement(ProfWinPlacement *placement)
|
||||
{
|
||||
free(placement);
|
||||
}
|
||||
|
||||
ProfWinPlacement*
|
||||
prefs_get_win_placement(void)
|
||||
{
|
||||
// read from settings file
|
||||
int titlebar_pos = g_key_file_get_integer(prefs, PREF_GROUP_UI, "titlebar.position", NULL);
|
||||
int mainwin_pos = g_key_file_get_integer(prefs, PREF_GROUP_UI, "mainwin.position", NULL);
|
||||
int statusbar_pos = g_key_file_get_integer(prefs, PREF_GROUP_UI, "statusbar.position", NULL);
|
||||
int inputwin_pos = g_key_file_get_integer(prefs, PREF_GROUP_UI, "inputwin.position", NULL);
|
||||
|
||||
// default if setting invalid, or not present
|
||||
if (titlebar_pos < 1 || titlebar_pos > 4) {
|
||||
titlebar_pos = 1;
|
||||
}
|
||||
if (mainwin_pos < 1 || mainwin_pos > 4) {
|
||||
mainwin_pos = 2;
|
||||
}
|
||||
if (statusbar_pos < 1 || statusbar_pos > 4) {
|
||||
statusbar_pos = 3;
|
||||
}
|
||||
if (inputwin_pos < 1 || inputwin_pos > 4) {
|
||||
inputwin_pos = 4;
|
||||
}
|
||||
|
||||
// return default if duplicates found
|
||||
if (titlebar_pos == mainwin_pos) {
|
||||
return prefs_create_profwin_placement(1, 2, 3, 5);
|
||||
}
|
||||
if (titlebar_pos == statusbar_pos) {
|
||||
return prefs_create_profwin_placement(1, 2, 3, 5);
|
||||
}
|
||||
if (titlebar_pos == inputwin_pos) {
|
||||
return prefs_create_profwin_placement(1, 2, 3, 5);
|
||||
}
|
||||
|
||||
if (mainwin_pos == statusbar_pos) {
|
||||
return prefs_create_profwin_placement(1, 2, 3, 5);
|
||||
}
|
||||
if (mainwin_pos == inputwin_pos) {
|
||||
return prefs_create_profwin_placement(1, 2, 3, 5);
|
||||
}
|
||||
|
||||
if (statusbar_pos == inputwin_pos) {
|
||||
return prefs_create_profwin_placement(1, 2, 3, 5);
|
||||
}
|
||||
|
||||
// return settings
|
||||
return prefs_create_profwin_placement(titlebar_pos, mainwin_pos, statusbar_pos, inputwin_pos);
|
||||
}
|
||||
|
||||
void
|
||||
prefs_save_win_placement(ProfWinPlacement *placement)
|
||||
{
|
||||
g_key_file_set_integer(prefs, PREF_GROUP_UI, "titlebar.position", placement->titlebar_pos);
|
||||
g_key_file_set_integer(prefs, PREF_GROUP_UI, "mainwin.position", placement->mainwin_pos);
|
||||
g_key_file_set_integer(prefs, PREF_GROUP_UI, "statusbar.position", placement->statusbar_pos);
|
||||
g_key_file_set_integer(prefs, PREF_GROUP_UI, "inputwin.position", placement->inputwin_pos);
|
||||
_save_prefs();
|
||||
}
|
||||
|
||||
gboolean
|
||||
prefs_titlebar_pos_up(void)
|
||||
{
|
||||
ProfWinPlacement *placement = prefs_get_win_placement();
|
||||
if (placement->titlebar_pos == 2) {
|
||||
placement->titlebar_pos = 1;
|
||||
if (placement->mainwin_pos == 1) {
|
||||
placement->mainwin_pos = 2;
|
||||
} else if (placement->statusbar_pos == 1) {
|
||||
placement->statusbar_pos = 2;
|
||||
} else if (placement->inputwin_pos == 1) {
|
||||
placement->inputwin_pos = 2;
|
||||
}
|
||||
|
||||
prefs_save_win_placement(placement);
|
||||
prefs_free_win_placement(placement);
|
||||
return TRUE;
|
||||
}
|
||||
if (placement->titlebar_pos == 3) {
|
||||
placement->titlebar_pos = 2;
|
||||
if (placement->mainwin_pos == 2) {
|
||||
placement->mainwin_pos = 3;
|
||||
} else if (placement->statusbar_pos == 2) {
|
||||
placement->statusbar_pos = 3;
|
||||
} else if (placement->inputwin_pos == 2) {
|
||||
placement->inputwin_pos = 3;
|
||||
}
|
||||
|
||||
prefs_save_win_placement(placement);
|
||||
prefs_free_win_placement(placement);
|
||||
return TRUE;
|
||||
}
|
||||
if (placement->titlebar_pos == 4) {
|
||||
placement->titlebar_pos = 3;
|
||||
if (placement->mainwin_pos == 3) {
|
||||
placement->mainwin_pos = 4;
|
||||
} else if (placement->statusbar_pos == 3) {
|
||||
placement->statusbar_pos = 4;
|
||||
} else if (placement->inputwin_pos == 3) {
|
||||
placement->inputwin_pos = 4;
|
||||
}
|
||||
|
||||
prefs_save_win_placement(placement);
|
||||
prefs_free_win_placement(placement);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
prefs_free_win_placement(placement);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
prefs_mainwin_pos_up(void)
|
||||
{
|
||||
ProfWinPlacement *placement = prefs_get_win_placement();
|
||||
if (placement->mainwin_pos == 2) {
|
||||
placement->mainwin_pos = 1;
|
||||
if (placement->titlebar_pos == 1) {
|
||||
placement->titlebar_pos = 2;
|
||||
} else if (placement->statusbar_pos == 1) {
|
||||
placement->statusbar_pos = 2;
|
||||
} else if (placement->inputwin_pos == 1) {
|
||||
placement->inputwin_pos = 2;
|
||||
}
|
||||
prefs_save_win_placement(placement);
|
||||
prefs_free_win_placement(placement);
|
||||
return TRUE;
|
||||
}
|
||||
if (placement->mainwin_pos == 3) {
|
||||
placement->mainwin_pos = 2;
|
||||
if (placement->titlebar_pos == 2) {
|
||||
placement->titlebar_pos = 3;
|
||||
} else if (placement->statusbar_pos == 2) {
|
||||
placement->statusbar_pos = 3;
|
||||
} else if (placement->inputwin_pos == 2) {
|
||||
placement->inputwin_pos = 3;
|
||||
}
|
||||
prefs_save_win_placement(placement);
|
||||
prefs_free_win_placement(placement);
|
||||
return TRUE;
|
||||
}
|
||||
if (placement->mainwin_pos == 4) {
|
||||
placement->mainwin_pos = 3;
|
||||
if (placement->titlebar_pos == 3) {
|
||||
placement->titlebar_pos = 4;
|
||||
} else if (placement->statusbar_pos == 3) {
|
||||
placement->statusbar_pos = 4;
|
||||
} else if (placement->inputwin_pos == 3) {
|
||||
placement->inputwin_pos = 4;
|
||||
}
|
||||
prefs_save_win_placement(placement);
|
||||
prefs_free_win_placement(placement);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
prefs_free_win_placement(placement);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
prefs_statusbar_pos_up(void)
|
||||
{
|
||||
ProfWinPlacement *placement = prefs_get_win_placement();
|
||||
if (placement->statusbar_pos == 2) {
|
||||
placement->statusbar_pos = 1;
|
||||
if (placement->titlebar_pos == 1) {
|
||||
placement->titlebar_pos = 2;
|
||||
} else if (placement->mainwin_pos == 1) {
|
||||
placement->mainwin_pos = 2;
|
||||
} else if (placement->inputwin_pos == 1) {
|
||||
placement->inputwin_pos = 2;
|
||||
}
|
||||
prefs_save_win_placement(placement);
|
||||
prefs_free_win_placement(placement);
|
||||
return TRUE;
|
||||
}
|
||||
if (placement->statusbar_pos == 3) {
|
||||
placement->statusbar_pos = 2;
|
||||
if (placement->titlebar_pos == 2) {
|
||||
placement->titlebar_pos = 3;
|
||||
} else if (placement->mainwin_pos == 2) {
|
||||
placement->mainwin_pos = 3;
|
||||
} else if (placement->inputwin_pos == 2) {
|
||||
placement->inputwin_pos = 3;
|
||||
}
|
||||
prefs_save_win_placement(placement);
|
||||
prefs_free_win_placement(placement);
|
||||
return TRUE;
|
||||
}
|
||||
if (placement->statusbar_pos == 4) {
|
||||
placement->statusbar_pos = 3;
|
||||
if (placement->titlebar_pos == 3) {
|
||||
placement->titlebar_pos = 4;
|
||||
} else if (placement->mainwin_pos == 3) {
|
||||
placement->mainwin_pos = 4;
|
||||
} else if (placement->inputwin_pos == 3) {
|
||||
placement->inputwin_pos = 4;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
prefs_free_win_placement(placement);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
prefs_inputwin_pos_up(void)
|
||||
{
|
||||
ProfWinPlacement *placement = prefs_get_win_placement();
|
||||
if (placement->inputwin_pos == 2) {
|
||||
placement->inputwin_pos = 1;
|
||||
if (placement->titlebar_pos == 1) {
|
||||
placement->titlebar_pos = 2;
|
||||
} else if (placement->mainwin_pos == 1) {
|
||||
placement->mainwin_pos = 2;
|
||||
} else if (placement->inputwin_pos == 1) {
|
||||
placement->inputwin_pos = 2;
|
||||
}
|
||||
prefs_save_win_placement(placement);
|
||||
prefs_free_win_placement(placement);
|
||||
return TRUE;
|
||||
}
|
||||
if (placement->inputwin_pos == 3) {
|
||||
placement->inputwin_pos = 2;
|
||||
if (placement->titlebar_pos == 2) {
|
||||
placement->titlebar_pos = 3;
|
||||
} else if (placement->mainwin_pos == 2) {
|
||||
placement->mainwin_pos = 3;
|
||||
} else if (placement->statusbar_pos == 2) {
|
||||
placement->statusbar_pos = 3;
|
||||
}
|
||||
prefs_save_win_placement(placement);
|
||||
prefs_free_win_placement(placement);
|
||||
return TRUE;
|
||||
}
|
||||
if (placement->inputwin_pos == 4) {
|
||||
placement->inputwin_pos = 3;
|
||||
if (placement->titlebar_pos == 3) {
|
||||
placement->titlebar_pos = 4;
|
||||
} else if (placement->mainwin_pos == 3) {
|
||||
placement->mainwin_pos = 4;
|
||||
} else if (placement->statusbar_pos == 3) {
|
||||
placement->statusbar_pos = 4;
|
||||
}
|
||||
prefs_save_win_placement(placement);
|
||||
prefs_free_win_placement(placement);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
prefs_free_win_placement(placement);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
prefs_titlebar_pos_down(void)
|
||||
{
|
||||
ProfWinPlacement *placement = prefs_get_win_placement();
|
||||
if (placement->titlebar_pos == 1) {
|
||||
placement->titlebar_pos = 2;
|
||||
if (placement->mainwin_pos == 2) {
|
||||
placement->mainwin_pos = 1;
|
||||
} else if (placement->statusbar_pos == 2) {
|
||||
placement->statusbar_pos = 1;
|
||||
} else if (placement->inputwin_pos == 2) {
|
||||
placement->inputwin_pos = 1;
|
||||
}
|
||||
prefs_save_win_placement(placement);
|
||||
prefs_free_win_placement(placement);
|
||||
return TRUE;
|
||||
}
|
||||
if (placement->titlebar_pos == 2) {
|
||||
placement->titlebar_pos = 3;
|
||||
if (placement->mainwin_pos == 3) {
|
||||
placement->mainwin_pos = 2;
|
||||
} else if (placement->statusbar_pos == 3) {
|
||||
placement->statusbar_pos = 2;
|
||||
} else if (placement->inputwin_pos == 3) {
|
||||
placement->inputwin_pos = 2;
|
||||
}
|
||||
prefs_save_win_placement(placement);
|
||||
prefs_free_win_placement(placement);
|
||||
return TRUE;
|
||||
}
|
||||
if (placement->titlebar_pos == 3) {
|
||||
placement->titlebar_pos = 4;
|
||||
if (placement->mainwin_pos == 4) {
|
||||
placement->mainwin_pos = 3;
|
||||
} else if (placement->statusbar_pos == 4) {
|
||||
placement->statusbar_pos = 3;
|
||||
} else if (placement->inputwin_pos == 4) {
|
||||
placement->inputwin_pos = 3;
|
||||
}
|
||||
prefs_save_win_placement(placement);
|
||||
prefs_free_win_placement(placement);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
prefs_free_win_placement(placement);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
prefs_mainwin_pos_down(void)
|
||||
{
|
||||
ProfWinPlacement *placement = prefs_get_win_placement();
|
||||
if (placement->mainwin_pos == 1) {
|
||||
placement->mainwin_pos = 2;
|
||||
if (placement->titlebar_pos == 2) {
|
||||
placement->titlebar_pos = 1;
|
||||
} else if (placement->statusbar_pos == 2) {
|
||||
placement->statusbar_pos = 1;
|
||||
} else if (placement->inputwin_pos == 2) {
|
||||
placement->inputwin_pos = 1;
|
||||
}
|
||||
prefs_save_win_placement(placement);
|
||||
prefs_free_win_placement(placement);
|
||||
return TRUE;
|
||||
}
|
||||
if (placement->mainwin_pos == 2) {
|
||||
placement->mainwin_pos = 3;
|
||||
if (placement->titlebar_pos == 3) {
|
||||
placement->titlebar_pos = 2;
|
||||
} else if (placement->statusbar_pos == 3) {
|
||||
placement->statusbar_pos = 2;
|
||||
} else if (placement->inputwin_pos == 3) {
|
||||
placement->inputwin_pos = 2;
|
||||
}
|
||||
prefs_save_win_placement(placement);
|
||||
prefs_free_win_placement(placement);
|
||||
return TRUE;
|
||||
}
|
||||
if (placement->mainwin_pos == 3) {
|
||||
placement->mainwin_pos = 4;
|
||||
if (placement->titlebar_pos == 4) {
|
||||
placement->titlebar_pos = 3;
|
||||
} else if (placement->statusbar_pos == 4) {
|
||||
placement->statusbar_pos = 3;
|
||||
} else if (placement->inputwin_pos == 4) {
|
||||
placement->inputwin_pos = 3;
|
||||
}
|
||||
prefs_save_win_placement(placement);
|
||||
prefs_free_win_placement(placement);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
prefs_free_win_placement(placement);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
prefs_statusbar_pos_down(void)
|
||||
{
|
||||
ProfWinPlacement *placement = prefs_get_win_placement();
|
||||
if (placement->statusbar_pos == 1) {
|
||||
placement->statusbar_pos = 2;
|
||||
if (placement->titlebar_pos == 2) {
|
||||
placement->titlebar_pos = 1;
|
||||
} else if (placement->mainwin_pos == 2) {
|
||||
placement->mainwin_pos = 1;
|
||||
} else if (placement->inputwin_pos == 2) {
|
||||
placement->inputwin_pos = 1;
|
||||
}
|
||||
prefs_save_win_placement(placement);
|
||||
prefs_free_win_placement(placement);
|
||||
return TRUE;
|
||||
}
|
||||
if (placement->statusbar_pos == 2) {
|
||||
placement->statusbar_pos = 3;
|
||||
if (placement->titlebar_pos == 3) {
|
||||
placement->titlebar_pos = 2;
|
||||
} else if (placement->mainwin_pos == 3) {
|
||||
placement->mainwin_pos = 2;
|
||||
} else if (placement->inputwin_pos == 3) {
|
||||
placement->inputwin_pos = 2;
|
||||
}
|
||||
prefs_save_win_placement(placement);
|
||||
prefs_free_win_placement(placement);
|
||||
return TRUE;
|
||||
}
|
||||
if (placement->statusbar_pos == 3) {
|
||||
placement->statusbar_pos = 4;
|
||||
if (placement->titlebar_pos == 4) {
|
||||
placement->titlebar_pos = 3;
|
||||
} else if (placement->mainwin_pos == 4) {
|
||||
placement->mainwin_pos = 3;
|
||||
} else if (placement->inputwin_pos == 4) {
|
||||
placement->inputwin_pos = 3;
|
||||
}
|
||||
prefs_save_win_placement(placement);
|
||||
prefs_free_win_placement(placement);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
prefs_free_win_placement(placement);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
gboolean
|
||||
prefs_inputwin_pos_down(void)
|
||||
{
|
||||
ProfWinPlacement *placement = prefs_get_win_placement();
|
||||
if (placement->inputwin_pos == 1) {
|
||||
placement->inputwin_pos = 2;
|
||||
if (placement->titlebar_pos == 2) {
|
||||
placement->titlebar_pos = 1;
|
||||
} else if (placement->mainwin_pos == 2) {
|
||||
placement->mainwin_pos = 1;
|
||||
} else if (placement->inputwin_pos == 2) {
|
||||
placement->inputwin_pos = 1;
|
||||
}
|
||||
prefs_save_win_placement(placement);
|
||||
prefs_free_win_placement(placement);
|
||||
return TRUE;
|
||||
}
|
||||
if (placement->inputwin_pos == 2) {
|
||||
placement->inputwin_pos = 3;
|
||||
if (placement->titlebar_pos == 3) {
|
||||
placement->titlebar_pos = 2;
|
||||
} else if (placement->mainwin_pos == 3) {
|
||||
placement->mainwin_pos = 2;
|
||||
} else if (placement->statusbar_pos == 3) {
|
||||
placement->statusbar_pos = 2;
|
||||
}
|
||||
prefs_save_win_placement(placement);
|
||||
prefs_free_win_placement(placement);
|
||||
return TRUE;
|
||||
}
|
||||
if (placement->inputwin_pos == 3) {
|
||||
placement->inputwin_pos = 4;
|
||||
if (placement->titlebar_pos == 4) {
|
||||
placement->titlebar_pos = 3;
|
||||
} else if (placement->mainwin_pos == 4) {
|
||||
placement->mainwin_pos = 3;
|
||||
} else if (placement->statusbar_pos == 4) {
|
||||
placement->statusbar_pos = 3;
|
||||
}
|
||||
prefs_save_win_placement(placement);
|
||||
prefs_free_win_placement(placement);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
prefs_free_win_placement(placement);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
prefs_add_alias(const char *const name, const char *const value)
|
||||
{
|
||||
@ -1224,7 +1686,6 @@ _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:
|
||||
@ -1457,8 +1918,6 @@ _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:
|
||||
@ -1587,8 +2046,6 @@ _get_default_string(preference_t pref)
|
||||
case PREF_CONSOLE_PRIVATE:
|
||||
case PREF_CONSOLE_CHAT:
|
||||
return "all";
|
||||
case PREF_INPUTWIN:
|
||||
return "bottom";
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
|
@ -132,7 +132,6 @@ typedef enum {
|
||||
PREF_RESOURCE_TITLE,
|
||||
PREF_RESOURCE_MESSAGE,
|
||||
PREF_INPBLOCK_DYNAMIC,
|
||||
PREF_INPUTWIN,
|
||||
PREF_ENC_WARN,
|
||||
PREF_PGP_LOG,
|
||||
PREF_TLS_CERTPATH,
|
||||
@ -149,6 +148,13 @@ typedef struct prof_alias_t {
|
||||
gchar *value;
|
||||
} ProfAlias;
|
||||
|
||||
typedef struct prof_winplacement_t {
|
||||
int titlebar_pos;
|
||||
int mainwin_pos;
|
||||
int statusbar_pos;
|
||||
int inputwin_pos;
|
||||
} ProfWinPlacement;
|
||||
|
||||
void prefs_load(void);
|
||||
void prefs_close(void);
|
||||
|
||||
@ -240,6 +246,20 @@ gboolean prefs_add_room_notify_trigger(const char * const text);
|
||||
gboolean prefs_remove_room_notify_trigger(const char * const text);
|
||||
GList* prefs_get_room_notify_triggers(void);
|
||||
|
||||
ProfWinPlacement* prefs_get_win_placement(void);
|
||||
void prefs_free_win_placement(ProfWinPlacement *placement);
|
||||
|
||||
gboolean prefs_titlebar_pos_up(void);
|
||||
gboolean prefs_titlebar_pos_down(void);
|
||||
gboolean prefs_mainwin_pos_up(void);
|
||||
gboolean prefs_mainwin_pos_down(void);
|
||||
gboolean prefs_statusbar_pos_up(void);
|
||||
gboolean prefs_statusbar_pos_down(void);
|
||||
gboolean prefs_inputwin_pos_up(void);
|
||||
gboolean prefs_inputwin_pos_down(void);
|
||||
ProfWinPlacement* prefs_create_profwin_placement(int titlebar, int mainwin, int statusbar, int inputwin);
|
||||
void prefs_save_win_placement(ProfWinPlacement *placement);
|
||||
|
||||
gboolean prefs_get_boolean(preference_t pref);
|
||||
void prefs_set_boolean(preference_t pref, gboolean value);
|
||||
char* prefs_get_string(preference_t pref);
|
||||
|
@ -429,7 +429,6 @@ _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);
|
||||
@ -531,6 +530,14 @@ _load_preferences(void)
|
||||
g_free(ch);
|
||||
}
|
||||
}
|
||||
|
||||
int titlebar_pos = g_key_file_get_integer(theme, "ui", "titlebar.position", NULL);
|
||||
int mainwin_pos = g_key_file_get_integer(theme, "ui", "mainwin.position", NULL);
|
||||
int statusbar_pos = g_key_file_get_integer(theme, "ui", "statusbar.position", NULL);
|
||||
int inputwin_pos = g_key_file_get_integer(theme, "ui", "inputwin.position", NULL);
|
||||
ProfWinPlacement *placement = prefs_create_profwin_placement(titlebar_pos, mainwin_pos, statusbar_pos, inputwin_pos);
|
||||
prefs_save_win_placement(placement);
|
||||
prefs_free_win_placement(placement);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -203,6 +203,7 @@ _init(char *log_level)
|
||||
tray_init();
|
||||
#endif
|
||||
inp_nonblocking(TRUE);
|
||||
ui_resize();
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1534,7 +1534,7 @@ cons_show_ui_prefs(void)
|
||||
cons_beep_setting();
|
||||
cons_flash_setting();
|
||||
cons_splash_setting();
|
||||
cons_inputwin_setting();
|
||||
cons_winpos_setting();
|
||||
cons_wrap_setting();
|
||||
cons_winstidy_setting();
|
||||
cons_time_setting();
|
||||
@ -1753,11 +1753,14 @@ cons_inpblock_setting(void)
|
||||
}
|
||||
|
||||
void
|
||||
cons_inputwin_setting(void)
|
||||
cons_winpos_setting(void)
|
||||
{
|
||||
char *pos = prefs_get_string(PREF_INPUTWIN);
|
||||
cons_show("Input window postion (/inputwin) : %s", pos);
|
||||
prefs_free_string(pos);
|
||||
ProfWinPlacement *placement = prefs_get_win_placement();
|
||||
cons_show("Title bar postion (/titlebar) : %d", placement->titlebar_pos);
|
||||
cons_show("Main window postion (/mainwin) : %d", placement->mainwin_pos);
|
||||
cons_show("Status bar postion (/statusbar) : %d", placement->statusbar_pos);
|
||||
cons_show("Input window postion (/inputwin) : %d", placement->inputwin_pos);
|
||||
prefs_free_win_placement(placement);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -370,7 +370,7 @@ ui_handle_login_account_success(ProfAccount *account, gboolean secured)
|
||||
} else {
|
||||
ui_hide_all_room_rosters();
|
||||
}
|
||||
ui_redraw();
|
||||
ui_resize();
|
||||
} else {
|
||||
cons_show("Couldn't find account theme: %s", account->theme);
|
||||
}
|
||||
|
@ -62,6 +62,7 @@
|
||||
#include "config/preferences.h"
|
||||
#include "config/theme.h"
|
||||
#include "ui/ui.h"
|
||||
#include "ui/screen.h"
|
||||
#include "ui/statusbar.h"
|
||||
#include "ui/inputwin.h"
|
||||
#include "ui/window.h"
|
||||
@ -280,16 +281,9 @@ inp_put_back(void)
|
||||
static void
|
||||
_inp_win_update_virtual(void)
|
||||
{
|
||||
int wrows, wcols;
|
||||
getmaxyx(stdscr, wrows, wcols);
|
||||
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);
|
||||
|
||||
int wcols = getmaxx(stdscr);
|
||||
int row = screen_inputwin_row();
|
||||
pnoutrefresh(inp_win, 0, pad_start, row, 0, row, wcols-2);
|
||||
}
|
||||
|
||||
static void
|
||||
|
123
src/ui/screen.c
Normal file
123
src/ui/screen.c
Normal file
@ -0,0 +1,123 @@
|
||||
/*
|
||||
* screen.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
* Profanity is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Profanity is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Profanity. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* In addition, as a special exception, the copyright holders give permission to
|
||||
* link the code of portions of this program with the OpenSSL library under
|
||||
* certain conditions as described in each individual source file, and
|
||||
* distribute linked combinations including the two.
|
||||
*
|
||||
* You must obey the GNU General Public License in all respects for all of the
|
||||
* code used other than OpenSSL. If you modify file(s) with this exception, you
|
||||
* may extend this exception to your version of the file(s), but you are not
|
||||
* obligated to do so. If you do not wish to do so, delete this exception
|
||||
* statement from your version. If you delete this exception statement from all
|
||||
* source files in the program, then also delete it here.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAVE_NCURSESW_NCURSES_H
|
||||
#include <ncursesw/ncurses.h>
|
||||
#elif HAVE_NCURSES_H
|
||||
#include <ncurses.h>
|
||||
#endif
|
||||
|
||||
#include "config/preferences.h"
|
||||
|
||||
int
|
||||
_screen_line_row(int win_pos, int mainwin_pos) {
|
||||
int wrows = getmaxy(stdscr);
|
||||
|
||||
if (win_pos == 1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (win_pos == 2) {
|
||||
int row = 1;
|
||||
if (mainwin_pos == 1) {
|
||||
row = wrows-3;
|
||||
}
|
||||
|
||||
return row;
|
||||
}
|
||||
|
||||
if (win_pos == 3) {
|
||||
int row = 2;
|
||||
if (mainwin_pos == 1 || mainwin_pos == 2) {
|
||||
row = wrows-2;
|
||||
}
|
||||
|
||||
return row;
|
||||
}
|
||||
|
||||
return wrows-1;
|
||||
}
|
||||
|
||||
int
|
||||
screen_titlebar_row(void)
|
||||
{
|
||||
ProfWinPlacement *placement = prefs_get_win_placement();
|
||||
int row = _screen_line_row(placement->titlebar_pos, placement->mainwin_pos);
|
||||
prefs_free_win_placement(placement);
|
||||
|
||||
return row;
|
||||
}
|
||||
|
||||
int
|
||||
screen_statusbar_row(void)
|
||||
{
|
||||
ProfWinPlacement *placement = prefs_get_win_placement();
|
||||
int row = _screen_line_row(placement->statusbar_pos, placement->mainwin_pos);
|
||||
prefs_free_win_placement(placement);
|
||||
|
||||
return row;
|
||||
}
|
||||
|
||||
int
|
||||
screen_inputwin_row(void)
|
||||
{
|
||||
ProfWinPlacement *placement = prefs_get_win_placement();
|
||||
int row = _screen_line_row(placement->inputwin_pos, placement->mainwin_pos);
|
||||
prefs_free_win_placement(placement);
|
||||
|
||||
return row;
|
||||
}
|
||||
|
||||
int
|
||||
screen_mainwin_row_start(void)
|
||||
{
|
||||
ProfWinPlacement *placement = prefs_get_win_placement();
|
||||
int row = placement->mainwin_pos-1;
|
||||
prefs_free_win_placement(placement);
|
||||
|
||||
return row;
|
||||
}
|
||||
|
||||
int
|
||||
screen_mainwin_row_end(void)
|
||||
{
|
||||
ProfWinPlacement *placement = prefs_get_win_placement();
|
||||
int wrows = getmaxy(stdscr);
|
||||
int row = wrows - (5 - placement->mainwin_pos);
|
||||
prefs_free_win_placement(placement);
|
||||
|
||||
return row;
|
||||
}
|
40
src/ui/screen.h
Normal file
40
src/ui/screen.h
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* screen.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
* Profanity is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Profanity is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Profanity. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* In addition, as a special exception, the copyright holders give permission to
|
||||
* link the code of portions of this program with the OpenSSL library under
|
||||
* certain conditions as described in each individual source file, and
|
||||
* distribute linked combinations including the two.
|
||||
*
|
||||
* You must obey the GNU General Public License in all respects for all of the
|
||||
* code used other than OpenSSL. If you modify file(s) with this exception, you
|
||||
* may extend this exception to your version of the file(s), but you are not
|
||||
* obligated to do so. If you do not wish to do so, delete this exception
|
||||
* statement from your version. If you delete this exception statement from all
|
||||
* source files in the program, then also delete it here.
|
||||
*
|
||||
*/
|
||||
|
||||
int screen_titlebar_row(void);
|
||||
int screen_statusbar_row(void);
|
||||
int screen_inputwin_row(void);
|
||||
|
||||
int screen_mainwin_row_start(void);
|
||||
int screen_mainwin_row_end(void);
|
@ -49,6 +49,7 @@
|
||||
#include "ui/ui.h"
|
||||
#include "ui/statusbar.h"
|
||||
#include "ui/inputwin.h"
|
||||
#include "ui/screen.h"
|
||||
|
||||
#define TIME_CHECK 60000000
|
||||
|
||||
@ -74,8 +75,8 @@ static void _status_bar_draw(void);
|
||||
void
|
||||
create_status_bar(void)
|
||||
{
|
||||
int rows, cols, i;
|
||||
getmaxyx(stdscr, rows, cols);
|
||||
int i;
|
||||
int cols = getmaxx(stdscr);
|
||||
|
||||
is_active[1] = TRUE;
|
||||
is_new[1] = FALSE;
|
||||
@ -89,13 +90,8 @@ create_status_bar(void)
|
||||
|
||||
int bracket_attrs = theme_attrs(THEME_STATUS_BRACKET);
|
||||
|
||||
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);
|
||||
int row = screen_statusbar_row();
|
||||
status_bar = newwin(1, cols, row, 0);
|
||||
wbkgd(status_bar, theme_attrs(THEME_STATUS_TEXT));
|
||||
wattron(status_bar, bracket_attrs);
|
||||
mvwprintw(status_bar, 0, cols - 34, _active);
|
||||
@ -121,20 +117,14 @@ status_bar_update_virtual(void)
|
||||
void
|
||||
status_bar_resize(void)
|
||||
{
|
||||
int rows, cols;
|
||||
getmaxyx(stdscr, rows, cols);
|
||||
int cols = getmaxx(stdscr);
|
||||
|
||||
werase(status_bar);
|
||||
|
||||
int bracket_attrs = theme_attrs(THEME_STATUS_BRACKET);
|
||||
|
||||
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);
|
||||
int row = screen_statusbar_row();
|
||||
mvwin(status_bar, row, 0);
|
||||
wresize(status_bar, 1, cols);
|
||||
wbkgd(status_bar, theme_attrs(THEME_STATUS_TEXT));
|
||||
wattron(status_bar, bracket_attrs);
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include "ui/inputwin.h"
|
||||
#include "ui/window_list.h"
|
||||
#include "ui/window.h"
|
||||
#include "ui/screen.h"
|
||||
#include "xmpp/roster_list.h"
|
||||
#include "xmpp/chat_session.h"
|
||||
|
||||
@ -67,13 +68,8 @@ create_title_bar(void)
|
||||
{
|
||||
int cols = getmaxx(stdscr);
|
||||
|
||||
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);
|
||||
int row = screen_titlebar_row();
|
||||
win = newwin(1, cols, row, 0);
|
||||
wbkgd(win, theme_attrs(THEME_TITLE_TEXT));
|
||||
title_bar_console();
|
||||
title_bar_set_presence(CONTACT_OFFLINE);
|
||||
@ -109,13 +105,8 @@ title_bar_resize(void)
|
||||
|
||||
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);
|
||||
int row = screen_titlebar_row();
|
||||
mvwin(win, row, 0);
|
||||
|
||||
wresize(win, 1, cols);
|
||||
wbkgd(win, theme_attrs(THEME_TITLE_TEXT));
|
||||
|
@ -317,7 +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_winpos_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);
|
||||
|
@ -52,6 +52,7 @@
|
||||
#include "config/preferences.h"
|
||||
#include "ui/ui.h"
|
||||
#include "ui/window.h"
|
||||
#include "ui/screen.h"
|
||||
#include "xmpp/xmpp.h"
|
||||
#include "xmpp/roster_list.h"
|
||||
|
||||
@ -604,9 +605,10 @@ win_resize(ProfWin *window)
|
||||
void
|
||||
win_update_virtual(ProfWin *window)
|
||||
{
|
||||
int rows, cols;
|
||||
getmaxyx(stdscr, rows, cols);
|
||||
int cols = getmaxx(stdscr);
|
||||
|
||||
int row_start = screen_mainwin_row_start();
|
||||
int row_end = screen_mainwin_row_end();
|
||||
if (window->layout->type == LAYOUT_SPLIT) {
|
||||
ProfLayoutSplit *layout = (ProfLayoutSplit*)window->layout;
|
||||
if (layout->subwin) {
|
||||
@ -616,83 +618,46 @@ win_update_virtual(ProfWin *window)
|
||||
} else {
|
||||
subwin_cols = win_roster_cols();
|
||||
}
|
||||
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);
|
||||
pnoutrefresh(layout->base.win, layout->base.y_pos, 0, row_start, 0, row_end, (cols-subwin_cols)-1);
|
||||
pnoutrefresh(layout->subwin, layout->sub_y_pos, 0, row_start, (cols-subwin_cols), row_end, 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 {
|
||||
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);
|
||||
pnoutrefresh(layout->base.win, layout->base.y_pos, 0, row_start, 0, row_end, cols-1);
|
||||
}
|
||||
} else {
|
||||
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);
|
||||
pnoutrefresh(window->layout->win, window->layout->y_pos, 0, row_start, 0, row_end, cols-1);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
win_refresh_without_subwin(ProfWin *window)
|
||||
{
|
||||
int rows, cols;
|
||||
getmaxyx(stdscr, rows, cols);
|
||||
int cols = getmaxx(stdscr);
|
||||
|
||||
if ((window->type == WIN_MUC) || (window->type == WIN_CONSOLE)) {
|
||||
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);
|
||||
int row_start = screen_mainwin_row_start();
|
||||
int row_end = screen_mainwin_row_end();
|
||||
pnoutrefresh(window->layout->win, window->layout->y_pos, 0, row_start, 0, row_end, cols-1);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
win_refresh_with_subwin(ProfWin *window)
|
||||
{
|
||||
int rows, cols;
|
||||
getmaxyx(stdscr, rows, cols);
|
||||
int cols = getmaxx(stdscr);
|
||||
int subwin_cols = 0;
|
||||
|
||||
int row_start = screen_mainwin_row_start();
|
||||
int row_end = screen_mainwin_row_end();
|
||||
if (window->type == WIN_MUC) {
|
||||
ProfLayoutSplit *layout = (ProfLayoutSplit*)window->layout;
|
||||
subwin_cols = win_occpuants_cols();
|
||||
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);
|
||||
pnoutrefresh(layout->base.win, layout->base.y_pos, 0, row_start, 0, row_end, (cols-subwin_cols)-1);
|
||||
pnoutrefresh(layout->subwin, layout->sub_y_pos, 0, row_start, (cols-subwin_cols), row_end, cols-1);
|
||||
} else if (window->type == WIN_CONSOLE) {
|
||||
ProfLayoutSplit *layout = (ProfLayoutSplit*)window->layout;
|
||||
subwin_cols = win_roster_cols();
|
||||
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);
|
||||
pnoutrefresh(layout->base.win, layout->base.y_pos, 0, row_start, 0, row_end, (cols-subwin_cols)-1);
|
||||
pnoutrefresh(layout->subwin, layout->sub_y_pos, 0, row_start, (cols-subwin_cols), row_end, cols-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -445,7 +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_winpos_setting(void) {}
|
||||
void cons_tray_setting(void) {}
|
||||
|
||||
void cons_show_contact_online(PContact contact, Resource *resource, GDateTime *last_activity)
|
||||
|
@ -130,4 +130,7 @@ otr.char=@
|
||||
pgp.char=%
|
||||
tls.show=true
|
||||
console.muc=first
|
||||
inputwin.position=bottom
|
||||
titlebar.position=1
|
||||
mainwin.position=2
|
||||
statusbar.position=3
|
||||
inputwin.position=4
|
||||
|
@ -137,4 +137,8 @@ tls.show=true
|
||||
console.muc=first
|
||||
console.chat=all
|
||||
console.private=all
|
||||
inputwin.position=bottom
|
||||
titlebar.position=1
|
||||
mainwin.position=2
|
||||
statusbar.position=3
|
||||
inputwin.position=4
|
||||
|
||||
|
@ -133,4 +133,8 @@ tls.show=true
|
||||
console.muc=first
|
||||
console.chat=all
|
||||
console.private=all
|
||||
inputwin.position=bottom
|
||||
titlebar.position=1
|
||||
mainwin.position=2
|
||||
statusbar.position=3
|
||||
inputwin.position=4
|
||||
|
||||
|
@ -58,4 +58,8 @@ tls.show=true
|
||||
console.muc=all
|
||||
console.chat=all
|
||||
console.private=all
|
||||
inputwin.position=bottom
|
||||
titlebar.position=1
|
||||
mainwin.position=2
|
||||
statusbar.position=3
|
||||
inputwin.position=4
|
||||
|
||||
|
@ -77,4 +77,8 @@ occupants.header=bold_green
|
||||
receipt.sent=bold_black
|
||||
|
||||
[ui]
|
||||
inputwin.position=top
|
||||
titlebar.position=1
|
||||
inputwin.position=2
|
||||
statusbar.position=3
|
||||
mainwin.position=4
|
||||
|
||||
|
@ -77,4 +77,7 @@ occupants.header=yellow
|
||||
receipt.sent=red
|
||||
|
||||
[ui]
|
||||
inputwin.position=bottom
|
||||
titlebar.position=1
|
||||
mainwin.position=2
|
||||
statusbar.position=3
|
||||
inputwin.position=4
|
||||
|
@ -45,4 +45,7 @@ tls.show=false
|
||||
console.muc=first
|
||||
console.chat=first
|
||||
console.private=first
|
||||
inputwin.position=bottom
|
||||
titlebar.position=1
|
||||
mainwin.position=2
|
||||
statusbar.position=3
|
||||
inputwin.position=4
|
||||
|
Loading…
Reference in New Issue
Block a user