Skip to content

Commit 9c8e21f

Browse files
committed
dual head works for me
1 parent b8cbe90 commit 9c8e21f

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

impressive.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# along with this program; if not, write to the Free Software
2121
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2222

23-
__title__ = "Impressive"
23+
__title__ = "Impressive (dual head)"
2424
__version__ = "0.10.2"
2525
__author__ = "Martin J. Fiedler"
2626
__email__ = "[email protected]"
@@ -111,7 +111,11 @@ def RunURL(url):
111111
win32api.ShellExecute(0, "open", url, "", "", 0)
112112
except ImportError:
113113
MPlayerPath = ""
114-
def GetScreenSize(): return pygame.display.list_modes()[0]
114+
def GetScreenSize():
115+
if True: # DualHead is not set at this point
116+
return ProjectionFrame.size()
117+
else:
118+
return pygame.display.list_modes()[0]
115119
def RunURL(url): print "Error: cannot run URL `%s'" % url
116120
MPlayerPlatformOptions = [ "-colorkey", "0x000000" ]
117121
MPlayerColorKey = True
@@ -140,6 +144,9 @@ def RunURL(url):
140144
except OSError:
141145
print >>sys.stderr, "Error: cannot open URL `%s'" % url
142146
def GetScreenSize():
147+
if True: # HACK: DualHead is not set at this point
148+
return ProjectionFrame.size()
149+
143150
res_re = re.compile(r'\s*(\d+)x(\d+)\s+\d+\.\d+\*')
144151
# parse string like
145152
# LVDS connected 1280x800+1920+0 (normal left inverted right x axis y axis) 287mm x 180mm
@@ -2191,6 +2198,7 @@ def DrawOverlays():
21912198

21922199
def ClearScreen():
21932200
WholeWindow.glViewport()
2201+
# green for debugging glClearColor(0, 255, 0, 0)
21942202
glClear(GL_COLOR_BUFFER_BIT)
21952203

21962204
# draw the complete image of the current page
@@ -3410,16 +3418,22 @@ def main():
34103418

34113419
# initialize graphics
34123420
pygame.init()
3421+
print "before detecting screen size"
3422+
print Fullscreen, UseAutoScreenSize
34133423
if Fullscreen and UseAutoScreenSize:
34143424
size = GetScreenSize()
34153425
if size:
34163426
ScreenWidth, ScreenHeight = size
3427+
print "Detected screen size: %dx%d pixels" % (ScreenWidth, ScreenHeight)
34173428
print >>sys.stderr, "Detected screen size: %dx%d pixels" % (ScreenWidth, ScreenHeight)
34183429
flags = OPENGL|DOUBLEBUF
34193430
if Fullscreen:
34203431
flags |= FULLSCREEN
34213432
try:
3422-
pygame.display.set_mode((ScreenWidth, ScreenHeight), flags)
3433+
if Fullscreen and UseAutoScreenSize:
3434+
pygame.display.set_mode((0,0), flags) # do not change the resolution - it is already OK
3435+
else:
3436+
pygame.display.set_mode((ScreenWidth, ScreenHeight), flags)
34233437
except:
34243438
print >>sys.stderr, "FATAL: cannot create rendering surface in the desired resolution (%dx%d)" % (ScreenWidth, ScreenHeight)
34253439
sys.exit(1)
@@ -3710,6 +3724,7 @@ def main():
37103724
DrawCurrentPage()
37113725
UpdateCaption(Pcurrent)
37123726
DrawPreviewNextSlide()
3727+
ClearScreen()
37133728
TransitionTo(1)
37143729
while True:
37153730
HandleEvent(pygame.event.wait())
@@ -4094,6 +4109,7 @@ def ParseOptions(argv):
40944109
projection, prompter = arg.split(",")
40954110
ProjectionFrame = FrameCoordinates.parse(projection)
40964111
PrompterWholeFrame = FrameCoordinates.parse(prompter)
4112+
print "ProjectionFrame: ", ProjectionFrame
40974113
print "PrompterWholeFrame: ", PrompterWholeFrame
40984114
prompter_width = PrompterWholeFrame.width*9/10/2
40994115
PrompterCurrentFrame = FrameCoordinates(
@@ -4103,7 +4119,7 @@ def ParseOptions(argv):
41034119
PrompterWholeFrame.width-PrompterCurrentFrame.width)
41044120
PrompterCurrentFrame.adjust_to_aspect_ratio((4,3), (5,3), (0,1))
41054121
PrompterNextFrame.adjust_to_aspect_ratio((4,3), (5,3), (1,0))
4106-
UseAutoScreenSize = False
4122+
UseAutoScreenSize = True
41074123
except:
41084124
opterr("invalid parameter for --dual-head")
41094125
if opt in ("-R", "--meshres"):

setres.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/sh
2+
xrandr --output TMDS-1 --off
3+
xrandr --output LVDS --auto
4+
xrandr --output VGA --mode 1024x768 --right-of LVDS
5+

0 commit comments

Comments
 (0)