kwin: const-ify iterator values where possible

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-10-29 07:11:05 +03:00
parent 6cc1c2b782
commit ca6280368c
4 changed files with 15 additions and 9 deletions

View file

@ -894,7 +894,7 @@ QRect Client::iconGeometry() const
return geom;
else {
// Check all mainwindows of this window (recursively)
foreach (Client * mainwin, mainClients()) {
foreach (const Client * mainwin, mainClients()) {
geom = mainwin->iconGeometry();
if (geom.isValid())
return geom;

View file

@ -115,10 +115,16 @@ void StartupFeedbackEffect::start(const QString& icon)
QCursor cursor = QCursor(Qt::WaitCursor);
xcb_connection_t *c = connection();
ScopedCPointer<xcb_grab_pointer_reply_t> grabPointer(xcb_grab_pointer_reply(c, xcb_grab_pointer_unchecked(c, false, rootWindow(),
XCB_EVENT_MASK_NO_EVENT,
XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC, XCB_WINDOW_NONE,
cursor.handle(), XCB_TIME_CURRENT_TIME), NULL));
ScopedCPointer<xcb_grab_pointer_reply_t> grabPointer(
xcb_grab_pointer_reply(
c,
xcb_grab_pointer_unchecked(c, false, rootWindow(),
XCB_EVENT_MASK_NO_EVENT,
XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC, XCB_WINDOW_NONE,
cursor.handle(), XCB_TIME_CURRENT_TIME),
NULL
)
);
if (grabPointer.isNull() || grabPointer->status != XCB_GRAB_STATUS_SUCCESS) {
kWarning() << "could not grab pointer";
return;

View file

@ -124,8 +124,8 @@ void DecorationModel::findDecorations()
}
}
}
KService::List offers = KServiceTypeTrader::self()->query("KWin/Decoration");
foreach (KService::Ptr service, offers) {
const KService::List offers = KServiceTypeTrader::self()->query("KWin/Decoration");
foreach (const KService::Ptr service, offers) {
DecorationModelData data;
data.name = service->name();
data.libraryName = "kwin3_aurorae";

View file

@ -183,8 +183,8 @@ static QString attributeString(KWin::AnimationEffect::Attribute attribute)
QList<AniData> AniData::list(const QString &str)
{
QList<AniData> newList;
QStringList list = str.split(';', QString::SkipEmptyParts);
foreach (const QString &astr, list) {
QStringList strlist = str.split(';', QString::SkipEmptyParts);
foreach (const QString &astr, strlist) {
newList << AniData(astr);
if (newList.last().duration < 0)
newList.removeLast();