Changeset 09f41d3 in mainline


Ignore:
Timestamp:
2024-09-25T17:19:36Z (4 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Children:
c23a1fe
Parents:
6a753a9c
Message:

Tetris should be able to detect screen cursor control capability

Location:
uspace
Files:
8 edited

Legend:

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

    r6a753a9c r09f41d3  
    7070
    7171#define TERM_CAPS \
    72         (CONSOLE_CAP_STYLE | CONSOLE_CAP_INDEXED | CONSOLE_CAP_RGB)
     72        (CONSOLE_CAP_CURSORCTL | CONSOLE_CAP_STYLE | CONSOLE_CAP_INDEXED | \
     73        CONSOLE_CAP_RGB)
    7374
    7475#define SCROLLBACK_MAX_LINES 1000
  • uspace/app/tetris/screen.c

    r6a753a9c r09f41d3  
    11/*
     2 * Copyright (c) 2024 Jiri Svoboda
    23 * Copyright (c) 2011 Martin Decky
    34 * All rights reserved.
     
    143144        console_cursor_visibility(console, 0);
    144145        resume_normal();
    145         scr_clear();
     146        scr_set();
    146147}
    147148
     
    170171        }
    171172
     173        if ((ccap & CONSOLE_CAP_CURSORCTL) == 0) {
     174                stop("Your screen does not support cursor control.\n");
     175                return;
     176        }
    172177        *rgb = ((ccap & CONSOLE_CAP_RGB) == CONSOLE_CAP_RGB);
    173178        *color = ((ccap & CONSOLE_CAP_INDEXED) == CONSOLE_CAP_INDEXED);
     
    195200
    196201                snprintf(smallscr, sizeof(smallscr),
    197                     "the screen is too small (must be at least %dx%d)",
     202                    "the screen is too small (must be at least %dx%d)\n",
    198203                    MINROWS, MINCOLS);
    199204                stop(smallscr);
  • uspace/lib/output/include/io/concaps.h

    r6a753a9c r09f41d3  
    11/*
    2  * Copyright (c) 2023 Jiri Svoboda
     2 * Copyright (c) 2024 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    3838typedef enum {
    3939        CONSOLE_CAP_NONE = 0,
    40         CONSOLE_CAP_STYLE = 1,
    41         CONSOLE_CAP_INDEXED = 2,
    42         CONSOLE_CAP_RGB = 4
     40        CONSOLE_CAP_CURSORCTL = 1,
     41        CONSOLE_CAP_STYLE = 2,
     42        CONSOLE_CAP_INDEXED = 4,
     43        CONSOLE_CAP_RGB = 8
    4344} console_caps_t;
    4445
  • uspace/srv/hid/output/ctl/serial.c

    r6a753a9c r09f41d3  
    8585static console_caps_t serial_get_caps(outdev_t *dev)
    8686{
    87         return (CONSOLE_CAP_STYLE | CONSOLE_CAP_INDEXED | CONSOLE_CAP_RGB);
     87        return (CONSOLE_CAP_CURSORCTL | CONSOLE_CAP_STYLE |
     88            CONSOLE_CAP_INDEXED | CONSOLE_CAP_RGB);
    8889}
    8990
  • uspace/srv/hid/output/port/ddev.c

    r6a753a9c r09f41d3  
    11/*
    2  * Copyright (c) 2020 Jiri Svoboda
     2 * Copyright (c) 2024 Jiri Svoboda
    33 * Copyright (c) 2008 Martin Decky
    44 * Copyright (c) 2006 Jakub Vana
     
    198198static console_caps_t output_ddev_get_caps(outdev_t *dev)
    199199{
    200         return (CONSOLE_CAP_STYLE | CONSOLE_CAP_INDEXED | CONSOLE_CAP_RGB);
     200        return (CONSOLE_CAP_CURSORCTL | CONSOLE_CAP_STYLE |
     201            CONSOLE_CAP_INDEXED | CONSOLE_CAP_RGB);
    201202}
    202203
  • uspace/srv/hid/output/port/ega.c

    r6a753a9c r09f41d3  
    143143static console_caps_t ega_get_caps(outdev_t *dev)
    144144{
    145         return (CONSOLE_CAP_STYLE | CONSOLE_CAP_INDEXED);
     145        return (CONSOLE_CAP_CURSORCTL | CONSOLE_CAP_STYLE |
     146            CONSOLE_CAP_INDEXED);
    146147}
    147148
  • uspace/srv/hid/remcons/remcons.c

    r6a753a9c r09f41d3  
    248248        remcons_t *remcons = srv_to_remcons(srv);
    249249
    250         if (remcons->enable_ctl)
    251                 *ccaps = CONSOLE_CAP_INDEXED | CONSOLE_CAP_RGB;
    252         else
    253                 *ccaps = 0;
     250        *ccaps = 0;
     251
     252        if (remcons->enable_ctl) {
     253                *ccaps |= CONSOLE_CAP_CURSORCTL | CONSOLE_CAP_STYLE |
     254                    CONSOLE_CAP_INDEXED;
     255        }
     256
     257        if (remcons->enable_rgb)
     258                *ccaps |= CONSOLE_CAP_RGB;
    254259
    255260        return EOK;
     
    437442
    438443        remcons->enable_ctl = !no_ctl;
     444        remcons->enable_rgb = !no_ctl && !no_rgb;
    439445        remcons->user = user;
    440446
     
    448454            remcons_vt_putchar, remcons_vt_cputs, remcons_vt_flush);
    449455        assert(remcons->vt != NULL); // XXX
    450         remcons->vt->enable_rgb = !no_rgb;
     456        remcons->vt->enable_rgb = remcons->enable_rgb;
    451457
    452458        if (remcons->enable_ctl) {
  • uspace/srv/hid/remcons/remcons.h

    r6a753a9c r09f41d3  
    4848        vt100_state_t *vt;
    4949        bool enable_ctl;
     50        bool enable_rgb;
    5051} remcons_t;
    5152
Note: See TracChangeset for help on using the changeset viewer.