diff options
author | Jesse Luehrs <doy@tozt.net> | 2016-05-10 17:25:12 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2016-05-10 17:31:39 -0400 |
commit | ec77a7037586864ece6505c448ab5c15bf8a57d9 (patch) | |
tree | ad23ca8d2ded6ffc0a9d9c6c5320e457c37ece32 /src/runesd.c | |
parent | 9118ead5ae15548c8a5b96340f9a0a24b3104e32 (diff) | |
download | runes-ec77a7037586864ece6505c448ab5c15bf8a57d9.tar.gz runes-ec77a7037586864ece6505c448ab5c15bf8a57d9.zip |
refactor how submodules are handled
let them own their own memory, so that they can free themselves once
they exit the loop. also split out the parts of the terminal that we
only want to initialize once, even if we open multiple terminal windows
Diffstat (limited to 'src/runesd.c')
-rw-r--r-- | src/runesd.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/runesd.c b/src/runesd.c index 2ba6ba0..344e834 100644 --- a/src/runesd.c +++ b/src/runesd.c @@ -4,11 +4,13 @@ #include "loop.h" #include "socket.h" +#include "window-xlib.h" int main (int argc, char *argv[]) { - RunesLoop loop; - RunesSocket socket; + RunesLoop *loop; + RunesSocket *socket; + RunesWindowBackendGlobal *wg; UNUSED(argv); @@ -18,13 +20,18 @@ int main (int argc, char *argv[]) setlocale(LC_ALL, ""); - runes_loop_init(&loop); - runes_socket_init(&socket, &loop); + loop = runes_loop_new(); + wg = runes_window_backend_global_init(); + socket = runes_socket_new(loop, wg); + UNUSED(socket); - runes_loop_run(&loop); + runes_loop_run(loop); - runes_socket_cleanup(&socket); - runes_loop_cleanup(&loop); +#ifdef RUNES_VALGRIND + runes_socket_delete(socket); + runes_window_backend_global_cleanup(wg); + runes_loop_delete(loop); +#endif return 0; } |