Changed debug statements in kwin/effects from qDebug() to qCDebug(KWINEFFECTS)

A new .cpp file is added containing the declaration of the logging
category and compiled into the effects lib.

REVIEW: 114194
This commit is contained in:
Jacob Logan 2013-11-29 16:18:28 +11:00 committed by Martin Gräßlin
parent cae5a4f1e0
commit ac72e9fb73
24 changed files with 76 additions and 73 deletions

View file

@ -97,7 +97,7 @@ endmacro()
install( FILES kwineffect.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR} )
# Create initial variables
set( kwin4_effect_builtins_sources )
set( kwin4_effect_builtins_sources logging.cpp)
if( NOT KWIN_MOBILE_EFFECTS )
set( kwin4_effect_builtins_config_sources configs_builtins.cpp )
endif()

View file

@ -26,7 +26,6 @@
#include <QMatrix4x4>
#include <QTextStream>
#include <QVector2D>
#include <QDebug>
#include <cmath>

View file

@ -34,8 +34,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <math.h>
#include <QDebug>
namespace KWin
{

View file

@ -31,7 +31,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QApplication>
#include <QColor>
#include <QDebug>
#include <QElapsedTimer>
#include <QRect>
#include <QEvent>
@ -1328,7 +1327,7 @@ void CubeEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPa
if (activated && cube_painting) {
region= infiniteRegion(); // we need to explicitly prevent any clipping, bug #325432
shader = shaderManager->pushShader(ShaderManager::GenericShader);
//qDebug() << w->caption();
//qCDebug(KWINEFFECTS) << w->caption();
float opacity = cubeOpacity;
if (start) {
opacity = 1.0 - (1.0 - opacity) * timeLine.currentValue();
@ -1625,13 +1624,13 @@ bool CubeEffect::borderActivated(ElectricBorder border)
void CubeEffect::toggleCube()
{
qDebug() << "toggle cube";
qCDebug(KWINEFFECTS) << "toggle cube";
toggle(Cube);
}
void CubeEffect::toggleCylinder()
{
qDebug() << "toggle cylinder";
qCDebug(KWINEFFECTS) << "toggle cylinder";
if (!useShaders)
useShaders = loadShader();
if (useShaders)
@ -1642,7 +1641,7 @@ void CubeEffect::toggleCylinder()
void CubeEffect::toggleSphere()
{
qDebug() << "toggle sphere";
qCDebug(KWINEFFECTS) << "toggle sphere";
if (!useShaders)
useShaders = loadShader();
if (useShaders)
@ -1704,7 +1703,7 @@ void CubeEffect::grabbedKeyboardEvent(QKeyEvent* e)
// wrap only on autorepeat
case Qt::Key_Left:
// rotate to previous desktop
qDebug() << "left";
qCDebug(KWINEFFECTS) << "left";
if (!rotating && !start) {
rotating = true;
if (invertKeys)
@ -1722,7 +1721,7 @@ void CubeEffect::grabbedKeyboardEvent(QKeyEvent* e)
break;
case Qt::Key_Right:
// rotate to next desktop
qDebug() << "right";
qCDebug(KWINEFFECTS) << "right";
if (!rotating && !start) {
rotating = true;
if (invertKeys)
@ -1739,7 +1738,7 @@ void CubeEffect::grabbedKeyboardEvent(QKeyEvent* e)
}
break;
case Qt::Key_Up:
qDebug() << "up";
qCDebug(KWINEFFECTS) << "up";
if (invertKeys) {
if (verticalPosition != Down) {
if (!verticalRotating) {
@ -1781,7 +1780,7 @@ void CubeEffect::grabbedKeyboardEvent(QKeyEvent* e)
}
break;
case Qt::Key_Down:
qDebug() << "down";
qCDebug(KWINEFFECTS) << "down";
if (invertKeys) {
if (verticalPosition != Up) {
if (!verticalRotating) {
@ -1920,7 +1919,7 @@ void CubeEffect::setActive(bool active)
zOrderingFactor = zPosition / (effects->stackingOrder().count() - 1);
start = true;
effects->setActiveFullScreenEffect(this);
qDebug() << "Cube is activated";
qCDebug(KWINEFFECTS) << "Cube is activated";
verticalPosition = Normal;
verticalRotating = false;
manualAngle = 0.0;

View file

@ -31,7 +31,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QAction>
#include <QApplication>
#include <kactioncollection.h>
#include <QDebug>
#include <KDE/KGlobalAccel>
#include <KDE/KLocalizedString>
#include <netwm_def.h>

View file

@ -19,7 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#include "fallapart.h"
#include <QDebug>
#include <assert.h>
#include <math.h>
#include <KDE/KConfigGroup>
@ -135,15 +134,15 @@ bool FallApartEffect::isRealWindow(EffectWindow* w)
{
// TODO: isSpecialWindow is rather generic, maybe tell windowtypes separately?
/*
qDebug() << "--" << w->caption() << "--------------------------------";
qDebug() << "Tooltip:" << w->isTooltip();
qDebug() << "Toolbar:" << w->isToolbar();
qDebug() << "Desktop:" << w->isDesktop();
qDebug() << "Special:" << w->isSpecialWindow();
qDebug() << "TopMenu:" << w->isTopMenu();
qDebug() << "Notific:" << w->isNotification();
qDebug() << "Splash:" << w->isSplash();
qDebug() << "Normal:" << w->isNormalWindow();
qCDebug(KWINEFFECTS) << "--" << w->caption() << "--------------------------------";
qCDebug(KWINEFFECTS) << "Tooltip:" << w->isTooltip();
qCDebug(KWINEFFECTS) << "Toolbar:" << w->isToolbar();
qCDebug(KWINEFFECTS) << "Desktop:" << w->isDesktop();
qCDebug(KWINEFFECTS) << "Special:" << w->isSpecialWindow();
qCDebug(KWINEFFECTS) << "TopMenu:" << w->isTopMenu();
qCDebug(KWINEFFECTS) << "Notific:" << w->isNotification();
qCDebug(KWINEFFECTS) << "Splash:" << w->isSplash();
qCDebug(KWINEFFECTS) << "Normal:" << w->isNormalWindow();
*/
if (!w->isNormalWindow())
return false;

View file

@ -27,7 +27,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QKeyEvent>
#include <QMatrix4x4>
#include <QDebug>
#include <QAction>
#include <KActionCollection>
#include <KDE/KGlobalAccel>

View file

@ -20,8 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "highlightwindow.h"
#include <QDebug>
namespace KWin
{
@ -163,7 +161,7 @@ void HighlightWindowEffect::slotPropertyNotify(EffectWindow* w, long a, EffectWi
m_highlightedIds << data[i];
EffectWindow* foundWin = effects->findWindow(data[i]);
if (!foundWin) {
qDebug() << "Invalid window targetted for highlight. Requested:" << data[i];
qCDebug(KWINEFFECTS) << "Invalid window targetted for highlight. Requested:" << data[i];
continue; // might come in later.
}
m_highlightedWindows.append(foundWin);

View file

@ -27,7 +27,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kactioncollection.h>
#include <KDE/KGlobalAccel>
#include <KDE/KLocalizedString>
#include <QDebug>
#include <QStandardPaths>
#include <QMatrix4x4>

View file

@ -21,8 +21,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "kscreen.h"
// KConfigSkeleton
#include "kscreenconfig.h"
// Qt
#include <QDebug>
/**
* How this effect works:
@ -165,7 +163,7 @@ void KscreenEffect::propertyNotify(EffectWindow *window, long int atom)
effects->addRepaintFull();
return;
}
qDebug() << "Incorrect Property state, immediate stop: " << data[0];
qCDebug(KWINEFFECTS) << "Incorrect Property state, immediate stop: " << data[0];
m_state = StateNormal;
effects->addRepaintFull();
}

21
effects/logging.cpp Normal file
View file

@ -0,0 +1,21 @@
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2013 Martin Gräßlin <mgraesslin@kde.org>
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 2 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.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#include <kwineffects.h>
Q_LOGGING_CATEGORY(KWINEFFECTS, "kwineffects");

View file

@ -28,7 +28,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "kwinglplatform.h"
#include <math.h>
#include <QDebug>
#include <QtGui/QMatrix4x4>
#include <QtGui/QVector2D>
@ -307,7 +306,7 @@ void LogoutEffect::renderVignetting()
QStandardPaths::locate(QStandardPaths::GenericDataLocation,
m_shadersDir + QStringLiteral("vignetting.frag")));
if (!m_vignettingShader->isValid()) {
qDebug() << "Vignetting Shader failed to load";
qCDebug(KWINEFFECTS) << "Vignetting Shader failed to load";
return;
}
} else if (!m_vignettingShader->isValid()) {
@ -388,7 +387,7 @@ void LogoutEffect::renderBlurTexture()
QStandardPaths::locate(QStandardPaths::GenericDataLocation,
m_shadersDir + QStringLiteral("logout-blur.frag")));
if (!m_blurShader->isValid()) {
qDebug() << "Logout blur shader failed to load";
qCDebug(KWINEFFECTS) << "Logout blur shader failed to load";
}
} else if (!m_blurShader->isValid()) {
// shader is broken - no need to continue here

View file

@ -31,7 +31,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kactioncollection.h>
#include <KDE/KGlobalAccel>
#include <KDE/KLocalizedString>
#include <QDebug>
#include <QVector2D>
#include <kmessagebox.h>
@ -94,7 +93,7 @@ void LookingGlassEffect::reconfigure(ReconfigureFlags)
LookingGlassConfig::self()->readConfig();
initialradius = LookingGlassConfig::radius();
radius = initialradius;
qDebug() << QStringLiteral("Radius from config: %1").arg(radius) << endl;
qCDebug(KWINEFFECTS) << QStringLiteral("Radius from config: %1").arg(radius) << endl;
actionCollection->readSettings();
m_valid = loadData();
}
@ -215,7 +214,7 @@ void LookingGlassEffect::prePaintScreen(ScreenPrePaintData& data, int time)
zoom = qMin(zoom * qMax(1.0 + diff, 1.2), target_zoom);
else
zoom = qMax(zoom * qMin(1.0 - diff, 0.8), target_zoom);
qDebug() << "zoom is now " << zoom;
qCDebug(KWINEFFECTS) << "zoom is now " << zoom;
radius = qBound((double)initialradius, initialradius * zoom, 3.5 * initialradius);
if (zoom <= 1.0f) {

View file

@ -33,8 +33,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <math.h>
#include <QDebug>
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
#include <xcb/render.h>
#endif

View file

@ -26,7 +26,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kactioncollection.h>
#include <KDE/KGlobalAccel>
#include <KDE/KLocalizedString>
#include <QDebug>
#include <kdeclarative/kdeclarative.h>
#include <kwinglutils.h>
@ -866,7 +865,7 @@ void PresentWindowsEffect::slotPropertyNotify(EffectWindow* w, long a)
for (int i = 0; i < length; i++) {
EffectWindow* foundWin = effects->findWindow(data[i]);
if (!foundWin) {
qDebug() << "Invalid window targetted for present windows. Requested:" << data[i];
qCDebug(KWINEFFECTS) << "Invalid window targetted for present windows. Requested:" << data[i];
continue;
}
m_selectedWindows.append(foundWin);
@ -1114,7 +1113,7 @@ void PresentWindowsEffect::calculateWindowTransformationsKompose(EffectWindowLis
rows = (int)ceil(sqrt((double)windowlist.count()));
columns = (int)ceil((double)windowlist.count() / (double)rows);
}
//qDebug() << "Using " << rows << " rows & " << columns << " columns for " << windowlist.count() << " clients";
//qCDebug(KWINEFFECTS) << "Using " << rows << " rows & " << columns << " columns for " << windowlist.count() << " clients";
// Calculate width & height
int w = (availRect.width() - (columns + 1) * spacing) / columns;
@ -1217,7 +1216,7 @@ void PresentWindowsEffect::calculateWindowTransformationsKompose(EffectWindowLis
// winData->slot = pos;
motionManager.moveWindow(window, target);
//qDebug() << "Window '" << window->caption() << "' gets moved to (" <<
//qCDebug(KWINEFFECTS) << "Window '" << window->caption() << "' gets moved to (" <<
// mWindowData[window].area.left() << "; " << mWindowData[window].area.right() <<
// "), scale: " << mWindowData[window].scale << endl;
}

View file

@ -21,7 +21,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "screenshot.h"
#include <kwinglutils.h>
#include <kwinxrenderutils.h>
#include <QDebug>
#include <QtCore/QTemporaryFile>
#include <QtCore/QDir>
#include <QtDBus/QDBusConnection>
@ -275,14 +274,14 @@ QString ScreenShotEffect::blitScreenshot(const QRect &geometry)
{
#ifdef KWIN_HAVE_OPENGLES
Q_UNUSED(geometry)
qDebug() << "Framebuffer Blit not supported";
qCDebug(KWINEFFECTS) << "Framebuffer Blit not supported";
return QString();
#else
QImage img;
if (effects->isOpenGLCompositing())
{
if (!GLRenderTarget::blitSupported()) {
qDebug() << "Framebuffer Blit not supported";
qCDebug(KWINEFFECTS) << "Framebuffer Blit not supported";
return QString();
}
GLTexture tex(geometry.width(), geometry.height());

View file

@ -20,7 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "slidingpopups.h"
#include <QDebug>
#include <KDE/KConfigGroup>
#include <QTimeLine>

View file

@ -19,7 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#include "startupfeedback.h"
// Qt
#include <QDebug>
#include <QSize>
#include <QtCore/QStandardPaths>
#include <QtGui/QPainter>
@ -134,9 +133,9 @@ void StartupFeedbackEffect::reconfigure(Effect::ReconfigureFlags flags)
const QString shader = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kwin/blinking-startup-fragment.glsl"));
m_blinkingShader = ShaderManager::instance()->loadFragmentShader(ShaderManager::SimpleShader, shader);
if (m_blinkingShader->isValid()) {
qDebug() << "Blinking Shader is valid";
qCDebug(KWINEFFECTS) << "Blinking Shader is valid";
} else {
qDebug() << "Blinking Shader is not valid";
qCDebug(KWINEFFECTS) << "Blinking Shader is not valid";
}
}
} else

View file

@ -21,8 +21,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "taskbarthumbnail.h"
#include <QDebug>
#include <kwinglutils.h>
// This effect shows a preview inside a window that has a special property set

View file

@ -38,8 +38,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <math.h>
#include <QDebug>
namespace KWin
{

View file

@ -12,7 +12,6 @@ License. See the file "COPYING" for the exact licensing terms.
#include "wobblywindows.h"
#include "wobblywindowsconfig.h"
#include <QDebug>
#include <math.h>
#define USE_ASSERT
@ -164,7 +163,7 @@ WobblyWindowsEffect::~WobblyWindowsEffect()
if (!windows.empty()) {
// we should be empty at this point...
// emit a warning and clean the list.
qDebug() << "Windows list not empty. Left items : " << windows.count();
qCDebug(KWINEFFECTS) << "Windows list not empty. Left items : " << windows.count();
QHash< const EffectWindow*, WindowWobblyInfos >::iterator i;
for (i = windows.begin(); i != windows.end(); ++i) {
freeWobblyInfo(i.value());
@ -180,7 +179,7 @@ void WobblyWindowsEffect::reconfigure(ReconfigureFlags)
if (settingsMode != QStringLiteral("Custom")) {
unsigned int wobblynessLevel = WobblyWindowsConfig::wobblynessLevel();
if (wobblynessLevel > 4) {
qDebug() << "Wrong value for \"WobblynessLevel\" : " << wobblynessLevel;
qCDebug(KWINEFFECTS) << "Wrong value for \"WobblynessLevel\" : " << wobblynessLevel;
wobblynessLevel = 4;
}
setParameterSet(pset[wobblynessLevel]);
@ -215,7 +214,7 @@ void WobblyWindowsEffect::reconfigure(ReconfigureFlags)
m_resizeWobble = WobblyWindowsConfig::resizeWobble();
#if defined VERBOSE_MODE
qDebug() << "Parameters :\n" <<
qCDebug(KWINEFFECTS) << "Parameters :\n" <<
"move : " << m_moveEffectEnabled << ", open : " << m_openEffectEnabled << ", close : " << m_closeEffectEnabled << "\n"
"grid(" << m_stiffness << ", " << m_drag << ", " << m_move_factor << ")\n" <<
"velocity(" << m_minVelocity << ", " << m_maxVelocity << ", " << m_stopVelocity << ")\n" <<
@ -292,7 +291,7 @@ void WobblyWindowsEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& da
while (!stop && (updateTime > maxTime)) {
#if defined VERBOSE_MODE
qDebug() << "loop time " << updateTime << " / " << time;
qCDebug(KWINEFFECTS) << "loop time " << updateTime << " / " << time;
#endif
stop = !updateWindowWobblyDatas(w, maxTime);
updateTime -= maxTime;
@ -422,14 +421,14 @@ void WobblyWindowsEffect::startMovedResized(EffectWindow* w)
int indy = (picked.y - rect.y()) / y_increment + 0.5;
int pickedPointIndex = indy * wwi.width + indx;
if (pickedPointIndex < 0) {
qDebug() << "Picked index == " << pickedPointIndex << " with (" << cursorPos().x() << "," << cursorPos().y() << ")";
qCDebug(KWINEFFECTS) << "Picked index == " << pickedPointIndex << " with (" << cursorPos().x() << "," << cursorPos().y() << ")";
pickedPointIndex = 0;
} else if (static_cast<unsigned int>(pickedPointIndex) > wwi.count - 1) {
qDebug() << "Picked index == " << pickedPointIndex << " with (" << cursorPos().x() << "," << cursorPos().y() << ")";
qCDebug(KWINEFFECTS) << "Picked index == " << pickedPointIndex << " with (" << cursorPos().x() << "," << cursorPos().y() << ")";
pickedPointIndex = wwi.count - 1;
}
#if defined VERBOSE_MODE
qDebug() << "Original Picked point -- x : " << picked.x << " - y : " << picked.y;
qCDebug(KWINEFFECTS) << "Original Picked point -- x : " << picked.x << " - y : " << picked.y;
#endif
wwi.constraint[pickedPointIndex] = true;
@ -716,8 +715,8 @@ bool WobblyWindowsEffect::updateWindowWobblyDatas(EffectWindow* w, qreal time)
qreal y_length = rect.height() / (wwi.height - 1.0);
#if defined VERBOSE_MODE
qDebug() << "time " << time;
qDebug() << "increment x " << x_length << " // y" << y_length;
qCDebug(KWINEFFECTS) << "time " << time;
qCDebug(KWINEFFECTS) << "increment x " << x_length << " // y" << y_length;
#endif
Pair origine = {rect.x(), rect.y()};
@ -1013,7 +1012,7 @@ bool WobblyWindowsEffect::updateWindowWobblyDatas(EffectWindow* w, qreal time)
#if defined VERBOSE_MODE
if (wwi.constraint[i]) {
qDebug() << "Constraint point ** vel : " << vel.x << "," << vel.y << " ** move : " << vel.x*time << "," << vel.y*time;
qCDebug(KWINEFFECTS) << "Constraint point ** vel : " << vel.x << "," << vel.y << " ** move : " << vel.x*time << "," << vel.y*time;
}
#endif
}
@ -1041,10 +1040,10 @@ bool WobblyWindowsEffect::updateWindowWobblyDatas(EffectWindow* w, qreal time)
#if defined VERBOSE_MODE
# if defined COMPUTE_STATS
qDebug() << "Acceleration bounds (" << accBound.x << ", " << accBound.y << ")";
qDebug() << "Velocity bounds (" << velBound.x << ", " << velBound.y << ")";
qCDebug(KWINEFFECTS) << "Acceleration bounds (" << accBound.x << ", " << accBound.y << ")";
qCDebug(KWINEFFECTS) << "Velocity bounds (" << velBound.x << ", " << velBound.y << ")";
# endif
qDebug() << "sum_acc : " << acc_sum << " *** sum_vel :" << vel_sum;
qCDebug(KWINEFFECTS) << "sum_acc : " << acc_sum << " *** sum_vel :" << vel_sum;
#endif
if (wwi.status != Moving && acc_sum < m_stopAcceleration && vel_sum < m_stopVelocity) {

View file

@ -25,7 +25,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QAction>
#include <QApplication>
#include <QDebug>
#include <QStyle>
#include <QtGui/QVector2D>
#include <QtDBus/QDBusConnection>
@ -205,7 +204,7 @@ void ZoomEffect::recreateTexture()
XcursorImageDestroy(ximg);
}
else {
qDebug() << "Loading cursor image (" << theme << ") FAILED -> falling back to proportional mouse tracking!";
qCDebug(KWINEFFECTS) << "Loading cursor image (" << theme << ") FAILED -> falling back to proportional mouse tracking!";
mouseTracking = MouseTrackingProportional;
}
}

View file

@ -34,6 +34,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QtGui/QVector3D>
#include <QVector>
#include <QLoggingCategory>
#include <QList>
#include <QHash>
#include <QStack>
@ -52,6 +53,12 @@ class QGraphicsScale;
class QKeyEvent;
class QMatrix4x4;
/**
* Logging category to be used inside the KWin effects.
* Do not use in this library.
**/
Q_DECLARE_LOGGING_CATEGORY(KWINEFFECTS);
namespace KWin
{

View file

@ -394,7 +394,8 @@ KDE_EXPORT int kdemain(int argc, char * argv[])
mallopt(M_TRIM_THRESHOLD, 5*pagesize);
#endif // M_TRIM_THRESHOLD
QLoggingCategory::setFilterRules(QStringLiteral("aurorae.debug = true"));
QLoggingCategory::setFilterRules(QStringLiteral("aurorae.debug = true\n") +
QStringLiteral("kwineffects.debug = true"));
int primaryScreen = 0;
xcb_connection_t *c = xcb_connect(nullptr, &primaryScreen);