Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Retina display position fix
Adds an if statement for correcting the position of non-fullscreen windows on retina displays.
  • Loading branch information
jfkominsky authored and peircej committed May 14, 2018
1 parent 9b46ff0 commit 0d4538d
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions psychopy/visual/backends/pygletbackend.py
Expand Up @@ -202,12 +202,16 @@ def __init__(self, win, *args, **kwargs):
self.winHandle.set_mouse_visible(False)
self.winHandle.on_resize = _onResize # avoid circular reference
if not win.pos:
# work out where the centre should be
win.pos = [(thisScreen.width - win.size[0]) / 2,
(thisScreen.height - win.size[1]) / 2]
# work out where the centre should be
if win.useRetina:
win.pos = [(thisScreen.width - win.size[0]/2) / 2,
(thisScreen.height - win.size[1]/2) / 2]
else:
win.pos = [(thisScreen.width - win.size[0]) / 2,
(thisScreen.height - win.size[1]) / 2]
if not win._isFullScr:
# add the necessary amount for second screen
self.winHandle.set_location(int(win.pos[0] + thisScreen.x),
print(win.size[0])
self.winHandle.set_location(int(win.pos[0] + thisScreen.x),
int(win.pos[1] + thisScreen.y))

try: # to load an icon for the window
Expand Down

0 comments on commit 0d4538d

Please sign in to comment.