]> git.plutz.net Git - blast/blob - modules/display_ws5inch.mk
improved DPI scaling for several applications
[blast] / modules / display_ws5inch.mk
1 ifndef display_rotate
2   display_rotate := 0
3 endif
4
5 ifeq "${display_rotate}" "0"
6   display_touch_calibration := 200 3950 250 4000
7 else ifeq "${display_rotate}" "2"
8   display_touch_calibration := 3950 200 4000 250
9 endif
10
11 define RPICONFIG +=
12
13 ### Waveshare 5 Inch Display ###
14 hdmi_group=2
15 hdmi_mode=87
16 hdmi_cvt=800 480 60 6 0 0 0
17 hdmi_drive=1
18 dtoverlay=ads7846,cs=1,penirq=25,penirq_pull=2,speed=50000,keep_vref_on=0,swapxy=0,pmax=255,xohms=150,xmin=200,xmax=3900,ymin=200,ymax=3900
19 display_rotate=${display_rotate}
20 endef
21
22 define display_ws5inch_cfg :=
23 Section "InputClass"
24         Identifier "evdev touchscreen catchall"
25         MatchIsTouchscreen "on"
26         Option  "Calibration"   "${display_touch_calibration}"
27         MatchDevicePath "/dev/input/event*"
28         Driver "evdev"
29 EndSection
30 endef
31
32 export display_ws5inch_cfg
33
34 PACKAGES += xserver-xorg-input-evdev xinput xinput-calibrator
35
36 .PHONY: _display_ws5inch
37 _config: _display_ws5inch
38 _display_ws5inch: ${CFGROOT} _copy _mount
39         mkdir -p "$${CFGROOT}/usr/share/X11/xorg.conf.d/"
40         printf '%s\n' "$${display_ws5inch_cfg}" >"$${CFGROOT}/usr/share/X11/xorg.conf.d/45-evdev.conf"
41         mkdir -p "$${CFGROOT}/etc/X11/Xsession.d/"
42         printf 'xrandr --size 800x480\n' >"$${CFGROOT}/etc/X11/Xsession.d/10display_resolution"
43         # Correct DPI scaling, although application support is mediocre
44         mkdir -p "$${CFGROOT}/etc/X11/Xresources/"
45         printf 'Xft.dpi: 180\n' >"$${CFGROOT}/etc/X11/Xresources/dpi_resolution"
46         # Workaround for applications that do not handle DPI scaling correctly
47         -sed -i 's;^Exec=;Exec=env GDK_DPI_SCALE=.5 ;' \
48           $${CFGROOT}/usr/share/applications/chromium*.desktop \
49           $${CFGROOT}/usr/share/applications/firefox*.desktop \
50           $${CFGROOT}/usr/share/applications/exo-web-browser.desktop