Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interlaced display modes aren't supported on lwjgl for linux #130

Open
ScoreUnder opened this issue Feb 27, 2016 · 4 comments
Open

Interlaced display modes aren't supported on lwjgl for linux #130

ScoreUnder opened this issue Feb 27, 2016 · 4 comments

Comments

@ScoreUnder
Copy link

This is the output of xrandr -q

Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 16384 x 16384
HDMI-0 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 16mm x 9mm
   1920x1080i    60.00*+  50.00    59.94  
   1920x1080     24.00    23.98  
   1280x720      60.00    50.00    59.94  
   1024x768      75.08    70.07    60.00  
   1440x480i     59.94  
   832x624       74.55  
   800x600       72.19    75.00    60.32    56.25  
   720x576       50.00  
   720x576i      50.00  
   720x480       60.00    59.94  
   720x480i      60.00    59.94  
   640x480       75.00    72.81    66.67    60.00    59.94  
DVI-0 disconnected (normal left inverted right x axis y axis)
VGA-0 disconnected (normal left inverted right x axis y axis)

The error encountered was an ArrayIndexOutOfBoundsException in XRandR.findPrimary.

This is a second-hand error report because my own monitors don't support interlaced display modes, but the person who I'm helping is testing this with Minecraft, which is notoriously hard to replace libraries in nowadays (due to integrity checks and automatic re-downloading). For that reason I can't really test a solution to this, but I suspect it may be as simple as:

diff --git a/src/java/org/lwjgl/opengl/XRandR.java b/src/java/org/lwjgl/opengl/XRandR.java
index 6630f97..586b611 100644
--- a/src/java/org/lwjgl/opengl/XRandR.java
+++ b/src/java/org/lwjgl/opengl/XRandR.java
@@ -259,7 +259,7 @@ public class XRandR {
        }

        private static final Pattern SCREEN_HEADER_PATTERN   = Pattern.compile("^(\\d+)x(\\d+)[+](\\d+)[+](\\d+)$");
-       private static final Pattern SCREEN_MODELINE_PATTERN = Pattern.compile("^(\\d+)x(\\d+)$");
+       private static final Pattern SCREEN_MODELINE_PATTERN = Pattern.compile("^(\\d+)x(\\d+)i?$");
        private static final Pattern FREQ_PATTERN            = Pattern.compile("^(\\d+)[.](\\d+)(?:\\s*[*])?(?:\\s*[+])?$");

        /**

I gave my friend an entirely different workaround, and one which is laughably hacky. I sent a tar.gz file containing a directory with these two scripts inside, then instructed them to run ./stupid-hack minecraft in that directory. It worked.

Probably related to:

@tfg13
Copy link
Collaborator

tfg13 commented Feb 27, 2016

This should be fixed by the proposed change in: #112 (comment)

@ScoreUnder
Copy link
Author

Sounds good.

On an almost-related note, does Java support non-capturing groups in regexes? It's been a long, long time since I used Java's particular flavour of regex, but in many dialects you could write it like this:
"^(?:\\S*\\D)?(\\d+)x(\\d+)(?:\\D\\S*)?$"
This would remove the need for switching the group numbers around.

@aaronfranke
Copy link

Has this issue been fixed in LWJGL yet? This issue is still occuring in programs such as Minecraft. https://bugs.mojang.com/browse/MC-79573 (main bug page, there are also 11 duplicates).

@nodakai
Copy link

nodakai commented Jul 29, 2017

Custom resolution such as 1680x1050_60.00 aren't supported, either:

@ScoreUnder Yes they are supported:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants