示例#1
0
static void timeout_handler() {
  timeout_timer = NULL;
  if (update_in_progress) {
    update_in_progress = false;
    schedule_update(TIMEOUT_RETRY_DELAY);
  }
}
示例#2
0
	void on_active_tool_changed()
	{
		m_tool = &m_document_state.active_tool();

		m_vbox.hide();
		schedule_update();
	}
示例#3
0
文件: slang.c 项目: rdebath/sgt
static int sigwinch (int sigtype)
{
    extern void schedule_update(void);
    schedule_update();
    signal (SIGWINCH, (void *) sigwinch);
    return 0;
}
示例#4
0
static void in_received_handler(DictionaryIterator *received, void *context) {
  phone_contact = true;
  update_in_progress = false;
  staleness_update(received);
  int msg_type = dict_find(received, APP_KEY_MSG_TYPE)->value->uint8;
  if (msg_type == MSG_TYPE_DATA) {
    uint32_t recency = dict_find(received, APP_KEY_RECENCY)->value->uint32;
    int32_t next_update = SGV_UPDATE_FREQUENCY - recency * 1000;
    int32_t delay = next_update < LATE_DATA_UPDATE_FREQUENCY ? LATE_DATA_UPDATE_FREQUENCY : next_update;
    schedule_update((uint32_t) delay);
  }
  if (msg_type == MSG_TYPE_ERROR) {
    schedule_update(ERROR_RETRY_DELAY);
  } else {
    data_callback(received);
  }
}
示例#5
0
文件: curses.c 项目: rdebath/sgt
int display_getkey(void)
{
    int ret;
    extern void schedule_update(void);

    if (last_getch != ERR) {
	int ret = last_getch;
	last_getch = ERR;
	return ret;
    }
    while (1) {
	ret = getch();
	if (ret == KEY_RESIZE) {
	    schedule_update();
	    continue;
	}
	return ret;
    }
}
示例#6
0
	implementation(document_state& DocumentState) :
		m_document_state(DocumentState),
		m_tool(0),
		m_object_properties(DocumentState)
	{
		m_label.set_alignment(Gtk::ALIGN_LEFT);
		m_label.set_padding(5, 5);

		m_scrolled_window.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
		m_scrolled_window.add(m_object_properties.get_widget());

		m_vbox.get_accessible()->set_name("vbox");
		m_vbox.pack_start(m_label, Gtk::PACK_SHRINK);
		m_vbox.pack_start(m_scrolled_window, Gtk::PACK_EXPAND_WIDGET);

		m_document_state.connect_active_tool_changed_signal(sigc::mem_fun(*this, &implementation::on_active_tool_changed));

		m_tool = &m_document_state.active_tool();
		schedule_update();
	}
示例#7
0
static void out_failed_handler(DictionaryIterator *failed, AppMessageResult reason, void *context) {
  update_in_progress = false;
  schedule_update(OUT_RETRY_DELAY);
}
示例#8
0
static void in_dropped_handler(AppMessageResult reason, void *context) {
  update_in_progress = false;
  schedule_update(IN_RETRY_DELAY);
}
示例#9
0
void TextMan::print_text2(int l, const char *msg, int foff, int xoff, int yoff,
						int len, int fg, int bg) {
	int x1, y1;
	int maxx, minx, ofoff;
	int update;
	/* Note: Must be unsigned to use AGDS cyrillic characters! */
	const unsigned char *m;

	/* kludge! */
	update = 1;
	if (l == 2) {
		update = l = 0;
	}

	/* FR: strings with len == 1 were not printed
	 */
	if (len == 1) {
		put_text_character(l, xoff + foff, yoff, *msg, fg, bg);
		maxx = 1;
		minx = 0;
		ofoff = foff;
		y1 = 0;		/* Check this */
	} else {
		maxx = 0;
		minx = GFX_WIDTH;
		ofoff = foff;

		for (m = (const unsigned char *)msg, x1 = y1 = 0; *m; m++) {

			if (*m >= 0x20 || *m == 1 || *m == 2 || *m == 3) {
				/* FIXME */
				int ypos;

				ypos = (y1 * CHAR_LINES) + yoff;

				if ((x1 != (len - 1) || x1 == 39) && (ypos <= (GFX_HEIGHT - CHAR_LINES))) {
					int xpos;

					xpos = (x1 * CHAR_COLS) + xoff + foff;

					if (xpos >= GFX_WIDTH)
						continue;

					put_text_character(l, xpos, ypos, *m, fg, bg);

					if (x1 > maxx)
						maxx = x1;
					if (x1 < minx)
						minx = x1;
				}

				x1++;
				/* DF: changed the len-1 to len... */
				if (x1 == len && m[1] != '\n')
					y1++, x1 = foff = 0;
			} else {
				y1++;
				x1 = foff = 0;
			}
		}
	}

	if (l)
		return;

	if (maxx < minx)
		return;

	maxx *= CHAR_COLS;
	minx *= CHAR_COLS;

	if (update) {
		schedule_update(foff + xoff + minx, yoff, ofoff + xoff + maxx + CHAR_COLS - 1,
				yoff + y1 * CHAR_LINES + CHAR_LINES + 1);
		/* Making synchronous text updates reduces CPU load
		 * when updating status line and input area
		 */
		do_update();
	}
}