generic: mostly KWin auditing

Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
Ivailo Monev 2016-09-01 16:17:20 +00:00
parent 6d73ee0e50
commit 0b328b7563
19 changed files with 82 additions and 111 deletions

View file

@ -76,6 +76,6 @@ Name[x-test]=xxCompiz custom (create wrapper script 'compiz-kde-launcher' to lau
Name[zh_CN]=Compiz (compiz-kde-launcher)
Name[zh_TW]=Compiz 稿 compiz-kde-launcher
Exec=compiz-kde-launcher
TryExec=compiz
TryExec=compiz-kde-launcher
X-KDE-WindowManagerId=compiz
X-KDE-WindowManagerRestartArgument=--replace

View file

@ -1,5 +0,0 @@
[Desktop Entry]
Name=KWin GLES
Exec=kwin_gles
TryExec=kwin_gles
X-KDE-WindowManagerRestartArgument=--replace

View file

@ -1449,7 +1449,7 @@ void Client::setDesktop(int desktop)
// the next desktop change
{
foreach (Client * c2, mainClients())
c2->setDesktop(desktop);
c2->setDesktop(desktop);
}
FocusChain::self()->update(this, FocusChain::MakeFirst);

View file

@ -88,8 +88,9 @@ namespace Oxygen
loadConfiguration( configuration );
// load shadows
foreach( ShadowConfigWidget* ui, _configWidget->shadowConfigurations )
{ ui->readConfig( _configuration.data() ); }
foreach( ShadowConfigWidget* ui, _configWidget->shadowConfigurations ) {
ui->readConfig( _configuration.data() );
}
// load exceptions
ExceptionList exceptions;
@ -136,8 +137,9 @@ namespace Oxygen
ExceptionList( exceptions ).writeConfig( _configuration );
// write shadow configuration
foreach( ShadowConfigWidget* ui, _configWidget->shadowConfigurations )
{ ui->writeConfig( _configuration.data() ); }
foreach( ShadowConfigWidget* ui, _configWidget->shadowConfigurations ) {
ui->writeConfig( _configuration.data() );
}
// sync configuration
_configuration->sync();
@ -157,8 +159,9 @@ namespace Oxygen
loadConfiguration( configuration );
// load shadows
foreach( ShadowConfigWidget* ui, _configWidget->shadowConfigurations )
{ ui->readDefaults( _configuration.data() ); }
foreach( ShadowConfigWidget* ui, _configWidget->shadowConfigurations ) {
ui->readDefaults( _configuration.data() );
}
updateChanged();

View file

@ -101,8 +101,9 @@ namespace Oxygen
{
QList<QLabel*> children( widget()->findChildren<QLabel*>() );
foreach( QLabel* widget, children )
{ widget->setAutoFillBackground( false ); }
foreach( QLabel* widget, children ) {
widget->setAutoFillBackground( false );
}
// also change shadow configuration size to something that fits in the preview list
shadowCache().setShadowSize( QPalette::Active, 15 );
@ -1360,8 +1361,7 @@ namespace Oxygen
// update buttons
QList<Button*> buttons( widget()->findChildren<Button*>() );
foreach( Button* button, buttons )
{
foreach( Button* button, buttons ) {
if( ( button->isVisible() || isPreview() ) && event->rect().intersects( button->geometry() ) )
{
@ -1391,10 +1391,10 @@ namespace Oxygen
// update buttons
QList<Button*> buttons( widget()->findChildren<Button*>() );
foreach( Button* button, buttons )
{
if( event->rect().intersects( button->geometry() ) )
{ button->update(); }
foreach( Button* button, buttons ) {
if( event->rect().intersects( button->geometry() ) ) {
button->update();
}
}
}

View file

@ -83,8 +83,7 @@ namespace Oxygen
// rewrite current exceptions
int index = 0;
foreach( const ConfigurationPtr& exception, _exceptions )
{
foreach( const ConfigurationPtr& exception, _exceptions ) {
Util::writeConfig( exception.data(), config.data(), exceptionGroupName( index ) );
++index;

View file

@ -154,8 +154,7 @@ namespace Oxygen
QString windowTitle;
QString className;
foreach( const ConfigurationPtr& configuration, _exceptions )
{
foreach( const ConfigurationPtr& configuration, _exceptions ) {
// discard disabled exceptions
if( !configuration->enabled() ) continue;

View file

@ -258,13 +258,13 @@ void Compositor::finish()
foreach (Deleted * c, Workspace::self()->deletedList())
m_scene->windowDeleted(c);
foreach (Client * c, Workspace::self()->clientList())
c->finishCompositing();
c->finishCompositing();
foreach (Client * c, Workspace::self()->desktopList())
c->finishCompositing();
c->finishCompositing();
foreach (Unmanaged * c, Workspace::self()->unmanagedList())
c->finishCompositing();
c->finishCompositing();
foreach (Deleted * c, Workspace::self()->deletedList())
c->finishCompositing();
c->finishCompositing();
xcb_composite_unredirect_subwindows(connection(), rootWindow(), XCB_COMPOSITE_REDIRECT_MANUAL);
delete effects;
effects = NULL;
@ -545,9 +545,10 @@ void Compositor::performCompositing()
// TODO ?
// this cannot be used so carelessly - needs protections against broken clients, the window
// should not get focus before it's displayed, handle unredirected windows properly and so on.
foreach (Toplevel *t, windows)
foreach (Toplevel *t, windows) {
if (!t->readyForPainting())
windows.removeAll(t);
}
QRegion repaints = repaints_region;
// clear all repaints, so that post-pass can add repaints for the next repaint
@ -566,18 +567,22 @@ void Compositor::performCompositing()
bool Compositor::windowRepaintsPending() const
{
foreach (Toplevel * c, Workspace::self()->clientList())
if (!c->repaints().isEmpty())
return true;
foreach (Toplevel * c, Workspace::self()->desktopList())
if (!c->repaints().isEmpty())
return true;
foreach (Toplevel * c, Workspace::self()->unmanagedList())
if (!c->repaints().isEmpty())
return true;
foreach (Toplevel * c, Workspace::self()->deletedList())
if (!c->repaints().isEmpty())
return true;
foreach (Toplevel * c, Workspace::self()->clientList()) {
if (!c->repaints().isEmpty())
return true;
}
foreach (Toplevel * c, Workspace::self()->desktopList()) {
if (!c->repaints().isEmpty())
return true;
}
foreach (Toplevel * c, Workspace::self()->unmanagedList()) {
if (!c->repaints().isEmpty())
return true;
}
foreach (Toplevel * c, Workspace::self()->deletedList()) {
if (!c->repaints().isEmpty())
return true;
}
return false;
}
@ -670,9 +675,9 @@ void Compositor::delayedCheckUnredirect()
ToplevelList list;
bool changed = forceUnredirectCheck;
foreach (Client * c, Workspace::self()->clientList())
list.append(c);
list.append(c);
foreach (Unmanaged * c, Workspace::self()->unmanagedList())
list.append(c);
list.append(c);
foreach (Toplevel * c, list) {
if (c->updateUnredirectedState())
changed = true;

View file

@ -21,35 +21,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "config-kwin.h"
#include "compositingprefs.h"
#include "xcbutils.h"
#include <kconfiggroup.h>
#include <kdebug.h>
#include <kxerrorhandler.h>
#include <KGlobal>
#include <KLocalizedString>
#include <kdeversion.h>
#include <ksharedconfig.h>
#include <kstandarddirs.h>
#include <qprocess.h>
#include <klocale.h>
namespace KWin
{
extern int screen_number; // main.cpp
extern bool is_multihead;
CompositingPrefs::CompositingPrefs()
{
}
CompositingPrefs::~CompositingPrefs()
{
}
bool CompositingPrefs::compositingPossible()
{
if (!Xcb::Extensions::self()->isCompositeAvailable()) {

View file

@ -22,7 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define KWIN_COMPOSITINGPREFS_H
#include <QString>
#include <QStringList>
#include "kwinglobals.h"
@ -33,9 +32,6 @@ namespace KWin
class CompositingPrefs
{
public:
CompositingPrefs();
~CompositingPrefs();
static bool compositingPossible();
static QString compositingNotPossibleReason();
};

View file

@ -122,7 +122,7 @@ void DimInactiveEffect::slotWindowActivated(EffectWindow* w)
if ((w == NULL || w->group() != active->group()) && active->group() != NULL) {
// repaint windows that are no longer in the active group
foreach (EffectWindow * tmp, active->group()->members())
tmp->addRepaintFull();
tmp->addRepaintFull();
}
} else
active->addRepaintFull();
@ -133,7 +133,7 @@ void DimInactiveEffect::slotWindowActivated(EffectWindow* w)
if (active->group() != NULL) {
// repaint newly active windows
foreach (EffectWindow * tmp, active->group()->members())
tmp->addRepaintFull();
tmp->addRepaintFull();
}
} else
active->addRepaintFull();

View file

@ -87,10 +87,12 @@ void TaskbarThumbnailEffect::slotWindowDamaged(EffectWindow* w, const QRect& dam
{
Q_UNUSED(damage);
// Update the thumbnail if the window was damaged
foreach (EffectWindow * window, thumbnails.uniqueKeys())
foreach (const Data & thumb, thumbnails.values(window))
if (w == effects->findWindow(thumb.window))
window->addRepaint(thumb.rect);
foreach (EffectWindow * window, thumbnails.uniqueKeys()) {
foreach (const Data & thumb, thumbnails.values(window)) {
if (w == effects->findWindow(thumb.window))
window->addRepaint(thumb.rect);
}
}
}
void TaskbarThumbnailEffect::slotWindowAdded(EffectWindow* w)

View file

@ -178,7 +178,7 @@ void ThumbnailAsideEffect::arrange()
void ThumbnailAsideEffect::repaintAll()
{
foreach (const Data & d, windows)
effects->addRepaint(d.rect);
effects->addRepaint(d.rect);
}
bool ThumbnailAsideEffect::isActive() const

View file

@ -333,9 +333,10 @@ QRegion Workspace::restrictedMoveArea(int desktop, StrutAreas areas) const
if (desktop == NETWinInfo::OnAllDesktops || desktop == 0)
desktop = VirtualDesktopManager::self()->current();
QRegion region;
foreach (const StrutRect & rect, restrictedmovearea[desktop])
if (areas & rect.area())
region += rect;
foreach (const StrutRect & rect, restrictedmovearea[desktop]) {
if (areas & rect.area())
region += rect;
}
return region;
}
@ -349,9 +350,10 @@ QRegion Workspace::previousRestrictedMoveArea(int desktop, StrutAreas areas) con
if (desktop == NETWinInfo::OnAllDesktops || desktop == 0)
desktop = VirtualDesktopManager::self()->current();
QRegion region;
foreach (const StrutRect & rect, oldrestrictedmovearea.at(desktop))
if (areas & rect.area())
region += rect;
foreach (const StrutRect & rect, oldrestrictedmovearea.at(desktop)) {
if (areas & rect.area())
region += rect;
}
return region;
}

View file

@ -384,7 +384,7 @@ void Workspace::updateMinimizedOfTransients(Client* c)
}
if (c->isModal()) { // if a modal dialog is minimized, minimize its mainwindow too
foreach (Client * c2, c->mainClients())
c2->minimize();
c2->minimize();
}
} else {
// else unmiminize the transients
@ -398,7 +398,7 @@ void Workspace::updateMinimizedOfTransients(Client* c)
}
if (c->isModal()) {
foreach (Client * c2, c->mainClients())
c2->unminimize();
c2->unminimize();
}
}
}
@ -923,7 +923,7 @@ ClientList Client::allMainClients() const
{
ClientList result = mainClients();
foreach (const Client * cl, result)
result += cl->allMainClients();
result += cl->allMainClients();
return result;
}

View file

@ -163,9 +163,10 @@ void Monitor::selectEdgeItem(int edge, int index)
int Monitor::selectedEdgeItem(int edge) const
{
foreach (QAction * act, popup_actions[ edge ])
if (act->isChecked())
return popup_actions[ edge ].indexOf(act);
foreach (QAction * act, popup_actions[ edge ]) {
if (act->isChecked())
return popup_actions[ edge ].indexOf(act);
}
abort();
}

View file

@ -27,7 +27,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QPalette>
#include <QPixmap>
#include <QProcess>
#include <kapplication.h>
#include <kconfig.h>
#include <kglobal.h>

View file

@ -1762,7 +1762,7 @@ void Workspace::slotInvertScreen()
if (succeeded)
return;
#endif
#endif // KWIN_NO_XF86VM
if (!succeeded)
kDebug(1212) << "sorry - neither Xrandr, nor XF86VidModeSetGammaRamp worked and there's no inversion supplying effect plugin either";
@ -1791,11 +1791,9 @@ void Client::setShortcut(const QString& _cut)
}
QList< KShortcut > keys;
QStringList groups = cut.split(" - ");
for (QStringList::ConstIterator it = groups.constBegin();
it != groups.constEnd();
++it) {
foreach (const QString it, groups) {
QRegExp reg("(.*\\+)\\((.*)\\)");
if (reg.indexIn(*it) > -1) {
if (reg.indexIn(it) > -1) {
QString base = reg.cap(1);
QString list = reg.cap(2);
for (int i = 0;
@ -1807,23 +1805,17 @@ void Client::setShortcut(const QString& _cut)
}
} else {
// regexp doesn't match, so it should be a normal shortcut
KShortcut c(*it);
KShortcut c(it);
if (!c.isEmpty()) {
keys.append(c);
}
}
}
for (QList< KShortcut >::ConstIterator it = keys.constBegin();
it != keys.constEnd();
++it) {
if (_shortcut == *it) // current one is in the list
foreach (const KShortcut it, keys) {
if (_shortcut == it) // current one is in the list
return;
}
for (QList< KShortcut >::ConstIterator it = keys.constBegin();
it != keys.constEnd();
++it) {
if (workspace()->shortcutAvailable(*it, this)) {
setShortcutInternal(*it);
if (workspace()->shortcutAvailable(it, this)) {
setShortcutInternal(it);
return;
}
}
@ -1855,15 +1847,13 @@ bool Workspace::shortcutAvailable(const KShortcut& cut, Client* ignore) const
{
if (ignore && cut == ignore->shortcut())
return true;
Q_FOREACH (const QKeySequence &seq, cut.toList()) {
foreach (const QKeySequence &seq, cut.toList()) {
if (!KGlobalAccel::getGlobalShortcutsByKey(seq).isEmpty()) {
return false;
}
}
for (ClientList::ConstIterator it = clients.constBegin();
it != clients.constEnd();
++it) {
if ((*it) != ignore && (*it)->shortcut() == cut)
foreach (const Client* it, clients) {
if (it != ignore && it->shortcut() == cut)
return false;
}
return true;

View file

@ -434,7 +434,7 @@ Workspace::~Workspace()
delete Placement::self();
delete client_keys_dialog;
foreach (SessionInfo * s, session)
delete s;
delete s;
// TODO: ungrabXServer();