Changeset 9805cde in mainline for uspace/srv/console/console.c
- Timestamp:
- 2009-01-01T13:31:23Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7122bc7
- Parents:
- 666773c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/console/console.c
r666773c r9805cde 41 41 #include <errno.h> 42 42 #include <key_buffer.h> 43 #include <console.h>44 43 #include <ipc/console.h> 45 44 #include <unistd.h> … … 51 50 #include <sysinfo.h> 52 51 52 #include "console.h" 53 53 #include "gcons.h" 54 54 … … 125 125 } 126 126 127 static void set_style(style_t *style) 128 { 129 async_msg_2(fb_info.phone, FB_SET_STYLE, style->fg_color, 130 style->bg_color); 131 } 132 133 static void set_style_col(int fgcolor, int bgcolor) 134 { 135 async_msg_2(fb_info.phone, FB_SET_STYLE, fgcolor, bgcolor); 127 static void set_style(int style) 128 { 129 async_msg_1(fb_info.phone, FB_SET_STYLE, style); 130 } 131 132 static void set_color(int fgcolor, int bgcolor, int flags) 133 { 134 async_msg_3(fb_info.phone, FB_SET_COLOR, fgcolor, bgcolor, flags); 135 } 136 137 static void set_rgb_color(int fgcolor, int bgcolor) 138 { 139 async_msg_2(fb_info.phone, FB_SET_RGB_COLOR, fgcolor, bgcolor); 140 } 141 142 static void set_attrs(attrs_t *attrs) 143 { 144 switch (attrs->t) { 145 case at_style: 146 set_style(attrs->a.s.style); 147 break; 148 149 case at_idx: 150 set_color(attrs->a.i.fg_color, attrs->a.i.bg_color, 151 attrs->a.i.flags); 152 break; 153 154 case at_rgb: 155 set_rgb_color(attrs->a.r.fg_color, attrs->a.r.bg_color); 156 break; 157 } 136 158 } 137 159 … … 199 221 int i, j, rc; 200 222 keyfield_t *field; 201 style_t *style;223 attrs_t *attrs; 202 224 203 225 if (newcons == active_console) … … 227 249 conn = &connections[active_console]; 228 250 229 set_ style(&conn->screenbuffer.style);251 set_attrs(&conn->screenbuffer.attrs); 230 252 curs_visibility(false); 231 253 if (interbuffer) { … … 243 265 244 266 if ((!interbuffer) || (rc != 0)) { 245 set_ style(&conn->screenbuffer.style);267 set_attrs(&conn->screenbuffer.attrs); 246 268 clrscr(); 247 style = &conn->screenbuffer.style;269 attrs = &conn->screenbuffer.attrs; 248 270 249 271 for (j = 0; j < conn->screenbuffer.size_y; j++) 250 272 for (i = 0; i < conn->screenbuffer.size_x; i++) { 251 273 field = get_field_at(&conn->screenbuffer, i, j); 252 if (! style_same(*style, field->style))253 set_ style(&field->style);254 style = &field->style;274 if (!attrs_same(*attrs, field->attrs)) 275 set_attrs(&field->attrs); 276 attrs = &field->attrs; 255 277 if ((field->character == ' ') && 256 ( style_same(field->style,257 conn->screenbuffer. style)))278 (attrs_same(field->attrs, 279 conn->screenbuffer.attrs))) 258 280 continue; 259 281 260 282 prtchr(field->character, j, i); 261 283 } … … 342 364 ipc_call_t call; 343 365 int consnum; 344 ipcarg_t arg1, arg2 ;366 ipcarg_t arg1, arg2, arg3; 345 367 connection_t *conn; 346 368 … … 410 432 case CONSOLE_SET_STYLE: 411 433 arg1 = IPC_GET_ARG1(call); 434 screenbuffer_set_style(&conn->screenbuffer, arg1); 435 if (consnum == active_console) 436 set_style(arg1); 437 break; 438 case CONSOLE_SET_COLOR: 439 arg1 = IPC_GET_ARG1(call); 412 440 arg2 = IPC_GET_ARG2(call); 413 screenbuffer_set_style(&conn->screenbuffer, arg1, 441 arg3 = IPC_GET_ARG3(call); 442 screenbuffer_set_color(&conn->screenbuffer, arg1, 443 arg2, arg3); 444 if (consnum == active_console) 445 set_color(arg1, arg2, arg3); 446 break; 447 case CONSOLE_SET_RGB_COLOR: 448 arg1 = IPC_GET_ARG1(call); 449 arg2 = IPC_GET_ARG2(call); 450 screenbuffer_set_rgb_color(&conn->screenbuffer, arg1, 414 451 arg2); 415 452 if (consnum == active_console) 416 set_ style_col(arg1, arg2);453 set_rgb_color(arg1, arg2); 417 454 break; 418 455 case CONSOLE_CURSOR_VISIBILITY: … … 488 525 async_req_0_2(fb_info.phone, FB_GET_CSIZE, &fb_info.rows, 489 526 &fb_info.cols); 490 set_ style_col(DEFAULT_FOREGROUND, DEFAULT_BACKGROUND);527 set_rgb_color(DEFAULT_FOREGROUND, DEFAULT_BACKGROUND); 491 528 clrscr(); 492 529
Note:
See TracChangeset
for help on using the changeset viewer.