commit b258c174a4e826c151adb216553628987e50f7c8
parent d3a9d7a5c6f891acf2eb0bcdc32b68795c9c225b
Author: TheJackiMonster <thejackimonster@gmail.com>
Date: Mon, 30 May 2022 11:35:15 +0200
Taking care of the application window
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
Diffstat:
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git 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
@@ -41,6 +41,7 @@ typedef struct MESSENGER_Application
int argc;
int status;
+ WINDOW *window;
MESSENGER_Chat chat;