Accessing global environment variables in X startup
Paul Sokolovsky <[email protected]> Sat, 19 Aug 2006 14:07:20 +0300
| Newsgroups | gmane.comp.handhelds.gpe |
|---|---|
| Message-ID | <[email protected]> |
Hello gpe,
I'm working on improving dynamic mouse/touchscreen handling in GPE,
i.e. letting it automatically use input which is present (and not use
one which is not). The first and rather obvious thing is touchscreen
calibration: if there's no TS, it makes no sense to calibrate it,
especially that xtscal seem to be hardcoded to expect exactly a TS
device, not arbitrary input device.
The fix would be trivial, like:
--- xserver-common/X11/Xinit.d/30xTs_Calibrate 29 Aug 2005 11:57:23 -0000
+++ xserver-common/X11/Xinit.d/30xTs_Calibrate 19 Aug 2006 09:18:02 -0000
@@ -1,5 +1,11 @@
#!/bin/sh
-if [ ! -f /etc/pointercal ]; then
- /usr/bin/run-calibrate.sh
+# Calibrate touchscreen only if it is detected.
+# Otherwise, assume we have a mouse.
+if [ ! -z "$TSLIB_TSDEVICE" ]; then
+
+ if [ ! -f /etc/pointercal ]; then
+ /usr/bin/run-calibrate.sh
+ fi
+
fi
However, I found that $TSLIB_TSDEVICE is not set there, and
generally, env is empty in Xinit. I traced this too clearenv()
call in gpe-dm.c,a nd it's present since rev 1.1 in CVS.
Is there reason why it gpe-dm clears environment, which outweights
flexibility of parameter passing via it? If not, I'd like to propose
following patch:
--- gpe-dm.c.org 2003-08-08 09:39:52.000000000 +0000
+++ gpe-dm.c 2006-08-19 11:05:12.000000000 +0000
@@ -113,7 +113,9 @@
start_server (FALSE);
- clearenv ();
+ /* Do not clear environment as Xinit, etc. may have a need to
+ access variables set by system startup scripts. */
+ /*clearenv ();*/
setenv ("DISPLAY", dpyname, 1);
--
Best regards,
Paul mailto:[email protected]