From 4541501ccc1e42e2ad871152898f197a80d3c174 Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Wed, 14 Jun 2023 16:05:57 +0200 Subject: [PATCH] get rid of some unnecessary const_casts --- src/activation.cpp | 2 +- src/events.cpp | 2 +- src/rules.h | 2 +- src/tiles/tile.cpp | 2 +- src/workspace.h | 2 +- src/x11window.cpp | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/activation.cpp b/src/activation.cpp index df80da8463..87780eb3cd 100644 --- a/src/activation.cpp +++ b/src/activation.cpp @@ -551,7 +551,7 @@ void Workspace::switchToOutput(Output *output) void Workspace::gotFocusIn(const Window *window) { - if (should_get_focus.contains(const_cast(window))) { + if (should_get_focus.contains(window)) { // remove also all sooner elements that should have got FocusIn, // but didn't for some reason (and also won't anymore, because they were sooner) while (should_get_focus.first() != window) { diff --git a/src/events.cpp b/src/events.cpp index a3b43bc8db..5664d23d78 100644 --- a/src/events.cpp +++ b/src/events.cpp @@ -1117,7 +1117,7 @@ bool X11Window::buttonReleaseEvent(xcb_window_t w, int button, int state, int x, return true; } if (w == frameId() && workspace()->userActionsMenu() && workspace()->userActionsMenu()->isShown()) { - const_cast(workspace()->userActionsMenu())->grabInput(); + workspace()->userActionsMenu()->grabInput(); } x = this->x(); // translate from grab window to local coords y = this->y(); diff --git a/src/rules.h b/src/rules.h index 24d8a3c4b9..eb3835a62b 100644 --- a/src/rules.h +++ b/src/rules.h @@ -363,7 +363,7 @@ inline WindowRules::WindowRules() inline bool WindowRules::contains(const Rules *rule) const { - return rules.contains(const_cast(rule)); + return rules.contains(rule); } inline void WindowRules::remove(Rules *rule) diff --git a/src/tiles/tile.cpp b/src/tiles/tile.cpp index ee8043e1a5..4a2ef0551c 100644 --- a/src/tiles/tile.cpp +++ b/src/tiles/tile.cpp @@ -394,7 +394,7 @@ TileManager *Tile::manager() const int Tile::row() const { if (m_parentTile) { - return m_parentTile->m_children.indexOf(const_cast(this)); + return m_parentTile->m_children.indexOf(this); } return -1; diff --git a/src/workspace.h b/src/workspace.h index bd1850c033..1e7af8e466 100644 --- a/src/workspace.h +++ b/src/workspace.h @@ -306,7 +306,7 @@ public: * it's not already. */ void showWindowMenu(const QRect &pos, Window *cl); - const UserActionsMenu *userActionsMenu() const + UserActionsMenu *userActionsMenu() const { return m_userActionsMenu; } diff --git a/src/x11window.cpp b/src/x11window.cpp index 094dc0849e..a53c1860ef 100644 --- a/src/x11window.cpp +++ b/src/x11window.cpp @@ -3404,7 +3404,7 @@ bool X11Window::hasTransientInternal(const X11Window *cl, bool indirect, QList(cl))) { + if (transients().contains(cl)) { return true; } if (!indirect) {