Package: pygame / 1.9.1release+dfsg-8

set_WM_CLASS.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Description: Set WM_CLASS when running in X11
 Export the proper SDL_VIDEO_X11_WMCLASS environment variable every time that
 the pygame module is loaded.
Origin: http://www.pygame.org/old_bug_attachments/45/pygame-set-the-SDL-WM_CLASS-when-running-under-X11.patch
Applied-Upstream: 1.9.2, https://bitbucket.org/pygame/pygame/issue/71/pygame-needs-to-set-the-wm_class-when
Bug-Ubuntu: https://bugs.launchpad.net/bugs/777417
--- a/lib/__init__.py
+++ b/lib/__init__.py
@@ -42,6 +42,10 @@
         except:
             pass
 
+# when running under X11, always set the SDL window WM_CLASS to make the
+# window managers correctly match the pygame window.
+if 'DISPLAY' in os.environ and not 'SDL_VIDEO_X11_WMCLASS' in os.environ:
+    os.environ['SDL_VIDEO_X11_WMCLASS'] = os.path.basename(sys.argv[0])
 
 class MissingModule:
     _NOT_IMPLEMENTED_ = True