The attachment is a patch to provide setting DPI value by adding
"dpi=xxx" in /etc/sysconfig/uxlaunch or running uxlaunch with command
option "--dpi xxx". I have set the default value of DPI to 120 which is
the same as before and won't affect netbook. I hope this is helpful to
refine our uxlaunch. 

And for my bug(I totally agree with you), it is not reasonable to rely
on one specific DPI value.  Of course there is some work to do. :)



On Wed, 2010-04-14 at 11:07 +0800, Arjan van de Ven wrote:
> On 4/13/2010 17:56, Zhao, Juan J wrote:
> > Yes, here is one bug in my platform. The characters are in a mess with
> > dpi 120. And the command option sent to X has the highest priority and I
> > can not set the specific DPI value by xorg.conf except using the
> > workaround "xrandr --output default --dpi 96".
> 
> 
> it is very unlikely that your platform has an actual dpi of 96, so when we 
> provide a
> mechanism to provide the actual DPI, you will still hit your bug... I suspect 
> you have
> some work to do ;-)
> 

>From aef0c6f6cea6374a1bb7ae8e579a6ae9cd8391de Mon Sep 17 00:00:00 2001
From: JuanZhao <[email protected]>
Date: Wed, 14 Apr 2010 17:40:01 +0800
Subject: [PATCH] add the dpi set option to uxlaunch

---
 options.c          |   13 ++++++++++---
 uxlaunch.h         |    1 +
 uxlaunch.sysconfig |    1 +
 xserver.c          |    5 +++--
 4 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/options.c b/options.c
index 11d550a..0a5445b 100644
--- a/options.c
+++ b/options.c
@@ -25,6 +25,7 @@
 
 /* builtin defaults */
 int tty = 2;
+char dpinum[8] = "120";
 char session[256] = "/usr/bin/mutter --sm-disable";
 char username[256] = "meego";
 
@@ -35,11 +36,11 @@ static struct option opts[] = {
 	{ "tty",     1, NULL, 't' },
 	{ "session", 1, NULL, 's' },
 	{ "help",    0, NULL, 'h' },
+	{ "dpi",     1, NULL, 'd' },
 	{ "verbose", 0, NULL, 'v' },
 	{ 0, 0, NULL, 0}
 };
 
-
 void usage(const char *name)
 {
 	printf("Usage: %s [OPTION...] [-- [session cmd] [session args]]\n", name);
@@ -48,6 +49,7 @@ void usage(const char *name)
 	printf("  -s, --session   Start a non-default session\n");
 	printf("  -v, --verbose   Display lots of output to the console\n");
 	printf("  -h, --help      Display this help message\n");
+	printf("  -d, --dpi       Start session on specified dpi value");
 }
 
 void get_options(int argc, char **argv)
@@ -126,13 +128,15 @@ void get_options(int argc, char **argv)
 				tty = atoi(val);
 			if (!strcmp(key, "session"))
 				strncpy(session, val, 256);
+			if (!strcmp(key, "dpi"))
+				strncpy(dpinum, val, 8);
 		}
 		fclose(f);
 	}
 
 	/* parse cmdline - overrides */
 	while (1) {
-		c = getopt_long(argc, argv, "u:t:s:hv", opts, &i);
+		c = getopt_long(argc, argv, "u:t:s:h:dv", opts, &i);
 		if (c == -1)
 			break;
 
@@ -150,6 +154,9 @@ void get_options(int argc, char **argv)
 			usage(argv[0]);
 			exit (EXIT_SUCCESS);
 			break;
+		case 'd':
+			strncpy(dpinum, optarg, 8);
+			break;
 		case 'v':
 			verbose = 1;
 			break;
@@ -171,7 +178,7 @@ void get_options(int argc, char **argv)
 	}
 
 	lprintf("uxlaunch v%s started.", VERSION);
-	lprintf("user \"%s\", tty #%d, session \"%s\"", username, tty, session);
+	lprintf("user \"%s\", tty #%d, session \"%s\", dpi %s", username, tty, session, dpinum);
 
 	pass = getpwnam(username);
 	if (!pass)
diff --git a/uxlaunch.h b/uxlaunch.h
index 58d24e2..7d037a3 100644
--- a/uxlaunch.h
+++ b/uxlaunch.h
@@ -19,6 +19,7 @@ extern char user_xauth_path[];
 extern int tty;
 extern char session[];
 extern char username[];
+extern char dpinum[];
 
 extern int session_pid;
 extern int xpid;
diff --git a/uxlaunch.sysconfig b/uxlaunch.sysconfig
index f3c59ba..4bc6887 100644
--- a/uxlaunch.sysconfig
+++ b/uxlaunch.sysconfig
@@ -11,6 +11,7 @@
 # user=meego
 # tty=2
 # session=/usr/bin/mutter --sm-disable
+# dpi=120
 #
 # standard MeeGo desktop:
 # session=/usr/bin/mutter --sm-disable
diff --git a/xserver.c b/xserver.c
index d22fdf1..d40de11 100644
--- a/xserver.c
+++ b/xserver.c
@@ -229,12 +229,12 @@ void start_X_server(void)
 	ret = stat(xserver, &statbuf);
 	if (!ret && (statbuf.st_mode & S_ISUID)) {
 		execl(xserver, xserver,  displayname,
-		      "-nolisten", "tcp", "-dpi", "120", "-noreset",
+		      "-nolisten", "tcp", "-dpi", dpinum, "-noreset",
 		      "-auth", xauth_cookie_file,
 		      vt, NULL);
 	} else {
 		execl(xserver, xserver,  displayname,
-		      "-nolisten", "tcp", "-dpi", "120", "-noreset",
+		      "-nolisten", "tcp", "-dpi", dpinum, "-noreset",
 		      "-auth", user_xauth_path,
 		      "-logfile", xorg_log,
 		      vt, NULL);
@@ -307,3 +307,4 @@ void set_text_mode(void)
 		close(fd);
 
 }
+
-- 
1.6.3.3

_______________________________________________
MeeGo-dev mailing list
[email protected]
http://lists.meego.com/listinfo/meego-dev

Reply via email to