summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-graphics/xserver-common/xserver-common-1.34/0002-add-setdpi-Xinit.d-script.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-oe/recipes-graphics/xserver-common/xserver-common-1.34/0002-add-setdpi-Xinit.d-script.patch')
-rw-r--r--meta-oe/recipes-graphics/xserver-common/xserver-common-1.34/0002-add-setdpi-Xinit.d-script.patch112
1 files changed, 112 insertions, 0 deletions
diff --git a/meta-oe/recipes-graphics/xserver-common/xserver-common-1.34/0002-add-setdpi-Xinit.d-script.patch b/meta-oe/recipes-graphics/xserver-common/xserver-common-1.34/0002-add-setdpi-Xinit.d-script.patch
new file mode 100644
index 000000000..23b5345a1
--- /dev/null
+++ b/meta-oe/recipes-graphics/xserver-common/xserver-common-1.34/0002-add-setdpi-Xinit.d-script.patch
@@ -0,0 +1,112 @@
1From 3d1a1a8273112668927a6c6bb3e361e896f5b229 Mon Sep 17 00:00:00 2001
2From: Martin Jansa <Martin.Jansa@gmail.com>
3Date: Wed, 11 Apr 2012 14:28:45 +0200
4Subject: [PATCH 02/12] add setdpi Xinit.d script
5
6Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
7---
8 X11/Xinit.d/50setdpi | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++
9 1 files changed, 92 insertions(+), 0 deletions(-)
10 create mode 100644 X11/Xinit.d/50setdpi
11
12diff --git a/X11/Xinit.d/50setdpi b/X11/Xinit.d/50setdpi
13new file mode 100644
14index 0000000..04a2edd
15--- /dev/null
16+++ b/X11/Xinit.d/50setdpi
17@@ -0,0 +1,92 @@
18+#! /bin/sh
19+#
20+# Copyright Matthias Hentges <devel@hentges.net> (c) 2006
21+# License: GPL (see http://www.gnu.org/licenses/gpl.txt for a copy of the license)
22+#
23+# Filename: setDPI.sh
24+# Date: 09-Apr-06
25+
26+# This script configures Xft.dpi dependent on your screens DPI. This insures that the same font-size
27+# setting of 7 can be used on all machines.
28+
29+
30+XDEFAULTS="/etc/X11/Xdefaults"
31+
32+
33+
34+set_dpi() {
35+
36+ CURRENT_SETTING="`cat ${XDEFAULTS} | sed -n "/Xft.dpi\:/s/.*\:\(.*\)/\1/p" | sed -n "s/\ //p"`"
37+
38+ if test "$CURRENT_SETTING" != "$1"
39+ then
40+ echo "Using Xft.dpi of $SET_SCREEN_DPI for your $SCREEN_DPI DPI screen"
41+
42+ if grep -q "Xft.dpi" "$XDEFAULTS"
43+ then
44+ cat "${XDEFAULTS}" | sed "s/^Xft.dpi\:.*/Xft.dpi\: $SET_SCREEN_DPI/" > "${XDEFAULTS}_"
45+ mv "${XDEFAULTS}_" "${XDEFAULTS}"
46+ else
47+ echo -e "Xft.dpi: $SET_SCREEN_DPI\n" >> "$XDEFAULTS"
48+ fi
49+ else
50+ echo "Your $SCREEN_DPI DPI screen is already configured."
51+ fi
52+}
53+
54+set_rxvt_font() {
55+
56+ CURRENT_SETTING="`cat ${XDEFAULTS} | sed -n "/Rxvt\*font/s/\(.*\pixelsize=\)\(.*\)/\2/p"`"
57+
58+ if test "$1" -gt 100
59+ then
60+
61+ # Configure the rxvt font-size for your screen here:
62+ test "$1" -gt 180 -a "$1" -lt "221" && RXVT_FONT_SIZE=16
63+
64+ if test -z "$RXVT_FONT_SIZE"
65+ then
66+ echo "WARNING: No rxvt font-size configured for a $SCREEN_DPI DPI screen!"
67+ echo "Defaulting to size 9"
68+ RXVT_FONT_SIZE=9
69+ fi
70+
71+ if test "$CURRENT_SETTING" != "$RXVT_FONT_SIZE"
72+ then
73+ echo "Using a rxvt font-size of $RXVT_FONT_SIZE"
74+ cat ${XDEFAULTS} | sed "/Rxvt\*font/s/\(.*\pixelsize\)\(=*.*\)/\1=$RXVT_FONT_SIZE/" > ${XDEFAULTS}_
75+ mv ${XDEFAULTS}_ ${XDEFAULTS}
76+ else
77+ echo "The rxvt font-size is already configured"
78+ fi
79+ fi
80+}
81+
82+if test -z "$DISPLAY"
83+then
84+ echo "DISPLAY is not set, aborting..."
85+ exit 0
86+fi
87+
88+SCREEN_DPI="`/usr/bin/xdpyinfo | grep "dots per inch" | awk '{print $2}'| sed -n "s/\(.*\)x\(.*\)/\2/p"`"
89+
90+if test -z "$SCREEN_DPI"
91+then
92+ echo "WARNING: Couldn't read your screens DPI, defaulting to 100"
93+ SCREEN_DPI=100
94+fi
95+
96+# Configure your screen here:
97+test "$SCREEN_DPI" -gt 180 -a "$SCREEN_DPI" -lt "221" && SET_SCREEN_DPI=160
98+test "$SCREEN_DPI" -gt 90 -a "$SCREEN_DPI" -lt "121" && SET_SCREEN_DPI=100
99+
100+
101+if test -z "$SET_SCREEN_DPI"
102+then
103+ echo "WARNING: No default configuration found for your $SCREEN_DPI DPI screen!"
104+ echo "Using 100 DPI"
105+ SET_SCREEN_DPI=100
106+fi
107+
108+set_dpi "$SET_SCREEN_DPI"
109+set_rxvt_font "$SCREEN_DPI"
110--
1111.7.8.5
112