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_CN]=Compiz (compiz-kde-launcher)
Name[zh_TW]=Compiz 稿 compiz-kde-launcher Name[zh_TW]=Compiz 稿 compiz-kde-launcher
Exec=compiz-kde-launcher Exec=compiz-kde-launcher
TryExec=compiz TryExec=compiz-kde-launcher
X-KDE-WindowManagerId=compiz X-KDE-WindowManagerId=compiz
X-KDE-WindowManagerRestartArgument=--replace 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 // the next desktop change
{ {
foreach (Client * c2, mainClients()) foreach (Client * c2, mainClients())
c2->setDesktop(desktop); c2->setDesktop(desktop);
} }
FocusChain::self()->update(this, FocusChain::MakeFirst); FocusChain::self()->update(this, FocusChain::MakeFirst);

View file

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

View file

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

View file

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

View file

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

View file

@ -258,13 +258,13 @@ void Compositor::finish()
foreach (Deleted * c, Workspace::self()->deletedList()) foreach (Deleted * c, Workspace::self()->deletedList())
m_scene->windowDeleted(c); m_scene->windowDeleted(c);
foreach (Client * c, Workspace::self()->clientList()) foreach (Client * c, Workspace::self()->clientList())
c->finishCompositing(); c->finishCompositing();
foreach (Client * c, Workspace::self()->desktopList()) foreach (Client * c, Workspace::self()->desktopList())
c->finishCompositing(); c->finishCompositing();
foreach (Unmanaged * c, Workspace::self()->unmanagedList()) foreach (Unmanaged * c, Workspace::self()->unmanagedList())
c->finishCompositing(); c->finishCompositing();
foreach (Deleted * c, Workspace::self()->deletedList()) foreach (Deleted * c, Workspace::self()->deletedList())
c->finishCompositing(); c->finishCompositing();
xcb_composite_unredirect_subwindows(connection(), rootWindow(), XCB_COMPOSITE_REDIRECT_MANUAL); xcb_composite_unredirect_subwindows(connection(), rootWindow(), XCB_COMPOSITE_REDIRECT_MANUAL);
delete effects; delete effects;
effects = NULL; effects = NULL;
@ -545,9 +545,10 @@ void Compositor::performCompositing()
// TODO ? // TODO ?
// this cannot be used so carelessly - needs protections against broken clients, the window // 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. // 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()) if (!t->readyForPainting())
windows.removeAll(t); windows.removeAll(t);
}
QRegion repaints = repaints_region; QRegion repaints = repaints_region;
// clear all repaints, so that post-pass can add repaints for the next repaint // 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 bool Compositor::windowRepaintsPending() const
{ {
foreach (Toplevel * c, Workspace::self()->clientList()) foreach (Toplevel * c, Workspace::self()->clientList()) {
if (!c->repaints().isEmpty()) if (!c->repaints().isEmpty())
return true; return true;
foreach (Toplevel * c, Workspace::self()->desktopList()) }
if (!c->repaints().isEmpty()) foreach (Toplevel * c, Workspace::self()->desktopList()) {
return true; if (!c->repaints().isEmpty())
foreach (Toplevel * c, Workspace::self()->unmanagedList()) return true;
if (!c->repaints().isEmpty()) }
return true; foreach (Toplevel * c, Workspace::self()->unmanagedList()) {
foreach (Toplevel * c, Workspace::self()->deletedList()) if (!c->repaints().isEmpty())
if (!c->repaints().isEmpty()) return true;
return true; }
foreach (Toplevel * c, Workspace::self()->deletedList()) {
if (!c->repaints().isEmpty())
return true;
}
return false; return false;
} }
@ -670,9 +675,9 @@ void Compositor::delayedCheckUnredirect()
ToplevelList list; ToplevelList list;
bool changed = forceUnredirectCheck; bool changed = forceUnredirectCheck;
foreach (Client * c, Workspace::self()->clientList()) foreach (Client * c, Workspace::self()->clientList())
list.append(c); list.append(c);
foreach (Unmanaged * c, Workspace::self()->unmanagedList()) foreach (Unmanaged * c, Workspace::self()->unmanagedList())
list.append(c); list.append(c);
foreach (Toplevel * c, list) { foreach (Toplevel * c, list) {
if (c->updateUnredirectedState()) if (c->updateUnredirectedState())
changed = true; 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 "config-kwin.h"
#include "compositingprefs.h" #include "compositingprefs.h"
#include "xcbutils.h" #include "xcbutils.h"
#include <kconfiggroup.h>
#include <kdebug.h> #include <kdebug.h>
#include <kxerrorhandler.h> #include <klocale.h>
#include <KGlobal>
#include <KLocalizedString>
#include <kdeversion.h>
#include <ksharedconfig.h>
#include <kstandarddirs.h>
#include <qprocess.h>
namespace KWin namespace KWin
{ {
extern int screen_number; // main.cpp
extern bool is_multihead;
CompositingPrefs::CompositingPrefs()
{
}
CompositingPrefs::~CompositingPrefs()
{
}
bool CompositingPrefs::compositingPossible() bool CompositingPrefs::compositingPossible()
{ {
if (!Xcb::Extensions::self()->isCompositeAvailable()) { 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 #define KWIN_COMPOSITINGPREFS_H
#include <QString> #include <QString>
#include <QStringList>
#include "kwinglobals.h" #include "kwinglobals.h"
@ -33,9 +32,6 @@ namespace KWin
class CompositingPrefs class CompositingPrefs
{ {
public: public:
CompositingPrefs();
~CompositingPrefs();
static bool compositingPossible(); static bool compositingPossible();
static QString compositingNotPossibleReason(); static QString compositingNotPossibleReason();
}; };

View file

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

View file

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

View file

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

View file

@ -333,9 +333,10 @@ QRegion Workspace::restrictedMoveArea(int desktop, StrutAreas areas) const
if (desktop == NETWinInfo::OnAllDesktops || desktop == 0) if (desktop == NETWinInfo::OnAllDesktops || desktop == 0)
desktop = VirtualDesktopManager::self()->current(); desktop = VirtualDesktopManager::self()->current();
QRegion region; QRegion region;
foreach (const StrutRect & rect, restrictedmovearea[desktop]) foreach (const StrutRect & rect, restrictedmovearea[desktop]) {
if (areas & rect.area()) if (areas & rect.area())
region += rect; region += rect;
}
return region; return region;
} }
@ -349,9 +350,10 @@ QRegion Workspace::previousRestrictedMoveArea(int desktop, StrutAreas areas) con
if (desktop == NETWinInfo::OnAllDesktops || desktop == 0) if (desktop == NETWinInfo::OnAllDesktops || desktop == 0)
desktop = VirtualDesktopManager::self()->current(); desktop = VirtualDesktopManager::self()->current();
QRegion region; QRegion region;
foreach (const StrutRect & rect, oldrestrictedmovearea.at(desktop)) foreach (const StrutRect & rect, oldrestrictedmovearea.at(desktop)) {
if (areas & rect.area()) if (areas & rect.area())
region += rect; region += rect;
}
return region; 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 if (c->isModal()) { // if a modal dialog is minimized, minimize its mainwindow too
foreach (Client * c2, c->mainClients()) foreach (Client * c2, c->mainClients())
c2->minimize(); c2->minimize();
} }
} else { } else {
// else unmiminize the transients // else unmiminize the transients
@ -398,7 +398,7 @@ void Workspace::updateMinimizedOfTransients(Client* c)
} }
if (c->isModal()) { if (c->isModal()) {
foreach (Client * c2, c->mainClients()) foreach (Client * c2, c->mainClients())
c2->unminimize(); c2->unminimize();
} }
} }
} }
@ -923,7 +923,7 @@ ClientList Client::allMainClients() const
{ {
ClientList result = mainClients(); ClientList result = mainClients();
foreach (const Client * cl, result) foreach (const Client * cl, result)
result += cl->allMainClients(); result += cl->allMainClients();
return result; return result;
} }

View file

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

View file

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

View file

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

View file

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