refactor: server: use contains when possible

This commit is contained in:
sithlord48
2025-08-06 22:22:06 -04:00
committed by Chris Rizzitello
parent 85e7d95188
commit db67550db3

View File

@ -800,10 +800,10 @@ bool Server::isSwitchOkay(
// are we in a locked corner? first check if screen has the option set
// and, if not, check the global options.
const Config::ScreenOptions *options = m_config->getOptions(getName(m_active));
if (options == nullptr || options->count(kOptionScreenSwitchCorners) == 0) {
if (options == nullptr || !options->contains(kOptionScreenSwitchCorners)) {
options = m_config->getOptions("");
}
if (options != nullptr && options->count(kOptionScreenSwitchCorners) > 0) {
if (options != nullptr && options->contains(kOptionScreenSwitchCorners)) {
// get corner mask and size
Config::ScreenOptions::const_iterator i = options->find(kOptionScreenSwitchCorners);
auto corners = static_cast<uint32_t>(i->second);
@ -1129,7 +1129,7 @@ void Server::processOptions()
void Server::handleShapeChanged(BaseClientProxy *client)
{
if (m_clientSet.count(client) == 0) {
if (!m_clientSet.contains(client)) {
return;
}
@ -1164,7 +1164,7 @@ void Server::handleClipboardGrabbed(const Event &event, BaseClientProxy *grabber
}
// ignore events from unknown clients
if (m_clientSet.count(grabber) == 0) {
if (!m_clientSet.contains(grabber)) {
return;
}
const auto *info = static_cast<const IScreen::ClipboardInfo *>(event.getData());
@ -1850,7 +1850,7 @@ void Server::onMouseWheel(int32_t xDelta, int32_t yDelta)
bool Server::addClient(BaseClientProxy *client)
{
std::string name = getName(client);
if (m_clients.count(name) != 0) {
if (m_clients.contains(name)) {
return false;
}