Lines Matching refs:window
33 static int __textui_init_window(struct textui_window_t *window, uint8_t flags, uint16_t vlines_num,… in __textui_init_window() argument
36 memset((window), 0, sizeof(struct textui_window_t)); in __textui_init_window()
37 list_init(&(window)->list); in __textui_init_window()
38 window->lock.lock = 1; in __textui_init_window()
40 window->id = __window_max_id++; in __textui_init_window()
42 window->flags = flags; in __textui_init_window()
43 window->vlines_num = vlines_num; in __textui_init_window()
44 window->vlines_used = 1; in __textui_init_window()
45 window->top_vline = 0; in __textui_init_window()
46 window->vline_operating = 0; in __textui_init_window()
47 window->chars_per_line = cperline; in __textui_init_window()
49 window->vlines.chromatic = vlines_ptr; in __textui_init_window()
51 window->vlines.normal = vlines_ptr; in __textui_init_window()
52 list_add(&__windows_list, &(window)->list); in __textui_init_window()
135 static int __textui_new_line(struct textui_window_t *window, uint16_t vline_id) in __textui_new_line() argument
139 ++window->vline_operating; in __textui_new_line()
141 if (unlikely(window->vline_operating == window->vlines_num)) in __textui_new_line()
142 window->vline_operating = 0; in __textui_new_line()
143 struct textui_vline_chromatic_t *vline = &window->vlines.chromatic[window->vline_operating]; in __textui_new_line()
144 memset(vline->chars, 0, sizeof(struct textui_char_chromatic_t) * window->chars_per_line); in __textui_new_line()
147 if (likely(window->vlines_used == window->vlines_num)) // 需要滚动屏幕 in __textui_new_line()
150 ++window->top_vline; in __textui_new_line()
152 if (unlikely(window->top_vline >= window->vlines_num)) in __textui_new_line()
153 window->top_vline = 0; in __textui_new_line()
156 textui_refresh_vlines(window, window->top_vline, window->vlines_num); in __textui_new_line()
159 ++window->vlines_used; in __textui_new_line()
171 static int __textui_putchar_window(struct textui_window_t *window, uint16_t character, uint32_t FRc… in __textui_putchar_window() argument
174 if (textui_is_chromatic(window->flags)) // 启用彩色字符 in __textui_putchar_window()
176 struct textui_vline_chromatic_t *vline = &window->vlines.chromatic[window->vline_operating]; in __textui_putchar_window()
182 textui_refresh_characters(window, window->vline_operating, vline->index - 1, 1); in __textui_putchar_window()
185 if (vline->index > window->chars_per_line) in __textui_putchar_window()
187 __textui_new_line(window, window->vline_operating); in __textui_putchar_window()
208 int textui_putchar_window(struct textui_window_t *window, uint16_t character, uint32_t FRcolor, uin… in textui_putchar_window() argument
212 if (!textui_is_chromatic(window->flags)) // 暂不支持纯文本窗口 in textui_putchar_window()
216 spin_lock(&window->lock); in textui_putchar_window()
222 __textui_new_line(window, window->vline_operating); in textui_putchar_window()
224 spin_unlock(&window->lock); in textui_putchar_window()
229 int space_to_print = 8 - window->vlines.chromatic[window->vline_operating].index % 8; in textui_putchar_window()
233 __textui_putchar_window(window, ' ', FRcolor, BKcolor); in textui_putchar_window()
239 --(window->vlines.chromatic[window->vline_operating].index); in textui_putchar_window()
241 uint16_t tmp = window->vlines.chromatic[window->vline_operating].index; in textui_putchar_window()
244 window->vlines.chromatic[window->vline_operating].chars[tmp].c = ' '; in textui_putchar_window()
245 … window->vlines.chromatic[window->vline_operating].chars[tmp].BKcolor = BKcolor & 0xffffff; in textui_putchar_window()
246 textui_refresh_characters(window, window->vline_operating, tmp, 1); in textui_putchar_window()
250 if (window->vlines.chromatic[window->vline_operating].index <= 0) in textui_putchar_window()
252 window->vlines.chromatic[window->vline_operating].index = 0; in textui_putchar_window()
253 memset(window->vlines.chromatic[window->vline_operating].chars, 0, in textui_putchar_window()
254 sizeof(struct textui_char_chromatic_t) * window->chars_per_line); in textui_putchar_window()
255 --(window->vline_operating); in textui_putchar_window()
256 if (unlikely(window->vline_operating < 0)) in textui_putchar_window()
257 window->vline_operating = window->vlines_num - 1; in textui_putchar_window()
260 if (likely(window->vlines_used > __private_info.actual_line)) in textui_putchar_window()
262 --window->top_vline; in textui_putchar_window()
263 if (unlikely(window->top_vline < 0)) in textui_putchar_window()
264 window->top_vline = window->vlines_num - 1; in textui_putchar_window()
266 --window->vlines_used; in textui_putchar_window()
267 textui_refresh_vlines(window, window->top_vline, __private_info.actual_line); in textui_putchar_window()
272 if (window->vlines.chromatic[window->vline_operating].index == window->chars_per_line) in textui_putchar_window()
273 __textui_new_line(window, window->vline_operating); in textui_putchar_window()
274 __textui_putchar_window(window, character, FRcolor, BKcolor); in textui_putchar_window()
278 spin_unlock(&window->lock); in textui_putchar_window()