Merge pull request #116 from tfg13/master

further fixes for exotic xrandr outputs
This commit is contained in:
Ioannis Tsakpinis 2015-05-14 01:20:20 +03:00
commit 1dbca8b623
1 changed files with 25 additions and 10 deletions

View File

@ -92,15 +92,28 @@ public class XRandR {
} }
name = sa[0]; name = sa[0];
// save position of this screen, will be used later when current modeline is parsed // enabled?
if ( "primary".equals(sa[2]) ) { if (sa.length > 2) {
parseScreenHeader(currentScreenPosition, sa[3]); // save position of this screen, will be used later when current modeline is parsed
// save primary if ( "primary".equals(sa[2]) ) {
primaryScreenIdentifier = name; parseScreenHeader(currentScreenPosition, sa[3]);
} else { // save primary
parseScreenHeader(currentScreenPosition, sa[2]); primaryScreenIdentifier = name;
} } else {
} else { parseScreenHeader(currentScreenPosition, sa[2]);
}
} else {
// disabled screen, no position info available
currentScreenPosition[0] = 0;
currentScreenPosition[1] = 0;
}
} else if ("disconnected".equals(sa[1])) {
// previous screen block is over
if (name != null) {
screens.put(name, possibles.toArray(new Screen[possibles.size()]));
name = null;
}
} else if (name != null) { // only read modelines after a valid screen identifier
Matcher m = SCREEN_MODELINE_PATTERN.matcher(sa[0]); Matcher m = SCREEN_MODELINE_PATTERN.matcher(sa[0]);
if ( m.matches() ) { if ( m.matches() ) {
// found a new mode line // found a new mode line
@ -113,7 +126,9 @@ public class XRandR {
} }
} }
screens.put(name, possibles.toArray(new Screen[possibles.size()])); if (name != null) {
screens.put(name, possibles.toArray(new Screen[possibles.size()]));
}
current = currentList.toArray(new Screen[currentList.size()]); current = currentList.toArray(new Screen[currentList.size()]);