Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset b48e680f in mainline for uspace/app/terminal/terminal.c


Ignore:
Timestamp:
2021-11-03T10:23:28Z (3 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
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)
Message:

Allow console application to set the terminal window caption

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/terminal/terminal.c

    rce862ac rb48e680f  
    8888static void term_set_rgb_color(con_srv_t *, pixel_t, pixel_t);
    8989static void term_set_cursor_visibility(con_srv_t *, bool);
     90static errno_t term_set_caption(con_srv_t *, const char *);
    9091static errno_t term_get_event(con_srv_t *, cons_event_t *);
    9192static errno_t term_map(con_srv_t *, sysarg_t, sysarg_t, charfield_t **);
     
    109110        .set_rgb_color = term_set_rgb_color,
    110111        .set_cursor_visibility = term_set_cursor_visibility,
     112        .set_caption = term_set_caption,
    111113        .get_event = term_get_event,
    112114        .map = term_map,
     
    645647}
    646648
     649static 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
    647669static errno_t term_get_event(con_srv_t *srv, cons_event_t *event)
    648670{
Note: See TracChangeset for help on using the changeset viewer.