Comment 21 for bug 807487

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

=== added file 'debian/patches/rev_2821_fix_807487.patch'
--- debian/patches/rev_2821_fix_807487.patch 1970-01-01 00:00:00 +0000
+++ debian/patches/rev_2821_fix_807487.patch 2011-10-17 07:02:55 +0000
@@ -0,0 +1,91 @@
+bzr+ssh://bazaar.launchpad.net/~compiz-team/compiz-core/oneiric/
+=== modified file 'plugins/opengl/include/opengl/opengl.h'
+Index: compiz-0.9.6+bzr20110929/plugins/opengl/include/opengl/opengl.h
+===================================================================
+--- compiz-0.9.6+bzr20110929.orig/plugins/opengl/include/opengl/opengl.h 2011-10-17 14:35:33.867415820 +0800
++++ compiz-0.9.6+bzr20110929/plugins/opengl/include/opengl/opengl.h 2011-10-17 14:35:56.703529052 +0800
+@@ -398,6 +398,7 @@
+ WRAPABLE_HND (4, GLScreenInterface, void, glDisableOutputClipping);
+
+ friend class GLTexture;
++ friend class GLWindow;
+ friend class SpewScreen;
+ friend class SpewWindow;
+
+Index: compiz-0.9.6+bzr20110929/plugins/opengl/src/privates.h
+===================================================================
+--- compiz-0.9.6+bzr20110929.orig/plugins/opengl/src/privates.h 2011-10-17 14:35:33.879415881 +0800
++++ compiz-0.9.6+bzr20110929/plugins/opengl/src/privates.h 2011-10-17 14:35:56.703529052 +0800
+@@ -121,6 +121,9 @@
+ bool hasCompositing;
+
+ GLIcon defaultIcon;
++
++ Window saveWindow; // hack for broken applications, see:
++ // https://bugs.launchpad.net/ubuntu/+source/compiz/+bug/807487
+ };
+
+ class PrivateGLWindow :
+Index: compiz-0.9.6+bzr20110929/plugins/opengl/src/screen.cpp
+===================================================================
+--- compiz-0.9.6+bzr20110929.orig/plugins/opengl/src/screen.cpp 2011-10-17 14:35:33.895415963 +0800
++++ compiz-0.9.6+bzr20110929/plugins/opengl/src/screen.cpp 2011-10-17 14:35:56.703529052 +0800
+@@ -99,6 +99,7 @@
+ GLfloat diffuseLight[] = { 0.9f, 0.9f, 0.9f, 0.9f };
+ GLfloat light0Position[] = { -0.5f, 0.5f, -9.0f, 1.0f };
+ XWindowAttributes attr;
++ XSetWindowAttributes attrib;
+ const char *glRenderer;
+ CompOption::Vector o (0);
+
+@@ -114,6 +115,10 @@
+ setenv ("LIBGL_ALWAYS_INDIRECT", "1", True);
+ }
+
++ attrib.override_redirect = 1;
++
++ priv->saveWindow = XCreateWindow (dpy, screen->root (), -100, -100, 1, 1, 0, CopyFromParent, InputOutput, CopyFromParent, CWOverrideRedirect, &attrib);
++
+ if (!XGetWindowAttributes (dpy, s->root (), &attr))
+ {
+ screen->handleCompizEvent ("opengl", "fatal_fallback", o);
+Index: compiz-0.9.6+bzr20110929/plugins/opengl/src/window.cpp
+===================================================================
+--- compiz-0.9.6+bzr20110929.orig/plugins/opengl/src/window.cpp 2011-10-17 14:35:33.907416017 +0800
++++ compiz-0.9.6+bzr20110929/plugins/opengl/src/window.cpp 2011-10-17 14:35:56.703529052 +0800
+@@ -105,6 +105,21 @@
+ compLogMessage ("opengl", CompLogLevelInfo,
+ "Couldn't bind redirected window 0x%x to "
+ "texture\n", (int) priv->window->id ());
++
++ if (priv->cWindow->size ().width () > GL::maxTextureSize ||
++ priv->cWindow->size ().height () > GL::maxTextureSize)
++ {
++ compLogMessage ("opengl", CompLogLevelWarn,
++ "Bug in window 0x%x (identifying as %s)", (int) priv->window->id (), priv->window->resName ().size () ? priv->window->resName ().c_str () : "(none available)");
++ compLogMessage ("opengl", CompLogLevelWarn,
++ "This window tried to create an absurdly large window %i x %i\n", priv->cWindow->size ().width (), priv->cWindow->size ().height ());
++ compLogMessage ("opengl", CompLogLevelWarn,
++ "Unforunately, that's not supported on your hardware, because you have a maximum texture size of %i", GL::maxTextureSize);
++ compLogMessage ("opengl", CompLogLevelWarn, "you should probably file a bug against that application");
++ compLogMessage ("opengl", CompLogLevelWarn, "for now, we're going to hide tht window so that it doesn't break your desktop\n");
++
++ XReparentWindow (screen->dpy (), priv->window->id (), GLScreen::get (screen)->priv->saveWindow, 0, 0);
++ }
+ }
+
+ priv->setWindowMatrix ();
+Index: compiz-0.9.6+bzr20110929/unity/unity_window_decorator/src/gtk-window-decorator.c
+===================================================================
+--- compiz-0.9.6+bzr20110929.orig/unity/unity_window_decorator/src/gtk-window-decorator.c 2011-10-17 14:35:33.919416082 +0800
++++ compiz-0.9.6+bzr20110929/unity/unity_window_decorator/src/gtk-window-decorator.c 2011-10-17 14:35:56.703529052 +0800
+@@ -432,8 +432,7 @@
+ }
+
+ decor_set_dm_check_hint (xdisplay, gdk_screen_get_number (gdkscreen),
+- WINDOW_DECORATION_TYPE_PIXMAP |
+- WINDOW_DECORATION_TYPE_WINDOW);
++ WINDOW_DECORATION_TYPE_PIXMAP);
+
+ update_default_decorations (gdkscreen);
+

This missing patch adds a workaround for applications that create absurdly large windows by hiding them rather than letting them break the desktop or cause problems on the graphics hardware. It also disables the "2D mode" of the window decorator which is unmaintained and unsupported.