/** * WINDOW command, parse the parameter setting command * Sets graphics window attributes * * @param nerr * Error Return Code * - 0 on Success * - Non-Zero on Error * * @date 861230: Original version. * */ void xwindow(int *nerr) { int iwin; int width, height; double ratio; int ratio_on; double tmp[2]; *nerr = 0; iwin = 1; ratio = 11.0 / 8.5; /* - Loop on each token in command: */ L_1000: if( lcmore( nerr ) ){ /* -- Set up window number. */ if( lcirc( 1, MWINDOWS, &iwin ) ){ } else if( lkrrcp( "XSIZE$",7, 0., 1., &tmp[0], &tmp[1] ) ){ Xwindowmin[iwin] = tmp[0]; Xwindowmax[iwin] = tmp[1]; set_window_width( -1 ); set_window_height( -1 ); set_constrain_plot_ratio_x11( FALSE ); } else if( lkrrcp( "YSIZE$",7, 0., 1., &tmp[0], &tmp[1] ) ){ Ywindowmin[iwin] = tmp[0]; Ywindowmax[iwin] = tmp[1]; set_window_width( -1 ); set_window_height( -1 ); } else if( lkint( "WIDTH$", 7, &width) ) { set_window_width( width ); } else if( lkint( "HEIGHT$", 7, &height) ) { set_window_height( height ); } else if( lklogr( "ASPECT$", 8, &ratio_on, &ratio) ) { set_constrain_plot_ratio_x11( ratio_on ); if(ratio_on) { set_plot_ratio_x11( ratio ); } } else{ cfmt( "ILLEGAL OPTION:",17 ); cresp(); } goto L_1000; } return; }
void bar_setup(struct bar *bar, const char *socket_path, const char *bar_id, int desired_output) { /* initialize bar with default values */ bar_init(bar); bar->output->registry = registry_poll(); if (!bar->output->registry->desktop_shell) { sway_abort("swaybar requires the compositor to support the desktop-shell extension."); } /* connect to sway ipc */ bar->ipc_socketfd = ipc_open_socket(socket_path); bar->ipc_event_socketfd = ipc_open_socket(socket_path); ipc_bar_init(bar, desired_output, bar_id); struct output_state *output = bar->output->registry->outputs->items[desired_output]; bar->output->window = window_setup(bar->output->registry, output->width, 30, false); if (!bar->output->window) { sway_abort("Failed to create window."); } desktop_shell_set_panel(bar->output->registry->desktop_shell, output->output, bar->output->window->surface); desktop_shell_set_panel_position(bar->output->registry->desktop_shell, bar->config->position); /* set font */ bar->output->window->font = bar->config->font; /* set window height */ set_window_height(bar->output->window, bar->config->height); /* spawn status command */ spawn_status_cmd_proc(bar); }
GLFWwindow* setupWindow(bool fullscreen) { GLFWwindow* window; if (!glfwInit()){ fprintf(stderr, "Failed to initialize GLFW\n"); return NULL; } doHints(); const GLFWvidmode * mode = glfwGetVideoMode(glfwGetPrimaryMonitor()); if (fullscreen) { window = glfwCreateWindow( mode->width, mode->height, "SLUMBER", glfwGetPrimaryMonitor(), NULL); } else { window = glfwCreateWindow( mode->width, mode->height, "SLUMBER", NULL, NULL); } set_window_width(mode->width); set_window_height(mode->height); if(window == NULL){ fprintf(stderr, "Failed to initialize window\n"); glfwTerminate(); return NULL; } glfwMakeContextCurrent(window); // Initialize GLAD if (!gladLoadGL()) { printf("Couldn't initialize GLAD\n"); glfwDestroyWindow(window); glfwTerminate(); return NULL; } glEnable(GL_DEPTH_TEST); glEnable(GL_MULTISAMPLE); glEnable (GL_BLEND); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // glClearColor(.051f, .447f, .60f, 0.0f); glClearColor(.1f, .0, .0f, 0.0f); return window; }