Linux users: a moment of your time please

Hello there
I’m currently trying to fix an annoyance in the way LWJGL handles multiple monitors on linux. See this thread for the full details, but the upshot is that I’m entirely too stupid and lazy to write the native code necessary, so I’m proposing to just call out to the “xrandr” command-line utility. This works for me, but there are valid concerns on how reliable it is over the full panoply of linux environments.
I’d be grateful if you could run this webstart and post the output (the code is here and here if you don’t want to blindly give all permissions to a self-certified jar). Also, if anyone has had problems with using the xrandr command I’d like to hear about them.

So in the interests of transparency, here’s my output:

AWT display mode handling
	Device: :0.0
	Fullscreen support: false
	Display modes:
		1920x1200
	Device: :0.1
	Fullscreen support: false
	Display modes:
		1440x900
xrandr display mode handling
	Screen: VGA1
		1920x1200
		1280x1024
		1024x768
		800x600
		640x480
		720x400
	Screen: LVDS1
		1440x900
		1360x768
		1152x864
		1024x768
		800x600
		640x480
xrandr raw output
Screen 0: minimum 320 x 200, current 3360 x 1200, maximum 8192 x 8192
VGA1 connected 1920x1200+1440+0 (normal left inverted right x axis y axis) 518mm x 324mm
   1920x1200      60.0*+
   1280x1024      75.0  
   1024x768       75.1     60.0  
   800x600        75.0     60.3  
   640x480        75.0     60.0  
   720x400        70.1  
LVDS1 connected 1440x900+0+300 (normal left inverted right x axis y axis) 303mm x 189mm
   1440x900       60.0*+   59.9  
   1360x768       59.8  
   1152x864       60.0  
   1024x768       60.0  
   800x600        60.3  
   640x480        59.9  
HDMI1 disconnected (normal left inverted right x axis y axis)
DP1 disconnected (normal left inverted right x axis y axis)
HDMI2 disconnected (normal left inverted right x axis y axis)
DP2 disconnected (normal left inverted right x axis y axis)
DP3 disconnected (normal left inverted right x axis y axis)
TV1 disconnected (normal left inverted right x axis y axis)

hmm, looking at your code I think your method to handle this problem is pretty genius. Minimal code, no extra native code and fixes the issue.

btw my output is

AWT display mode handling
	Device: :0.0
	Fullscreen support: true
	Display modes:
		1680x1050
		1400x1050
		1280x1024
		1280x1024
		1440x900
		1280x960
		1280x800
		1152x864
		1024x768
		1024x768
		1024x768
		800x600
		800x600
		800x600
		800x600
		640x480
		640x480
		640x480
		640x480
		640x480
		832x624
		700x525
		700x525
		512x384
		512x384
		400x300
		320x240
		320x240
xrandr display mode handling
	Screen: null
xrandr raw output

Does it revert to the current lwjgl behaviour if for example xrandr isn’t found or fails ?

Yeah, if there’s any problems with using xrandr or parsing the output it’ll fail-over to the current behaviour. As to your output: are you running linux? Probably should have put the OS name in the output really…

yes, i’m running openSUSE 64bit. Only have one monitor though.


AWT display mode handling
	Device: :0.0
	Fullscreen support: false
	Display modes:
		1280x1024
	Device: :0.1
	Fullscreen support: false
	Display modes:
		1680x1050
xrandr display mode handling
	Screen: default
		2960x1050
xrandr raw output
Screen 0: minimum 2960 x 1050, current 2960 x 1050, maximum 2960 x 1050
default connected 2960x1050+0+0 0mm x 0mm
   2960x1050      50.0* 

I have a pretty nasty setup - laptop plugged into two external monitors with different resolutions and aspect ratios. Ubuntu 9.10 running nvidia display driver.

On a laptop with slamd64:


AWT display mode handling
	Device: :0.0
	Fullscreen support: true
	Display modes:
		1280x800
		1024x768
		800x600
		800x512
		640x512
		640x480
		640x480
		512x384
		400x300
		320x240
xrandr display mode handling
	Screen: default
		1280x800
		1024x768
		800x600
		800x512
		640x512
		640x480
		512x384
		400x300
		320x240
xrandr raw output
Screen 0: minimum 320 x 240, current 1280 x 800, maximum 1280 x 800
default connected 1280x800+0+0 0mm x 0mm
   1280x800       50.0* 
   1024x768       51.0  
   800x600        52.0  
   800x512        53.0  
   640x512        54.0  
   640x480        55.0     56.0  
   512x384        57.0  
   400x300        58.0  
   320x240        59.0  

Im on ubuntu server, one monitor(not sure if th at will help you)


AWT display mode handling
	Device: :0.0
	Fullscreen support: true
	Display modes:
		1024x768
		1024x768
		1024x768
		800x600
		800x600
		800x600
		640x480
		640x480
		640x480
		720x400
xrandr display mode handling
	Screen: VGA1
		1024x768
		800x600
		640x480
		720x400
xrandr raw output
Screen 0: minimum 320 x 200, current 1024 x 768, maximum 2048 x 2048
VGA1 connected 1024x768+0+0 (normal left inverted right x axis y axis) 30mm x 22mm
   1024x768       75.1*    70.1     60.0  
   800x600        72.2     75.0     60.3  
   640x480        72.8     75.0     60.0  
   720x400        70.1  

