1. pygame
  2. pygame
  3. pygame
  4. Issues


Issue #71 resolved

Pygame needs to set the WM_CLASS when running in X11

René Dudfield
created an issue

== Marco Trevisan (Treviño), 2011-06-26 14:16:28 -0700

{{{ Created attachment 45 Set the SDL WM_CLASS when running under X11

When some pygame windows are running under X11, they all share the same WM_CLASS which is automatically computed by SDL using the process's binary name. So, for pygame, all the pygame windows will have a "pythonX.Y" WM_CLASS.

This is very confusing for windows managers such as Unity [1] and Gnome Shell (I guess) which will consider all the pygame windows just as python windows of the same kind. However SDL allows to set the window WM_CLASS using the environment variable "SDL_VIDEO_X11_WMCLASS", so I guess that should be set to the pygame script name (as suggested by ICCCM standards).

Attached you can find the small patch that fixes the issue. The implementation is very simple and it actually just exports the proper SDL_VIDEO_X11_WMCLASS environment variable every time that the pygame module is loaded. Maybe you would prefer to make this happen only when the pygame display get initialized, in this case I can rewrite it by doing the same thing in PyGame_Video_AutoInit I guess...

Just let me know which one you'd prefer.

[1] https://bugs.launchpad.net/bamf/+bug/777417 }}}

Attachments: [[http://www.pygame.org/old_bug_attachments/45/pygame-set-the-SDL-WM_CLASS-when-running-under-X11.patch| pygame-set-the-SDL-WM_CLASS-when-running-under-X11.patch]]

== Marco Trevisan (Treviño), 2011-06-27 07:21:32 -0700

{{{ I'm just wondering if it's better to use the file name as WM_CLASS or the without the possible .py/.pyc extension... It would be better for some WM (like BAMF), but maybe it's not that standard. }}}

Comments (5)

  1. Log in to comment