summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon TURNEY <jon.turney@dronecode.org.uk>2012-07-16 15:03:01 +0100
committerJon TURNEY <jon.turney@dronecode.org.uk>2012-07-16 15:03:01 +0100
commit58d6f159eac4a447297b60ef0d61ab8ccb3620fe (patch)
tree9b3773d8e125acaab2034274bbc949a1c4bba434
parent0ab35f0a23e7a9df062358f51254b3e64c8ba2b6 (diff)
hw/xwin: allow DPI configuration in XWinrc
Signed-off-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
-rw-r--r--hw/xwin/man/XWinrc.man5
-rw-r--r--hw/xwin/winconfig.c1
-rw-r--r--hw/xwin/winconfig.h1
-rw-r--r--hw/xwin/winprefslex.l1
-rw-r--r--hw/xwin/winprefsyacc.y16
-rw-r--r--hw/xwin/winprocarg.c8
6 files changed, 32 insertions, 0 deletions
diff --git a/hw/xwin/man/XWinrc.man b/hw/xwin/man/XWinrc.man
index 71d8dad23..820528730 100644
--- a/hw/xwin/man/XWinrc.man
+++ b/hw/xwin/man/XWinrc.man
@@ -54,6 +54,11 @@ There are four kinds of instructions: miscellaneous, menu, icon and style.
.SH Miscellaneous instruction
.TP 8
+.B DPI \fIresolution\fP
+Sets the resolution for all screens, in dots per inch. To be used when
+the server cannot determine the screen size(s) from the hardware.
+
+.TP 8
.B DEBUG \fIString\fP
The \fIString\fP is printed to the XWin log file.
diff --git a/hw/xwin/winconfig.c b/hw/xwin/winconfig.c
index 4dbbe7ced..ee2bb2bd6 100644
--- a/hw/xwin/winconfig.c
+++ b/hw/xwin/winconfig.c
@@ -70,6 +70,7 @@ WinCmdlineRec g_cmdline = {
#ifdef XWIN_XF86CONFIG
NULL, /* keyboard */
#endif
+ FALSE, /* customDPI */
NULL, /* xkbRules */
NULL, /* xkbModel */
NULL, /* xkbLayout */
diff --git a/hw/xwin/winconfig.h b/hw/xwin/winconfig.h
index 4699ca8ef..fd3fcbf1e 100644
--- a/hw/xwin/winconfig.h
+++ b/hw/xwin/winconfig.h
@@ -195,6 +195,7 @@ typedef struct
#ifdef XWIN_XF86CONFIG
char *keyboard;
#endif
+ Bool customDPI;
char *xkbRules;
char *xkbModel;
char *xkbLayout;
diff --git a/hw/xwin/winprefslex.l b/hw/xwin/winprefslex.l
index ba8aea696..1ce5d1add 100644
--- a/hw/xwin/winprefslex.l
+++ b/hw/xwin/winprefslex.l
@@ -92,6 +92,7 @@ DEBUG { return DEBUGOUTPUT; }
RELOAD { return RELOAD; }
TRAYICON { return TRAYICON; }
SILENTEXIT { return SILENTEXIT; }
+DPI { return DPI; }
"{" { return LB; }
"}" { return RB; }
"\""[^\"\r\n]+"\"" { yylval.sVal = makestr(yytext+1); \
diff --git a/hw/xwin/winprefsyacc.y b/hw/xwin/winprefsyacc.y
index 0acf160e4..e6bb124a6 100644
--- a/hw/xwin/winprefsyacc.y
+++ b/hw/xwin/winprefsyacc.y
@@ -38,6 +38,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "globals.h"
+#include "winconfig.h"
#include "winprefs.h"
/* The following give better error messages in bison at the cost of a few KB */
@@ -56,6 +58,8 @@ static MENUPARSED menu;
/* Functions for parsing the tokens into out structure */
/* Defined at the end section of this file */
+static void SetDPI (char *dpi);
+
static void SetIconDirectory (char *path);
static void SetDefaultIcon (char *fname);
static void SetRootMenu (char *menu);
@@ -120,6 +124,7 @@ extern int yylex(void);
%token TRAYICON
%token FORCEEXIT
%token SILENTEXIT
+%token DPI
%token <sVal> STRING
%type <uVal> group1
@@ -154,6 +159,10 @@ command: defaulticon
| trayicon
| forceexit
| silentexit
+ | dpi
+ ;
+
+dpi: DPI STRING NEWLINE { SetDPI($2); free($2); }
;
trayicon: TRAYICON STRING NEWLINE { SetTrayIcon($2); free($2); }
@@ -260,6 +269,13 @@ yyerror (char *s)
return 1;
}
+static void
+SetDPI (char *dpi)
+{
+ if (!g_cmdline.customDPI)
+ monitorResolution = atoi (dpi);
+}
+
/* Miscellaneous functions to store TOKENs into the structure */
static void
SetIconDirectory (char *path)
diff --git a/hw/xwin/winprocarg.c b/hw/xwin/winprocarg.c
index 1b539c025..a6f491049 100644
--- a/hw/xwin/winprocarg.c
+++ b/hw/xwin/winprocarg.c
@@ -996,6 +996,14 @@ ddxProcessArgument (int argc, char *argv[], int i)
}
/*
+ * Look for the '-dpi' argument
+ */
+ if (IS_OPTION("-dpi")) {
+ g_cmdline.customDPI = TRUE;
+ return 0; /* Let DIX parse this again */
+ }
+
+ /*
* Look for the '-config' argument
*/
if (IS_OPTION ("-config")