Changeset b48e680f in mainline
- Timestamp:
- 2021-11-03T10:23:28Z (3 years ago)
- Branches:
- master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ec8a1bf
- Parents:
- ce862ac
- git-author:
- Jiri Svoboda <jiri@…> (2021-11-02 19:19:50)
- git-committer:
- Jiri Svoboda <jiri@…> (2021-11-03 10:23:28)
- Location:
- uspace
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/terminal/terminal.c
rce862ac rb48e680f 88 88 static void term_set_rgb_color(con_srv_t *, pixel_t, pixel_t); 89 89 static void term_set_cursor_visibility(con_srv_t *, bool); 90 static errno_t term_set_caption(con_srv_t *, const char *); 90 91 static errno_t term_get_event(con_srv_t *, cons_event_t *); 91 92 static errno_t term_map(con_srv_t *, sysarg_t, sysarg_t, charfield_t **); … … 109 110 .set_rgb_color = term_set_rgb_color, 110 111 .set_cursor_visibility = term_set_cursor_visibility, 112 .set_caption = term_set_caption, 111 113 .get_event = term_get_event, 112 114 .map = term_map, … … 645 647 } 646 648 649 static errno_t term_set_caption(con_srv_t *srv, const char *caption) 650 { 651 terminal_t *term = srv_to_terminal(srv); 652 const char *cap; 653 654 fibril_mutex_lock(&term->mtx); 655 656 if (str_size(caption) > 0) 657 cap = caption; 658 else 659 cap = "Terminal"; 660 661 ui_window_set_caption(term->window, cap); 662 fibril_mutex_unlock(&term->mtx); 663 664 term_update(term); 665 gfx_update(term->gc); 666 return EOK; 667 } 668 647 669 static errno_t term_get_event(con_srv_t *srv, cons_event_t *event) 648 670 { -
uspace/lib/c/generic/io/con_srv.c
rce862ac rb48e680f 281 281 } 282 282 283 static void con_set_caption_srv(con_srv_t *srv, ipc_call_t *icall) 284 { 285 char *caption; 286 errno_t rc; 287 288 rc = async_data_write_accept((void **) &caption, true, 0, 289 CON_CAPTION_MAXLEN, 0, NULL); 290 if (rc != EOK) { 291 async_answer_0(icall, rc); 292 return; 293 } 294 295 if (srv->srvs->ops->set_caption == NULL) { 296 async_answer_0(icall, ENOTSUP); 297 return; 298 } 299 300 srv->srvs->ops->set_caption(srv, caption); 301 free(caption); 302 async_answer_0(icall, EOK); 303 } 304 283 305 static void con_get_event_srv(con_srv_t *srv, ipc_call_t *icall) 284 306 { … … 488 510 con_set_cursor_visibility_srv(srv, &call); 489 511 break; 512 case CONSOLE_SET_CAPTION: 513 con_set_caption_srv(srv, &call); 514 break; 490 515 case CONSOLE_GET_EVENT: 491 516 con_get_event_srv(srv, &call); -
uspace/lib/c/generic/io/console.c
rce862ac rb48e680f 40 40 #include <errno.h> 41 41 #include <stdlib.h> 42 #include <str.h> 42 43 #include <vfs/vfs_sess.h> 43 44 #include <io/console.h> … … 128 129 async_req_1_0(exch, CONSOLE_SET_CURSOR_VISIBILITY, (show != false)); 129 130 async_exchange_end(exch); 131 } 132 133 /** Set console caption. 134 * 135 * Set caption text for the console (if the console suports captions). 136 * 137 * @param ctrl Console 138 * @param caption Caption text 139 * @return EOK on success or an error code 140 */ 141 errno_t console_set_caption(console_ctrl_t *ctrl, const char *caption) 142 { 143 async_exch_t *exch = async_exchange_begin(ctrl->output_sess); 144 ipc_call_t answer; 145 aid_t req = async_send_0(exch, CONSOLE_SET_CAPTION, &answer); 146 errno_t retval = async_data_write_start(exch, caption, str_size(caption)); 147 148 if (retval != EOK) { 149 async_forget(req); 150 async_exchange_end(exch); 151 return retval; 152 } 153 154 async_wait_for(req, &retval); 155 async_exchange_end(exch); 156 return EOK; 130 157 } 131 158 -
uspace/lib/c/include/io/con_srv.h
rce862ac rb48e680f 51 51 typedef struct con_ops con_ops_t; 52 52 53 #define CON_CAPTION_MAXLEN 255 54 53 55 /** Service setup (per sevice) */ 54 56 typedef struct { … … 83 85 void (*set_rgb_color)(con_srv_t *, pixel_t, pixel_t); 84 86 void (*set_cursor_visibility)(con_srv_t *, bool); 87 errno_t (*set_caption)(con_srv_t *, const char *); 85 88 errno_t (*get_event)(con_srv_t *, cons_event_t *); 86 89 errno_t (*map)(con_srv_t *, sysarg_t, sysarg_t, charfield_t **); -
uspace/lib/c/include/io/console.h
rce862ac rb48e680f 83 83 84 84 extern void console_cursor_visibility(console_ctrl_t *, bool); 85 extern errno_t console_set_caption(console_ctrl_t *, const char *); 85 86 extern errno_t console_get_color_cap(console_ctrl_t *, sysarg_t *); 86 87 extern errno_t console_get_event(console_ctrl_t *, cons_event_t *); -
uspace/lib/c/include/ipc/console.h
rce862ac rb48e680f 50 50 CONSOLE_SET_RGB_COLOR, 51 51 CONSOLE_SET_CURSOR_VISIBILITY, 52 CONSOLE_SET_CAPTION, 52 53 CONSOLE_MAP, 53 54 CONSOLE_UNMAP, -
uspace/lib/ui/include/ui/wdecor.h
rce862ac rb48e680f 1 1 /* 2 * Copyright (c) 202 0Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 51 51 extern void ui_wdecor_set_rect(ui_wdecor_t *, gfx_rect_t *); 52 52 extern void ui_wdecor_set_active(ui_wdecor_t *, bool); 53 extern errno_t ui_wdecor_set_caption(ui_wdecor_t *, const char *); 53 54 extern errno_t ui_wdecor_paint(ui_wdecor_t *); 54 55 extern ui_evclaim_t ui_wdecor_pos_event(ui_wdecor_t *, pos_event_t *); -
uspace/lib/ui/include/ui/window.h
rce862ac rb48e680f 51 51 ui_window_t **); 52 52 extern void ui_window_set_cb(ui_window_t *, ui_window_cb_t *, void *); 53 extern errno_t ui_window_set_caption(ui_window_t *, const char *); 53 54 extern void ui_window_destroy(ui_window_t *); 54 55 extern void ui_window_add(ui_window_t *, ui_control_t *); -
uspace/lib/ui/private/window.h
rce862ac rb48e680f 95 95 /** Current cursor */ 96 96 ui_stock_cursor_t cursor; 97 /** Window placement */ 98 ui_wnd_placement_t placement; 97 99 }; 98 100 -
uspace/lib/ui/src/ui.c
rce862ac rb48e680f 50 50 #include <ui/wdecor.h> 51 51 #include <ui/window.h> 52 #include "../private/wdecor.h" 52 53 #include "../private/window.h" 53 54 #include "../private/ui.h" … … 372 373 return EOK; 373 374 375 (void) console_set_caption(ui->console, ""); 374 376 return console_gc_suspend(ui->cgc); 375 377 } … … 386 388 { 387 389 errno_t rc; 390 ui_window_t *awnd; 388 391 389 392 if (ui->cgc == NULL) … … 393 396 if (rc != EOK) 394 397 return rc; 398 399 awnd = ui_window_get_active(ui); 400 if (awnd != NULL) 401 (void) console_set_caption(ui->console, awnd->wdecor->caption); 395 402 396 403 return gfx_cursor_set_visible(console_gc_get_ctx(ui->cgc), false); -
uspace/lib/ui/src/wdecor.c
rce862ac rb48e680f 157 157 { 158 158 wdecor->active = active; 159 } 160 161 /** Change caption. 162 * 163 * @param wdecor Window decoration 164 * @param caption New caption 165 * 166 * @return EOK on success or an error code 167 */ 168 errno_t ui_wdecor_set_caption(ui_wdecor_t *wdecor, const char *caption) 169 { 170 char *cdup; 171 172 cdup = str_dup(caption); 173 if (cdup == NULL) 174 return ENOMEM; 175 176 free(wdecor->caption); 177 wdecor->caption = cdup; 178 179 ui_wdecor_paint(wdecor); 180 return EOK; 159 181 } 160 182 -
uspace/lib/ui/src/window.c
rce862ac rb48e680f 262 262 gfx_coord2_add(&dparams.rect.p0, &scr_dims, 263 263 &dparams.rect.p1); 264 (void) console_set_caption(ui->console, 265 params->caption); 264 266 } 265 267 } else { … … 355 357 window->wdecor = wdecor; 356 358 window->cursor = ui_curs_arrow; 359 window->placement = params->placement; 357 360 *rwindow = window; 358 361 … … 412 415 ui_paint(ui); 413 416 } 417 418 if (ui->console != NULL && 419 window->placement == ui_wnd_place_full_screen) { 420 (void) console_set_caption(ui->console, ""); 421 } 414 422 } 415 423 … … 599 607 window->cb = cb; 600 608 window->arg = arg; 609 } 610 611 /** Change window caption. 612 * 613 * @param window Window 614 * @param caption New caption 615 * 616 * @return EOK on success or an error code 617 */ 618 errno_t ui_window_set_caption(ui_window_t *window, const char *caption) 619 { 620 return ui_wdecor_set_caption(window->wdecor, caption); 601 621 } 602 622 -
uspace/srv/hid/console/console.c
rce862ac rb48e680f 151 151 static void cons_set_rgb_color(con_srv_t *, pixel_t, pixel_t); 152 152 static void cons_set_cursor_visibility(con_srv_t *, bool); 153 static errno_t cons_set_caption(con_srv_t *, const char *); 153 154 static errno_t cons_get_event(con_srv_t *, cons_event_t *); 154 155 static errno_t cons_map(con_srv_t *, sysarg_t, sysarg_t, charfield_t **); … … 172 173 .set_rgb_color = cons_set_rgb_color, 173 174 .set_cursor_visibility = cons_set_cursor_visibility, 175 .set_caption = cons_set_caption, 174 176 .get_event = cons_get_event, 175 177 .map = cons_map, … … 669 671 } 670 672 673 static errno_t cons_set_caption(con_srv_t *srv, const char *caption) 674 { 675 console_t *cons = srv_to_console(srv); 676 677 (void) cons; 678 (void) caption; 679 return EOK; 680 } 681 671 682 static errno_t cons_get_event(con_srv_t *srv, cons_event_t *event) 672 683 {
Note:
See TracChangeset
for help on using the changeset viewer.