aboutsummaryrefslogtreecommitdiffstats
path: root/drv_X11.c
diff options
context:
space:
mode:
authorvolker <volker@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2009-11-20 14:49:34 +0000
committervolker <volker@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2009-11-20 14:49:34 +0000
commitcd705f84010afaa24ec457a90de61f2b4635ea69 (patch)
tree45e3f2bf5c912c48130c5830168b296fe56b2ebf /drv_X11.c
parent82a0af2c3007a9ebcbae4c1af4cc40765b1f5c96 (diff)
downloadlcd4linux-cd705f84010afaa24ec457a90de61f2b4635ea69.tar.gz
special commandline parameters for X11
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@1067 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to 'drv_X11.c')
-rw-r--r--drv_X11.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/drv_X11.c b/drv_X11.c
index 6ff17df..41e2f77 100644
--- a/drv_X11.c
+++ b/drv_X11.c
@@ -49,6 +49,7 @@
#include <signal.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
+#include <X11/Xresource.h>
#include "debug.h"
#include "cfg.h"
@@ -93,6 +94,14 @@ static GC gc;
static Colormap cm;
static Pixmap pm;
+static char myDisplayName[256] = "";
+static int opTableEntries = 2;
+static XrmOptionDescRec opTable[] = {
+ {"-display", ".display", XrmoptionSepArg, NULL},
+ {"-synchronous", "*synchronous", XrmoptionNoArg, "on"},
+};
+static XrmDatabase commandlineDB;
+
/****************************************/
/*** hardware dependant functions ***/
@@ -413,6 +422,8 @@ static int drv_X11_start(const char *section)
{
int i;
char *s;
+ XrmValue value;
+ char *str_type[20];
XSetWindowAttributes wa;
XSizeHints sh;
XEvent ev;
@@ -489,11 +500,21 @@ static int drv_X11_start(const char *section)
drv_X11_FB[i] = NO_COL;
}
- if ((dp = XOpenDisplay(NULL)) == NULL) {
- error("%s: can't open display", Name);
+ if (XrmGetResource(commandlineDB, "lcd4linux.display", "Lcd4linux.Display", str_type, &value)) {
+ strncpy(myDisplayName, value.addr, value.size);
+ debug("%s: X11 display name from command line: %s", Name, myDisplayName);
+ }
+
+ if ((dp = XOpenDisplay(strlen(myDisplayName) > 0 ? myDisplayName : NULL)) == NULL) {
+ error("%s: can't open display %s", Name, XDisplayName(strlen(myDisplayName) > 0 ? myDisplayName : NULL));
return -1;
}
+ if (XrmGetResource(commandlineDB, "lcd4linux*synchronous", "Lcd4linux*Synchronous", str_type, &value)) {
+ debug("%s: X synchronize on", Name);
+ XSynchronize(dp, 1 /* true */ );
+ }
+
sc = DefaultScreen(dp);
gc = DefaultGC(dp, sc);
vi = DefaultVisual(dp, sc);
@@ -595,6 +616,15 @@ int drv_X11_list(void)
}
+/* read X11 specific command line arguments */
+/* it is defined in drv.h */
+void drv_X11_parseArgs(int *argc, char *argv[])
+{
+ XrmInitialize();
+ XrmParseCommand(&commandlineDB, opTable, opTableEntries, "lcd4linux", argc, argv);
+}
+
+
/* initialize driver & display */
int drv_X11_init(const char *section, const int quiet)
{