示例#1
0
static void im_deactive(void)
{
    Rectangle rect = { 0, 0, 0, 0 };
    set_im_window(0, rect);
    set_im_window(1, rect);
    set_im_window(2, rect);
    FcitxIMClientCloseIC(client);
    state = 0;
    active = 0;
}
示例#2
0
static void draw_lookup_table()
{
	set_im_window(LookupTableWin, lookup_table_win);
	if (!lookup_table_win.w) return;

	draw_margin(lookup_table_win, COLOR_BG);

	unsigned i, x = lookup_table_win.x + MARGIN, y = lookup_table_win.y + MARGIN;
	for (i = 0; ; i++) {
		IBusText *text = ibus_lookup_table_get_candidate(lookup_table, i);
		if (!text) break;

		char buf[8];
		snprintf(buf, sizeof(buf), "%d.", i + 1);
		draw_text(x, y, COLOR_FG, COLOR_BG, buf, strlen(buf));
		x += FW(2);

		draw_text(x, y, i == lookup_table->cursor_pos ? COLOR_ACTIVE_CANDIDATE : COLOR_FG, COLOR_BG, text->text, strlen(text->text));
		x += FW(text_width(text->text));

		char space = ' ';
		draw_text(x, y, COLOR_FG, COLOR_BG, &space, 1);
		x += FW(1);
	}

	unsigned endx = lookup_table_win.x + lookup_table_win.w - MARGIN;
	if (x < endx) {
		Rectangle rect = { x, y, endx - x, FH(1) };
		fill_rect(rect, COLOR_BG);
	}
}
示例#3
0
static void draw_auxiliary_text()
{
	set_im_window(AuxiliaryTextWin, auxiliary_text_win);
	if (!auxiliary_text_win.w) return;

	draw_margin(auxiliary_text_win, COLOR_BG);

	unsigned x = auxiliary_text_win.x + MARGIN, y = auxiliary_text_win.y + MARGIN;
	draw_text(x, y, COLOR_FG, COLOR_BG, auxiliary_text->text, strlen(auxiliary_text->text));
}
示例#4
0
static void draw_status_bar()
{
	set_im_window(StatusBarWin, status_bar_win);
	if (!status_bar_win.w) return;

	draw_margin(status_bar_win, COLOR_BG);

	unsigned i, x = status_bar_win.x + MARGIN, y = status_bar_win.y + MARGIN;
	for (i = 0; ; i++) {
		IBusProperty *prop = ibus_prop_list_get(property_list, i);
		if (!prop) break;

		draw_text(x, y, COLOR_FG, COLOR_BG, prop->label->text, strlen(prop->label->text));
		x += FW(text_width(prop->label->text));

		char space = ' ';
		draw_text(x, y, COLOR_FG, COLOR_BG, &space, 1);
		x += FW(1);
	}
}