Changeset e1c6d5df in mainline for uspace/lib/gui
- Timestamp:
- 2012-11-29T07:44:58Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3194d83
- Parents:
- ff98ce8 (diff), 82edef2 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- uspace/lib/gui
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/gui/terminal.c
rff98ce8 re1c6d5df 196 196 uint16_t glyph = fb_font_glyph(field->ch); 197 197 198 // FIXME: This font drawing routine is shamelessly199 // suboptimal. It should be optimized for200 // aligned memory transfers, etc.201 202 198 for (unsigned int y = 0; y < FONT_SCANLINES; y++) { 203 for (unsigned int x = 0; x < FONT_WIDTH; x++) { 204 pixel_t pixel = 205 (fb_font[glyph][y] & (1 << (7 - x))) ? fgcolor : bgcolor; 206 surface_put_pixel(surface, bx + x, by + y, pixel); 199 pixel_t *dst = pixelmap_pixel_at( 200 surface_pixmap_access(surface), bx, by + y); 201 pixel_t *dst_max = pixelmap_pixel_at( 202 surface_pixmap_access(surface), bx + FONT_WIDTH - 1, by + y); 203 if (!dst || !dst_max) continue; 204 int count = FONT_WIDTH; 205 while (count-- != 0) { 206 *dst++ = (fb_font[glyph][y] & (1 << count)) ? fgcolor : bgcolor; 207 207 } 208 208 } 209 surface_add_damaged_region(surface, bx, by, FONT_WIDTH, FONT_SCANLINES); 209 210 } 210 211 -
uspace/lib/gui/window.c
rff98ce8 re1c6d5df 66 66 67 67 static pixel_t border_color = PIXEL(255, 0, 0, 0); 68 static pixel_t header_bgcolor = PIXEL(255, 25, 25, 112); 69 static pixel_t header_fgcolor = PIXEL(255, 255, 255, 255); 68 static pixel_t header_bg_focus_color = PIXEL(255, 25, 25, 112); 69 static pixel_t header_fg_focus_color = PIXEL(255, 255, 255, 255); 70 static pixel_t header_bg_unfocus_color = PIXEL(255, 70, 130, 180); 71 static pixel_t header_fg_unfocus_color = PIXEL(255, 255, 255, 255); 70 72 71 73 static void paint_internal(widget_t *w) … … 94 96 w->vpos + w->height - border_thickness, w->width, border_thickness); 95 97 96 source_set_color(&source, header_bgcolor); 98 source_set_color(&source, 99 w->window->is_focused ? header_bg_focus_color : header_bg_unfocus_color); 97 100 drawctx_transfer(&drawctx, 98 101 w->hpos + border_thickness, w->vpos + border_thickness, … … 106 109 char cls_pict[] = "x"; 107 110 font_get_box(&font, cls_pict, &cls_width, &cls_height); 108 source_set_color(&source, header_fgcolor); 111 source_set_color(&source, 112 w->window->is_focused ? header_fg_focus_color : header_fg_unfocus_color); 109 113 sysarg_t cls_x = ((close_width - cls_width) / 2) + w->hpos + w->width - 110 114 border_thickness - close_width; … … 447 451 break; 448 452 case ET_POSITION_EVENT: 453 if (!win->is_focused) { 454 win->is_focused = true; 455 handle_refresh(win); 456 } 449 457 deliver_position_event(win, event->data.pos); 450 458 break; … … 454 462 case ET_WINDOW_RESIZE: 455 463 handle_resize(win, event->data.rsz.width, event->data.rsz.height); 464 break; 465 case ET_WINDOW_FOCUS: 466 if (!win->is_focused) { 467 win->is_focused = true; 468 handle_refresh(win); 469 } 470 break; 471 case ET_WINDOW_UNFOCUS: 472 if (win->is_focused) { 473 win->is_focused = false; 474 handle_refresh(win); 475 } 456 476 break; 457 477 case ET_WINDOW_REFRESH: … … 514 534 } 515 535 516 window_t *window_open(char *winreg, bool is_main, bool is_decorated, const char *caption) 536 window_t *window_open(char *winreg, bool is_main, bool is_decorated, 537 const char *caption, sysarg_t x_offset, sysarg_t y_offset) 517 538 { 518 539 int rc; … … 525 546 win->is_main = is_main; 526 547 win->is_decorated = is_decorated; 548 win->is_focused = true; 527 549 prodcons_initialize(&win->events); 528 550 fibril_mutex_initialize(&win->guard); … … 557 579 service_id_t out_dsid; 558 580 559 rc = win_register(reg_sess, &in_dsid, &out_dsid );581 rc = win_register(reg_sess, &in_dsid, &out_dsid, x_offset, y_offset); 560 582 async_hangup(reg_sess); 561 583 if (rc != EOK) { -
uspace/lib/gui/window.h
rff98ce8 re1c6d5df 50 50 bool is_main; /**< True for the main window of the application. */ 51 51 bool is_decorated; /**< True if the window decorations should be rendered. */ 52 bool is_focused; /**< True for the top level window of the desktop. */ 52 53 char *caption; /**< Text title of the window header. */ 53 54 async_sess_t *isess; /**< Input events from compositor. */ … … 65 66 * If the window is declared as main, its closure causes termination of the 66 67 * whole application. Note that opened window does not have any surface yet. */ 67 extern window_t *window_open(char *, bool, bool, const char * );68 extern window_t *window_open(char *, bool, bool, const char *, sysarg_t, sysarg_t); 68 69 69 70 /**
Note:
See TracChangeset
for help on using the changeset viewer.
