summaryrefslogtreecommitdiff
path: root/plugins/unityshell/src
diff options
authorSam Spilsbury <sam.spilsbury@canonical.com>2012-09-07 07:05:34 -0400
committerTarmac <>2012-09-07 07:05:34 -0400
commitfb21dc7e141a33c0d7ce72c386f181b79922d0e0 (patch)
tree78a08dd2bb6ccb89f19032fe36c34302b16f1cdd /plugins/unityshell/src
parent4776de183ecbcb38ea42bcd2d883136f00f3c981 (diff)
parentd5893765285fcc917799a8f503cb54fcc3691147 (diff)
Remove everything in the #ifndef USE_MODERN_COMPIZ_GL ifdefs and remove the ifdefs alltogether. lp:unity now requires compiz 0.9.8.0 . Also removed ScreenEffectFramebufferObject.. Fixes: . Approved by Omer Akram, Sam Spilsbury, Andrea Azzarone.
(bzr r2669)
Diffstat (limited to 'plugins/unityshell/src')
-rw-r--r--plugins/unityshell/src/ScreenEffectFramebufferObject.cpp243
-rw-r--r--plugins/unityshell/src/ScreenEffectFramebufferObject.h89
-rw-r--r--plugins/unityshell/src/unityshell.cpp316
-rw-r--r--plugins/unityshell/src/unityshell.h20
4 files changed, 2 insertions, 666 deletions
diff --git a/plugins/unityshell/src/ScreenEffectFramebufferObject.cpp b/plugins/unityshell/src/ScreenEffectFramebufferObject.cpp
deleted file mode 100644
index de9be43f3..000000000
--- a/plugins/unityshell/src/ScreenEffectFramebufferObject.cpp
+++ /dev/null
@@ -1,243 +0,0 @@
-// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
-/* Compiz unity plugin
- * unity.h
- *
- * Copyright (c) 2010-11 Canonical Ltd.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * Authored By: Sam Spilsbury <sam.spilsbury@canonical.com>
- */
-
-#ifndef USE_GLES
-#include "ScreenEffectFramebufferObject.h"
-#include "BackgroundEffectHelper.h"
-#include <NuxCore/Logger.h>
-#include <dlfcn.h>
-
-namespace
-{
- nux::logging::Logger logger ("unity.screeneffectframebufferobject");
-}
-
-void unity::ScreenEffectFramebufferObject::paint (const nux::Geometry &output)
-{
- /* Draw the bit of the relevant framebuffer for each output */
-
- glPushAttrib (GL_VIEWPORT_BIT);
- glViewport (0, 0, mScreenSize.width, mScreenSize.height);
-
- if (mFBTexture)
- {
- glEnable (GL_TEXTURE_2D);
- activeTexture (GL_TEXTURE0_ARB);
- glBindTexture (GL_TEXTURE_2D, mFBTexture);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-
- glPushAttrib (GL_SCISSOR_BIT);
- glEnable (GL_SCISSOR_TEST);
-
- glScissor (output.x, mScreenSize.height - (output.y + output.height),
- output.width, output.height);
-
- /* FIXME: This needs to be GL_TRIANGLE_STRIP */
- glBegin (GL_QUADS);
- glTexCoord2f (0, 1);
- glVertex2i (mGeometry.x, mGeometry.y);
- glTexCoord2f (0, 0);
- glVertex2i (mGeometry.x, mGeometry.y + mGeometry.height);
- glTexCoord2f (1, 0);
- glVertex2i (mGeometry.x + mGeometry.width, mGeometry.y + mGeometry.height);
- glTexCoord2f (1, 1);
- glVertex2i (mGeometry.x + mGeometry.width, mGeometry.y);
- glEnd ();
-
- activeTexture (GL_TEXTURE0_ARB);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glBindTexture (GL_TEXTURE_2D, 0);
- glDisable (GL_TEXTURE_2D);
- glPopAttrib ();
- }
- glPopAttrib ();
-}
-
-void unity::ScreenEffectFramebufferObject::onScreenSizeChanged(const nux::Geometry& screenSize)
-{
- mScreenSize = screenSize;
-}
-
-
-void unity::ScreenEffectFramebufferObject::unbind ()
-{
- if (!mBoundCnt)
- return;
-
- mBoundCnt--;
-
- (*bindFramebuffer) (GL_FRAMEBUFFER_EXT, 0);
-
- glDrawBuffer (GL_BACK);
- glReadBuffer (GL_BACK);
-
- /* Matches the viewport set we did in ::bind () */
- glPopAttrib ();
-
-}
-
-bool unity::ScreenEffectFramebufferObject::status ()
-{
- return mFboStatus;
-}
-
-void unity::ScreenEffectFramebufferObject::bind (const nux::Geometry &output)
-{
- /* Very important!
- * Don't bind unless BackgroundEffectHelper says it's necessary.
- * Because binding has a severe impact on graphics performance and we
- * can't afford to do it every frame. (LP: #861061) (LP: #987304)
- */
- if (!BackgroundEffectHelper::HasDirtyHelpers())
- return;
-
- /* Clear the error bit */
- glGetError ();
-
- if (!mFBTexture)
- {
- glGenTextures (1, &mFBTexture);
-
- glBindTexture (GL_TEXTURE_2D, mFBTexture);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, mGeometry.width, mGeometry.height, 0, GL_BGRA,
-#if IMAGE_BYTE_ORDER == MSBFirst
- GL_UNSIGNED_INT_8_8_8_8_REV,
-#else
- GL_UNSIGNED_BYTE,
-#endif
- NULL);
-
- glBindTexture (GL_TEXTURE_2D, 0);
-
- if (glGetError () != GL_NO_ERROR)
- {
- mFboHandle = 0;
- mFboStatus = false;
- return;
- }
- }
-
- (*bindFramebuffer) (GL_FRAMEBUFFER_EXT, mFboHandle);
-
- (*framebufferTexture2D) (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
- GL_TEXTURE_2D, mFBTexture, 0);
-
- (*framebufferTexture2D) (GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
- GL_TEXTURE_2D, 0, 0);
-
- /* Ensure that a framebuffer is actually available */
- if (!mFboStatus)
- {
- GLint status = (*checkFramebufferStatus) (GL_DRAW_FRAMEBUFFER);
-
- if (status != GL_FRAMEBUFFER_COMPLETE)
- {
- switch (status)
- {
- case GL_FRAMEBUFFER_UNDEFINED:
- LOG_WARN (logger) << "no window";
- break;
- case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
- LOG_WARN (logger) << "attachment incomplete";
- break;
- case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
- LOG_WARN (logger) << "no buffers attached to fbo";
- break;
- case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER:
- LOG_WARN (logger) << "some attachment in glDrawBuffers doesn't exist in FBO";
- break;
- case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER:
- LOG_WARN (logger) << "some attachment in glReadBuffers doesn't exist in FBO";
- break;
- case GL_FRAMEBUFFER_UNSUPPORTED:
- LOG_WARN (logger) << "unsupported internal format";
- break;
- case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:
- LOG_WARN (logger) << "different levels of sampling for each attachment";
- break;
- case GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS:
- LOG_WARN (logger) << "number of layers is different";
- break;
- default:
- LOG_WARN (logger) << "unable to bind the framebuffer for an unknown reason";
- break;
- }
-
- bindFramebuffer (GL_FRAMEBUFFER_EXT, 0);
- deleteFramebuffers (1, &mFboHandle);
-
- glDrawBuffer (GL_BACK);
- glReadBuffer (GL_BACK);
-
- mFboHandle = 0;
-
- mFboStatus = false;
- }
- else
- mFboStatus = true;
- }
-
- if (mFboStatus)
- {
- glPushAttrib (GL_VIEWPORT_BIT);
-
- glViewport (output.x,
- mScreenSize.height - (output.y + output.height),
- output.width,
- output.height);
- }
-
- mBoundCnt++;
-}
-
-
-unity::ScreenEffectFramebufferObject::ScreenEffectFramebufferObject (GLXGetProcAddressProc p, const nux::Geometry &geom)
- : getProcAddressGLX (p)
- , mFboStatus (false)
- , mFBTexture (0)
- , mGeometry (geom)
- , mBoundCnt (0)
- , mScreenSize (geom)
-{
- activeTexture = (GLActiveTextureProc) (*getProcAddressGLX) ((GLubyte *) "glActiveTexture");
- genFramebuffers = (GLGenFramebuffersProc) (*getProcAddressGLX) ((GLubyte *)"glGenFramebuffersEXT");
- deleteFramebuffers = (GLDeleteFramebuffersProc) (*getProcAddressGLX) ((GLubyte *)"glDeleteFramebuffersEXT");
- bindFramebuffer = (GLBindFramebufferProc) (*getProcAddressGLX) ((GLubyte *)"glBindFramebufferEXT");
- checkFramebufferStatus = (GLCheckFramebufferStatusProc) (*getProcAddressGLX) ((GLubyte *) "glCheckFramebufferStatusEXT");
- framebufferTexture2D = (GLFramebufferTexture2DProc) (*getProcAddressGLX) ((GLubyte *) "glFramebufferTexture2DEXT");
-
- (*genFramebuffers) (1, &mFboHandle);
-}
-
-unity::ScreenEffectFramebufferObject::~ScreenEffectFramebufferObject ()
-{
- (*deleteFramebuffers) (1, &mFboHandle);
-
- if (mFBTexture)
- glDeleteTextures (1, &mFBTexture);
-}
-
-#endif // USE_GLES
-
diff --git a/plugins/unityshell/src/ScreenEffectFramebufferObject.h b/plugins/unityshell/src/ScreenEffectFramebufferObject.h
deleted file mode 100644
index 9ccfb9a92..000000000
--- a/plugins/unityshell/src/ScreenEffectFramebufferObject.h
+++ /dev/null
@@ -1,89 +0,0 @@
-// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
-/* Compiz unity plugin
- * unity.h
- *
- * Copyright (c) 2010-11 Canonical Ltd.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * Authored By: Sam Spilsbury <sam.spilsbury@canonical.com>
- */
-
-#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 33e8e4e64..81ce97c4b 100644
--- a/plugins/unityshell/src/unityshell.cpp
+++ b/plugins/unityshell/src/unityshell.cpp
@@ -124,9 +124,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)
@@ -250,25 +247,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));
@@ -506,17 +484,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();
@@ -525,9 +492,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();
@@ -549,19 +513,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
@@ -573,86 +527,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))
@@ -746,7 +623,6 @@ void UnityScreen::paintPanelShadow(const GLMatrix& matrix)
}
}
nuxEpilogue();
-#endif
}
void
@@ -767,73 +643,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;
@@ -841,12 +657,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;
@@ -864,56 +678,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
}
}
}
@@ -1350,26 +1136,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();
@@ -1381,11 +1147,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;
}
@@ -1415,10 +1177,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;
}
@@ -1545,7 +1303,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
@@ -1565,60 +1322,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 */
@@ -1633,9 +1336,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.
@@ -2600,11 +2300,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)
@@ -3121,14 +2817,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 21498f0cf..fbe7e4c53 100644
--- a/plugins/unityshell/src/unityshell.h
+++ b/plugins/unityshell/src/unityshell.h
@@ -55,9 +55,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"
@@ -97,11 +94,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);
@@ -311,12 +304,7 @@ private:
BGHash _bghash;
-#ifdef USE_MODERN_COMPIZ_GL
::GLFramebufferObject *oldFbo;
-#else
- ScreenEffectFramebufferObject::Ptr _fbo;
- GLuint _active_fbo;
-#endif
bool queryForShader ();
@@ -337,10 +325,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;
@@ -386,11 +370,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);