Rev 4346 | Rev 4348 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 4346 | Rev 4347 | ||
|---|---|---|---|
| Line 221... | Line 221... | ||
| 221 | a->a.i.bg_color, a->a.i.flags); break; |
221 | a->a.i.bg_color, a->a.i.flags); break; |
| 222 | default: break; |
222 | default: break; |
| 223 | } |
223 | } |
| 224 | } |
224 | } |
| 225 | 225 | ||
| - | 226 | /** Draw text data to viewport. |
|
| - | 227 | * |
|
| - | 228 | * @param vport Viewport id |
|
| - | 229 | * @param data Text data. |
|
| - | 230 | * @param x Leftmost column of the area. |
|
| - | 231 | * @param y Topmost row of the area. |
|
| - | 232 | * @param w Number of rows. |
|
| - | 233 | * @param h Number of columns. |
|
| - | 234 | */ |
|
| 226 | static void draw_text_data(keyfield_t *data) |
235 | static void draw_text_data(keyfield_t *data, unsigned int x, |
| - | 236 | unsigned int y, unsigned int w, unsigned int h) |
|
| 227 | { |
237 | { |
| 228 | int i, j; |
238 | unsigned int i, j; |
| - | 239 | keyfield_t *field; |
|
| 229 | attrs_t *a0, *a1; |
240 | attrs_t *a0, *a1; |
| 230 | 241 | ||
| 231 | serial_goto(0, 0); |
242 | serial_goto(y, x); |
| 232 | a0 = &data[0].attrs; |
243 | a0 = &data[0].attrs; |
| 233 | serial_set_attrs(a0); |
244 | serial_set_attrs(a0); |
| 234 | 245 | ||
| 235 | for (i = 0; i < scr_height; i++) { |
246 | for (j = 0; j < h; j++) { |
| - | 247 | if (j > 0 && w != scr_width) |
|
| - | 248 | serial_goto(y, x); |
|
| - | 249 | ||
| 236 | for (j = 0; j < scr_width; j++) { |
250 | for (i = 0; i < w; i++) { |
| - | 251 | unsigned int col = x + i; |
|
| - | 252 | unsigned int row = y + j; |
|
| - | 253 | ||
| 237 | a1 = &data[i * scr_width + j].attrs; |
254 | field = &data[j * w + i]; |
| - | 255 | ||
| - | 256 | a1 = &field->attrs; |
|
| 238 | if (!attrs_same(*a0, *a1)) |
257 | if (!attrs_same(*a0, *a1)) |
| 239 | serial_set_attrs(a1); |
258 | serial_set_attrs(a1); |
| 240 | (*putc_function)(data[i * scr_width + j].character); |
259 | (*putc_function)(field->character); |
| 241 | a0 = a1; |
260 | a0 = a1; |
| 242 | } |
261 | } |
| 243 | } |
262 | } |
| 244 | } |
263 | } |
| 245 | 264 | ||
| - | 265 | int lastcol = 0; |
|
| - | 266 | int lastrow = 0; |
|
| - | 267 | ||
| 246 | /** |
268 | /** |
| 247 | * Main function of the thread serving client connections. |
269 | * Main function of the thread serving client connections. |
| 248 | */ |
270 | */ |
| 249 | void serial_client_connection(ipc_callid_t iid, ipc_call_t *icall) |
271 | void serial_client_connection(ipc_callid_t iid, ipc_call_t *icall) |
| 250 | { |
272 | { |
| Line 253... | Line 275... | ||
| 253 | ipc_call_t call; |
275 | ipc_call_t call; |
| 254 | keyfield_t *interbuf = NULL; |
276 | keyfield_t *interbuf = NULL; |
| 255 | size_t intersize = 0; |
277 | size_t intersize = 0; |
| 256 | 278 | ||
| 257 | char c; |
279 | char c; |
| 258 | int lastcol = 0; |
- | |
| 259 | int lastrow = 0; |
280 | int col, row, w, h; |
| 260 | int newcol; |
- | |
| 261 | int newrow; |
- | |
| 262 | int fgcolor; |
281 | int fgcolor; |
| 263 | int bgcolor; |
282 | int bgcolor; |
| 264 | int flags; |
283 | int flags; |
| 265 | int style; |
284 | int style; |
| 266 | int i; |
285 | int i; |
| Line 297... | Line 316... | ||
| 297 | continue; |
316 | continue; |
| 298 | } |
317 | } |
| 299 | retval = EINVAL; |
318 | retval = EINVAL; |
| 300 | break; |
319 | break; |
| 301 | case FB_DRAW_TEXT_DATA: |
320 | case FB_DRAW_TEXT_DATA: |
| - | 321 | col = IPC_GET_ARG1(call); |
|
| - | 322 | row = IPC_GET_ARG2(call); |
|
| - | 323 | w = IPC_GET_ARG3(call); |
|
| - | 324 | h = IPC_GET_ARG4(call); |
|
| 302 | if (!interbuf) { |
325 | if (!interbuf) { |
| 303 | retval = EINVAL; |
326 | retval = EINVAL; |
| 304 | break; |
327 | break; |
| 305 | } |
328 | } |
| - | 329 | if (col + w > scr_width || row + h > scr_height) { |
|
| - | 330 | retval = EINVAL; |
|
| - | 331 | break; |
|
| - | 332 | } |
|
| 306 | draw_text_data(interbuf); |
333 | draw_text_data(interbuf, col, row, w, h); |
| - | 334 | lastrow = row + h - 1; |
|
| - | 335 | lastcol = col + w; |
|
| 307 | retval = 0; |
336 | retval = 0; |
| 308 | break; |
337 | break; |
| 309 | case FB_PUTCHAR: |
338 | case FB_PUTCHAR: |
| 310 | c = IPC_GET_ARG1(call); |
339 | c = IPC_GET_ARG1(call); |
| 311 | newrow = IPC_GET_ARG2(call); |
340 | row = IPC_GET_ARG2(call); |
| 312 | newcol = IPC_GET_ARG3(call); |
341 | col = IPC_GET_ARG3(call); |
| 313 | if ((lastcol != newcol) || (lastrow != newrow)) |
342 | if ((lastcol != col) || (lastrow != row)) |
| 314 | serial_goto(newrow, newcol); |
343 | serial_goto(row, col); |
| 315 | lastcol = newcol + 1; |
344 | lastcol = col + 1; |
| 316 | lastrow = newrow; |
345 | lastrow = row; |
| 317 | (*putc_function)(c); |
346 | (*putc_function)(c); |
| 318 | retval = 0; |
347 | retval = 0; |
| 319 | break; |
348 | break; |
| 320 | case FB_CURSOR_GOTO: |
349 | case FB_CURSOR_GOTO: |
| 321 | newrow = IPC_GET_ARG1(call); |
350 | row = IPC_GET_ARG1(call); |
| 322 | newcol = IPC_GET_ARG2(call); |
351 | col = IPC_GET_ARG2(call); |
| 323 | serial_goto(newrow, newcol); |
352 | serial_goto(row, col); |
| 324 | lastrow = newrow; |
353 | lastrow = row; |
| 325 | lastcol = newcol; |
354 | lastcol = col; |
| 326 | retval = 0; |
355 | retval = 0; |
| 327 | break; |
356 | break; |
| 328 | case FB_GET_CSIZE: |
357 | case FB_GET_CSIZE: |
| 329 | ipc_answer_2(callid, EOK, scr_height, scr_width); |
358 | ipc_answer_2(callid, EOK, scr_height, scr_width); |
| 330 | continue; |
359 | continue; |