changeset 146:96c30ffd9b87

Evil workaround to pyglet's X11 backend
author Thibaut Girka <thib@sitedethib.com>
date Mon, 03 Oct 2011 22:42:26 +0200
parents 30338dc33a7b
children a61c96265779
files pytouhou/opengl/gamerunner.py
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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