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); }
void game_init(void) { tft_fill(GAME_BGC); bar_init(); box_init(); switch (game.mode) { case 1: game_display_score(1); case 0: case 2: game_display_score(0); break; case 3: game_display_score(1); } }
int main(int argc, char **argv){ pthread_t pt_data [4]; bar_init(&barr, 4); // printf("Took _____ seconds.\n"); //initialize threads for (int i = 0; i<4; i++){ pthread_create(&pt_data[i], NULL, stabilize, (void *)i); } for (int i = 0; i<4; i++){ pthread_join(pt_data[i], NULL); } exit(0); }
/** * Initialize the templ theme * @param hue [0..360] hue value from HSV color space to define the theme's base color * @param font pointer to a font (NULL to use the default) * @return pointer to the initialized theme */ lv_theme_t * lv_theme_templ_init(uint16_t hue, lv_font_t *font) { if(font == NULL) font = LV_FONT_DEFAULT; _hue = hue; _font = font; /*For backward compatibility initialize all theme elements with a default style */ uint16_t i; lv_style_t **style_p = (lv_style_t**) &theme; for(i = 0; i < sizeof(lv_theme_t) / sizeof(lv_style_t*); i++) { *style_p = &def; style_p++; } basic_init(); cont_init(); btn_init(); label_init(); img_init(); line_init(); led_init(); bar_init(); slider_init(); sw_init(); lmeter_init(); gauge_init(); chart_init(); cb_init(); btnm_init(); kb_init(); mbox_init(); page_init(); ta_init(); list_init(); ddlist_init(); roller_init(); tabview_init(); win_init(); return &theme; }
int main(int argc, char * argv[]) { foo_init(); bar_init(); return EXIT_SUCCESS; }
void init_screens(void) { Rectangle *rects; View *v; int i, n, m; #ifdef notdef d.x = Dx(scr.rect) - Dx(screen->r); d.y = Dy(scr.rect) - Dy(screen->r); for(v=view; v; v=v->next) { v->r.max.x += d.x; v->r.max.y += d.y; } #endif /* Reallocate screens, zero any new ones. */ rects = xinerama_screens(&n); m = max(n, nscreens); screens = erealloc(screens, (m + 1) * sizeof *screens); screens[m] = nil; for(v=view; v; v=v->next) { v->areas = erealloc(v->areas, m * sizeof *v->areas); v->r = erealloc(v->r, m * sizeof *v->r); v->pad = erealloc(v->pad, m * sizeof *v->pad); } for(i=nscreens; i < m; i++) { screens[i] = emallocz(sizeof *screens[i]); for(v=view; v; v=v->next) view_init(v, i); } nscreens = m; /* Reallocate buffers. */ freeimage(ibuf); freeimage(ibuf32); ibuf = allocimage(Dx(scr.rect), Dy(scr.rect), scr.depth); ibuf32 = nil; /* Probably shouldn't do this until it's needed. */ if(render_visual) ibuf32 = allocimage(Dx(scr.rect), Dy(scr.rect), 32); disp.ibuf = ibuf; disp.ibuf32 = ibuf32; /* Resize and initialize screens. */ for(i=0; i < nscreens; i++) { screen = screens[i]; screen->idx = i; screen->showing = i < n; if(screen->showing) screen->r = rects[i]; else screen->r = rectsetorigin(screen->r, scr.rect.max); def.snap = Dy(screen->r) / 63; bar_init(screens[i]); } screen = screens[0]; if(selview) view_update(selview); }