diff --git a/common/window.py b/common/window.py index 983dc439843539..ce1eecb8818442 100644 --- a/common/window.py +++ b/common/window.py @@ -11,11 +11,18 @@ def __init__(self, w, h, caption="window", double=False, halve=False): self.double = double self.halve = halve if self.double: - self.screen = pygame.display.set_mode((w*2, h*2)) + self.rw, self.rh = w*2, h*2 elif self.halve: - self.screen = pygame.display.set_mode((w//2, h//2)) + self.rw, self.rh = w//2, h//2 else: - self.screen = pygame.display.set_mode((w, h)) + self.rw, self.rh = w, h + self.screen = pygame.display.set_mode((self.rw, self.rh)) + pygame.display.flip() + + # hack for xmonad, it shrinks the window by 6 pixels after the display.flip + if self.screen.get_width() != self.rw: + self.screen = pygame.display.set_mode((self.rw+(self.rw-self.screen.get_width()), self.rh+(self.rh-self.screen.get_height()))) + pygame.display.flip() def draw(self, out): pygame.event.pump()