int main(int argc, char **argv) { (void)argc; (void)argv; /* open connection with the server */ nil_.con = xcb_connect(0, 0); if (xcb_connection_has_error(nil_.con)) { NIL_ERR("xcb_connect %p", (void *)nil_.con); exit(1); } /* 1st stage */ if ((init_screen() != 0) || (init_key() != 0) || (init_mouse() != 0)) { xcb_disconnect(nil_.con); exit(1); } /* 2nd stage */ if ((init_cursor() != 0) || (init_color() != 0) != (init_font() != 0) || (init_bar() != 0) || (init_wm() != 0)) { cleanup(); exit(1); } xcb_flush(nil_.con); recv_events(); cleanup(); return 0; }
int main() { int ch; init_wm(); initscr(); while((ch = getch()) != 'q') { switch(ch) { case 'd': move_window_to(WM_RIGHT); break; case 'a': move_window_to(WM_LEFT); break; case 's': move_window_to(WM_DOWN); break; case 'w': move_window_to(WM_UP); break; } } endwin(); return 0; }
void gnt_init() { char *filename; const char *locale; if (channel) return; locale = setlocale(LC_ALL, ""); setup_io(); #ifdef NO_WIDECHAR ascii_only = TRUE; #else if (locale && (strstr(locale, "UTF") || strstr(locale, "utf"))) ascii_only = FALSE; else ascii_only = TRUE; #endif initscr(); typeahead(-1); noecho(); curs_set(0); gnt_init_keys(); gnt_init_styles(); filename = g_build_filename(g_get_home_dir(), ".gntrc", NULL); gnt_style_read_configure_file(filename); g_free(filename); gnt_init_colors(); wbkgdset(stdscr, '\0' | gnt_color_pair(GNT_COLOR_NORMAL)); refresh(); #ifdef ALL_MOUSE_EVENTS if ((mouse_enabled = gnt_style_get_bool(GNT_STYLE_MOUSE, FALSE))) mousemask(ALL_MOUSE_EVENTS | REPORT_MOUSE_POSITION, NULL); #endif wbkgdset(stdscr, '\0' | gnt_color_pair(GNT_COLOR_NORMAL)); werase(stdscr); wrefresh(stdscr); #ifdef SIGWINCH org_winch_handler = signal(SIGWINCH, sighandler); #endif signal(SIGCHLD, sighandler); signal(SIGINT, sighandler); signal(SIGPIPE, SIG_IGN); g_type_init(); init_wm(); clipboard = g_object_new(GNT_TYPE_CLIPBOARD, NULL); }