summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
authorJfreegman <Jfreegman@gmail.com>2013-08-02 03:36:31 -0400
committerJfreegman <Jfreegman@gmail.com>2013-08-02 05:10:41 -0400
commit7189f4c7b2f7753f4b373af9f1a9f20eef5fba54 (patch)
tree322ffec7ee8129eab10e50a0d760e7d1e709854a /testing
parent91216719a528971110975883f59f48465567ced8 (diff)
fixed cursor
Diffstat (limited to 'testing')
-rw-r--r--testing/toxic/main.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/testing/toxic/main.c b/testing/toxic/main.c
index cdc6dc16..c596b708 100644
--- a/testing/toxic/main.c
+++ b/testing/toxic/main.c
@@ -280,6 +280,26 @@ void prepare_window(WINDOW* w) {
280 wresize(w, LINES-2, COLS); 280 wresize(w, LINES-2, COLS);
281} 281}
282 282
283/*
284 * Draws cursor relative to input on prompt window.
285 * Removes cursor on friends window and chat windows.
286 *
287 * TODO: Make it work for chat windows
288 */
289void position_cursor(WINDOW* w, char* title)
290{
291 curs_set(1);
292 if (strcmp(title, "[prompt]") == 0) { // main/prompt window
293 int x, y;
294 getyx(w, y, x);
295 move(y, x);
296 }
297 else if (strcmp(title, "[friends]") == 0) // friends window
298 curs_set(0);
299 else // any other window (i.e chat)
300 curs_set(0);
301}
302
283int main(int argc, char* argv[]) { 303int main(int argc, char* argv[]) {
284 int ch; 304 int ch;
285 ToxWindow* a; 305 ToxWindow* a;
@@ -299,6 +319,7 @@ int main(int argc, char* argv[]) {
299 a->blink = false; 319 a->blink = false;
300 a->onDraw(a); 320 a->onDraw(a);
301 draw_bar(); 321 draw_bar();
322 position_cursor(a->window, a->title);
302 323
303 // Handle input. 324 // Handle input.
304 ch = getch(); 325 ch = getch();