From 5541008b3b4042fb21d1be833a7290f954700e10 Mon Sep 17 00:00:00 2001 From: Jfreegman Date: Fri, 2 Aug 2013 03:36:31 -0400 Subject: fixed cursor --- testing/toxic/main.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/testing/toxic/main.c b/testing/toxic/main.c index cdc6dc16..b014a79f 100644 --- a/testing/toxic/main.c +++ b/testing/toxic/main.c @@ -280,6 +280,14 @@ void prepare_window(WINDOW* w) { wresize(w, LINES-2, COLS); } +/* Draws cursor relative to input */ +void position_cursor(WINDOW* w) +{ + int x, y; + getyx(w, y, x); + move(y, x); +} + int main(int argc, char* argv[]) { int ch; ToxWindow* a; @@ -299,6 +307,7 @@ int main(int argc, char* argv[]) { a->blink = false; a->onDraw(a); draw_bar(); + position_cursor(a->window); // Handle input. ch = getch(); -- cgit v1.2.3 From fbf92e4f5ee8eeadae4c18e4af6196896df6975b Mon Sep 17 00:00:00 2001 From: Jfreegman Date: Fri, 2 Aug 2013 04:58:15 -0400 Subject: remove cursor from friend and chat windows --- testing/toxic/main.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/testing/toxic/main.c b/testing/toxic/main.c index b014a79f..6ceab010 100644 --- a/testing/toxic/main.c +++ b/testing/toxic/main.c @@ -280,12 +280,24 @@ void prepare_window(WINDOW* w) { wresize(w, LINES-2, COLS); } -/* Draws cursor relative to input */ -void position_cursor(WINDOW* w) +/* + * Draws cursor relative to input on prompt window. + * Removes cursor on friends window and chat windows. + * + * TODO: Make it work for chat windows + */ +void position_cursor(WINDOW* w, char* title, ToxWindow* a) { - int x, y; - getyx(w, y, x); - move(y, x); + curs_set(1); + if (strcmp(title, "[prompt]") == 0) { // main/prompt window + int x, y; + getyx(w, y, x); + move(y, x); + } + else if (strcmp(title, "[friends]") == 0) // friends window + curs_set(0); + else // any other window (i.e chat) + curs_set(0); } int main(int argc, char* argv[]) { @@ -307,7 +319,7 @@ int main(int argc, char* argv[]) { a->blink = false; a->onDraw(a); draw_bar(); - position_cursor(a->window); + position_cursor(a->window, a->title, a); // Handle input. ch = getch(); -- cgit v1.2.3 From 1205b902e4e53187e742961e6fed5266c680affe Mon Sep 17 00:00:00 2001 From: Jfreegman Date: Fri, 2 Aug 2013 05:08:04 -0400 Subject: rm unused arg --- testing/toxic/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testing/toxic/main.c b/testing/toxic/main.c index 6ceab010..c596b708 100644 --- a/testing/toxic/main.c +++ b/testing/toxic/main.c @@ -286,7 +286,7 @@ void prepare_window(WINDOW* w) { * * TODO: Make it work for chat windows */ -void position_cursor(WINDOW* w, char* title, ToxWindow* a) +void position_cursor(WINDOW* w, char* title) { curs_set(1); if (strcmp(title, "[prompt]") == 0) { // main/prompt window @@ -319,7 +319,7 @@ int main(int argc, char* argv[]) { a->blink = false; a->onDraw(a); draw_bar(); - position_cursor(a->window, a->title, a); + position_cursor(a->window, a->title); // Handle input. ch = getch(); -- cgit v1.2.3