chore: declare const methods recommened by sonar

This commit is contained in:
sithlord48 2025-05-19 22:19:19 -04:00 committed by Nick Bolton
parent 635962618f
commit c224cd4661
48 changed files with 91 additions and 87 deletions

View file

@ -751,7 +751,7 @@ const int *ArchNetworkBSD::getUnblockPipeForThread(ArchThread thread)
return unblockPipe; return unblockPipe;
} }
void ArchNetworkBSD::throwError(int err) void ArchNetworkBSD::throwError(int err) const
{ {
switch (err) { switch (err) {
case EINTR: case EINTR:
@ -822,7 +822,7 @@ void ArchNetworkBSD::throwError(int err)
} }
} }
void ArchNetworkBSD::throwNameError(int err) void ArchNetworkBSD::throwNameError(int err) const
{ {
static const char *s_msg[] = { static const char *s_msg[] = {
"The specified host is unknown", "The requested name is valid but does not have an IP address", "The specified host is unknown", "The requested name is valid but does not have an IP address",

View file

@ -123,8 +123,8 @@ private:
const int *getUnblockPipe(); const int *getUnblockPipe();
const int *getUnblockPipeForThread(ArchThread); const int *getUnblockPipeForThread(ArchThread);
void setBlockingOnSocket(int fd, bool blocking); void setBlockingOnSocket(int fd, bool blocking);
void throwError(int); void throwError(int) const;
void throwNameError(int); void throwNameError(int) const;
private: private:
std::shared_ptr<Deps> m_pDeps; std::shared_ptr<Deps> m_pDeps;

View file

@ -72,8 +72,9 @@ bool ConsoleLogOutputter::write(ELevel level, const char *msg)
return true; return true;
} }
void ConsoleLogOutputter::flush() void ConsoleLogOutputter::flush() const
{ {
// do nothing
} }
// //

View file

@ -47,7 +47,7 @@ public:
void close() override; void close() override;
void show(bool showIfEmpty) override; void show(bool showIfEmpty) override;
bool write(ELevel level, const char *message) override; bool write(ELevel level, const char *message) override;
void flush(); void flush() const;
}; };
//! Write log to file //! Write log to file

View file

