void prof_run(char *log_level, char *account_name) { _init(log_level); _connect_default(account_name); ui_update(); log_info("Starting main event loop"); activity_state = ACTIVITY_ST_ACTIVE; saved_status = NULL; char *line = NULL; while(cont) { log_stderr_handler(); _check_autoaway(); line = ui_readline(); if (line) { ProfWin *window = wins_get_current(); cont = cmd_process_input(window, line); free(line); line = NULL; } else { cont = TRUE; } #ifdef HAVE_LIBOTR otr_poll(); #endif notify_remind(); jabber_process_events(10); ui_update(); } }
static int key_press_event(XKeyEvent *event) { if (event->keycode == mmkeys.raise_volume) { mixer_set_volume_rel(config.scrollstep); if (!osd_mapped()) map_osd(); if (osd_mapped()) update_osd(mixer_get_volume(), false); ui_update(); return 1; } if (event->keycode == mmkeys.lower_volume) { mixer_set_volume_rel(-config.scrollstep); if (!osd_mapped()) map_osd(); if (osd_mapped()) update_osd(mixer_get_volume(), false); ui_update(); return 1; } if (event->keycode == mmkeys.mute) { mixer_toggle_mute(); ui_update(); return 1; } /* Ignore other keys */ return 0; }
void prof_run(const int disable_tls, char *log_level, char *account_name) { _init(disable_tls, log_level); _connect_default(account_name); ui_update(); char *line = NULL; gboolean cmd_result = TRUE; log_info("Starting main event loop"); while(cmd_result) { while(!line) { _check_autoaway(); line = ui_readline(); #ifdef HAVE_LIBOTR otr_poll(); #endif notify_remind(); jabber_process_events(); ui_update(); } cmd_result = cmd_process_input(line); ui_input_clear(); FREE_SET_NULL(line); } }
void prof_run(char *log_level, char *account_name) { #ifdef PROF_HAVE_GTK gtk_ready = gtk_init_check(0, NULL); log_debug("Env is GTK-ready: %s", gtk_ready ? "true" : "false"); if (gtk_ready) { gtk_init(0, NULL); gtk_main_iteration_do(false); } #endif _init(log_level); plugins_on_start(); _connect_default(account_name); ui_update(); log_info("Starting main event loop"); activity_state = ACTIVITY_ST_ACTIVE; saved_status = NULL; char *line = NULL; while(cont && !force_quit) { log_stderr_handler(); _check_autoaway(); line = inp_readline(); if (line) { ProfWin *window = wins_get_current(); cont = cmd_process_input(window, line); free(line); line = NULL; } else { cont = TRUE; } #ifdef PROF_HAVE_LIBOTR otr_poll(); #endif plugins_run_timed(); notify_remind(); jabber_process_events(10); iq_autoping_check(); ui_update(); #ifdef PROF_HAVE_GTK if (gtk_ready) { gtk_main_iteration_do(false); } #endif } }
int main(int argc, const char* argv[]) { gfxInitDefault(); Result setCpuTimeRes = APT_SetAppCpuTimeLimit(30); if(R_FAILED(setCpuTimeRes)) { util_panic("Failed to set syscore CPU time limit: %08lX", setCpuTimeRes); return 1; } romfsInit(); cfguInit(); acInit(); ptmuInit(); httpcInit(0); amInit(); AM_InitializeExternalTitleDatabase(false); soc_buffer = memalign(0x1000, 0x100000); if(soc_buffer != NULL) { socInit(soc_buffer, 0x100000); } screen_init(); ui_init(); mainmenu_open(); while(aptMainLoop() && ui_update()); cleanup(); return 0; }
void frame_changed( void ) { uint32_t new_frame,max,l,f; double percent; GtkWidget *wid; GtkAdjustment *adj; max=incoming->getInfo()->nb_frames; wid=WID(hscale1); adj=gtk_range_get_adjustment (GTK_RANGE(wid)); new_frame=0; percent=(double)GTK_ADJUSTMENT(adj)->value; percent*=max; percent/=100.; new_frame=(uint32_t)floor(percent); if(new_frame>=max) new_frame=max-1; prepare(new_frame); ui_update(); gui_draw(); }
gboolean scripts_exec(const char *const script) { char *scriptsdir = files_get_data_path(DIR_SCRIPTS); GString *scriptpath = g_string_new(scriptsdir); free(scriptsdir); g_string_append(scriptpath, "/"); g_string_append(scriptpath, script); FILE *scriptfile = g_fopen(scriptpath->str, "r"); if (!scriptfile) { log_info("Script not found: %s", scriptpath->str); g_string_free(scriptpath, TRUE); return FALSE; } g_string_free(scriptpath, TRUE); char *line = NULL; size_t len = 0; ssize_t read; while ((read = getline(&line, &len, scriptfile)) != -1) { ProfWin *win = wins_get_current(); cmd_process_input(win, line); session_process_events(); ui_update(); } fclose(scriptfile); if (line) free(line); return TRUE; }
static int ui_timeoutHandler (gpointer data) { Bubblemon *base = (Bubblemon*)data; ui_update(base); return TRUE; }
int main(void) { ui_init(); while (1) { ui_update(); } }
static int ui_expose(GtkWidget *exposed, GdkEventExpose *event, gpointer data) { BubblemonApplet *applet = (BubblemonApplet*)data; ui_update(applet); return FALSE; }
static int ui_realize(GtkWidget *realized, gpointer data) { BubblemonApplet *applet = (BubblemonApplet*)data; ui_update(applet); return FALSE; }
static int ui_timeoutHandler(gpointer data) { BubblemonApplet *applet = (BubblemonApplet*)data; ui_update(applet); return TRUE; }
gboolean ui_changed(void) { if(!lock) { ui_read(); memcpy(working,original,(width*height*3)>>1); ui_update(); draw(dialog,width,height); }
void screen_update(long dt) { ui_update(&ui, dt); const screen_t* screen = get_active_screen(); if (screen != NULL && screen->update != NULL) { (*screen->update)(dt); } }
static int e_player_status(GtkWidget *widget, GdkEventButton *event, void *data) { if(player_toggle() < 0) { return TRUE; } ui_update(NULL); return TRUE; }
void prof_run(char *log_level, char *account_name) { _init(log_level); plugins_on_start(); _connect_default(account_name); ui_update(); log_info("Starting main event loop"); session_init_activity(); char *line = NULL; while(cont && !force_quit) { log_stderr_handler(); session_check_autoaway(); line = inp_readline(); if (line) { ProfWin *window = wins_get_current(); cont = cmd_process_input(window, line); free(line); line = NULL; } else { cont = TRUE; } #ifdef HAVE_LIBOTR otr_poll(); #endif plugins_run_timed(); notify_remind(); session_process_events(); iq_autoping_check(); ui_update(); #ifdef HAVE_GTK tray_update(); #endif } }
static int e_player_prev(GtkWidget *widget, GdkEventButton *event, void *data) { if(player_prev() < 0) { /* fail */ return TRUE; } ui_update(NULL); return TRUE; }
int periodic_task_2(void) { int i, j, k, equal=0; // UI thread if(telemetry_mode == UI_NCURSES_MODE) { ui_update(&imu_data, &eff_data, &mra_data,&enc_data, total, failure); } buff_i=buff_i%5; buff[0][0][buff_i]=imu_data.acc.x; buff[0][1][buff_i]=imu_data.acc.y; buff[0][2][buff_i]=imu_data.acc.z; buff[1][0][buff_i]=imu_data.gyr.x; buff[1][0][buff_i]=imu_data.gyr.x; buff[1][1][buff_i]=imu_data.gyr.y; buff[1][2][buff_i]=imu_data.gyr.z; buff[2][0][buff_i]=imu_data.mag.x; buff[2][1][buff_i]=imu_data.mag.y; buff[2][2][buff_i]=imu_data.mag.z; buff_i++; for( i=0; i<3; i++) { for( j=0; j<3; j++) for( k=1; k<3; k++) { if( buff[i][j][k]==buff[i][j][0] ) equal=1; else equal=0; } if( equal==1) i=3; } if( equal==1 ) { close(imu_param.i2c_dev); close(spi_param.spi_dev); devices_init(&imu_param, &spi_param, &mra_data); equal=0; } /*if(telemetry_mode == UI_MAVLINK_MODE) { mavlink_module_update(t_task_1_global, t0, &battery_data, &gps_data, &imu_data, &pitot_data, &pwm_read_data, &pwm_write_data, &scp1000_data, &sonar_data, &gps_measure, &imu_measure, &magnetometer_measure, &estimation_data, &control_data); }*/ return SUCCESS; }
static gboolean plugin_reconfigure (XfcePanelPlugin *plugin, guint size, Bubblemon *base) { int width = base->width; int height = base->height; GtkOrientation orientation = xfce_panel_plugin_get_orientation(base->plugin); if (orientation != GTK_ORIENTATION_HORIZONTAL) { width=size; // We're on a vertical panel, height is decided based on the width if (width <= RELATIVE_WIDTH) { height = RELATIVE_HEIGHT; } else { height = (width * RELATIVE_HEIGHT) / RELATIVE_WIDTH; } } else { height=size; // We're on a horizontal panel, width is decided based on the height if (height <= RELATIVE_HEIGHT) { width = RELATIVE_WIDTH; } else { width = (height * RELATIVE_WIDTH) / RELATIVE_HEIGHT; } } if (base->width == width && base->height == height) { // Already at the correct size, done! return TRUE; } gtk_widget_set_size_request(GTK_WIDGET(base->draw_area), width, height); base->width = width; base->height = height; if (base->plugin == NULL) { // Not yet all loaded up return TRUE; } base->rgb_buffer = g_realloc(base->rgb_buffer, width * height * 3); bubblemon_setSize(base->bubblemon, width, height); ui_update(base); return TRUE; }
static int e_player_next(GtkWidget *widget, GdkEventButton *event, void *data) { if(player_next() < 0) { /* fail */ return TRUE; } /* refresh ui info */ ui_update(NULL); return TRUE; }
int main(void) { init_ctrl(); adc_init(); sync_init(); timer1_init(); ui_init(); timer1_load(); while (1) { ui_update(); } }
static gboolean applet_reconfigure (GtkDrawingArea *drawingArea, GdkEventConfigure *event, BubblemonApplet *bubble) { int width = event->width; int height = event->height; MatePanelAppletOrient orientation = mate_panel_applet_get_orient(MATE_PANEL_APPLET(bubble->applet)); if (orientation == MATE_PANEL_APPLET_ORIENT_LEFT || orientation == MATE_PANEL_APPLET_ORIENT_RIGHT) { // We're on a vertical panel, height is decided based on the width if (width <= RELATIVE_WIDTH) { height = RELATIVE_HEIGHT; } else { height = (width * RELATIVE_HEIGHT) / RELATIVE_WIDTH; } } else { // We're on a horizontal panel, width is decided based on the height if (height <= RELATIVE_HEIGHT) { width = RELATIVE_WIDTH; } else { width = (height * RELATIVE_WIDTH) / RELATIVE_HEIGHT; } } if (bubble->width == width && bubble->height == height) { // Already at the correct size, done! return TRUE; } gtk_widget_set_size_request(GTK_WIDGET(drawingArea), width, height); bubble->width = width; bubble->height = height; if (bubble->applet == NULL) { // Not yet all loaded up return TRUE; } bubble->rgb_buffer = g_realloc(bubble->rgb_buffer, width * height * 4);/* times 4 for A R G B */ bubblemon_setSize(bubble->bubblemon, width, height); ui_update(bubble); return TRUE; }
/* * Mark a target and sequence with given symbol */ void target_mark(struct target *t, int seq, int ch) { if (ch == '.' && t->res[seq % NUM] != ' ') t->res[seq % NUM] = ':'; else t->res[seq % NUM] = ch; if (a_flag && ch == '.') { if (a_flag == 1) (void)write(STDOUT_FILENO, "\a", 1); else if (a_flag >=2 && t->npkts >= 4 && t->res[(seq-3) % NUM] != '.' && t->res[(seq-2) % NUM] != '.' && t->res[(seq-1) % NUM] == '.' && t->res[(seq-0) % NUM] == '.') (void)write(STDOUT_FILENO, "\a", 1); } if (seq == t->npkts - 1) ui_update(t); else ui_update(NULL); /* this is a late reply, need full update to redraw this */ }
int main(int argc, char **argv) { corange_init("../../core_assets"); sea_init(); int running = 1; SDL_Event event; while(running) { frame_begin(); while(SDL_PollEvent(&event)) { switch(event.type) { case SDL_KEYDOWN: case SDL_KEYUP: if (event.key.keysym.sym == SDLK_ESCAPE) { running = 0; } if (event.key.keysym.sym == SDLK_PRINT) { graphics_viewport_screenshot(); } break; case SDL_QUIT: running = 0; break; } sea_event(event); ui_event(event); } sea_update(); ui_update(); sea_render(); ui_render(); SDL_GL_SwapBuffers(); frame_end(); } sea_finish(); corange_finish(); return 0; }
int threads_linux_periodic_task_2(void) { // UI thread if(telemetry_mode == UI_NCURSES_MODE) { ui_update(&battery_data, &gps_data, &imu_data, &pitot_data, &pwm_read_data, &pwm_write_data, &scp1000_data, &sonar_data, &gps_measure, &imu_measure, &magnetometer_measure, &calibration_local_coordinate_system_data, &calibration_local_fields_data, &calibration_altimeter_data, &estimation_data, &control_data, total, failure); } if(telemetry_mode == UI_MAVLINK_MODE) { mavlink_module_update(t_task_1_global, t0, &battery_data, &gps_data, &imu_data, &pitot_data, &pwm_read_data, &pwm_write_data, &scp1000_data, &sonar_data, &gps_measure, &imu_measure, &magnetometer_measure, &estimation_data, &control_data); } return THREADS_LINUX_SUCCESS; }
static void signal_catch(int sig) { switch (sig) { case SIGUSR1: mixer_set_volume_rel(config.scrollstep); if (!osd_mapped()) map_osd(); if (osd_mapped()) update_osd(mixer_get_volume(), false); ui_update(); idle_loop = 0; break; case SIGUSR2: mixer_set_volume_rel(-config.scrollstep); if (!osd_mapped()) map_osd(); if (osd_mapped()) update_osd(mixer_get_volume(), false); ui_update(); idle_loop = 0; break; } }
char* inp_get_line(void) { werase(inp_win); wmove(inp_win, 0, 0); _inp_win_update_virtual(); doupdate(); char *line = NULL; while (!line) { line = inp_readline(); ui_update(); } status_bar_clear(); return line; }
void gui_readerview_print(unsigned event, const bytestring_t *command, unsigned short sw, const bytestring_t *response, void *extra_data) { const char* text; char buf[200]; GtkTextIter iter; char *string_sw = NULL; UNUSED(extra_data); if (event==CARDREADER_EVENT_RESET || event==CARDREADER_EVENT_CONNECT) { gtk_text_buffer_get_iter_at_offset (READER_BUFFER,&iter,-1); gtk_text_buffer_insert_with_tags_by_name(READER_BUFFER,&iter,"RSET ",-1,"red_text",NULL); text = hex_pretty_print(5,command,0); gtk_text_buffer_get_iter_at_offset (READER_BUFFER,&iter,-1); gtk_text_buffer_insert_with_tags_by_name(READER_BUFFER,&iter,text,-1,"red_text",NULL); } else if (event==CARDREADER_EVENT_TRANSMIT) { gtk_text_buffer_get_iter_at_offset (READER_BUFFER,&iter,-1); gtk_text_buffer_insert_with_tags_by_name(READER_BUFFER,&iter,"SEND ",-1,"green_text",NULL); text = hex_pretty_print(5,command,0); gtk_text_buffer_get_iter_at_offset (READER_BUFFER,&iter,-1); gtk_text_buffer_insert_with_tags_by_name(READER_BUFFER,&iter,text,-1,"green_text",NULL); luax_variable_call("card.stringify_sw","u>s",sw,&string_sw); snprintf(buf,200,"RECV %04X # %s\n ",sw,string_sw); if (string_sw) free(string_sw); gtk_text_buffer_get_iter_at_offset (READER_BUFFER,&iter,-1); gtk_text_buffer_insert_with_tags_by_name(READER_BUFFER,&iter,buf,-1,"blue_text",NULL); text = hex_pretty_print(5,response,1); if (text) { gtk_text_buffer_get_iter_at_offset (READER_BUFFER,&iter,-1); gtk_text_buffer_insert_with_tags_by_name(READER_BUFFER,&iter,text,-1,"blue_text",NULL); } } else if (event==CARDREADER_EVENT_CLEAR_LOG) { gtk_text_buffer_set_text(READER_BUFFER,"",0); } ui_update(); }
int main(int argc, const char* argv[]) { gfxInitDefault(); gfxSet3D(false); if(argc > 0) { svchax_init(true); if(!__ctr_svchax || !__ctr_svchax_srv) { util_panic("Failed to acquire kernel access."); return 1; } } aptOpenSession(); Result setCpuTimeRes = APT_SetAppCpuTimeLimit(30); aptCloseSession(); if(R_FAILED(setCpuTimeRes)) { util_panic("Failed to set syscore CPU time limit: %08lX", setCpuTimeRes); return 1; } romfsInit(); cfguInit(); acInit(); ptmuInit(); httpcInit(0); amInit(); AM_InitializeExternalTitleDatabase(false); soc_buffer = memalign(0x1000, 0x100000); if(soc_buffer != NULL) { socInit(soc_buffer, 0x100000); } screen_init(); ui_init(); task_init(); mainmenu_open(); while(aptMainLoop() && ui_update()); cleanup(); return 0; }
char* inp_get_password(void) { werase(inp_win); wmove(inp_win, 0, 0); _inp_win_update_virtual(); doupdate(); char *password = NULL; get_password = TRUE; while (!password) { password = inp_readline(); ui_update(); } get_password = FALSE; status_bar_clear(); return password; }