Lines Matching refs:window
36 static int __textui_init_window(struct textui_window_t *window, uint8_t flags, uint16_t vlines_num,… in __textui_init_window() argument
39 memset((window), 0, sizeof(struct textui_window_t)); in __textui_init_window()
40 list_init(&(window)->list); in __textui_init_window()
41 window->lock.lock = 1; in __textui_init_window()
43 window->id = __window_max_id++; in __textui_init_window()
45 window->flags = flags; in __textui_init_window()
46 window->vlines_num = vlines_num; in __textui_init_window()
47 window->vlines_used = 1; in __textui_init_window()
48 window->top_vline = 0; in __textui_init_window()
49 window->vline_operating = 0; in __textui_init_window()
50 window->chars_per_line = cperline; in __textui_init_window()
52 window->vlines.chromatic = vlines_ptr; in __textui_init_window()
54 window->vlines.normal = vlines_ptr; in __textui_init_window()
55 list_add(&__windows_list, &(window)->list); in __textui_init_window()
141 static int __textui_new_line(struct textui_window_t *window, uint16_t vline_id) in __textui_new_line() argument
145 ++window->vline_operating; in __textui_new_line()
147 if (unlikely(window->vline_operating == window->vlines_num)) in __textui_new_line()
148 window->vline_operating = 0; in __textui_new_line()
149 struct textui_vline_chromatic_t *vline = &window->vlines.chromatic[window->vline_operating]; in __textui_new_line()
150 memset(vline->chars, 0, sizeof(struct textui_char_chromatic_t) * window->chars_per_line); in __textui_new_line()
153 if (likely(window->vlines_used == window->vlines_num)) // 需要滚动屏幕 in __textui_new_line()
156 ++window->top_vline; in __textui_new_line()
158 if (unlikely(window->top_vline >= window->vlines_num)) in __textui_new_line()
159 window->top_vline = 0; in __textui_new_line()
162 textui_refresh_vlines(window, window->top_vline, window->vlines_num); in __textui_new_line()
165 ++window->vlines_used; in __textui_new_line()
177 static int __textui_putchar_window(struct textui_window_t *window, uint16_t character, uint32_t FRc… in __textui_putchar_window() argument
180 if (textui_is_chromatic(window->flags)) // 启用彩色字符 in __textui_putchar_window()
182 struct textui_vline_chromatic_t *vline = &window->vlines.chromatic[window->vline_operating]; in __textui_putchar_window()
188 textui_refresh_characters(window, window->vline_operating, vline->index - 1, 1); in __textui_putchar_window()
191 if (vline->index > window->chars_per_line) in __textui_putchar_window()
193 __textui_new_line(window, window->vline_operating); in __textui_putchar_window()
214 int textui_putchar_window(struct textui_window_t *window, uint16_t character, uint32_t FRcolor, uin… in textui_putchar_window() argument
218 if (!textui_is_chromatic(window->flags)) // 暂不支持纯文本窗口 in textui_putchar_window()
222 spin_lock_no_preempt(&window->lock); in textui_putchar_window()
227 spin_unlock_no_preempt(&window->lock); in textui_putchar_window()
235 __textui_new_line(window, window->vline_operating); in textui_putchar_window()
237 spin_unlock_no_preempt(&window->lock); in textui_putchar_window()
242 int space_to_print = 8 - window->vlines.chromatic[window->vline_operating].index % 8; in textui_putchar_window()
246 __textui_putchar_window(window, ' ', FRcolor, BKcolor); in textui_putchar_window()
252 --(window->vlines.chromatic[window->vline_operating].index); in textui_putchar_window()
254 uint16_t tmp = window->vlines.chromatic[window->vline_operating].index; in textui_putchar_window()
257 window->vlines.chromatic[window->vline_operating].chars[tmp].c = ' '; in textui_putchar_window()
258 … window->vlines.chromatic[window->vline_operating].chars[tmp].BKcolor = BKcolor & 0xffffff; in textui_putchar_window()
259 textui_refresh_characters(window, window->vline_operating, tmp, 1); in textui_putchar_window()
263 if (window->vlines.chromatic[window->vline_operating].index <= 0) in textui_putchar_window()
265 window->vlines.chromatic[window->vline_operating].index = 0; in textui_putchar_window()
266 memset(window->vlines.chromatic[window->vline_operating].chars, 0, in textui_putchar_window()
267 sizeof(struct textui_char_chromatic_t) * window->chars_per_line); in textui_putchar_window()
268 --(window->vline_operating); in textui_putchar_window()
269 if (unlikely(window->vline_operating < 0)) in textui_putchar_window()
270 window->vline_operating = window->vlines_num - 1; in textui_putchar_window()
273 if (likely(window->vlines_used > __private_info.actual_line)) in textui_putchar_window()
275 --window->top_vline; in textui_putchar_window()
276 if (unlikely(window->top_vline < 0)) in textui_putchar_window()
277 window->top_vline = window->vlines_num - 1; in textui_putchar_window()
279 --window->vlines_used; in textui_putchar_window()
280 textui_refresh_vlines(window, window->top_vline, __private_info.actual_line); in textui_putchar_window()
285 if (window->vlines.chromatic[window->vline_operating].index == window->chars_per_line) in textui_putchar_window()
286 __textui_new_line(window, window->vline_operating); in textui_putchar_window()
287 __textui_putchar_window(window, character, FRcolor, BKcolor); in textui_putchar_window()
291 spin_unlock_no_preempt(&window->lock); in textui_putchar_window()