forked from pool/python-pyglet
Accepting request 513624 from home:kkirill:branches:devel:languages:python
- fix build for oS:Factory (fix examples) - make Brain Workshop work with system pyglet and latest python2 (fix "import Image") - add WMClass to have a proper application name instead of Unknown OBS-URL: https://build.opensuse.org/request/show/513624 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pyglet?expand=0&rev=7
This commit is contained in:
34
pyglet-1.2.4-add-wmclass.patch
Normal file
34
pyglet-1.2.4-add-wmclass.patch
Normal file
@@ -0,0 +1,34 @@
|
||||
Index: pyglet/window/xlib/__init__.py
|
||||
===================================================================
|
||||
--- pyglet/window/xlib/__init__.py.orig
|
||||
+++ pyglet/window/xlib/__init__.py
|
||||
@@ -352,6 +352,9 @@ class XlibWindow(BaseWindow):
|
||||
# Set caption
|
||||
self.set_caption(self._caption)
|
||||
|
||||
+ # Set WM_CLASS for modern desktop environments
|
||||
+ self.set_wm_class(self._caption)
|
||||
+
|
||||
# this is supported by some compositors (ie gnome-shell), and more to come
|
||||
# see: http://standards.freedesktop.org/wm-spec/wm-spec-latest.html#idp6357888
|
||||
_NET_WM_BYPASS_COMPOSITOR_HINT_ON = c_ulong(int(self._fullscreen))
|
||||
@@ -513,6 +516,19 @@ class XlibWindow(BaseWindow):
|
||||
self._set_text_property('_NET_WM_NAME', caption)
|
||||
self._set_text_property('_NET_WM_ICON_NAME', caption)
|
||||
|
||||
+ def set_wm_class(self, name):
|
||||
+ # WM_CLASS can only contain Ascii characters
|
||||
+ try:
|
||||
+ name = name.encode('ascii')
|
||||
+ except UnicodeEncodeError:
|
||||
+ name = "pyglet"
|
||||
+
|
||||
+ hints = xlib.XAllocClassHint()
|
||||
+ hints.contents.res_class = asbytes(name)
|
||||
+ hints.contents.res_name = asbytes(name.lower())
|
||||
+ xlib.XSetClassHint(self._x_display, self._window, hints.contents)
|
||||
+ xlib.XFree(hints)
|
||||
+
|
||||
def get_caption(self):
|
||||
return self._caption
|
||||
|
Reference in New Issue
Block a user