Constify Qt containers passed to ranges

This constifies a few mutable Qt containers passed to std::ranges to improve the efficiency.
wilder/Plasma/6.2
Fushan Wen 2 years ago committed by Vlad Zahorodnii
parent d2d92cdfd2
commit 7a2e6bb58e
  1. 4
      src/backends/libinput/connection.cpp
  2. 4
      src/backends/x11/windowed/x11_windowed_backend.cpp

@ -287,10 +287,10 @@ void Connection::processEvents()
break;
}
case LIBINPUT_EVENT_DEVICE_REMOVED: {
auto it = std::ranges::find_if(m_devices, [&event](Device *d) {
auto it = std::ranges::find_if(std::as_const(m_devices), [&event](Device *d) {
return event->device() == d;
});
if (it == m_devices.end()) {
if (it == m_devices.cend()) {
// we don't know this device
break;
}

@ -513,10 +513,10 @@ void X11WindowedBackend::updateWindowTitle()
void X11WindowedBackend::handleClientMessage(xcb_client_message_event_t *event)
{
auto it = std::ranges::find_if(m_outputs, [event](X11WindowedOutput *output) {
auto it = std::ranges::find_if(std::as_const(m_outputs), [event](X11WindowedOutput *output) {
return output->window() == event->window;
});
if (it == m_outputs.end()) {
if (it == m_outputs.cend()) {
return;
}
if (event->type == m_protocols && m_protocols != XCB_ATOM_NONE) {

Loading…
Cancel
Save