# HG changeset patch # User Thibaut Girka # Date 1317674546 -7200 # Node ID 96c30ffd9b876894f0ead6911f0a1595371009b0 # Parent 30338dc33a7ba22b7f070e55e437ed3ff4eee99a Evil workaround to pyglet's X11 backend diff --git a/pytouhou/opengl/gamerunner.py b/pytouhou/opengl/gamerunner.py --- a/pytouhou/opengl/gamerunner.py +++ b/pytouhou/opengl/gamerunner.py @@ -13,6 +13,8 @@ ## import pyglet +import traceback + from pyglet.gl import * from pytouhou.opengl.texture import TextureManager @@ -63,6 +65,17 @@ class GameRunner(pyglet.window.Window, G glViewport(0, 0, width, height) + def _event_text_symbol(self, ev): + # XXX: Ugly workaround to a pyglet bug on X11 + #TODO: fix that bug in pyglet + try: + return pyglet.window.Window._event_text_symbol(self, ev) + except Exception as exc: + print('*WARNING* Pyglet error:') + traceback.print_exc(exc) + return None, None + + def on_key_press(self, symbol, modifiers): if symbol == pyglet.window.key.ESCAPE: self.has_exit = True