1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-26 16:03:27 +01:00

fix window resizing bug on some platforms and add -O1 optimization flag

This commit is contained in:
Jfreegman 2014-07-01 19:39:25 -04:00
parent 7c71c35797
commit 95d09e4b75
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63
2 changed files with 10 additions and 13 deletions

View File

@ -15,7 +15,7 @@ MANFILES = toxic.1 toxic.conf.5
LIBS = libtoxcore ncursesw LIBS = libtoxcore ncursesw
CFLAGS = -std=gnu99 -pthread -Wimplicit-function-declaration -Wreturn-type CFLAGS = -std=gnu99 -pthread -Wimplicit-function-declaration -Wreturn-type -O1
CFLAGS += -DTOXICVER="\"$(VERSION)\"" -DHAVE_WIDECHAR -D_XOPEN_SOURCE_EXTENDED CFLAGS += -DTOXICVER="\"$(VERSION)\"" -DHAVE_WIDECHAR -D_XOPEN_SOURCE_EXTENDED
CFLAGS += -DPACKAGE_DATADIR="\"$(abspath $(DATADIR))\"" CFLAGS += -DPACKAGE_DATADIR="\"$(abspath $(DATADIR))\""
CFLAGS += $(USER_CFLAGS) CFLAGS += $(USER_CFLAGS)

View File

@ -315,6 +315,11 @@ void on_window_resize(void)
refresh(); refresh();
clear(); clear();
/* equivalent to LINES and COLS */
int x2, y2;
getmaxyx(stdscr, y2, x2);
y2 -= 2;
int i; int i;
for (i == 0; i < MAX_WINDOWS_NUM; ++i) { for (i == 0; i < MAX_WINDOWS_NUM; ++i) {
@ -323,19 +328,13 @@ void on_window_resize(void)
ToxWindow *w = &windows[i]; ToxWindow *w = &windows[i];
if (windows[i].is_friendlist) {
delwin(w->window);
w->window = newwin(LINES - 2, COLS, 0, 0);
continue;
}
delwin(w->window); delwin(w->window);
w->window = newwin(LINES - 2, COLS, 0, 0); w->window = newwin(y2, x2, 0, 0);
int x2, y2, x, y;
getmaxyx(w->window, y2, x2);
w->x = x2; w->x = x2;
if (windows[i].is_friendlist)
continue;
if (w->is_groupchat) if (w->is_groupchat)
delwin(w->chatwin->sidebar); delwin(w->chatwin->sidebar);
else else
@ -355,12 +354,10 @@ void on_window_resize(void)
} }
#ifdef _SUPPORT_AUDIO #ifdef _SUPPORT_AUDIO
if (w->chatwin->infobox.active) { if (w->chatwin->infobox.active) {
delwin(w->chatwin->infobox.win); delwin(w->chatwin->infobox.win);
w->chatwin->infobox.win = newwin(INFOBOX_HEIGHT, INFOBOX_WIDTH + 1, 1, x2 - INFOBOX_WIDTH); w->chatwin->infobox.win = newwin(INFOBOX_HEIGHT, INFOBOX_WIDTH + 1, 1, x2 - INFOBOX_WIDTH);
} }
#endif /* #ifdef _SUPPORT_AUDIO */ #endif /* #ifdef _SUPPORT_AUDIO */
scrollok(w->chatwin->history, 0); scrollok(w->chatwin->history, 0);