mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Fix titlebar write position
Mistake introduced in 86f0e0ea70
The functions later on dont set an explitic position when writing their
strings.
Fix https://github.com/profanity-im/profanity/issues/1346
This commit is contained in:
parent
438552c14c
commit
d251b56166
@ -61,7 +61,8 @@ static gboolean typing;
|
|||||||
static GTimer *typing_elapsed;
|
static GTimer *typing_elapsed;
|
||||||
|
|
||||||
static void _title_bar_draw(void);
|
static void _title_bar_draw(void);
|
||||||
static int _show_self_presence(void);
|
static void _show_self_presence(void);
|
||||||
|
static int _calc_self_presence(void);
|
||||||
static void _show_contact_presence(ProfChatWin *chatwin, int pos, int maxpos);
|
static void _show_contact_presence(ProfChatWin *chatwin, int pos, int maxpos);
|
||||||
static void _show_privacy(ProfChatWin *chatwin);
|
static void _show_privacy(ProfChatWin *chatwin);
|
||||||
static void _show_muc_privacy(ProfMucWin *mucwin);
|
static void _show_muc_privacy(ProfMucWin *mucwin);
|
||||||
@ -203,7 +204,7 @@ _title_bar_draw(void)
|
|||||||
|
|
||||||
// presence is written from the right side
|
// presence is written from the right side
|
||||||
// calculate it first so we have a maxposition
|
// calculate it first so we have a maxposition
|
||||||
maxrightpos = _show_self_presence();
|
maxrightpos = _calc_self_presence();
|
||||||
|
|
||||||
if (current && current->type == WIN_CHAT) {
|
if (current && current->type == WIN_CHAT) {
|
||||||
ProfChatWin *chatwin = (ProfChatWin*) current;
|
ProfChatWin *chatwin = (ProfChatWin*) current;
|
||||||
@ -222,6 +223,8 @@ _title_bar_draw(void)
|
|||||||
_show_scrolled(current);
|
_show_scrolled(current);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_show_self_presence();
|
||||||
|
|
||||||
wnoutrefresh(win);
|
wnoutrefresh(win);
|
||||||
inp_put_back();
|
inp_put_back();
|
||||||
}
|
}
|
||||||
@ -248,6 +251,36 @@ _show_scrolled(ProfWin *current)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
_calc_self_presence(void)
|
||||||
|
{
|
||||||
|
int tls_start = 0;
|
||||||
|
|
||||||
|
switch (current_presence)
|
||||||
|
{
|
||||||
|
case CONTACT_ONLINE:
|
||||||
|
tls_start = 15;
|
||||||
|
break;
|
||||||
|
case CONTACT_AWAY:
|
||||||
|
tls_start = 13;
|
||||||
|
break;
|
||||||
|
case CONTACT_DND:
|
||||||
|
tls_start = 12;
|
||||||
|
break;
|
||||||
|
case CONTACT_CHAT:
|
||||||
|
tls_start = 13;
|
||||||
|
break;
|
||||||
|
case CONTACT_XA:
|
||||||
|
tls_start = 11;
|
||||||
|
break;
|
||||||
|
case CONTACT_OFFLINE:
|
||||||
|
tls_start = 16;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return tls_start - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
_show_self_presence(void)
|
_show_self_presence(void)
|
||||||
{
|
{
|
||||||
int presence_attrs = 0;
|
int presence_attrs = 0;
|
||||||
@ -345,8 +378,6 @@ _show_self_presence(void)
|
|||||||
mvwaddch(win, 0, cols - (tls_start - 4), ']');
|
mvwaddch(win, 0, cols - (tls_start - 4), ']');
|
||||||
wattroff(win, bracket_attrs);
|
wattroff(win, bracket_attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
return tls_start - 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user