mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-22 21:43:02 +01:00
astyle --options=tools/astylerc -r ./*.{c,h}
This commit is contained in:
parent
05fd02767f
commit
43d0d7a1c0
2
prompt.c
2
prompt.c
@ -365,7 +365,9 @@ static void execute(ToxWindow *self, Messenger *m, char *u_cmd)
|
||||
cmd[i] = '\0';
|
||||
|
||||
int j = i;
|
||||
|
||||
while (++j < MAX_STR_SIZE && isspace(cmd[j]));
|
||||
|
||||
i = j - 1;
|
||||
|
||||
numargs++;
|
||||
|
26
windows.c
26
windows.c
@ -90,18 +90,20 @@ int add_window(Messenger *m, ToxWindow w)
|
||||
return -1;
|
||||
|
||||
int i;
|
||||
for(i = 0; i < MAX_WINDOWS_NUM; i++) {
|
||||
|
||||
for (i = 0; i < MAX_WINDOWS_NUM; i++) {
|
||||
if (windows[i].window)
|
||||
continue;
|
||||
|
||||
w.window = newwin(LINES - 2, COLS, 0, 0);
|
||||
|
||||
if (w.window == NULL)
|
||||
return -1;
|
||||
|
||||
windows[i] = w;
|
||||
w.onInit(&w, m);
|
||||
|
||||
active_window = windows+i;
|
||||
active_window = windows + i;
|
||||
return i;
|
||||
}
|
||||
|
||||
@ -113,8 +115,10 @@ void del_window(ToxWindow *w)
|
||||
{
|
||||
active_window = windows; // Go to prompt screen
|
||||
delwin(w->window);
|
||||
|
||||
if (w->x)
|
||||
free(w->x);
|
||||
|
||||
w->window = NULL;
|
||||
memset(w, 0, sizeof(ToxWindow));
|
||||
clear();
|
||||
@ -124,15 +128,15 @@ void del_window(ToxWindow *w)
|
||||
/* Shows next window when tab or back-tab is pressed */
|
||||
void set_next_window(int ch)
|
||||
{
|
||||
ToxWindow *end = windows+MAX_WINDOWS_NUM-1;
|
||||
ToxWindow *end = windows + MAX_WINDOWS_NUM - 1;
|
||||
ToxWindow *inf = active_window;
|
||||
while(true) {
|
||||
|
||||
while (true) {
|
||||
if (ch == '\t') {
|
||||
if (++active_window > end)
|
||||
active_window = windows;
|
||||
} else
|
||||
if (--active_window < windows)
|
||||
active_window = end;
|
||||
} else if (--active_window < windows)
|
||||
active_window = end;
|
||||
|
||||
if (active_window->window)
|
||||
return;
|
||||
@ -149,7 +153,7 @@ void set_active_window(int index)
|
||||
if (index < 0 || index >= MAX_WINDOWS_NUM)
|
||||
return;
|
||||
|
||||
active_window = windows+index;
|
||||
active_window = windows + index;
|
||||
}
|
||||
|
||||
ToxWindow *init_windows()
|
||||
@ -189,7 +193,7 @@ static void draw_bar()
|
||||
|
||||
for (i = 0; i < (MAX_WINDOWS_NUM); ++i) {
|
||||
if (windows[i].window) {
|
||||
if (windows+i == active_window)
|
||||
if (windows + i == active_window)
|
||||
attron(A_BOLD);
|
||||
|
||||
odd = (odd + 1) % blinkrate;
|
||||
@ -197,13 +201,13 @@ static void draw_bar()
|
||||
if (windows[i].blink && (odd < (blinkrate / 2)))
|
||||
attron(COLOR_PAIR(3));
|
||||
|
||||
clrtoeol();
|
||||
clrtoeol();
|
||||
printw(" %s", windows[i].title);
|
||||
|
||||
if (windows[i].blink && (odd < (blinkrate / 2)))
|
||||
attroff(COLOR_PAIR(3));
|
||||
|
||||
if (windows+i == active_window) {
|
||||
if (windows + i == active_window) {
|
||||
attroff(A_BOLD);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user