hongy19’s blog

keyboard


 

According to Archlinux wiki and How Keys Are Turned Into Actions, here comes how keystroke information is transferred in computer.

  • Keyboard send scancode to computer
  • Linux kernel convert scancode to keycode
  • Keyboard layout convert keycode to symbol/keysym
  • Linux terminal convert keysym into ASCII sequences

And there are two types of key (see link )* Ordinary key, like “a”, “b”. we should use them to input text

  • Special keys, which you would use to tell xterm to perform some action. They could not be to used to input text. They will generate escape sequences.

.inputrc is readline initialization file and used to map key sequence to readline function like “end-of-history”. Then you need to use text to describe “special keys” or “escape sequences”, see following example.* “\e[1~”: beginning-of-line      # Home Key

Read more ⟶

Wayland and weston


  • Wayland
  • see overview: Wayland Weston overview
  • Wayland is a communication protocol that specifies the communication between a display server and its clients, from wikipedia
  • Weston is the reference implementation of a Wayland compositor, from weston github.

  • Weston
  • backends, from “man weston”
  • drm-backend.so: The DRM backend uses Linux KMS for output and evdev devices for input
  • wayland-backend.so: The  Wayland  backend  runs on another Wayland server, a different Weston instance
  • x11-backend.so: The X11 backend runs on an X server
  • rdp-backend.so: The  RDP backend runs in memory without the need of graphical hardware.
  • to run weston from wsl2, use wayland-backend.so.
  • to run weston for rdp connection, use rdp-backend.so
  • all for drm connector, see “/sys/class/drm”
  • modules/shell
  • all *.so are located at usr/lib/weston for modules and shell in weston.ini
  • weston terminal
  • scale: scale text for high DPI screen
  • GDK setting for GTK application from application level
  • export GDK_BACKEND=wayland
  • #To scale UI elements by an integer only factor
  • #GTK3/4 does not support fractional scaling currently, so fractional factors will be ignored
  • export GDK_SCALE=1
  • #GDK_DPI_SCALE can be used to scale text only
  • export GDK_DPI_SCALE=1.2
  • composition level
  • “[output]” on weston.ini, only work for drm and X11. set “scale=1.5”.
Read more ⟶

font, 2D drawing on linux


 Here come several basic concept for font, drawing on linux

  • DRM/KMS

  • font
  • black and white rendering is first generation rendering and print still use it.
  • gray-scale rending (anti-aliasing) is second generation rendering to utilize controlling the brightness of each pixel.
  • subpixel (ClearType in windows) is third generation rendering to utilize controlling pixel colors. it is for LCD on which screens, the red, green and blue subpixels that control the color and brightness of the pixel.
  • Archlinux enable Anti-aliasing and subpixel by default.
  • fontconfig/freetype/pango

Read more ⟶