[quote]AWT display mode handling
Device: :0.0
Fullscreen support: true
Display modes:
1280x1024
1280x1024
1280x960
1152x864
1152x864
1152x864
1152x864
1024x768
1024x768
1024x768
800x600
800x600
800x600
800x600
800x600
800x600
1280x800
1280x800
1280x800
1280x768
1280x768
1280x768
1280x720
1280x720
1280x720
960x600
960x540
960x540
840x525
840x525
832x624
800x512
720x450
640x512
640x512
640x480
640x480
640x480
640x480
640x480
640x400
640x400
640x400
640x384
640x384
640x384
640x360
640x360
640x360
576x432
576x432
576x432
576x432
512x384
512x384
512x384
416x312
400x300
400x300
400x300
400x300
320x240
320x240
320x240
xrandr display mode handling
Screen: null
xrandr raw output
SZ: Pixels Physical Refresh
*0 1280 x 1024 ( 382mm x 302mm ) *50 55
1 1280 x 960 ( 382mm x 283mm ) 51
2 1152 x 864 ( 344mm x 255mm ) 52 65 66 67
3 1024 x 768 ( 305mm x 226mm ) 53 68 69
4 800 x 600 ( 239mm x 177mm ) 54 76 77 78 79 80
5 1280 x 800 ( 382mm x 236mm ) 56 57 58
6 1280 x 768 ( 382mm x 226mm ) 59 60 61
7 1280 x 720 ( 382mm x 212mm ) 62 63 64
8 960 x 600 ( 286mm x 177mm ) 70
9 960 x 540 ( 286mm x 159mm ) 71 72
10 840 x 525 ( 251mm x 155mm ) 73 74
11 832 x 624 ( 248mm x 184mm ) 75
12 800 x 512 ( 239mm x 151mm ) 81
13 720 x 450 ( 215mm x 132mm ) 82
14 640 x 512 ( 191mm x 151mm ) 83 84
15 640 x 480 ( 191mm x 141mm ) 85 86 87 88 89
16 640 x 400 ( 191mm x 118mm ) 90 91 92
17 640 x 384 ( 191mm x 113mm ) 93 94 95
18 640 x 360 ( 191mm x 106mm ) 96 97 98
19 576 x 432 ( 172mm x 127mm ) 99 100 101 102
20 512 x 384 ( 152mm x 113mm ) 103 104 105
21 416 x 312 ( 124mm x 92mm ) 106
22 400 x 300 ( 119mm x 88mm ) 107 108 109 110
23 320 x 240 ( 95mm x 70mm ) 111 112 113
Current rotation - normal
Current reflection - none
Rotations possible - normal left inverted right
Reflections possible - none
[/quote]

Aha! Output from xrandr 1.1! Great stuff - I’ll upgrade the parsing to cope. LWJGL currently handles this case just fine though.

AWT display mode handling
	Device: :0.0
	Fullscreen support: true
	Display modes:
		1280x1024
		1024x768
		1024x768
		1024x768
		800x600
		800x600
		640x480
		640x480
		640x480
		720x400
xrandr display mode handling
xrandr raw output
Screen 0: minimum 320 x 200, current 1024 x 768, maximum 4096 x 4096
VGA-0 connected 1024x768+0+0 (normal left inverted right x axis y axis) 306mm x 230mm
   1280x1024      60.0  
   1024x768       85.0     75.1*    75.0     70.1  
   800x600        85.1     75.0  
   640x480        85.0     75.0     60.0  
   720x400        70.1  
LVDS connected (normal left inverted right x axis y axis)
   1280x800       60.1 +
   1280x720       59.9  
   1152x768       59.8  
   1024x768       59.9  
   800x600        59.9  
   848x480        59.7  
   720x480        59.7  
   640x480        59.4  
S-video disconnected (normal left inverted right x axis y axis)
DVI-0 disconnected (normal left inverted right x axis y axis)

AWT display mode handling
	Device: :0.0
	Fullscreen support: true
	Display modes:
		1280x1024
		1280x1024
		1400x1050
		1400x1050
		1400x1050
		1280x960
		1280x960
		1152x864
		1152x864
		1152x864
		1152x864
		1024x768
		1024x768
		1024x768
		1024x768
		832x624
		640x480
		640x480
		640x480
		640x480
		640x480
		640x480
		1360x768
		1360x768
		960x600
		960x540
		840x525
		840x525
		840x525
		840x525
		800x600
		800x600
		800x600
		800x600
		800x600
		800x600
		800x512
		720x450
		680x384
		680x384
		640x512
		640x512
		576x432
		576x432
		576x432
		576x432
		512x384
		512x384
		512x384
		416x312
		400x300
		400x300
		400x300
		400x300
		320x240
		320x240
		320x240
xrandr display mode handling
	Screen: default
		1280x1024
		1400x1050
		1280x960
		1152x864
		1024x768
		832x624
		640x480
		1360x768
		960x600
		960x540
		840x525
		800x600
		800x512
		720x450
		680x384
		640x512
		576x432
		512x384
		416x312
		400x300
		320x240
xrandr raw output
Screen 0: minimum 320 x 240, current 1280 x 1024, maximum 1400 x 1050
default connected 1280x1024+0+0 0mm x 0mm
   1280x1024      50.0     64.0* 
   1400x1050      51.0     61.0     50.0  
   1280x960       52.0     65.0  
   1152x864       53.0     66.0     67.0     68.0  
   1024x768       54.0     55.0     56.0     69.0  
   832x624        57.0  
   640x480        58.0     59.0     60.0     88.0     89.0     90.0  
   1360x768       62.0     63.0  
   960x600        70.0  
   960x540        71.0  
   840x525        72.0     73.0     74.0     75.0  
   800x600        76.0     77.0     78.0     79.0     80.0     81.0  
   800x512        82.0  
   720x450        83.0  
   680x384        84.0     85.0  
   640x512        86.0     87.0  
   576x432        91.0     92.0     93.0     94.0  
   512x384        95.0     96.0     97.0  
   416x312        98.0  
   400x300        99.0    100.0    101.0    102.0  
   320x240       103.0    104.0    105.0