Changes in uspace/lib/ui/src/ui.c [3d10a2f:252d03c] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/src/ui.c
r3d10a2f r252d03c 39 39 #include <errno.h> 40 40 #include <fibril.h> 41 #include <gfx/color.h>42 #include <gfx/render.h>43 41 #include <io/console.h> 44 42 #include <stdbool.h> … … 55 53 * 56 54 * Output specification has the form <proto>@<service> where proto is 57 * eiher 'disp' for display service , 'cons' for console, 'null'58 * for dummy output. Serviceis a location ID service name (e.g. hid/display).55 * eiher 'disp' for display service or 'cons' for console. Service 56 * is a location ID service name (e.g. hid/display). 59 57 * 60 58 * @param ospec Output specification … … 82 80 } else if (str_lcmp(ospec, "cons@", str_length("cons@")) == 0) { 83 81 *ws = ui_ws_console; 84 } else if (str_lcmp(ospec, "null@", str_length("null@")) == 0) {85 *ws = ui_ws_null;86 82 } else { 87 83 *ws = ui_ws_unknown; … … 101 97 * 102 98 * @param ospec Output specification or @c UI_DISPLAY_DEFAULT to use 103 * the default display service, UI_CONSOLE_DEFAULT to use 104 * the default console service, UI_DISPLAY_NULL to use 105 * dummy output. 99 * the default output 106 100 * @param rui Place to store pointer to new UI 107 101 * @return EOK on success or an error code … … 115 109 ui_winsys_t ws; 116 110 const char *osvc; 117 sysarg_t cols;118 sysarg_t rows;119 111 ui_t *ui; 120 112 … … 135 127 if (console == NULL) 136 128 return EIO; 137 138 rc = console_get_size(console, &cols, &rows);139 if (rc != EOK) {140 console_done(console);141 return rc;142 }143 144 console_cursor_visibility(console, false);145 129 146 130 /* ws == ui_ws_console */ … … 159 143 160 144 ui->cgc = cgc; 161 ui->rect.p0.x = 0;162 ui->rect.p0.y = 0;163 ui->rect.p1.x = cols;164 ui->rect.p1.y = rows;165 166 (void) ui_paint(ui);167 } else if (ws == ui_ws_null) {168 rc = ui_create_disp(NULL, &ui);169 if (rc != EOK)170 return rc;171 145 } else { 172 146 return EINVAL; … … 229 203 if (ui->cgc != NULL) 230 204 console_gc_delete(ui->cgc); 231 if (ui->console != NULL) { 232 console_cursor_visibility(ui->console, true); 205 if (ui->console != NULL) 233 206 console_done(ui->console); 234 }235 207 if (ui->display != NULL) 236 208 display_close(ui->display); … … 244 216 ui_window_t *awnd; 245 217 ui_evclaim_t claim; 246 pos_event_t pos;247 218 248 219 awnd = ui_window_get_active(ui); … … 255 226 break; 256 227 case CEV_POS: 257 pos = event->ev.pos; 258 /* Translate event to window-relative coordinates */ 259 pos.hpos -= awnd->dpos.x; 260 pos.vpos -= awnd->dpos.y; 261 262 claim = ui_wdecor_pos_event(awnd->wdecor, &pos); 228 claim = ui_wdecor_pos_event(awnd->wdecor, &event->ev.pos); 263 229 /* Note: If event is claimed, awnd might not be valid anymore */ 264 230 if (claim == ui_unclaimed) 265 ui_window_send_pos(awnd, &pos); 266 231 ui_window_send_pos(awnd, &event->ev.pos); 267 232 break; 268 233 } … … 315 280 { 316 281 errno_t rc; 317 gfx_context_t *gc;318 282 ui_window_t *awnd; 319 gfx_color_t *color = NULL;320 321 /* In case of null output */322 if (ui->cgc == NULL)323 return EOK;324 325 gc = console_gc_get_ctx(ui->cgc);326 327 rc = gfx_color_new_ega(0x11, &color);328 if (rc != EOK)329 return rc;330 331 rc = gfx_set_color(gc, color);332 if (rc != EOK) {333 gfx_color_delete(color);334 return rc;335 }336 337 rc = gfx_fill_rect(gc, &ui->rect);338 if (rc != EOK) {339 gfx_color_delete(color);340 return rc;341 }342 343 gfx_color_delete(color);344 283 345 284 /* XXX Should repaint all windows */
Note:
See TracChangeset
for help on using the changeset viewer.