int sys_createWindow() { int left_x, right_x, left_y, right_y; if (argint(0, &left_x) < 0 || argint(1, &left_y) < 0 || argint(2, &right_x) < 0 || argint(3, &right_y) < 0) return -1; return allocWindow(left_x, left_y, right_x, right_y, proc->pid)->window_id; }
int resetWindows(DictionaryIterator *rdi) { MyWindow *mw; int rh; objects *tmpWindows; APP_LOG(APP_LOG_LEVEL_DEBUG, "resetWindows"); // Doesn't currently work once windows exist. if (myWindows != NULL) { return 0; } tmpWindows = myWindows; myWindows = NULL; APP_LOG(APP_LOG_LEVEL_DEBUG, "About to create windows structure."); myWindows = createObjects(MyWindowDestructor); APP_LOG(APP_LOG_LEVEL_DEBUG, "objects created. "); // Need to create a window to keep the app from // exiting, so we might as well make it available. rh = allocWindow(NULL); APP_LOG(APP_LOG_LEVEL_DEBUG, "root window handle = %d", rh); if (rh != 0) { APP_LOG(APP_LOG_LEVEL_ERROR, "Root window handle %d != 0", rh); } mw = getWindowByHandle(rh); if (mw == NULL) { APP_LOG(APP_LOG_LEVEL_ERROR, "Root window null"); } pushWindow(mw, rdi); if (tmpWindows) { freeObjects(tmpWindows); } return 0; }