diff options
author | TheJackiMonster <thejackimonster@gmail.com> | 2022-05-30 11:35:15 +0200 |
---|---|---|
committer | TheJackiMonster <thejackimonster@gmail.com> | 2022-05-30 11:35:15 +0200 |
commit | b258c174a4e826c151adb216553628987e50f7c8 (patch) | |
tree | ca718fc5092cb64ff434f80dd7900fd1d87ec32f | |
parent | d3a9d7a5c6f891acf2eb0bcdc32b68795c9c225b (diff) |
Taking care of the application window
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-rw-r--r-- | src/application.c | 17 | ||||
-rw-r--r-- | src/application.h | 1 |
2 files changed, 16 insertions, 2 deletions
diff --git a/src/application.c b/src/application.c index a56fd43..74641c5 100644 --- a/src/application.c +++ b/src/application.c @@ -34,10 +34,17 @@ application_init(MESSENGER_Application *app, app->argc = argc; app->argv = argv; - initscr(); + app->window = initscr(); + + if (!(app->window)) + { + app->status = GNUNET_SYSERR; + return; + } + noecho(); - keypad(stdscr, TRUE); + keypad(app->window, TRUE); timeout(100); } @@ -49,6 +56,9 @@ run (void *cls, { MESSENGER_Application *app = cls; + if (!(app->window)) + return; + chat_start(&(app->chat), app, cfg); } @@ -71,6 +81,9 @@ application_run(MESSENGER_Application *app) messages_clear(&(app->messages)); + if (app->window) + delwin(app->window); + endwin(); } diff --git a/src/application.h b/src/application.h index 3e4bede..63e1689 100644 --- a/src/application.h +++ b/src/application.h @@ -41,6 +41,7 @@ typedef struct MESSENGER_Application int argc; int status; + WINDOW *window; MESSENGER_Chat chat; |