File: set_WM_CLASS.patch

package info (click to toggle)
pygame 1.9.1release%2Bdfsg-10
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 7,280 kB
  • ctags: 6,685
  • sloc: ansic: 41,205; python: 21,987; cpp: 537; objc: 196; php: 92; sh: 77; makefile: 41
file content (19 lines) | stat: -rw-r--r-- 853 bytes parent folder | download | duplicates (2)
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