Changeset 2cf8f994 in mainline


Ignore:
Timestamp:
2024-09-19T22:04:13Z (4 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Children:
3fcea34
Parents:
84cc190
Message:

Improve terminal behavior in console mode.

Location:
uspace
Files:
2 edited

Legend:

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

    r84cc190 r2cf8f994  
    302302static void term_render(terminal_t *term)
    303303{
    304         gfx_coord2_t pos = { .x = 4, .y = 26 };
    305         (void) gfx_bitmap_render(term->bmp, &term->update, &pos);
     304        (void) gfx_bitmap_render(term->bmp, &term->update, &term->off);
    306305
    307306        term->update.p0.x = 0;
     
    816815                as_area_destroy(term->ubuf);
    817816
     817        ui_destroy(term->ui);
    818818        free(term);
    819819}
     
    939939                return;
    940940
    941         sysarg_t sx = -term->off.x;
    942         sysarg_t sy = -term->off.y;
     941        sysarg_t sx = term->off.x;
     942        sysarg_t sy = term->off.y;
    943943
    944944        if (event->hpos < sx || event->vpos < sy)
     
    10051005        gfx_rect_t wrect;
    10061006
     1007        errno_t rc = ui_create(display_spec, &term->ui);
     1008        if (rc != EOK) {
     1009                printf("Error creating UI on %s.\n", display_spec);
     1010                return rc;
     1011        }
     1012
    10071013        ui_wnd_params_t wparams;
    10081014        ui_wnd_params_init(&wparams);
    10091015        wparams.caption = "Terminal";
    10101016        wparams.style |= ui_wds_maximize_btn | ui_wds_resizable;
     1017
    10111018        if ((flags & tf_topleft) != 0)
    10121019                wparams.placement = ui_wnd_place_top_left;
    10131020
    1014         errno_t rc = ui_create(display_spec, &term->ui);
    1015         if (rc != EOK) {
    1016                 printf("Error creating UI on %s.\n", display_spec);
    1017                 return rc;
     1021        if (ui_is_fullscreen(term->ui)) {
     1022                wparams.placement = ui_wnd_place_full_screen;
     1023                wparams.style &= ~ui_wds_decorated;
    10181024        }
    10191025
     
    10251031        gfx_rect_t rect = { { 0, 0 }, { width, height } };
    10261032        ui_wdecor_rect_from_app(term->ui, wparams.style, &rect, &rect);
    1027         term->off = rect.p0;
    1028         gfx_rect_rtranslate(&term->off, &rect, &wparams.rect);
     1033        term->off.x = -rect.p0.x;
     1034        term->off.y = -rect.p0.y;
     1035        printf("off=%d,%d\n", term->off.x, term->off.y);
     1036        gfx_rect_translate(&term->off, &rect, &wparams.rect);
     1037        printf("wparams.rect=%d,%d,%d,%d\n",
     1038            wparams.rect.p0.x,
     1039            wparams.rect.p1.x,
     1040            wparams.rect.p0.y,
     1041            wparams.rect.p1.y);
    10291042
    10301043        rc = ui_window_create(term->ui, &wparams, &term->window);
     
    10631076        term->selection_bgcolor = termui_color_from_pixel(_basic_colors[COLOR_RED | COLOR_BRIGHT]);
    10641077        term->selection_fgcolor = termui_color_from_pixel(_basic_colors[COLOR_WHITE | COLOR_BRIGHT]);
    1065 
    1066         term->termui = termui_create(width / FONT_WIDTH, height / FONT_SCANLINES,
    1067             SCROLLBACK_MAX_LINES);
    1068         if (!term->termui) {
    1069                 printf("Error creating terminal UI.\n");
    1070                 rc = ENOMEM;
    1071                 goto error;
    1072         }
    1073 
    1074         termui_set_refresh_cb(term->termui, termui_refresh_cb, term);
    1075         termui_set_scroll_cb(term->termui, termui_scroll_cb, term);
    1076         termui_set_update_cb(term->termui, termui_update_cb, term);
    10771078
    10781079        rc = term_init_window(term, display_spec, width, height,
     
    10821083                goto error;
    10831084        }
     1085
     1086        term->termui = termui_create(term->w / FONT_WIDTH,
     1087            term->h / FONT_SCANLINES, SCROLLBACK_MAX_LINES);
     1088        if (!term->termui) {
     1089                printf("Error creating terminal UI.\n");
     1090                rc = ENOMEM;
     1091                goto error;
     1092        }
     1093
     1094        termui_set_refresh_cb(term->termui, termui_refresh_cb, term);
     1095        termui_set_scroll_cb(term->termui, termui_scroll_cb, term);
     1096        termui_set_update_cb(term->termui, termui_update_cb, term);
    10841097
    10851098        async_set_fallback_port_handler(term_connection, NULL);
  • uspace/lib/termui/src/termui.c

    r84cc190 r2cf8f994  
    190190        }
    191191
    192         termui->row++;
     192        if (termui->rows > 1)
     193                termui->row++;
    193194
    194195        if (termui->row >= termui->used_rows)
Note: See TracChangeset for help on using the changeset viewer.