Skip to content
Snippets Groups Projects
  1. Sep 12, 2023
  2. Sep 22, 2022
  3. Nov 19, 2021
  4. Oct 14, 2020
  5. Mar 16, 2020
  6. Oct 18, 2019
  7. Aug 21, 2019
  8. Jun 12, 2019
  9. Jun 07, 2019
    • Hanna Reitz's avatar
      ui/curses: Fix build with -m32 · dc3c871a
      Hanna Reitz authored
      
      wchar_t may resolve to be an unsigned long on 32-bit architectures.
      Using the %x conversion specifier will then give a compiler warning:
      
      ui/curses.c: In function ‘get_ucs’:
      ui/curses.c:492:49: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘wchar_t’ {aka ‘long int’} [-Werror=format=]
        492 |         fprintf(stderr, "Could not convert 0x%04x "
            |                                              ~~~^
            |                                                 |
            |                                                 unsigned int
            |                                              %04lx
        493 |                         "from wchar_t to a multibyte character: %s\n",
        494 |                         wch, strerror(errno));
            |                         ~~~
            |                         |
            |                         wchar_t {aka long int}
      ui/curses.c:504:49: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘wchar_t’ {aka ‘long int’} [-Werror=format=]
        504 |         fprintf(stderr, "Could not convert 0x%04x "
            |                                              ~~~^
            |                                                 |
            |                                                 unsigned int
            |                                              %04lx
        505 |                         "from a multibyte character to UCS-2 : %s\n",
        506 |                         wch, strerror(errno));
            |                         ~~~
            |                         |
            |                         wchar_t {aka long int}
      
      Fix this by casting the wchar_t value to an unsigned long and using %lx
      as the conversion specifier.
      
      Fixes: b7b664a4
      Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
      Reviewed-by: default avatarSamuel Thibault <samuel.thibault@ens-lyon.org>
      Message-id: 20190527142540.23255-1-mreitz@redhat.com
      Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
      dc3c871a
  10. May 17, 2019
  11. Apr 12, 2019
  12. Mar 18, 2019
  13. Mar 13, 2019
  14. Mar 11, 2019
    • Samuel Thibault's avatar
      curses: support wide input · 459a707e
      Samuel Thibault authored
      
      This makes use of wide curses functions instead of 8bit functions. This
      allows to type e.g. accented letters.
      
      Unfortunately, key codes are then returned with values that could be
      confused with wide characters by ncurses, so we need to add a maybe_keycode
      variable to know whether the returned value is a key code or a character
      (curses with wide support), or possibly both (curses without wide support).
      
      The translation tables thus also need to be separated into key code
      translation and character translation.  The curses2foo helper makes it easier
      to use them.
      
      Signed-off-by: default avatarSamuel Thibault <samuel.thibault@ens-lyon.org>
      Message-id: 20190304210532.7840-1-samuel.thibault@ens-lyon.org
      Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
      459a707e
    • Samuel Thibault's avatar
      Reduce curses escdelay from 1s to 25ms · 633786fe
      Samuel Thibault authored
      
      By default, curses will only report single ESC key event after 1s delay,
      since ESC is also used for keypad escape sequences. This however makes
      users believe that ESC is not working. Reducing to 25ms provides good user
      experience, while still allowing 25ms for keypad sequences to get in, which
      should be enough.
      
      Signed-off-by: default avatarSamuel Thibault <samuel.thibault@ens-lyon.org>
      Message-Id: <20190303172557.17139-1-samuel.thibault@ens-lyon.org>
      Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
      633786fe
  15. Feb 05, 2019
  16. Oct 19, 2018
  17. Mar 05, 2018
  18. Feb 22, 2018
  19. Feb 20, 2018
  20. Sep 29, 2017
  21. Jan 10, 2017
    • Stefan Weil's avatar
      curses: Fix compiler warnings (Mingw-w64 redefinition of macro KEY_EVENT) · f27ff810
      Stefan Weil authored
      
      For builds with Mingw-w64 as it is included in Cygwin, there are two
      header files which define KEY_EVENT with different values.
      
      This results in lots of compiler warnings like this one:
      
        CC      vl.o
      In file included from /qemu/include/ui/console.h:340:0,
                       from /qemu/vl.c:76:
      /usr/i686-w64-mingw32/sys-root/mingw/include/curses.h:1522:0: warning: "KEY_EVENT" redefined
       #define KEY_EVENT 0633  /* We were interrupted by an event */
      
      In file included from /usr/share/mingw-w64/include/windows.h:74:0,
                       from /usr/share/mingw-w64/include/winsock2.h:23,
                       from /qemu/include/sysemu/os-win32.h:29,
                       from /qemu/include/qemu/osdep.h:100,
                       from /qemu/vl.c:24:
      /usr/share/mingw-w64/include/wincon.h:101:0: note: this is the location of the previous definition
       #define KEY_EVENT 0x1
      
      QEMU only uses the KEY_EVENT macro from wincon.h.
      Therefore we can undefine the macro coming from curses.h.
      
      The explicit include statement for curses.h in ui/curses.c is not needed
      and was removed.
      
      Those two modifications fix the redefinition warnings.
      
      Signed-off-by: default avatarStefan Weil <sw@weilnetz.de>
      Acked-by: default avatarSamuel Thibault <samuel.thibault@ens-lyon.org>
      Message-id: 20161119185318.10564-1-sw@weilnetz.de
      Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
      f27ff810
  22. Oct 28, 2016
  23. Sep 13, 2016
  24. Feb 04, 2016
    • Peter Maydell's avatar
      ui: Clean up includes · e16f4c87
      Peter Maydell authored
      
      Clean up includes so that osdep.h is included first and headers
      which it implies are not included manually.
      
      This commit was created with scripts/clean-includes.
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      Message-id: 1454089805-5470-2-git-send-email-peter.maydell@linaro.org
      e16f4c87
  25. Jan 08, 2016
    • OGAWA Hirofumi's avatar
      ui/curses: Fix color attribute of monitor for curses · 4083733d
      OGAWA Hirofumi authored
      
      Current text_console_update() writes totally broken color attributes
      to console_write_ch(). The format now is writing,
      
      [WRONG]
      	bold << 21 | fg << 12 | bg << 8 | char
      	fg == 3bits curses color number
      	bg == 3bits curses color number
      
      I can't see this format is where come from. Anyway, this doesn't work
      at all.
      
      What curses expects is actually (and vga.c is using),
      
      [RIGHT]
      	bold << 21 | bg << 11 | fg << 8 | char
      	fg == 3bits vga color number
      	bg == 3bits vga color number
      
      And curses set COLOR_PAIR() up to match this format, and curses's
      chtype. I.e,
      
      	bold | color_pair | char
      	color_pair == (bg << 3 | fg)
      
      To fix, this simply uses VGA color number everywhere except curses.c
      internal. Then, convert it to above [RIGHT] format to write by
      console_write_ch(). And as bonus, this reduces to expose curses define
      to other parts (removes COLOR_* from console.c).
      
      [Tested the first line is displayed as white on blue back for monitor
      in curses console]
      
      Signed-off-by: default avatarOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
      Message-id: 87r3j95407.fsf@mail.parknet.co.jp
      Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
      4083733d
  26. Nov 06, 2015
  27. Nov 03, 2015
  28. Jun 04, 2014
  29. May 26, 2014
  30. Mar 05, 2014
Loading