Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ project(DDM
LANGUAGES CXX C)

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
Expand Down Expand Up @@ -234,8 +235,8 @@ add_subdirectory(data)
add_subdirectory(services)
add_subdirectory(src)

#enable_testing()
#add_subdirectory(test)
# enable_testing()
# add_subdirectory(test)

# Display feature summary
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
2 changes: 1 addition & 1 deletion src/auth/AuthMessages.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ namespace SDDM {
inline QDataStream& operator<<(QDataStream &s, const Request &m) {
qint32 length = m.prompts.length();
s << length;
for(const Prompt &p : qAsConst(m.prompts)) {
for (const Prompt &p : std::as_const(m.prompts)) {
s << p;
}
return s;
Expand Down
6 changes: 3 additions & 3 deletions src/auth/AuthRequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace SDDM {
: QObject(parent) { }

void AuthRequest::Private::responseChanged() {
for(const AuthPrompt *qap : qAsConst(prompts)) {
for (const AuthPrompt *qap : std::as_const(prompts)) {
if (qap->response().isEmpty())
return;
}
Expand All @@ -54,7 +54,7 @@ namespace SDDM {
QList<AuthPrompt*> promptsCopy(d->prompts);
d->prompts.clear();
if (request != nullptr) {
for (const Prompt& p : qAsConst(request->prompts)) {
for (const Prompt &p : std::as_const(request->prompts)) {
AuthPrompt *qap = new AuthPrompt(&p, this);
d->prompts << qap;
if (finishAutomatically())
Expand Down Expand Up @@ -96,7 +96,7 @@ namespace SDDM {

Request AuthRequest::request() const {
Request r;
for (const AuthPrompt* qap : qAsConst(d->prompts)) {
for (const AuthPrompt *qap : std::as_const(d->prompts)) {
Prompt p;
p.hidden = qap->hidden();
p.message = qap->message();
Expand Down
8 changes: 4 additions & 4 deletions src/common/ConfigReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ namespace SDDM {
}
m_fileModificationTime = latestModificationTime;

for (const QString &filepath : qAsConst(files)) {
for (const QString &filepath : std::as_const(files)) {
loadInternal(filepath);
}
}
Expand Down Expand Up @@ -245,14 +245,14 @@ namespace SDDM {
if (entry && !entry->matchesDefault())
remainingEntries.insert(section, entry);
else {
for (const ConfigEntryBase *b : qAsConst(section->entries()))
for (const ConfigEntryBase *b : std::as_const(section->entries()))
if (!b->matchesDefault())
remainingEntries.insert(section, b);
}
}
else {
for (const ConfigSection *s : qAsConst(m_sections)) {
for (const ConfigEntryBase *b : qAsConst(s->entries()))
for (const ConfigSection *s : std::as_const(m_sections)) {
for (const ConfigEntryBase *b : std::as_const(s->entries()))
if (!b->matchesDefault())
remainingEntries.insert(s, b);
}
Expand Down
6 changes: 3 additions & 3 deletions src/common/Session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ namespace SDDM {
}

QFile file;
for (const auto &path: qAsConst(sessionDirs)) {
for (const auto &path : std::as_const(sessionDirs)) {
m_dir.setPath(path);
m_fileName = m_dir.absoluteFilePath(fileName);

Expand All @@ -243,8 +243,8 @@ namespace SDDM {

settings.beginGroup(QLatin1String("Desktop Entry"));

auto localizedValue = [&] (const QLatin1String &key) {
for (QString locale : qAsConst(locales)) {
auto localizedValue = [&](const QLatin1String &key) {
for (QString locale : std::as_const(locales)) {
QString localizedValue = settings.value(key + QLatin1Char('[') + locale + QLatin1Char(']'), QString()).toString();
if (!localizedValue.isEmpty()) {
return localizedValue;
Expand Down
2 changes: 1 addition & 1 deletion src/daemon/Seat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ namespace SDDM {
return;
}

QTimer::singleShot(2000, display, [=] { startDisplay(display, tryNr + 1); });
QTimer::singleShot(2000, display, [this, display, tryNr] { startDisplay(display, tryNr + 1); });
}

void Seat::removeDisplay(Display* display) {
Expand Down
8 changes: 4 additions & 4 deletions src/daemon/SeatManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ namespace SDDM {

QDBusPendingReply<QVariant> reply = QDBusConnection::systemBus().asyncCall(canGraphicalMsg);
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply);
connect(watcher, &QDBusPendingCallWatcher::finished, this, [=]() {
connect(watcher, &QDBusPendingCallWatcher::finished, this, [watcher, reply, this]() {
watcher->deleteLater();
if (!reply.isValid())
return;
Expand Down Expand Up @@ -105,10 +105,10 @@ namespace SDDM {
QDBusPendingReply<NamedSeatPathList> reply = QDBusConnection::systemBus().asyncCall(listSeatsMsg);

QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply);
connect(watcher, &QDBusPendingCallWatcher::finished, this, [=]() {
connect(watcher, &QDBusPendingCallWatcher::finished, this, [watcher, reply, this]() {
watcher->deleteLater();
const auto seats = reply.value();
for(const NamedSeatPath &seat : seats) {
for (const NamedSeatPath &seat : seats) {
logindSeatAdded(seat.name, seat.path);
}
});
Expand Down Expand Up @@ -155,7 +155,7 @@ namespace SDDM {
void SDDM::SeatManager::logindSeatAdded(const QString& name, const QDBusObjectPath& objectPath)
{
auto logindSeat = new LogindSeat(name, objectPath);
connect(logindSeat, &LogindSeat::canGraphicalChanged, this, [=]() {
connect(logindSeat, &LogindSeat::canGraphicalChanged, this, [this, logindSeat]() {
if (logindSeat->canGraphical()) {
createSeat(logindSeat->name());
} else {
Expand Down
12 changes: 6 additions & 6 deletions src/daemon/SingleWaylandDisplayServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ SingleWaylandDisplayServer::SingleWaylandDisplayServer(SocketServer *socketServe
qDebug() << "Socket server started.";

// connect signals
connect(m_helperServer, &QLocalServer::newConnection, this, [=] {
connect(m_helperServer, &QLocalServer::newConnection, this, [this] {
QLocalSocket *socket = m_helperServer->nextPendingConnection();

// connect signals
connect(socket, &QLocalSocket::readyRead, this, [=] {
connect(socket, &QLocalSocket::readyRead, this, [this] {
QLocalSocket *socket = qobject_cast<QLocalSocket *>(sender());
QDataStream input(socket);

Expand Down Expand Up @@ -120,8 +120,8 @@ SingleWaylandDisplayServer::SingleWaylandDisplayServer(SocketServer *socketServe
connect(socket, &QLocalSocket::disconnected, socket, &QLocalSocket::deleteLater);
});

connect(m_socketServer, &SocketServer::connected, this, [=](QLocalSocket *socket) {
m_greeterSockets << socket;
connect(m_socketServer, &SocketServer::connected, this, [this](QLocalSocket *socket) {
m_greeterSockets << socket;
});
connect(m_socketServer, &SocketServer::requestStartHelper, this, [this](QLocalSocket *, const QString &path) {
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
Expand All @@ -131,12 +131,12 @@ SingleWaylandDisplayServer::SingleWaylandDisplayServer(SocketServer *socketServe
m_helper->setProcessEnvironment(env);
m_helper->start();
});
connect(m_socketServer, &SocketServer::disconnected, this, [=](QLocalSocket *socket) {
connect(m_socketServer, &SocketServer::disconnected, this, [this](QLocalSocket *socket) {
m_greeterSockets.removeOne(socket);
});

// TODO: use PAM auth again
connect(m_socketServer, &SocketServer::requestActivateUser, this, [this](QLocalSocket *socket, const QString &user){
connect(m_socketServer, &SocketServer::requestActivateUser, this, [this]([[maybe_unused]] QLocalSocket *socket, const QString &user){
activateUser(user);
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/greeter/GreeterApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class GreeterExtensionPlugin : public QQmlEngineExtensionPlugin
qmlRegisterType<GreeterProxy>("TreeLand.Greeter", 1, 0, "Proxy");
}

void initializeEngine(QQmlEngine *engine, const char *uri) final
void initializeEngine([[maybe_unused]] QQmlEngine *engine, [[maybe_unused]] const char *uri) final
{
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/greeter/SessionModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ void SessionModel::populate(Session::Type type, const QStringList &dirPaths) {
}
// read session
sessions.removeDuplicates();
for (auto& session : qAsConst(sessions)) {
for (auto &session : std::as_const(sessions)) {
Session *si = new Session(type, session);
bool execAllowed = true;
QFileInfo fi(si->tryExec());
Expand Down
1 change: 0 additions & 1 deletion src/helper/UserSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ namespace SDDM {
QString sessionType = processEnvironment().value(QStringLiteral("XDG_SESSION_TYPE"));
QString sessionClass = processEnvironment().value(QStringLiteral("XDG_SESSION_CLASS"));
const bool hasDisplayServer = !m_displayServerCmd.isEmpty();
const bool x11UserSession = sessionType == QLatin1String("x11") && sessionClass == QLatin1String("user");
const bool waylandUserSession = sessionType == QLatin1String("wayland") && sessionClass == QLatin1String("user");

// When the display server is part of the session, we leak the VT into
Expand Down
4 changes: 3 additions & 1 deletion src/treeland/helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include <QRegularExpression>

extern "C" {
#define WLR_USE_UNSTABLE
#define static
#include <wlr/types/wlr_output.h>
#include <wlr/types/wlr_compositor.h>
Expand Down Expand Up @@ -98,6 +97,7 @@ bool Helper::registerExclusiveZone(WLayerSurface *layerSurface)
case Right:
infoPtr->m_rightExclusiveMargin += exclusiveZone;
Q_EMIT rightExclusiveMarginChanged();
break;
default:
Q_UNREACHABLE();
}
Expand Down Expand Up @@ -133,6 +133,7 @@ bool Helper::unregisterExclusiveZone(WLayerSurface *layerSurface)
case Right:
infoPtr->m_rightExclusiveMargin -= exclusiveZone;
Q_EMIT rightExclusiveMarginChanged();
break;
default:
Q_UNREACHABLE();
}
Expand Down Expand Up @@ -167,6 +168,7 @@ QJSValue Helper::getExclusiveMargins(WLayerSurface *layerSurface)
break;
case Right:
margins.setRight(margins.right() + exclusiveZone);
break;
default:
Q_UNREACHABLE();
}
Expand Down
6 changes: 1 addition & 5 deletions src/treeland/helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@ class Helper : public WSeatEventFilter {
Q_OBJECT
Q_PROPERTY(WToplevelSurface* activatedSurface READ activatedSurface WRITE setActivateSurface NOTIFY activatedSurfaceChanged FINAL)
Q_PROPERTY(WSurfaceItem* resizingItem READ resizingItem NOTIFY resizingItemChanged FINAL)
Q_PROPERTY(WSurfaceItem* movingItem READ movingItem NOTIFY movingItemChanged FINAL)
Q_PROPERTY(quint32 topExclusiveMargin NOTIFY topExclusiveMarginChanged)
Q_PROPERTY(quint32 bottomExclusiveMargin NOTIFY bottomExclusiveMarginChanged)
Q_PROPERTY(quint32 leftExclusiveMargin NOTIFY leftExclusiveMarginChanged)
Q_PROPERTY(quint32 rightExclusiveMargin NOTIFY rightExclusiveMarginChanged)
Q_PROPERTY(WSurfaceItem *movingItem READ movingItem NOTIFY movingItemChanged FINAL)
QML_ELEMENT
QML_SINGLETON

Expand Down
10 changes: 5 additions & 5 deletions src/treeland/protocols/ext_foreign_toplevel_list_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ static const struct ext_foreign_toplevel_list_v1_interface toplevel_list_impl
.stop = foreign_toplevel_list_handle_stop, .destroy = resource_handle_destroy
};

void foreign_toplevel_list_handle_stop(struct wl_client *client, struct wl_resource *resource)
void foreign_toplevel_list_handle_stop([[maybe_unused]] struct wl_client *client, struct wl_resource *resource)
{
struct ext_foreign_toplevel_list_v1 *handle = foreign_toplevel_list_from_resource(resource);
[[maybe_unused]] struct ext_foreign_toplevel_list_v1 *handle = foreign_toplevel_list_from_resource(resource);

// TODO: stop
}
Expand Down Expand Up @@ -137,7 +137,7 @@ void ext_foreign_toplevel_list_bind(struct wl_client *client,
}
}

void ext_foreign_toplevel_list_handle_display_destroy(struct wl_listener *listener, void *data)
void ext_foreign_toplevel_list_handle_display_destroy(struct wl_listener *listener, [[maybe_unused]] void *data)
{
struct ext_foreign_toplevel_list_v1 *list = wl_container_of(listener, list, display_destroy);
ext_foreign_toplevel_list_v1_destroy(list);
Expand All @@ -154,8 +154,8 @@ struct ext_foreign_toplevel_list_v1 *ext_foreign_toplevel_list_v1_create(struct
handle,
ext_foreign_toplevel_list_bind);
if (!handle->global) {
free(handle);
return NULL;
delete handle;
return nullptr;
}

wl_signal_init(&handle->events.destroy);
Expand Down
11 changes: 6 additions & 5 deletions src/treeland/protocols/foreign_toplevel_manager_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ static const struct ztreeland_foreign_toplevel_manager_v1_interface foreign_topl
.stop = foreign_toplevel_manager_handle_stop
};

void foreign_toplevel_manager_handle_stop(struct wl_client *client, struct wl_resource *resource)
void foreign_toplevel_manager_handle_stop([[maybe_unused]] struct wl_client *client,
[[maybe_unused]] struct wl_resource *resource)
{
qDebug() << Q_FUNC_INFO;
}
Expand Down Expand Up @@ -118,7 +119,7 @@ void foreign_toplevel_manager_bind(struct wl_client *client,
}
}

void foreign_toplevel_manager_handle_display_destroy(struct wl_listener *listener, void *data)
void foreign_toplevel_manager_handle_display_destroy(struct wl_listener *listener, [[maybe_unused]] void *data)
{
struct ztreeland_foreign_toplevel_manager_v1 *manager =
wl_container_of(listener, manager, display_destroy);
Expand Down Expand Up @@ -150,8 +151,8 @@ ztreeland_foreign_toplevel_manager_v1_create(struct wl_display *display)
handle,
foreign_toplevel_manager_bind);
if (!handle->global) {
free(handle);
return NULL;
delete handle;
return nullptr;
}

wl_signal_init(&handle->events.destroy);
Expand Down Expand Up @@ -253,4 +254,4 @@ void ztreeland_foreign_toplevel_handle_v1_identifier(
identifier.toUtf8());
}
}
}
}
4 changes: 2 additions & 2 deletions src/treeland/protocols/shortcut_manager_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void shortcut_manager_bind(struct wl_client *client,
NULL);
}

void shortcut_manager_handle_display_destroy(struct wl_listener *listener, void *data)
void shortcut_manager_handle_display_destroy(struct wl_listener *listener, [[maybe_unused]] void *data)
{
struct ztreeland_shortcut_manager_v1 *manager =
wl_container_of(listener, manager, display_destroy);
Expand All @@ -115,4 +115,4 @@ void shortcut_manager_handle_display_destroy(struct wl_listener *listener, void
wl_global_destroy(manager->global);
wl_list_remove(&manager->display_destroy.link);
free(manager);
}
}
15 changes: 9 additions & 6 deletions src/treeland/protocols/socket_manager_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ struct treeland_socket_context_v1 *socket_context_from_resource(struct wl_resour
struct treeland_socket_manager_v1 *socket_manager_from_resource(
struct wl_resource *resource);

void context_handle_set_username(struct wl_client *client,
struct wl_resource *resource, const char *username) {
void context_handle_set_username([[maybe_unused]] struct wl_client *client, struct wl_resource *resource, const char *username)
{
struct treeland_socket_context_v1 *context = socket_context_from_resource(resource);
if (!context) {
wl_resource_post_error(resource,
Expand All @@ -39,7 +39,8 @@ void context_handle_set_username(struct wl_client *client,
context->state.username = strdup(username);
}

void context_handle_set_fd(struct wl_client *client, struct wl_resource *resource, int32_t fd) {
void context_handle_set_fd([[maybe_unused]] struct wl_client *client, struct wl_resource *resource, int32_t fd)
{
struct treeland_socket_context_v1 *context = socket_context_from_resource(resource);
if (!context) {
wl_resource_post_error(resource,
Expand All @@ -52,7 +53,8 @@ void context_handle_set_fd(struct wl_client *client, struct wl_resource *resourc
context->state.fd = fd;
}

void context_handle_commit(struct wl_client *client, struct wl_resource *resource) {
void context_handle_commit([[maybe_unused]] struct wl_client *client, struct wl_resource *resource)
{
struct treeland_socket_context_v1 *context = socket_context_from_resource(resource);
if (!context) {
wl_resource_post_error(resource,
Expand Down Expand Up @@ -145,7 +147,8 @@ void socket_manager_bind(struct wl_client *client, void *data, uint32_t version,
wl_resource_set_implementation(resource, &socket_manager_impl, manager, NULL);
}

void socket_manager_handle_display_destroy(struct wl_listener *listener, void *data) {
void socket_manager_handle_display_destroy(struct wl_listener *listener, [[maybe_unused]] void *data)
{
struct treeland_socket_manager_v1 *manager =
wl_container_of(listener, manager, display_destroy);
wl_signal_emit_mutable(&manager->events.destroy, manager);
Expand All @@ -160,4 +163,4 @@ void socket_manager_handle_display_destroy(struct wl_listener *listener, void *d
wl_global_destroy(manager->global);
wl_list_remove(&manager->display_destroy.link);
free(manager);
}
}
Loading