diff options
| -rw-r--r-- | CMakeLists.txt | 2 | ||||
| -rw-r--r-- | plugins/unity-mt-grab-handles/src/unity-mt-grab-handles.cpp | 39 | ||||
| -rw-r--r-- | plugins/unity-mt-grab-handles/src/unity-mt-grab-handles.h | 4 | ||||
| -rw-r--r-- | plugins/unitydialog/src/unitydialog.cpp | 131 | ||||
| -rw-r--r-- | plugins/unitydialog/src/unitydialog.h | 20 | ||||
| -rw-r--r-- | plugins/unityshell/src/ScreenEffectFramebufferObject.h | 66 | ||||
| -rw-r--r-- | plugins/unityshell/src/unityshell.cpp | 316 | ||||
| -rw-r--r-- | plugins/unityshell/src/unityshell.h | 20 |
8 files changed, 36 insertions, 562 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 6dc34c6b3..0bcfe5116 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -131,7 +131,7 @@ endif (DISABLE_MAINTAINER_CFLAGS) # Compiz Plugins # -set (UNITY_PLUGIN_DEPS "compiz;nux-3.0>=3.0.0;libbamf3;dee-1.0;gio-2.0;gio-unix-2.0;dbusmenu-glib-0.4;x11;libstartup-notification-1.0;gthread-2.0;indicator3-0.4>=0.4.90;atk;unity-misc>=0.4.0;dbus-glib-1;gtk+-3.0>=3.1;sigc++-2.0;json-glib-1.0;libnotify;xfixes;unity-protocol-private>=5.95.1;libgeis") +set (UNITY_PLUGIN_DEPS "compiz>=0.9.8.0;nux-3.0>=3.0.0;libbamf3;dee-1.0;gio-2.0;gio-unix-2.0;dbusmenu-glib-0.4;x11;libstartup-notification-1.0;gthread-2.0;indicator3-0.4>=0.4.90;atk;unity-misc>=0.4.0;dbus-glib-1;gtk+-3.0>=3.1;sigc++-2.0;json-glib-1.0;libnotify;xfixes;unity-protocol-private>=5.95.1;libgeis") # FIXME: unity-protocol-private shouldn't be there, but building of unityshell is just broken set (UNITY_PROTOCOL_PRIVATE_DEPS "unity-protocol-private>=5.95.1") diff --git a/plugins/unity-mt-grab-handles/src/unity-mt-grab-handles.cpp b/plugins/unity-mt-grab-handles/src/unity-mt-grab-handles.cpp index ad840204c..d737e406e 100644 --- a/plugins/unity-mt-grab-handles/src/unity-mt-grab-handles.cpp +++ b/plugins/unity-mt-grab-handles/src/unity-mt-grab-handles.cpp @@ -438,29 +438,19 @@ UnityMTGrabHandlesWindow::getOutputExtents(CompWindowExtents& output) bool UnityMTGrabHandlesWindow::glDraw(const GLMatrix& transform, -#ifdef USE_MODERN_COMPIZ_GL const GLWindowPaintAttrib& attrib, -#else - GLFragment::Attrib& fragment, -#endif const CompRegion& region, unsigned int mask) { /* Draw the window on the bottom, we will be drawing the * handles on top */ -#ifdef USE_MODERN_COMPIZ_GL bool status = gWindow->glDraw(transform, attrib, region, mask); -#else - bool status = gWindow->glDraw(transform, fragment, region, mask); -#endif if (mHandles && mHandles->visible()) { unsigned int allowedHandles = unity::MT::getLayoutForMask (window->state (), window->actions ()); unsigned int handle = 0; - UMTGH_SCREEN (screen); - for(unity::MT::TextureLayout layout : mHandles->layout (allowedHandles)) { /* We want to set the geometry of the handle to the window @@ -472,17 +462,11 @@ UnityMTGrabHandlesWindow::glDraw(const GLMatrix& transform, GLTexture::MatrixList matl; GLTexture::Matrix mat = tex->matrix(); CompRegion paintRegion(region); -#ifdef USE_MODERN_COMPIZ_GL GLWindowPaintAttrib wAttrib(attrib); -#endif /* We can reset the window geometry since it will be * re-added later */ -#ifdef USE_MODERN_COMPIZ_GL gWindow->vertexBuffer()->begin(); -#else - gWindow->geometry().reset(); -#endif /* Not sure what this does, but it is necessary * (adjusts for scale?) */ @@ -498,35 +482,22 @@ UnityMTGrabHandlesWindow::glDraw(const GLMatrix& transform, * dim (so we get a nice render for things like * wobbly etc etc */ gWindow->glAddGeometry(matl, reg, paintRegion); -#ifdef USE_MODERN_COMPIZ_GL - gWindow->vertexBuffer()->end(); - wAttrib.opacity = mHandles->opacity(); -#else - /* Did it succeed? */ - if (gWindow->geometry().vertices) - { - fragment.setOpacity(mHandles->opacity()); - /* Texture rendering set-up */ - us->gScreen->setTexEnvMode(GL_MODULATE); -#endif + + if (gWindow->vertexBuffer()->end()) + { + wAttrib.opacity = mHandles->opacity(); + glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); /* Draw the dim texture with all of it's modified * geometry glory */ gWindow->glDrawTexture(tex, -#ifdef USE_MODERN_COMPIZ_GL transform, wAttrib, -#else - fragment, -#endif mask | PAINT_WINDOW_BLEND_MASK | PAINT_WINDOW_TRANSLUCENT_MASK | PAINT_WINDOW_TRANSFORMED_MASK); /* Texture rendering tear-down */ glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); -#ifndef USE_MODERN_COMPIZ_GL - us->gScreen->setTexEnvMode(GL_REPLACE); } -#endif } handle++; diff --git a/plugins/unity-mt-grab-handles/src/unity-mt-grab-handles.h b/plugins/unity-mt-grab-handles/src/unity-mt-grab-handles.h index 9cd99b9d1..f0d3776e5 100644 --- a/plugins/unity-mt-grab-handles/src/unity-mt-grab-handles.h +++ b/plugins/unity-mt-grab-handles/src/unity-mt-grab-handles.h @@ -229,11 +229,7 @@ public: void moveNotify(int dx, int dy, bool immediate); bool glDraw(const GLMatrix&, -#ifdef USE_MODERN_COMPIZ_GL const GLWindowPaintAttrib&, -#else - GLFragment::Attrib&, -#endif const CompRegion&, unsigned int); diff --git a/plugins/unitydialog/src/unitydialog.cpp b/plugins/unitydialog/src/unitydialog.cpp index 91f7f235e..3951b65f7 100644 --- a/plugins/unitydialog/src/unitydialog.cpp +++ b/plugins/unitydialog/src/unitydialog.cpp @@ -420,12 +420,8 @@ UnityDialogWindow::glAddGeometry(const GLTexture::MatrixList& matrices, /* Collect textures */ void UnityDialogWindow::glDrawTexture(GLTexture* texture, -#ifdef USE_MODERN_COMPIZ_GL const GLMatrix &transform, const GLWindowPaintAttrib &attrib, -#else - GLFragment::Attrib& fa, -#endif unsigned int mask) { unity::PaintInfoCollector::Active ()->processTexture (texture); @@ -448,16 +444,12 @@ unity::GeometryCollection::status () collectedMinVertices.size () == collectedMatrixLists.size ()); } -void +bool unity::GeometryCollection::addGeometryForWindow (CompWindow *w, const CompRegion &paintRegion) { /* We can reset the window geometry since it will be * re-added later */ -#ifdef USE_MODERN_COMPIZ_GL GLWindow::get (w)->vertexBuffer()->begin(); -#else - GLWindow::get (w)->geometry().reset(); -#endif for (unsigned int i = 0; i < collectedMatrixLists.size (); i++) { @@ -472,9 +464,7 @@ unity::GeometryCollection::addGeometryForWindow (CompWindow *w, const CompRegion GLWindow::get (w)->glAddGeometry(matl, reg, paintRegion, min, max); } -#ifdef USE_MODERN_COMPIZ_GL - GLWindow::get (w)->vertexBuffer()->end(); -#endif + return GLWindow::get (w)->vertexBuffer()->end(); } void @@ -511,9 +501,7 @@ unity::TexGeometryCollection::setTexture (GLTexture *tex) void unity::TexGeometryCollection::addGeometriesAndDrawTextureForWindow(CompWindow *w, -#ifdef USE_MODERN_COMPIZ_GL const GLMatrix &transform, -#endif unsigned int mask) { if (mTexture && mGeometries.status ()) @@ -524,47 +512,25 @@ unity::TexGeometryCollection::addGeometriesAndDrawTextureForWindow(CompWindow *w if (mask & PAINT_WINDOW_TRANSFORMED_MASK) paintRegion = infiniteRegion; - mGeometries.addGeometryForWindow (w, paintRegion); - -#ifdef USE_MODERN_COMPIZ_GL - UnityDialogScreen *uds = UnityDialogScreen::get (screen); - GLWindowPaintAttrib attrib (gWindow->lastPaintAttrib()); - unsigned int glDrawTextureIndex = gWindow->glDrawTextureGetCurrentIndex(); - /* Texture rendering set-up */ -// uds->gScreen->setTexEnvMode(GL_MODULATE); - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - /* Draw the dim texture with all of it's modified - * geometry glory */ - gWindow->glDrawTextureSetCurrentIndex(MAXSHORT); - gWindow->glDrawTexture(mTexture, transform, attrib, mask - | PAINT_WINDOW_BLEND_MASK - | PAINT_WINDOW_TRANSLUCENT_MASK - | PAINT_WINDOW_TRANSFORMED_MASK); - gWindow->glDrawTextureSetCurrentIndex(glDrawTextureIndex); - /* Texture rendering tear-down */ - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - uds->gScreen->setTexEnvMode(GL_REPLACE); -#else - if (gWindow->geometry().vertices) + if (mGeometries.addGeometryForWindow (w, paintRegion)) { - UnityDialogScreen *uds = UnityDialogScreen::get (screen); - GLFragment::Attrib fa (gWindow->lastPaintAttrib()); - unsigned int glDrawTextureIndex = gWindow->glDrawTextureGetCurrentIndex(); - /* Texture rendering set-up */ - uds->gScreen->setTexEnvMode(GL_MODULATE); - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - /* Draw the dim texture with all of it's modified - * geometry glory */ - gWindow->glDrawTextureSetCurrentIndex(MAXSHORT); - gWindow->glDrawTexture(mTexture, fa, mask | PAINT_WINDOW_BLEND_MASK - | PAINT_WINDOW_TRANSLUCENT_MASK | - PAINT_WINDOW_TRANSFORMED_MASK); - gWindow->glDrawTextureSetCurrentIndex(glDrawTextureIndex); - /* Texture rendering tear-down */ - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - uds->gScreen->setTexEnvMode(GL_REPLACE); + UnityDialogScreen *uds = UnityDialogScreen::get (screen); + GLWindowPaintAttrib attrib (gWindow->lastPaintAttrib()); + unsigned int glDrawTextureIndex = gWindow->glDrawTextureGetCurrentIndex(); + /* Texture rendering set-up */ + glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + /* Draw the dim texture with all of it's modified + * geometry glory */ + gWindow->glDrawTextureSetCurrentIndex(MAXSHORT); + gWindow->glDrawTexture(mTexture, transform, attrib, mask + | PAINT_WINDOW_BLEND_MASK + | PAINT_WINDOW_TRANSLUCENT_MASK + | PAINT_WINDOW_TRANSFORMED_MASK); + gWindow->glDrawTextureSetCurrentIndex(glDrawTextureIndex); + /* Texture rendering tear-down */ + glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + uds->gScreen->setTexEnvMode(GL_REPLACE); } -#endif } } @@ -619,17 +585,11 @@ unity::PaintInfoCollector::processTexture (GLTexture *tex) void unity::PaintInfoCollector::drawGeometriesForWindow(CompWindow *w, -#ifdef USE_MODERN_COMPIZ_GL const GLMatrix &transform, -#endif unsigned int pm) { for (unity::TexGeometryCollection &tcg : mCollection) -#if USE_MODERN_COMPIZ_GL tcg.addGeometriesAndDrawTextureForWindow (w, transform, pm); -#else - tcg.addGeometriesAndDrawTextureForWindow (w, pm); -#endif } unity::PaintInfoCollector * unity::PaintInfoCollector::active_collector = NULL; @@ -644,11 +604,7 @@ unity::PaintInfoCollector::Active () bool UnityDialogWindow::glDraw(const GLMatrix& transform, -#ifdef USE_MODERN_COMPIZ_GL const GLWindowPaintAttrib& attrib, -#else - GLFragment::Attrib& fragment, -#endif const CompRegion& region, unsigned int mask) { @@ -660,11 +616,7 @@ UnityDialogWindow::glDraw(const GLMatrix& transform, /* Draw the window on the bottom, we will be drawing the * dim render on top */ bool status = gWindow->glDraw(transform, -#ifdef USE_MODERN_COMPIZ_GL attrib, -#else - fragment, -#endif region, mask); UNITY_DIALOG_SCREEN(screen); @@ -673,17 +625,11 @@ UnityDialogWindow::glDraw(const GLMatrix& transform, { GLTexture::MatrixList matl; GLTexture::Matrix mat = tex->matrix(); -#ifdef USE_MODERN_COMPIZ_GL GLWindowPaintAttrib wAttrib(attrib); -#endif /* We can reset the window geometry since it will be * re-added later */ -#ifdef USE_MODERN_COMPIZ_GL gWindow->vertexBuffer()->begin(); -#else - gWindow->geometry().reset(); -#endif /* Scale the dim render by the ratio of dim size * to window size */ @@ -704,48 +650,25 @@ UnityDialogWindow::glDraw(const GLMatrix& transform, * dim (so we get a nice render for things like * wobbly etc etc */ gWindow->glAddGeometry(matl, reg, paintRegion); -#ifdef USE_MODERN_COMPIZ_GL - gWindow->vertexBuffer()->end(); -#endif - -#ifdef USE_MODERN_COMPIZ_GL - unsigned int glDrawTextureIndex = gWindow->glDrawTextureGetCurrentIndex(); - wAttrib.opacity = mShadeProgress; - /* Texture rendering set-up */ -// uds->gScreen->setTexEnvMode(GL_MODULATE); - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - /* Draw the dim texture with all of it's modified - * geometry glory */ - gWindow->glDrawTextureSetCurrentIndex(MAXSHORT); - gWindow->glDrawTexture(tex, transform, attrib, mask - | PAINT_WINDOW_BLEND_MASK - | PAINT_WINDOW_TRANSLUCENT_MASK - | PAINT_WINDOW_TRANSFORMED_MASK); - gWindow->glDrawTextureSetCurrentIndex(glDrawTextureIndex); - /* Texture rendering tear-down */ - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - uds->gScreen->setTexEnvMode(GL_REPLACE); -#else - /* Did it succeed? */ - if (gWindow->geometry().vertices) + if (gWindow->vertexBuffer()->end()) { unsigned int glDrawTextureIndex = gWindow->glDrawTextureGetCurrentIndex(); - fragment.setOpacity(mShadeProgress); + wAttrib.opacity = mShadeProgress; /* Texture rendering set-up */ - uds->gScreen->setTexEnvMode(GL_MODULATE); + // uds->gScreen->setTexEnvMode(GL_MODULATE); glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); /* Draw the dim texture with all of it's modified * geometry glory */ gWindow->glDrawTextureSetCurrentIndex(MAXSHORT); - gWindow->glDrawTexture(tex, fragment, mask | PAINT_WINDOW_BLEND_MASK - | PAINT_WINDOW_TRANSLUCENT_MASK | - PAINT_WINDOW_TRANSFORMED_MASK); + gWindow->glDrawTexture(tex, transform, attrib, mask + | PAINT_WINDOW_BLEND_MASK + | PAINT_WINDOW_TRANSLUCENT_MASK + | PAINT_WINDOW_TRANSFORMED_MASK); gWindow->glDrawTextureSetCurrentIndex(glDrawTextureIndex); /* Texture rendering tear-down */ glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); uds->gScreen->setTexEnvMode(GL_REPLACE); } -#endif } for (CompWindow* w : mTransients) @@ -759,9 +682,7 @@ UnityDialogWindow::glDraw(const GLMatrix& transform, pc.collect(); pc.drawGeometriesForWindow (window, -#ifdef USE_MODERN_COMPIZ_GL transform, -#endif mask); } } diff --git a/plugins/unitydialog/src/unitydialog.h b/plugins/unitydialog/src/unitydialog.h index eee9adea7..4f3f26338 100644 --- a/plugins/unitydialog/src/unitydialog.h +++ b/plugins/unitydialog/src/unitydialog.h @@ -40,7 +40,7 @@ namespace unity GeometryCollection (); bool status (); - void addGeometryForWindow (CompWindow *, const CompRegion &paintRegion); + bool addGeometryForWindow (CompWindow *, const CompRegion &paintRegion); void addGeometry (const GLTexture::MatrixList &ml, const CompRegion &r, int min, @@ -64,13 +64,9 @@ namespace unity int max); void setTexture (GLTexture *); -#ifdef USE_MODERN_COMPIZ_GL void addGeometriesAndDrawTextureForWindow (CompWindow *w, const GLMatrix &transform, - unsigned int mask); -#else - void addGeometriesAndDrawTextureForWindow (CompWindow *, unsigned int pm); -#endif + unsigned int mask); private: GLTexture* mTexture; @@ -84,13 +80,9 @@ namespace unity PaintInfoCollector (CompWindow *w); void collect (); -#ifdef USE_MODERN_COMPIZ_GL void drawGeometriesForWindow (CompWindow *w, const GLMatrix &transform, unsigned int pm); -#else - void drawGeometriesForWindow (CompWindow *w, unsigned int pm); -#endif void processGeometry (const GLTexture::MatrixList &ml, const CompRegion &r, @@ -255,11 +247,7 @@ public: bool glDraw(const GLMatrix&, -#ifdef USE_MODERN_COMPIZ_GL const GLWindowPaintAttrib&, -#else - GLFragment::Attrib&, -#endif const CompRegion&, unsigned int); bool @@ -275,12 +263,8 @@ public: void glDrawTexture(GLTexture* texture, -#ifdef USE_MODERN_COMPIZ_GL const GLMatrix& transform, const GLWindowPaintAttrib& attrib, -#else - GLFragment::Attrib& attrib, -#endif unsigned int mask); diff --git a/plugins/unityshell/src/ScreenEffectFramebufferObject.h b/plugins/unityshell/src/ScreenEffectFramebufferObject.h index 9ccfb9a92..a2550a90a 100644 --- a/plugins/unityshell/src/ScreenEffectFramebufferObject.h +++ b/plugins/unityshell/src/ScreenEffectFramebufferObject.h @@ -20,70 +20,4 @@ #ifndef UNITY_SCREENEFFECT_FRAMEBUFFER_H #define UNITY_SCREENEFFECT_FRAMEBUFFER_H -#ifndef USE_MODERN_COMPIZ_GL -#include <Nux/Nux.h> - -namespace unity -{ -class ScreenEffectFramebufferObject -{ -public: - - typedef boost::shared_ptr <ScreenEffectFramebufferObject> Ptr; - typedef void (*FuncPtr) (void); - typedef FuncPtr (*GLXGetProcAddressProc) (const GLubyte *procName); - - ScreenEffectFramebufferObject (GLXGetProcAddressProc, const nux::Geometry &geom); - ~ScreenEffectFramebufferObject (); - -public: - - void bind (const nux::Geometry &geom); - void unbind (); - - bool status (); - void paint (const nux::Geometry &geom); - bool bound () { return mBoundCnt > 0; } - - GLuint texture () { return mFBTexture; } - - void onScreenSizeChanged (const nux::Geometry &screenSize); - -private: - - FuncPtr getProcAddr (const std::string &); - - typedef void (*GLActiveTextureProc) (GLenum texture); - typedef void (*GLGenFramebuffersProc) (GLsizei n, - GLuint *framebuffers); - typedef void (*GLDeleteFramebuffersProc) (GLsizei n, - GLuint *framebuffers); - typedef void (*GLBindFramebufferProc) (GLenum target, - GLuint framebuffer); - typedef GLenum (*GLCheckFramebufferStatusProc) (GLenum target); - typedef void (*GLFramebufferTexture2DProc) (GLenum target, - GLenum attachment, - GLenum textarget, - GLuint texture, - GLint level); - - GLXGetProcAddressProc getProcAddressGLX; - GLActiveTextureProc activeTexture; - GLGenFramebuffersProc genFramebuffers; - GLDeleteFramebuffersProc deleteFramebuffers; - GLBindFramebufferProc bindFramebuffer; - GLCheckFramebufferStatusProc checkFramebufferStatus; - GLFramebufferTexture2DProc framebufferTexture2D; - /* compiz fbo handle that goes through to nux */ - GLuint mFboHandle; // actual handle to the framebuffer_ext - bool mFboStatus; // did the framebuffer texture bind succeed - GLuint mFBTexture; - nux::Geometry mGeometry; - unsigned int mBoundCnt; - - nux::Geometry mScreenSize; -}; -} // namespace unity - -#endif // USE_MODERN_COMPIZ_GL #endif diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 17a2bb9c2..450618c1e 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -119,9 +119,6 @@ UnityScreen::UnityScreen(CompScreen* screen) , allowWindowPaint(false) , _key_nav_mode_requested(false) , _last_output(nullptr) -#ifndef USE_MODERN_COMPIZ_GL - , _active_fbo (0) -#endif , grab_index_ (0) , painting_tray_ (false) , last_scroll_event_(0) @@ -243,25 +240,6 @@ UnityScreen::UnityScreen(CompScreen* screen) uScreen = this; _in_paint = false; -#ifndef USE_MODERN_COMPIZ_GL - void *dlhand = dlopen ("libunityshell.so", RTLD_LAZY); - - if (dlhand) - { - dlerror (); - glXGetProcAddressP = (ScreenEffectFramebufferObject::GLXGetProcAddressProc) dlsym (dlhand, "glXGetProcAddress"); - if (dlerror () != NULL) - glXGetProcAddressP = NULL; - } - - if (GL::fbo) - { - nux::Geometry geometry (0, 0, screen->width (), screen->height ()); - uScreen->_fbo = ScreenEffectFramebufferObject::Ptr (new ScreenEffectFramebufferObject (glXGetProcAddressP, geometry)); - uScreen->_fbo->onScreenSizeChanged (geometry); - } -#endif - optionSetShowHudInitiate(boost::bind(&UnityScreen::ShowHudInitiate, this, _1, _2, _3)); optionSetShowHudTerminate(boost::bind(&UnityScreen::ShowHudTerminate, this, _1, _2, _3)); optionSetBackgroundColorNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2)); @@ -495,17 +473,6 @@ void UnityScreen::nuxPrologue() glMatrixMode(GL_MODELVIEW); glPushMatrix(); - -#ifndef USE_MODERN_COMPIZ_GL - /* This is needed to Fix a crash in glDrawArrays with the NVIDIA driver - * see bugs #1031554 and #982626. - * The NVIDIA driver looks to see if the legacy GL_VERTEX_ARRAY, - * GL_TEXTURE_COORDINATES_ARRAY and other such client states are enabled - * first before checking if a vertex buffer is bound and will prefer the - * client buffers over the the vertex buffer object. */ - glDisableClientState(GL_VERTEX_ARRAY); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); -#endif #endif glGetError(); @@ -514,9 +481,6 @@ void UnityScreen::nuxPrologue() void UnityScreen::nuxEpilogue() { #ifndef USE_GLES -#ifndef USE_MODERN_COMPIZ_GL - (*GL::bindFramebuffer)(GL_FRAMEBUFFER_EXT, _active_fbo); -#endif glMatrixMode(GL_PROJECTION); glLoadIdentity(); @@ -538,19 +502,9 @@ void UnityScreen::nuxEpilogue() glPopAttrib(); -#ifndef USE_MODERN_COMPIZ_GL - /* Re-enable the client states that have been disabled in nuxPrologue, for - * NVIDIA compatibility reasons */ - glEnableClientState(GL_VERTEX_ARRAY); - glEnableClientState(GL_TEXTURE_COORD_ARRAY); -#endif + glDepthRange(0, 1); #else -#ifdef USE_GLES glDepthRangef(0, 1); -#else - glDepthRange(0, 1); -#endif - //glViewport(-1, -1, 2, 2); gScreen->resetRasterPos(); #endif @@ -562,86 +516,9 @@ void UnityScreen::setPanelShadowMatrix(const GLMatrix& matrix) panel_shadow_matrix_ = matrix; } +/* Currently unimplemented */ void UnityScreen::paintPanelShadow(const GLMatrix& matrix) { -#ifndef USE_MODERN_COMPIZ_GL - if (sources_.GetSource(local::RELAYOUT_TIMEOUT)) - return; - - if (PluginAdapter::Default()->IsExpoActive()) - return; - - CompOutput* output = _last_output; - float vc[4]; - float h = 20.0f; - float w = 1.0f; - float panel_h = panel_style_.panel_height; - - float x1 = output->x(); - float y1 = output->y() + panel_h; - float x2 = x1 + output->width(); - float y2 = y1 + h; - - glPushMatrix (); - glLoadMatrixf (panel_shadow_matrix_.getMatrix ()); - - vc[0] = x1; - vc[1] = x2; - vc[2] = y1; - vc[3] = y2; - - // compiz doesn't use the same method of tracking monitors as our toolkit - // we need to make sure we properly associate with the right monitor - int current_monitor = -1; - auto monitors = UScreen::GetDefault()->GetMonitors(); - int i = 0; - for (auto monitor : monitors) - { - if (monitor.x == output->x() && monitor.y == output->y()) - { - current_monitor = i; - break; - } - i++; - } - - if (!(launcher_controller_->IsOverlayOpen() && current_monitor == dash_monitor_) - && panel_controller_->opacity() > 0.0f) - { - foreach(GLTexture * tex, _shadow_texture) - { - glEnable(GL_BLEND); - glColor4f(1.0f, 1.0f, 1.0f, panel_controller_->opacity()); - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - - GL::activeTexture(GL_TEXTURE0_ARB); - tex->enable(GLTexture::Fast); - - glTexParameteri(tex->target(), GL_TEXTURE_WRAP_S, GL_REPEAT); - - glBegin(GL_QUADS); - { - glTexCoord2f(COMP_TEX_COORD_X(tex->matrix(), 0), COMP_TEX_COORD_Y(tex->matrix(), 0)); - glVertex2f(vc[0], vc[2]); - - glTexCoord2f(COMP_TEX_COORD_X(tex->matrix(), 0), COMP_TEX_COORD_Y(tex->matrix(), h)); - glVertex2f(vc[0], vc[3]); - - glTexCoord2f(COMP_TEX_COORD_X(tex->matrix(), w), COMP_TEX_COORD_Y(tex->matrix(), h)); - glVertex2f(vc[1], vc[3]); - - glTexCoord2f(COMP_TEX_COORD_X(tex->matrix(), w), COMP_TEX_COORD_Y(tex->matrix(), 0)); - glVertex2f(vc[1], vc[2]); - } - glEnd(); - - tex->disable(); - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - glDisable(GL_BLEND); - } - } - glPopMatrix(); -#else return; if (sources_.GetSource(local::RELAYOUT_TIMEOUT)) @@ -735,7 +612,6 @@ void UnityScreen::paintPanelShadow(const GLMatrix& matrix) } } nuxEpilogue(); -#endif } void @@ -756,73 +632,13 @@ UnityScreen::OnPanelStyleChanged() panel_texture_has_changed_ = true; } -#ifdef USE_MODERN_COMPIZ_GL void UnityScreen::paintDisplay() -#else -void UnityScreen::paintDisplay(const CompRegion& region, const GLMatrix& transform, unsigned int mask) -#endif { CompOutput *output = _last_output; -#ifndef USE_MODERN_COMPIZ_GL - bool was_bound = _fbo->bound (); - - if (nux::GetGraphicsDisplay()->GetGraphicsEngine()->UsingGLSLCodePath()) - { - if (was_bound && launcher_controller_->IsOverlayOpen() && paint_panel_) - { - if (panel_texture_has_changed_ || !panel_texture_.IsValid()) - { - panel_texture_.Release(); - - nux::NBitmapData* bitmap = panel::Style::Instance().GetBackground(screen->width (), screen->height(), 1.0f); - nux::BaseTexture* texture2D = nux::GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableTexture(); - if (bitmap && texture2D) - { - texture2D->Update(bitmap); - panel_texture_ = texture2D->GetDeviceTexture(); - texture2D->UnReference(); - delete bitmap; - } - panel_texture_has_changed_ = false; - } - - if (panel_texture_.IsValid()) - { - nux::GetGraphicsDisplay()->GetGraphicsEngine()->ResetModelViewMatrixStack(); - nux::GetGraphicsDisplay()->GetGraphicsEngine()->Push2DTranslationModelViewMatrix(0.0f, 0.0f, 0.0f); - nux::GetGraphicsDisplay()->GetGraphicsEngine()->ResetProjectionMatrix(); - nux::GetGraphicsDisplay()->GetGraphicsEngine()->SetOrthographicProjectionMatrix(screen->width (), screen->height()); - - nux::TexCoordXForm texxform; - int panel_height = panel_style_.panel_height; - nux::GetGraphicsDisplay()->GetGraphicsEngine()->QRP_GLSL_1Tex(0, 0, screen->width (), panel_height, panel_texture_, texxform, nux::color::White); - } - } - } - - _fbo->unbind (); - - /* Draw the bit of the relevant framebuffer for each output */ - - if (was_bound) - { - GLMatrix sTransform; - sTransform.toScreenSpace (&screen->fullscreenOutput (), -DEFAULT_Z_CAMERA); - glPushMatrix (); - glLoadMatrixf (sTransform.getMatrix ()); - _fbo->paint (nux::Geometry (output->x (), output->y (), output->width (), output->height ())); - glPopMatrix (); - } - - nux::ObjectPtr<nux::IOpenGLBaseTexture> device_texture = - nux::GetGraphicsDisplay()->GetGpuDevice()->CreateTexture2DFromID(_fbo->texture(), - screen->width (), screen->height(), 1, nux::BITFMT_R8G8B8A8); -#else nux::ObjectPtr<nux::IOpenGLTexture2D> device_texture = nux::GetGraphicsDisplay()->GetGpuDevice()->CreateTexture2DFromID(gScreen->fbo ()->tex ()->name (), screen->width(), screen->height(), 1, nux::BITFMT_R8G8B8A8); -#endif nux::GetGraphicsDisplay()->GetGpuDevice()->backup_texture0_ = device_texture; @@ -830,12 +646,10 @@ void UnityScreen::paintDisplay(const CompRegion& region, const GLMatrix& transfo nux::Geometry oGeo = nux::Geometry (output->x (), output->y (), output->width (), output->height ()); BackgroundEffectHelper::monitor_rect_ = geo; -#ifdef USE_MODERN_COMPIZ_GL GLint fboID; // Nux renders to the referenceFramebuffer when it's embedded. glGetIntegerv(GL_FRAMEBUFFER_BINDING, &fboID); wt->GetWindowCompositor().SetReferenceFramebuffer(fboID, oGeo); -#endif nuxPrologue(); _in_paint = true; @@ -853,56 +667,28 @@ void UnityScreen::paintDisplay(const CompRegion& region, const GLMatrix& transfo { GLMatrix oTransform; UnityWindow *uTrayWindow = UnityWindow::get (tray); -#ifndef USE_MODERN_COMPIZ_GL - GLFragment::Attrib attrib (uTrayWindow->gWindow->lastPaintAttrib()); -#else GLWindowPaintAttrib attrib (uTrayWindow->gWindow->lastPaintAttrib()); -#endif unsigned int oldGlAddGeometryIndex = uTrayWindow->gWindow->glAddGeometryGetCurrentIndex (); unsigned int oldGlDrawIndex = uTrayWindow->gWindow->glDrawGetCurrentIndex (); -#ifndef USE_MODERN_COMPIZ_GL - unsigned int oldGlDrawGeometryIndex = uTrayWindow->gWindow->glDrawGeometryGetCurrentIndex (); -#endif -#ifndef USE_MODERN_COMPIZ_GL - attrib.setOpacity (OPAQUE); - attrib.setBrightness (BRIGHT); - attrib.setSaturation (COLOR); -#else attrib.opacity = OPAQUE; attrib.brightness = BRIGHT; attrib.saturation = COLOR; -#endif oTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA); -#ifndef USE_MODERN_COMPIZ_GL - glPushMatrix (); - glLoadMatrixf (oTransform.getMatrix ()); -#endif - painting_tray_ = true; /* force the use of the core functions */ uTrayWindow->gWindow->glDrawSetCurrentIndex (MAXSHORT); uTrayWindow->gWindow->glAddGeometrySetCurrentIndex ( MAXSHORT); -#ifndef USE_MODERN_COMPIZ_GL - uTrayWindow->gWindow->glDrawGeometrySetCurrentIndex (MAXSHORT); -#endif uTrayWindow->gWindow->glDraw (oTransform, attrib, infiniteRegion, PAINT_WINDOW_TRANSFORMED_MASK | PAINT_WINDOW_BLEND_MASK | PAINT_WINDOW_ON_TRANSFORMED_SCREEN_MASK); -#ifndef USE_MODERN_COMPIZ_GL - uTrayWindow->gWindow->glDrawGeometrySetCurrentIndex (oldGlDrawGeometryIndex); -#endif uTrayWindow->gWindow->glAddGeometrySetCurrentIndex (oldGlAddGeometryIndex); uTrayWindow->gWindow->glDrawSetCurrentIndex (oldGlDrawIndex); painting_tray_ = false; - -#ifndef USE_MODERN_COMPIZ_GL - glPopMatrix (); -#endif } } } @@ -1281,26 +1067,6 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, _last_output = output; paint_panel_ = false; -#ifndef USE_MODERN_COMPIZ_GL - /* bind the framebuffer here - * - it will be unbound and flushed - * to the backbuffer when some - * plugin requests to draw a - * a transformed screen or when - * we have finished this draw cycle. - * once an fbo is bound any further - * attempts to bind it will only increment - * its bind reference so make sure that - * you always unbind as much as you bind - * - * But NOTE: It is only safe to bind the FBO if !shellCouldBeHidden. - * Otherwise it's possible painting won't occur and that would - * confuse the state of the FBO. - */ - if (doShellRepaint && !shellCouldBeHidden(*output)) - _fbo->bind (nux::Geometry (output->x (), output->y (), output->width (), output->height ())); -#endif - // CompRegion has no clear() method. So this is the fastest alternative. fullscreenRegion = CompRegion(); nuxRegion = CompRegion(); @@ -1312,11 +1078,7 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, doShellRepaint = false; if (doShellRepaint) -#ifdef USE_MODERN_COMPIZ_GL paintDisplay(); -#else - paintDisplay(region, transform, mask); -#endif return ret; } @@ -1346,10 +1108,6 @@ void UnityScreen::preparePaint(int ms) for (ShowdesktopHandlerWindowInterface *wi : ShowdesktopHandler::animating_windows) wi->HandleAnimations (ms); -#ifndef USE_MODERN_COMPIZ_GL - compizDamageNux(cScreen->currentDamage()); -#endif - didShellRepaint = false; firstWindowAboveShell = NULL; } @@ -1476,7 +1234,6 @@ void UnityScreen::compizDamageNux(CompRegion const& damage) /* Grab changed nux regions and add damage rects for them */ void UnityScreen::nuxDamageCompiz() { -#ifdef USE_MODERN_COMPIZ_GL /* * If Nux is going to redraw anything then we have to tell Compiz to * redraw everything. This is because Nux has a bad habit (bug??) of drawing @@ -1496,60 +1253,6 @@ void UnityScreen::nuxDamageCompiz() cScreen->damageScreen(); cScreen->damageRegionSetEnabled(this, true); } - -#else - - /* - * WARNING: Nux bug LP: #1014610 (unbounded DrawList growth) will cause - * this code to be called far too often in some cases and - * Unity will appear to freeze for a while. Please ensure you - * have Nux 3.0+ with the fix for LP: #1014610. - */ - - if (!launcher_controller_ || !dash_controller_) - return; - - CompRegion nux_damage; - - std::vector<nux::Geometry> const& dirty = wt->GetDrawList(); - - for (auto const& geo : dirty) - nux_damage += CompRegion(geo.x, geo.y, geo.width, geo.height); - - if (launcher_controller_->IsOverlayOpen()) - { - nux::BaseWindow* dash_window = dash_controller_->window(); - nux::Geometry const& geo = dash_window->GetAbsoluteGeometry(); - nux_damage += CompRegion(geo.x, geo.y, geo.width, geo.height); - } - - auto const& launchers = launcher_controller_->launchers(); - for (auto const& launcher : launchers) - { - if (!launcher->Hidden()) - { - nux::ObjectPtr<nux::View> tooltip = launcher->GetActiveTooltip(); - - if (tooltip) - { - nux::Geometry const& g = tooltip->GetAbsoluteGeometry(); - nux_damage += CompRegion(g.x, g.y, g.width, g.height); - } - - nux::ObjectPtr<LauncherDragWindow> const& dragged_icon = launcher->GetDraggedIcon(); - - if (dragged_icon) - { - nux::Geometry const& g = dragged_icon->GetAbsoluteGeometry(); - nux_damage += CompRegion(g.x, g.y, g.width, g.height); - } - } - } - - cScreen->damageRegionSetEnabled(this, false); - cScreen->damageRegion(nux_damage); - cScreen->damageRegionSetEnabled(this, true); -#endif } /* handle X Events */ @@ -1564,9 +1267,6 @@ void UnityScreen::handleEvent(XEvent* event) PluginAdapter::Default()->OnScreenGrabbed(); else if (event->xfocus.mode == NotifyUngrab) PluginAdapter::Default()->OnScreenUngrabbed(); -#ifndef USE_MODERN_COMPIZ_GL - cScreen->damageScreen(); // evil hack -#endif if (_key_nav_mode_requested) { // Close any overlay that is open. @@ -2513,11 +2213,7 @@ bool UnityWindow::glDraw(const GLMatrix& matrix, !uScreen->fullscreenRegion.contains(window->geometry()) ) { -#ifdef USE_MODERN_COMPIZ_GL uScreen->paintDisplay(); -#else - uScreen->paintDisplay(region, matrix, mask); -#endif } if (window->type() == CompWindowTypeDesktopMask) @@ -2998,14 +2694,6 @@ void UnityScreen::Relayout() if (!needsRelayout) return; -#ifndef USE_MODERN_COMPIZ_GL - if (GL::fbo) - { - uScreen->_fbo = ScreenEffectFramebufferObject::Ptr (new ScreenEffectFramebufferObject (glXGetProcAddressP, geometry)); - uScreen->_fbo->onScreenSizeChanged (geometry); - } -#endif - UScreen *uscreen = UScreen::GetDefault(); int primary_monitor = uscreen->GetPrimaryMonitor(); auto geo = uscreen->GetMonitorGeometry(primary_monitor); diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h index afc9b8da2..4cf7be93b 100644 --- a/plugins/unityshell/src/unityshell.h +++ b/plugins/unityshell/src/unityshell.h @@ -54,9 +54,6 @@ #include "UnityshellPrivate.h" #include "UnityShowdesktopHandler.h" #include "ThumbnailGenerator.h" -#ifndef USE_MODERN_COMPIZ_GL -#include "ScreenEffectFramebufferObject.h" -#endif #include "compizminimizedwindowhandler.h" #include "BGHash.h" @@ -94,11 +91,7 @@ public: void nuxEpilogue(); /* nux draw wrapper */ -#ifdef USE_MODERN_COMPIZ_GL void paintDisplay(); -#else - void paintDisplay(const CompRegion& region, const GLMatrix& transform, unsigned int mask); -#endif void paintPanelShadow(const GLMatrix& matrix); void setPanelShadowMatrix(const GLMatrix& matrix); @@ -306,12 +299,7 @@ private: BGHash _bghash; -#ifdef USE_MODERN_COMPIZ_GL ::GLFramebufferObject *oldFbo; -#else - ScreenEffectFramebufferObject::Ptr _fbo; - GLuint _active_fbo; -#endif bool queryForShader (); @@ -332,10 +320,6 @@ private: bool scale_just_activated_; -#ifndef USE_MODERN_COMPIZ_GL - ScreenEffectFramebufferObject::GLXGetProcAddressProc glXGetProcAddressP; -#endif - UBusManager ubus_manager_; glib::SourceManager sources_; unity::ThumbnailGenerator thumb_generator; @@ -377,11 +361,7 @@ public: /* basic window draw function */ bool glDraw(const GLMatrix& matrix, -#ifndef USE_MODERN_COMPIZ_GL - GLFragment::Attrib& attrib, -#else const GLWindowPaintAttrib& attrib, -#endif const CompRegion& region, unsigned intmask); |
