From 5aa43d61f84e69c9b46cfc3e37c6806b887f01d8 Mon Sep 17 00:00:00 2001 From: Michael Walle Date: Mon, 19 Sep 2011 22:43:25 +0200 Subject: [PATCH] Add force_xinerama configuration option The configuration option does the same as the commandline parameter, except it can be easily set by the user (e.g. you are using KDM and can't start a session through ~/.xsession). Signed-off-by: Michael Walle --- include/config.h | 10 ++++++++++ src/cfgparse.l | 1 + src/cfgparse.y | 10 ++++++++++ src/main.c | 5 ++++- 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/include/config.h b/include/config.h index 3234b91e..07391a6a 100644 --- a/include/config.h +++ b/include/config.h @@ -123,6 +123,16 @@ struct Config { * more often. */ bool force_focus_wrapping; + /** By default, use the RandR API for multi-monitor setups. + * Unfortunately, the nVidia binary graphics driver doesn't support + * this API. Instead, it only support the less powerful Xinerama API, + * which can be enabled by this option. + * + * Note: this option takes only effect on the initial startup (eg. + * reconfiguration is not possible). On startup, the list of screens + * is fetched once and never updated. */ + bool force_xinerama; + /** The default border style for new windows. */ border_style_t default_border; diff --git a/src/cfgparse.l b/src/cfgparse.l index 021e3516..dad5a915 100644 --- a/src/cfgparse.l +++ b/src/cfgparse.l @@ -125,6 +125,7 @@ none { return TOK_NONE; } 1pixel { return TOK_1PIXEL; } focus_follows_mouse { return TOKFOCUSFOLLOWSMOUSE; } force_focus_wrapping { return TOK_FORCE_FOCUS_WRAPPING; } +force_xinerama { return TOK_FORCE_XINERAMA; } workspace_bar { return TOKWORKSPACEBAR; } popup_during_fullscreen { return TOK_POPUP_DURING_FULLSCREEN; } ignore { return TOK_IGNORE; } diff --git a/src/cfgparse.y b/src/cfgparse.y index 016953fd..53608948 100644 --- a/src/cfgparse.y +++ b/src/cfgparse.y @@ -619,6 +619,7 @@ void parse_file(const char *f) { %token TOK_1PIXEL "1pixel" %token TOKFOCUSFOLLOWSMOUSE "focus_follows_mouse" %token TOK_FORCE_FOCUS_WRAPPING "force_focus_wrapping" +%token TOK_FORCE_XINERAMA "force_xinerama" %token TOKWORKSPACEBAR "workspace_bar" %token TOK_DEFAULT "default" %token TOK_STACKING "stacking" @@ -674,6 +675,7 @@ line: | new_float | focus_follows_mouse | force_focus_wrapping + | force_xinerama | workspace_bar | workspace | assign @@ -1022,6 +1024,14 @@ force_focus_wrapping: } ; +force_xinerama: + TOK_FORCE_XINERAMA bool + { + DLOG("force xinerama = %d\n", $2); + config.force_xinerama = $2; + } + ; + workspace_bar: TOKWORKSPACEBAR bool { diff --git a/src/main.c b/src/main.c index ea02bb6e..cc60d69c 100644 --- a/src/main.c +++ b/src/main.c @@ -432,7 +432,10 @@ int main(int argc, char *argv[]) { free(greply); - if (force_xinerama) { + /* Force Xinerama (for drivers which don't support RandR yet, esp. the + * nVidia binary graphics driver), when specified either in the config + * file or on command-line */ + if (force_xinerama || config.force_xinerama) { xinerama_init(); } else { DLOG("Checking for XRandR...\n"); -- 2.39.5