@ -135,7 +135,7 @@ void App::setupFileLogging()
} }
} }
void App::loggingFilterWarning() void App::loggingFilterWarning() const
{ {
if (CLOG->getFilter() > CLOG->getConsoleMaxLevel()) { if (CLOG->getFilter() > CLOG->getConsoleMaxLevel()) {
if (argsBase().m_logFile == nullptr) { if (argsBase().m_logFile == nullptr) {

View file

@ -80,7 +80,7 @@ public:
int run(int argc, char **argv); int run(int argc, char **argv);
int daemonMainLoop(int, const char **); int daemonMainLoop(int, const char **);
void setupFileLogging(); void setupFileLogging();
void loggingFilterWarning(); void loggingFilterWarning() const;
void initApp(int argc, const char **argv) override; void initApp(int argc, const char **argv) override;
void initApp(int argc, char **argv) void initApp(int argc, char **argv)
{ {

View file

@ -143,7 +143,7 @@ bool ArgParser::parsePlatformArgs(
#endif #endif
} }
bool ArgParser::parseGenericArgs(int argc, const char *const *argv, int &i) bool ArgParser::parseGenericArgs(int argc, const char *const *argv, int &i) const
{ {
if (isArg(i, argc, argv, "-a", "--address", 1)) { if (isArg(i, argc, argv, "-a", "--address", 1)) {
argsBase().m_deskflowAddress = argv[++i]; argsBase().m_deskflowAddress = argv[++i];
@ -197,7 +197,7 @@ bool ArgParser::parseGenericArgs(int argc, const char *const *argv, int &i)
return true; return true;
} }
bool ArgParser::parseDeprecatedArgs(int argc, const char *const *argv, int &i) bool ArgParser::parseDeprecatedArgs(int argc, const char *const *argv, int &i) const
{ {
static const std::vector<const char *> deprecatedArgs = { static const std::vector<const char *> deprecatedArgs = {
"--crypto-pass", "--res-w", "--res-h", "--prm-wc", "--prm-hc" "--crypto-pass", "--res-w", "--res-h", "--prm-wc", "--prm-hc"
@ -353,13 +353,13 @@ ArgParser::assembleCommand(std::vector<std::string> &argsArray, std::string igno
return result; return result;
} }
void ArgParser::updateCommonArgs(const char *const *argv) void ArgParser::updateCommonArgs(const char *const *argv) const
{ {
argsBase().m_name = ARCH->getHostName(); argsBase().m_name = ARCH->getHostName();
argsBase().m_pname = QFileInfo(argv[0]).fileName().toLocal8Bit().constData(); argsBase().m_pname = QFileInfo(argv[0]).fileName().toLocal8Bit().constData();
} }
bool ArgParser::checkUnexpectedArgs() bool ArgParser::checkUnexpectedArgs() const
{ {
#if SYSAPI_WIN32 #if SYSAPI_WIN32
// suggest that user installs as a windows service. when launched as // suggest that user installs as a windows service. when launched as

View file

@ -26,9 +26,9 @@ public:
bool parseServerArgs(deskflow::ServerArgs &args, int argc, const char *const *argv); bool parseServerArgs(deskflow::ServerArgs &args, int argc, const char *const *argv);
bool parseClientArgs(deskflow::ClientArgs &args, int argc, const char *const *argv); bool parseClientArgs(deskflow::ClientArgs &args, int argc, const char *const *argv);
bool parsePlatformArgs(deskflow::ArgsBase &argsBase, const int &argc, const char *const *argv, int &i, bool isServer); bool parsePlatformArgs(deskflow::ArgsBase &argsBase, const int &argc, const char *const *argv, int &i, bool isServer);
bool parseGenericArgs(int argc, const char *const *argv, int &i); bool parseGenericArgs(int argc, const char *const *argv, int &i) const;
bool parseDeprecatedArgs(int argc, const char *const *argv, int &i); bool parseDeprecatedArgs(int argc, const char *const *argv, int &i) const;
void setArgsBase(deskflow::ArgsBase &argsBase) void setArgsBase(deskflow::ArgsBase &argsBase) const
{ {
m_argsBase = &argsBase; m_argsBase = &argsBase;
} }
@ -49,8 +49,8 @@ public:
} }
private: private:
void updateCommonArgs(const char *const *argv); void updateCommonArgs(const char *const *argv) const;
bool checkUnexpectedArgs(); bool checkUnexpectedArgs() const;
private: private:
App *m_app; App *m_app;

View file

@ -204,17 +204,18 @@ void ClientApp::updateStatus()
updateStatus(""); updateStatus("");
} }
void ClientApp::updateStatus(const std::string &msg) void ClientApp::updateStatus(const std::string &msg) const
{ {
// do nothing
} }
void ClientApp::resetRestartTimeout() void ClientApp::resetRestartTimeout() const
{ {
// retry time can nolonger be changed // retry time can nolonger be changed
// s_retryTime = 0.0; // s_retryTime = 0.0;
} }
double ClientApp::nextRestartTimeout() double ClientApp::nextRestartTimeout() const
{ {
// retry at a constant rate (Issue 52) // retry at a constant rate (Issue 52)
return RETRY_TIME; return RETRY_TIME;

View file

@ -62,9 +62,9 @@ public:
// //
void updateStatus(); void updateStatus();
void updateStatus(const std::string &msg); void updateStatus(const std::string &msg) const;
void resetRestartTimeout(); void resetRestartTimeout() const;
double nextRestartTimeout(); double nextRestartTimeout() const;
void handleScreenError(const Event &, void *); void handleScreenError(const Event &, void *);
deskflow::Screen *openClientScreen(); deskflow::Screen *openClientScreen();
void closeClientScreen(deskflow::Screen *screen); void closeClientScreen(deskflow::Screen *screen);

View file

@ -72,7 +72,7 @@ public:
int32_t pollActiveGroup() const override = 0; int32_t pollActiveGroup() const override = 0;
void pollPressedKeys(KeyButtonSet &pressedKeys) const override = 0; void pollPressedKeys(KeyButtonSet &pressedKeys) const override = 0;
int32_t getKeyState(KeyButton keyButton) int32_t getKeyState(KeyButton keyButton) const
{ {
return m_keys[keyButton]; return m_keys[keyButton];
} }

View file

@ -225,7 +225,7 @@ void Screen::mouseMove(int32_t x, int32_t y)
m_screen->fakeMouseMove(x, y); m_screen->fakeMouseMove(x, y);
} }
void Screen::mouseRelativeMove(int32_t dx, int32_t dy) void Screen::mouseRelativeMove(int32_t dx, int32_t dy) const
{ {
assert(!m_isPrimary); assert(!m_isPrimary);
m_screen->fakeMouseRelativeMove(dx, dy); m_screen->fakeMouseRelativeMove(dx, dy);
@ -400,12 +400,12 @@ void Screen::disableSecondary()
m_screen->closeScreensaver(); m_screen->closeScreensaver();
} }
void Screen::enterPrimary() void Screen::enterPrimary() const
{ {
// do nothing // do nothing
} }
void Screen::enterSecondary(KeyModifierMask) void Screen::enterSecondary(KeyModifierMask) const
{ {
// do nothing // do nothing
} }

View file

@ -153,7 +153,7 @@ public:
Synthesize mouse events to generate mouse motion by the relative Synthesize mouse events to generate mouse motion by the relative
amount \c xRel,yRel. amount \c xRel,yRel.
*/ */
void mouseRelativeMove(int32_t xRel, int32_t yRel); void mouseRelativeMove(int32_t xRel, int32_t yRel) const;
//! Notify of mouse wheel motion //! Notify of mouse wheel motion
/*! /*!
@ -285,8 +285,8 @@ protected:
void disablePrimary(); void disablePrimary();
void disableSecondary(); void disableSecondary();
void enterPrimary(); void enterPrimary() const;
void enterSecondary(KeyModifierMask toggleMask); void enterSecondary(KeyModifierMask toggleMask) const;
void leavePrimary(); void leavePrimary();
void leaveSecondary(); void leaveSecondary();

View file

@ -269,8 +269,9 @@ void ServerApp::updateStatus()
updateStatus(""); updateStatus("");
} }
void ServerApp::updateStatus(const std::string &msg) void ServerApp::updateStatus(const std::string &msg) const
{ {
// do nothing
} }
void ServerApp::closeClientListener(ClientListener *listen) void ServerApp::closeClientListener(ClientListener *listen)
@ -603,6 +604,7 @@ void ServerApp::handleNoClients(const Event &, void *)
void ServerApp::handleScreenSwitched(const Event &e, void *) void ServerApp::handleScreenSwitched(const Event &e, void *)
{ {
// do nothing
} }
ISocketFactory *ServerApp::getSocketFactory() const ISocketFactory *ServerApp::getSocketFactory() const

View file

@ -86,7 +86,7 @@ public:
void closeServer(Server *server); void closeServer(Server *server);
void stopRetryTimer(); void stopRetryTimer();
void updateStatus(); void updateStatus();
void updateStatus(const std::string &msg); void updateStatus(const std::string &msg) const;
void closeClientListener(ClientListener *listen); void closeClientListener(ClientListener *listen);
void stopServer(); void stopServer();
void closePrimaryClient(PrimaryClient *primaryClient); void closePrimaryClient(PrimaryClient *primaryClient);

View file

@ -701,7 +701,7 @@ void MainWindow::applyConfig()
updateModeControls(coreMode == Settings::CoreMode::Server); updateModeControls(coreMode == Settings::CoreMode::Server);
} }
void MainWindow::saveSettings() void MainWindow::saveSettings() const
{ {
if (ui->rbModeClient->isChecked()) { if (ui->rbModeClient->isChecked()) {
Settings::setValue(Settings::Core::CoreMode, Settings::CoreMode::Client); Settings::setValue(Settings::Core::CoreMode, Settings::CoreMode::Client);
@ -1116,7 +1116,7 @@ void MainWindow::setHostName()
applyConfig(); applyConfig();
} }
QString MainWindow::trustedFingerprintDatabase() QString MainWindow::trustedFingerprintDatabase() const
{ {
const bool isClient = m_coreProcess.mode() == CoreMode::Client; const bool isClient = m_coreProcess.mode() == CoreMode::Client;
return isClient ? Settings::tlsTrustedServersDb() : Settings::tlsTrustedClientsDb(); return isClient ? Settings::tlsTrustedServersDb() : Settings::tlsTrustedClientsDb();

View file

@ -142,7 +142,7 @@ private:
void handleLogLine(const QString &line); void handleLogLine(const QString &line);
void updateLocalFingerprint(); void updateLocalFingerprint();
void updateScreenName(); void updateScreenName();
void saveSettings(); void saveSettings() const;
void showConfigureServer(const QString &message); void showConfigureServer(const QString &message);
void restoreWindow(); void restoreWindow();
void setupControls(); void setupControls();
@ -159,7 +159,7 @@ private:
* @brief trustedFingerprintDatabase get the FingerprintDatabase for the trusted clients or trusted servers. * @brief trustedFingerprintDatabase get the FingerprintDatabase for the trusted clients or trusted servers.
* @return The path to the trusted fingerprint file * @return The path to the trusted fingerprint file
*/ */
QString trustedFingerprintDatabase(); QString trustedFingerprintDatabase() const;
// Generate prints if they are missing // Generate prints if they are missing
// Returns true if successful // Returns true if successful

View file

@ -454,12 +454,12 @@ void ServerConfig::addClient(const QString &clientName)
m_Screens.addScreenByPriority(Screen(clientName)); m_Screens.addScreenByPriority(Screen(clientName));
} }
void ServerConfig::setConfigFile(const QString &configFile) void ServerConfig::setConfigFile(const QString &configFile) const
{ {
Settings::setValue(Settings::Server::ExternalConfigFile, configFile); Settings::setValue(Settings::Server::ExternalConfigFile, configFile);
} }
void ServerConfig::setUseExternalConfig(bool useExternalConfig) void ServerConfig::setUseExternalConfig(bool useExternalConfig) const
{ {
Settings::setValue(Settings::Server::ExternalConfig, useExternalConfig); Settings::setValue(Settings::Server::ExternalConfig, useExternalConfig);
} }

View file

@ -241,8 +241,8 @@ private:
{ {
m_ClipboardSharing = on; m_ClipboardSharing = on;
} }
void setConfigFile(const QString &configFile); void setConfigFile(const QString &configFile) const;
void setUseExternalConfig(bool useExternalConfig); void setUseExternalConfig(bool useExternalConfig) const;
size_t setClipboardSharingSize(size_t size); size_t setClipboardSharingSize(size_t size);
QList<bool> &switchCorners() QList<bool> &switchCorners()
{ {

View file

@ -700,7 +700,7 @@ QString CoreProcess::requestDaemonLogPath()
return logPath; return logPath;
} }
void CoreProcess::persistLogDir() void CoreProcess::persistLogDir() const
{ {
QDir(QFileInfo(Settings::value(Settings::Log::File).toString()).absolutePath()).mkpath("."); QDir(QFileInfo(Settings::value(Settings::Log::File).toString()).absolutePath()).mkpath(".");
} }

View file

@ -147,7 +147,7 @@ private:
QString correctedInterface() const; QString correctedInterface() const;
QString correctedAddress() const; QString correctedAddress() const;
QString requestDaemonLogPath(); QString requestDaemonLogPath();
void persistLogDir(); void persistLogDir() const;
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
void checkOSXNotification(const QString &line); void checkOSXNotification(const QString &line);

View file

@ -45,7 +45,7 @@ AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), ui{std::make_unique
setMinimumSize(size()); setMinimumSize(size());
} }
void AboutDialog::copyVersionText() void AboutDialog::copyVersionText() const
{ {
QString infoString = QStringLiteral("Deskflow: %1 (%2)\nQt: %3\nSystem: %4") QString infoString = QStringLiteral("Deskflow: %1 (%2)\nQt: %3\nSystem: %4")
.arg(kVersion, kVersionGitSha, qVersion(), QSysInfo::prettyProductName()); .arg(kVersion, kVersionGitSha, qVersion(), QSysInfo::prettyProductName());

View file

@ -23,7 +23,7 @@ public:
private: private:
std::unique_ptr<Ui::AboutDialog> ui; std::unique_ptr<Ui::AboutDialog> ui;
void copyVersionText(); void copyVersionText() const;
inline static const auto s_awesomeDevs = QStringList{ inline static const auto s_awesomeDevs = QStringList{
// Chris is the ultimate creator, and the one who started it all in 2001. // Chris is the ultimate creator, and the one who started it all in 2001.

View file

@ -32,7 +32,7 @@ public:
AddClientDialog(const QString &clientName, QWidget *parent = nullptr); AddClientDialog(const QString &clientName, QWidget *parent = nullptr);
~AddClientDialog() override; ~AddClientDialog() override;
int addResult() int addResult() const
{ {
return m_AddResult; return m_AddResult;
} }

View file

@ -54,7 +54,7 @@ SettingsDialog::SettingsDialog(QWidget *parent, const IServerConfig &serverConfi
initConnections(); initConnections();
} }
void SettingsDialog::initConnections() void SettingsDialog::initConnections() const
{ {
connect(this, &SettingsDialog::shown, this, &SettingsDialog::showReadOnlyMessage, Qt::QueuedConnection); connect(this, &SettingsDialog::shown, this, &SettingsDialog::showReadOnlyMessage, Qt::QueuedConnection);
@ -281,7 +281,7 @@ void SettingsDialog::updateControls()
updateTlsControls(); updateTlsControls();
} }
void SettingsDialog::updateRequestedKeySize() void SettingsDialog::updateRequestedKeySize() const
{ {
if (ui->comboTlsKeyLength->currentText() == Settings::value(Settings::Security::KeySize).toString()) if (ui->comboTlsKeyLength->currentText() == Settings::value(Settings::Security::KeySize).toString())
return; return;

View file

@ -34,7 +34,7 @@ signals:
void shown(); void shown();
private: private:
void initConnections(); void initConnections() const;
void regenCertificates(); void regenCertificates();
void browseCertificatePath(); void browseCertificatePath();
void browseLogPath(); void browseLogPath();
@ -56,7 +56,7 @@ private:
void updateControls(); void updateControls();
/// @brief updates the setting vaule for key size. /// @brief updates the setting vaule for key size.
void updateRequestedKeySize(); void updateRequestedKeySize() const;
std::unique_ptr<Ui::SettingsDialog> ui; std::unique_ptr<Ui::SettingsDialog> ui;
const IServerConfig &m_serverConfig; const IServerConfig &m_serverConfig;

View file

@ -48,7 +48,7 @@ bool TlsCertificate::generateCertificate(const QString &path, int keyLength)
return generateFingerprint(path); return generateFingerprint(path);
} }
bool TlsCertificate::generateFingerprint(const QString &certificateFilename) bool TlsCertificate::generateFingerprint(const QString &certificateFilename) const
{ {
qDebug("generating tls fingerprint"); qDebug("generating tls fingerprint");
const std::string certPath = certificateFilename.toStdString(); const std::string certPath = certificateFilename.toStdString();
@ -57,12 +57,12 @@ bool TlsCertificate::generateFingerprint(const QString &certificateFilename)
return db.write(Settings::tlsLocalDb()); return db.write(Settings::tlsLocalDb());
} }
int TlsCertificate::getCertKeyLength(const QString &path) int TlsCertificate::getCertKeyLength(const QString &path) const
{ {
return deskflow::getCertLength(path.toStdString()); return deskflow::getCertLength(path.toStdString());
} }
bool TlsCertificate::isCertificateValid(const QString &path) bool TlsCertificate::isCertificateValid(const QString &path) const
{ {
OpenSSL_add_all_algorithms(); OpenSSL_add_all_algorithms();
ERR_load_crypto_strings(); ERR_load_crypto_strings();

View file

@ -16,8 +16,8 @@ class TlsCertificate : public QObject
public: public:
explicit TlsCertificate(QObject *parent = nullptr); explicit TlsCertificate(QObject *parent = nullptr);
bool isCertificateValid(const QString &path); bool isCertificateValid(const QString &path) const;
bool generateCertificate(const QString &path, int keyLength); bool generateCertificate(const QString &path, int keyLength);
bool generateFingerprint(const QString &certificateFilename); bool generateFingerprint(const QString &certificateFilename) const;
int getCertKeyLength(const QString &path); int getCertKeyLength(const QString &path) const;
}; };

View file

@ -87,7 +87,7 @@ void FingerprintDatabase::addTrusted(const Fingerprint &fingerprint)
m_fingerprints.append(fingerprint); m_fingerprints.append(fingerprint);
} }
bool FingerprintDatabase::isTrusted(const Fingerprint &fingerprint) bool FingerprintDatabase::isTrusted(const Fingerprint &fingerprint) const
{ {
return m_fingerprints.contains(fingerprint); return m_fingerprints.contains(fingerprint);
} }

View file

@ -22,7 +22,7 @@ public:
void clear(); void clear();
void addTrusted(const Fingerprint &fingerprint); void addTrusted(const Fingerprint &fingerprint);
bool isTrusted(const Fingerprint &fingerprint); bool isTrusted(const Fingerprint &fingerprint) const;
const QList<Fingerprint> &fingerprints() const const QList<Fingerprint> &fingerprints() const
{ {

View file

@ -201,7 +201,7 @@ std::string NetworkAddress::getHostname() const
return m_hostname; return m_hostname;
} }
void NetworkAddress::checkPort() void NetworkAddress::checkPort() const
{ {
// check port number // check port number
if (m_port < 0 || m_port > 65535) { if (m_port < 0 || m_port > 65535) {

View file

@ -105,7 +105,7 @@ public:
//@} //@}
private: private:
void checkPort(); void checkPort() const;
private: private:
ArchNetAddress m_address = nullptr; ArchNetAddress m_address = nullptr;

View file

@ -287,7 +287,7 @@ int SecureSocket::secureWrite(const void *buffer, int size, int &wrote)
return wrote; return wrote;
} }
bool SecureSocket::isSecureReady() bool SecureSocket::isSecureReady() const
{ {
return m_secureReady; return m_secureReady;
} }
@ -643,7 +643,7 @@ void SecureSocket::disconnect()
sendEvent(EventTypes::StreamInputShutdown); sendEvent(EventTypes::StreamInputShutdown);
} }
bool SecureSocket::verifyCertFingerprint(const QString &FingerprintDatabasePath) bool SecureSocket::verifyCertFingerprint(const QString &FingerprintDatabasePath) const
{ {
const auto cert = SSL_get_peer_certificate(m_ssl->m_ssl); const auto cert = SSL_get_peer_certificate(m_ssl->m_ssl);
const auto sha256 = deskflow::sslCertFingerprint(cert, Fingerprint::Type::SHA256); const auto sha256 = deskflow::sslCertFingerprint(cert, Fingerprint::Type::SHA256);

View file

@ -57,7 +57,7 @@ public:
{ {
m_fatal = b; m_fatal = b;
} }
bool isSecureReady(); bool isSecureReady() const;
void secureConnect(); void secureConnect();
void secureAccept(); void secureAccept();
int secureRead(void *buffer, int size, int &read); int secureRead(void *buffer, int size, int &read);
@ -77,7 +77,7 @@ private:
bool showCertificate() const; bool showCertificate() const;
void checkResult(int n, int &retry); void checkResult(int n, int &retry);
void disconnect(); void disconnect();
bool verifyCertFingerprint(const QString &FingerprintDatabasePath); bool verifyCertFingerprint(const QString &FingerprintDatabasePath) const;
ISocketMultiplexerJob *serviceConnect(ISocketMultiplexerJob *, bool, bool, bool); ISocketMultiplexerJob *serviceConnect(ISocketMultiplexerJob *, bool, bool, bool);

View file

@ -79,11 +79,11 @@ protected:
void setJob(ISocketMultiplexerJob *); void setJob(ISocketMultiplexerJob *);
bool isReadable() bool isReadable() const
{ {
return m_readable; return m_readable;
} }
bool isWritable() bool isWritable() const
{ {
return m_writable; return m_writable;
} }

View file

@ -91,7 +91,7 @@ EiScreen::~EiScreen()
delete portal_input_capture_; delete portal_input_capture_;
} }
void EiScreen::handle_ei_log_event(ei *ei, ei_log_priority priority, const char *message, ei_log_context *context) void EiScreen::handle_ei_log_event(ei *ei, ei_log_priority priority, const char *message, ei_log_context *context) const
{ {
switch (priority) { switch (priority) {
case EI_LOG_PRIORITY_DEBUG: case EI_LOG_PRIORITY_DEBUG:
@ -693,7 +693,7 @@ void EiScreen::on_motion_event(ei_event *event)
} }
} }
void EiScreen::on_abs_motion_event(ei_event *event) void EiScreen::on_abs_motion_event(ei_event *event) const
{ {
assert(is_primary_); assert(is_primary_);
} }

View file

@ -96,9 +96,9 @@ private:
void on_pointer_scroll_event(ei_event *event); void on_pointer_scroll_event(ei_event *event);
void on_pointer_scroll_discrete_event(ei_event *event); void on_pointer_scroll_discrete_event(ei_event *event);
void on_motion_event(ei_event *event); void on_motion_event(ei_event *event);
void on_abs_motion_event(ei_event *event); void on_abs_motion_event(ei_event *event) const;
bool on_hotkey(KeyID key, bool is_press, KeyModifierMask mask); bool on_hotkey(KeyID key, bool is_press, KeyModifierMask mask);
void handle_ei_log_event(ei *ei, ei_log_priority priority, const char *message, ei_log_context *context); void handle_ei_log_event(ei *ei, ei_log_priority priority, const char *message, ei_log_context *context) const;
void handle_connected_to_eis_event(const Event &event, void *); void handle_connected_to_eis_event(const Event &event, void *);
void handle_portal_session_closed(const Event &event, void *); void handle_portal_session_closed(const Event &event, void *);

View file

@ -73,12 +73,12 @@ PortalInputCapture::~PortalInputCapture()
g_object_unref(portal_); g_object_unref(portal_);
} }
gboolean PortalInputCapture::timeout_handler() gboolean PortalInputCapture::timeout_handler() const
{ {
return true; // keep re-triggering return true; // keep re-triggering
} }
int PortalInputCapture::fake_eis_fd() int PortalInputCapture::fake_eis_fd() const
{ {
auto path = std::getenv("LIBEI_SOCKET"); auto path = std::getenv("LIBEI_SOCKET");

View file

@ -34,7 +34,7 @@ public:
private: private:
void glib_thread(void *); void glib_thread(void *);
gboolean timeout_handler(); gboolean timeout_handler() const;
gboolean init_input_capture_session(); gboolean init_input_capture_session();
void cb_init_input_capture_session(GObject *object, GAsyncResult *res); void cb_init_input_capture_session(GObject *object, GAsyncResult *res);
void cb_set_pointer_barriers(GObject *object, GAsyncResult *res); void cb_set_pointer_barriers(GObject *object, GAsyncResult *res);
@ -68,7 +68,7 @@ private:
reinterpret_cast<PortalInputCapture *>(data)->cb_zones_changed(session, options); reinterpret_cast<PortalInputCapture *>(data)->cb_zones_changed(session, options);
} }
int fake_eis_fd(); int fake_eis_fd() const;
private: private:
EiScreen *screen_ = nullptr; EiScreen *screen_ = nullptr;

View file

@ -49,7 +49,7 @@ PortalRemoteDesktop::~PortalRemoteDesktop()
free(session_restore_token_); free(session_restore_token_);
} }
gboolean PortalRemoteDesktop::timeout_handler() gboolean PortalRemoteDesktop::timeout_handler() const
{ {
return true; // keep re-triggering return true; // keep re-triggering
} }

View file

@ -23,7 +23,7 @@ public:
private: private:
void glib_thread(void *); void glib_thread(void *);
gboolean timeout_handler(); gboolean timeout_handler() const;
gboolean init_remote_desktop_session(); gboolean init_remote_desktop_session();
void cb_init_remote_desktop_session(GObject *object, GAsyncResult *res); void cb_init_remote_desktop_session(GObject *object, GAsyncResult *res);
void cb_session_started(GObject *object, GAsyncResult *res); void cb_session_started(GObject *object, GAsyncResult *res);

View file

@ -1642,7 +1642,7 @@ ClipboardID XWindowsScreen::getClipboardID(Atom selection) const
return kClipboardEnd; return kClipboardEnd;
} }
void XWindowsScreen::processClipboardRequest(Window requestor, Time time, Atom property) void XWindowsScreen::processClipboardRequest(Window requestor, Time time, Atom property) const
{ {
// check every clipboard until one returns success // check every clipboard until one returns success
for (ClipboardID id = 0; id < kClipboardEnd; ++id) { for (ClipboardID id = 0; id < kClipboardEnd; ++id) {
@ -1652,7 +1652,7 @@ void XWindowsScreen::processClipboardRequest(Window requestor, Time time, Atom p
} }
} }
void XWindowsScreen::destroyClipboardRequest(Window requestor) void XWindowsScreen::destroyClipboardRequest(Window requestor) const
{ {
// check every clipboard until one returns success // check every clipboard until one returns success
for (ClipboardID id = 0; id < kClipboardEnd; ++id) { for (ClipboardID id = 0; id < kClipboardEnd; ++id) {

View file

@ -100,10 +100,10 @@ private:
ClipboardID getClipboardID(Atom selection) const; ClipboardID getClipboardID(Atom selection) const;
// continue processing a selection request // continue processing a selection request
void processClipboardRequest(Window window, Time time, Atom property); void processClipboardRequest(Window window, Time time, Atom property) const;
// terminate a selection request // terminate a selection request
void destroyClipboardRequest(Window window); void destroyClipboardRequest(Window window) const;
// X I/O error handler // X I/O error handler
void onError(); void onError();

View file

@ -25,7 +25,7 @@ ClientProxy::~ClientProxy()
delete m_stream; delete m_stream;
} }
void ClientProxy::close(const char *msg) void ClientProxy::close(const char *msg) const
{ {
LOG((CLOG_DEBUG1 "send close \"%s\" to \"%s\"", msg, getName().c_str())); LOG((CLOG_DEBUG1 "send close \"%s\" to \"%s\"", msg, getName().c_str()));
ProtocolUtil::writef(getStream(), msg); ProtocolUtil::writef(getStream(), msg);

View file

@ -37,7 +37,7 @@ public:
/*! /*!
Ask the client to disconnect, using \p msg as the reason. Ask the client to disconnect, using \p msg as the reason.
*/ */
void close(const char *msg); void close(const char *msg) const;
//@} //@}
//! @name accessors //! @name accessors

View file

@ -49,12 +49,12 @@ bool ClientProxy1_5::parseMessage(const uint8_t *code)
return true; return true;
} }
void ClientProxy1_5::fileChunkReceived() void ClientProxy1_5::fileChunkReceived() const
{ {
// do nothing // do nothing
} }
void ClientProxy1_5::dragInfoReceived() void ClientProxy1_5::dragInfoReceived() const
{ {
// do nothing // do nothing
} }

View file

@ -29,8 +29,8 @@ public:
void sendDragInfo(uint32_t fileCount, const char *info, size_t size) override; void sendDragInfo(uint32_t fileCount, const char *info, size_t size) override;
void fileChunkSending(uint8_t mark, char *data, size_t dataSize) override; void fileChunkSending(uint8_t mark, char *data, size_t dataSize) override;
bool parseMessage(const uint8_t *code) override; bool parseMessage(const uint8_t *code) override;
void fileChunkReceived(); void fileChunkReceived() const;
void dragInfoReceived(); void dragInfoReceived() const;
private: private:
IEventQueue *m_events; IEventQueue *m_events;

View file

@ -160,11 +160,11 @@ public:
m_i = i.m_i; m_i = i.m_i;
return *this; return *this;
} }
std::string operator*() std::string operator*() const
{ {
return m_i->first; return m_i->first;
} }
const std::string *operator->() const std::string *operator->() const
{ {
return &(m_i->first); return &(m_i->first);
} }