summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYaakov Selkowitz <yselkowitz@users.sourceforge.net>2012-07-16 15:03:01 +0100
committerJon Turney <jon.turney@dronecode.org.uk>2015-11-10 11:39:56 +0000
commit2bc5bd50a50931972bcffe59835e6d477343f1cf (patch)
tree6e14be65ef1d4fb3fc122df5d3e70bbc10d79821
parent704663522f423caf5aee532905f0285db361bc1a (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 d26cc9376..afb0cfa27 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 f079368c7..3bc25d0bf 100644
--- a/hw/xwin/winconfig.h
+++ b/hw/xwin/winconfig.h
@@ -159,6 +159,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 9e6f0d6d4..38401345a 100644
--- a/hw/xwin/winprefslex.l
+++ b/hw/xwin/winprefslex.l
@@ -90,6 +90,7 @@ RELOAD { return RELOAD; }
TRAYICON { return TRAYICON; }
FORCEEXIT { return FORCEEXIT; }
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 9bb28ae92..6cc231fdc 100644
--- a/hw/xwin/winprefsyacc.y
+++ b/hw/xwin/winprefsyacc.y
@@ -39,6 +39,8 @@
#include <stdlib.h>
#define _STDLIB_H 1 /* bison checks this to know if stdlib has been included */
#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 */
@@ -57,6 +59,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);
@@ -121,6 +125,7 @@ extern int yylex(void);
%token TRAYICON
%token FORCEEXIT
%token SILENTEXIT
+%token DPI
%token <sVal> STRING
%type <uVal> group1
@@ -155,6 +160,10 @@ command: defaulticon
| trayicon
| forceexit
| silentexit
+ | dpi
+ ;
+
+dpi: DPI STRING NEWLINE { SetDPI($2); free($2); }
;
trayicon: TRAYICON STRING NEWLINE { SetTrayIcon($2); free($2); }
@@ -259,6 +268,13 @@ yyerror (const 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 90a65499c..12dd9c5ba 100644
--- a/hw/xwin/winprocarg.c
+++ b/hw/xwin/winprocarg.c
@@ -957,6 +957,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")