diff options
Diffstat (limited to 'libwinnie/src/winnie.cc')
-rw-r--r-- | libwinnie/src/winnie.cc | 60 |
1 files changed, 3 insertions, 57 deletions
diff --git a/libwinnie/src/winnie.cc b/libwinnie/src/winnie.cc index 2e94b24..d5021eb 100644 --- a/libwinnie/src/winnie.cc +++ b/libwinnie/src/winnie.cc @@ -30,18 +30,13 @@ Author: Eleni Maria Stea <elene.mst@gmail.com> #include "sdl/keyboard.h" #include "sdl/mouse.h" -#include "shalloc.h" #include "winnie.h" static Subsys *subsys; bool winnie_init() { - if(!init_shared_memory()) { - return false; - } - - if(!(subsys = (Subsys*)sh_malloc(sizeof *subsys))) { + if(!(subsys = (Subsys*)malloc(sizeof *subsys))) { return false; } @@ -77,67 +72,18 @@ void winnie_shutdown() destroy_text(); destroy_window_manager(); - sh_free(subsys); - - destroy_shared_memory(); + free(subsys); } -static int fd; -static void *pool; - bool winnie_open() { - if(((fd = shm_open(SHMNAME, O_RDWR, S_IRWXU)) == -1)) { - fprintf(stderr, "Failed to open shared memory: %s\n", strerror(errno)); - return false; - } - - if((pool = mmap(0, POOL_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)) == (void*)-1) { - fprintf(stderr, "Failed to map shared memory: %s\n", strerror(errno)); - return false; - } - - subsys = (Subsys*)pool; - - if(!client_open_gfx(pool, subsys->graphics_offset)) { - fprintf(stderr, "Failed to open graphics.\n"); - return false; - } - - if(!client_open_keyboard(pool, subsys->keyboard_offset)) { - fprintf(stderr, "Failed to open keyboard.\n"); - return false; - } - - if(!client_open_mouse(pool, subsys->mouse_offset)) { - fprintf(stderr, "Failed to open mouse.\n"); - return false; - } - - if(!client_open_text(pool, subsys->text_offset)) { - fprintf(stderr, "Failed to open text.\n"); - return false; - } - - if(!client_open_wm(pool, subsys->wm_offset)) { - fprintf(stderr, "Failed to open the window manager.\n"); - return false; - } + subsys = (Subsys*)malloc(sizeof(Subsys)); return true; } void winnie_close() { - client_close_gfx(); - client_close_keyboard(); - client_close_mouse(); - client_close_text(); - client_close_wm(); - - if(munmap(pool, POOL_SIZE) == -1) { - fprintf(stderr, "Failed to unmap shared memory: %s\n", strerror(errno)); - } } long winnie_get_time() |