int main(int argc, char *argv[]) { if (argc < 2) { printf("Compositor server not specified.\n"); return 1; } list_initialize(&led_devs); int rc = loc_register_cat_change_cb(loc_callback); if (rc != EOK) { printf("Unable to register callback for device discovery.\n"); return 1; } led_timer = fibril_timer_create(NULL); if (!led_timer) { printf("Unable to create LED timer.\n"); return 1; } frame_timer = fibril_timer_create(NULL); if (!frame_timer) { printf("Unable to create frame timer.\n"); return 1; } if (!decode_frames()) return 1; winreg = argv[1]; window_t *main_window = window_open(argv[1], NULL, WINDOW_MAIN | WINDOW_DECORATED, "barber"); if (!main_window) { printf("Cannot open main window.\n"); return 1; } frame_canvas = create_canvas(window_root(main_window), NULL, FRAME_WIDTH, FRAME_HEIGHT, frames[frame]); if (!frame_canvas) { window_close(main_window); printf("Cannot create widgets.\n"); return 1; } window_resize(main_window, 0, 0, FRAME_WIDTH + 8, FRAME_HEIGHT + 28, WINDOW_PLACEMENT_RIGHT | WINDOW_PLACEMENT_BOTTOM); window_exec(main_window); plan_led_timer(); plan_frame_timer(0); task_retval(0); async_manager(); return 0; }
int main(int argc, char *argv[]) { if (argc >= 2) { window_t *main_window = window_open(argv[1], NULL, WINDOW_MAIN | WINDOW_DECORATED | WINDOW_RESIZEABLE, "vdemo"); if (!main_window) { printf("Cannot open main window.\n"); return 1; } pixel_t grd_bg = PIXEL(255, 240, 240, 240); pixel_t btn_bg = PIXEL(255, 240, 240, 240); pixel_t btn_fg = PIXEL(255, 186, 186, 186); pixel_t btn_text = PIXEL(255, 0, 0, 0); pixel_t lbl_bg = PIXEL(255, 240, 240, 240); pixel_t lbl_text = PIXEL(255, 0, 0, 0); my_label_t *lbl_action = create_my_label(NULL, "Hello there!", 16, lbl_bg, lbl_text); button_t *btn_confirm = create_button(NULL, NULL, "Confirm", 16, btn_bg, btn_fg, btn_text); button_t *btn_cancel = create_button(NULL, NULL, "Cancel", 16, btn_bg, btn_fg, btn_text); grid_t *grid = create_grid(window_root(main_window), NULL, 2, 2, grd_bg); if (!lbl_action || !btn_confirm || !btn_cancel || !grid) { window_close(main_window); printf("Cannot create widgets.\n"); return 1; } sig_connect( &btn_confirm->clicked, &lbl_action->label.widget, lbl_action->confirm); sig_connect( &btn_cancel->clicked, &lbl_action->label.widget, lbl_action->cancel); grid->add(grid, &lbl_action->label.widget, 0, 0, 2, 1); grid->add(grid, &btn_confirm->widget, 0, 1, 1, 1); grid->add(grid, &btn_cancel->widget, 1, 1, 1, 1); window_resize(main_window, 0, 0, 200, 76, WINDOW_PLACEMENT_CENTER); window_exec(main_window); task_retval(0); async_manager(); return 1; } else { printf("Compositor server not specified.\n"); return 1; } }
void window_equalize(struct window *window, enum window_split_type type) { if (window->split_type == WINDOW_LEAF) { window = window->parent; } if (!window) { return; } struct window *root = window_root(window); size_t n = window_count_splits(root, type); size_t size; if (type == WINDOW_SPLIT_VERTICAL) { size = root->w; } else { size = root->h; } window_set_split_size(root, type, size / (n + 1)); }
int main(int argc, char *argv[]) { char buffer[30]; struct timeval tv; struct tm result; window_t *main_window = window_open(argv[1], true, true," ",0,720); if (!main_window) { printf("Cannot open main window.\n"); return 1; } time_t curtime; gettimeofday(&tv, NULL); curtime=tv.tv_sec; time_utc2tm(curtime,&result); strftime(buffer,30,"%T %m-%d-%Y",&result); pixel_t grd_bg = PIXEL(255, 25, 25, 112); pixel_t lbl_bg = PIXEL(255, 25, 25, 112);//(255, 240, 240, 240); pixel_t lbl_fg = PIXEL(255, 255, 255, 255); my_label_t *stime= create_my_label(NULL,buffer, 16, lbl_bg, lbl_fg); grid_t *grid = create_grid(window_root(main_window),1, 10, grd_bg); grid->add(grid, &stime->label.widget, 0, 7, 1, 2); window_resize(main_window,1024,60); window_exec(main_window); while(1){ gettimeofday(&tv, NULL); curtime=tv.tv_sec; time_utc2tm(curtime,&result); //Converting month to integer char month[5]; strftime(month,5,"%m",&result); char *mon; mon=month; int value=0; value=toInteger1(mon); switch(value){ case 0: strftime(buffer,30,"%T Jan-%d, %Y",&result); break; case 1: strftime(buffer,30,"%T Feb-%d, %Y",&result); break; case 2: strftime(buffer,30,"%T Mar-%d, %Y",&result); break; case 3: strftime(buffer,30,"%T Apr-%d, %Y",&result); break; case 4: strftime(buffer,30,"%T May-%d, %Y",&result); break; case 5: strftime(buffer,30,"%T Jun-%d, %Y",&result); break; case 6: strftime(buffer,30,"%T Jul-%d, %Y",&result); break; case 7: strftime(buffer,30,"%T Aug-%d, %Y",&result); break; case 8: strftime(buffer,30,"%T Sep-%d, %Y",&result); break; case 9: strftime(buffer,30,"%T Oct-%d, %Y",&result); break; case 10: strftime(buffer,30,"%T Nov-%d, %Y",&result); break; case 11: strftime(buffer,30,"%T Dec-%d, %Y",&result); break; } stime->label.rewrite(&stime->label.widget, (void *)buffer); } task_retval(0); async_manager(); return 0; }