chore: use const for more local ref and pointer vars
This commit is contained in:
parent
9c56fa5dda
commit
e6a374369b
13 changed files with 42 additions and 42 deletions
|
|
@ -603,7 +603,7 @@ std::string ArchNetworkBSD::addrToString(ArchNetAddress addr)
|
||||||
|
|
||||||
switch (getAddrFamily(addr)) {
|
switch (getAddrFamily(addr)) {
|
||||||
case kINET: {
|
case kINET: {
|
||||||
auto *ipAddr = TYPED_ADDR(struct sockaddr_in, addr);
|
const auto *ipAddr = TYPED_ADDR(struct sockaddr_in, addr);
|
||||||
ARCH->lockMutex(m_mutex);
|
ARCH->lockMutex(m_mutex);
|
||||||
std::string s = inet_ntoa(ipAddr->sin_addr);
|
std::string s = inet_ntoa(ipAddr->sin_addr);
|
||||||
ARCH->unlockMutex(m_mutex);
|
ARCH->unlockMutex(m_mutex);
|
||||||
|
|
@ -612,7 +612,7 @@ std::string ArchNetworkBSD::addrToString(ArchNetAddress addr)
|
||||||
|
|
||||||
case kINET6: {
|
case kINET6: {
|
||||||
char strAddr[INET6_ADDRSTRLEN];
|
char strAddr[INET6_ADDRSTRLEN];
|
||||||
auto *ipAddr = TYPED_ADDR(struct sockaddr_in6, addr);
|
const auto *ipAddr = TYPED_ADDR(struct sockaddr_in6, addr);
|
||||||
ARCH->lockMutex(m_mutex);
|
ARCH->lockMutex(m_mutex);
|
||||||
inet_ntop(AF_INET6, &ipAddr->sin6_addr, strAddr, INET6_ADDRSTRLEN);
|
inet_ntop(AF_INET6, &ipAddr->sin6_addr, strAddr, INET6_ADDRSTRLEN);
|
||||||
ARCH->unlockMutex(m_mutex);
|
ARCH->unlockMutex(m_mutex);
|
||||||
|
|
@ -669,12 +669,12 @@ int ArchNetworkBSD::getAddrPort(ArchNetAddress addr)
|
||||||
|
|
||||||
switch (getAddrFamily(addr)) {
|
switch (getAddrFamily(addr)) {
|
||||||
case kINET: {
|
case kINET: {
|
||||||
auto *ipAddr = TYPED_ADDR(struct sockaddr_in, addr);
|
const auto *ipAddr = TYPED_ADDR(struct sockaddr_in, addr);
|
||||||
return ntohs(ipAddr->sin_port);
|
return ntohs(ipAddr->sin_port);
|
||||||
}
|
}
|
||||||
|
|
||||||
case kINET6: {
|
case kINET6: {
|
||||||
auto *ipAddr = TYPED_ADDR(struct sockaddr_in6, addr);
|
const auto *ipAddr = TYPED_ADDR(struct sockaddr_in6, addr);
|
||||||
return ntohs(ipAddr->sin6_port);
|
return ntohs(ipAddr->sin6_port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -690,12 +690,12 @@ bool ArchNetworkBSD::isAnyAddr(ArchNetAddress addr)
|
||||||
|
|
||||||
switch (getAddrFamily(addr)) {
|
switch (getAddrFamily(addr)) {
|
||||||
case kINET: {
|
case kINET: {
|
||||||
auto *ipAddr = TYPED_ADDR(struct sockaddr_in, addr);
|
const auto *ipAddr = TYPED_ADDR(struct sockaddr_in, addr);
|
||||||
return (ipAddr->sin_addr.s_addr == INADDR_ANY && addr->m_len == static_cast<socklen_t>(sizeof(struct sockaddr_in)));
|
return (ipAddr->sin_addr.s_addr == INADDR_ANY && addr->m_len == static_cast<socklen_t>(sizeof(struct sockaddr_in)));
|
||||||
}
|
}
|
||||||
|
|
||||||
case kINET6: {
|
case kINET6: {
|
||||||
auto *ipAddr = TYPED_ADDR(struct sockaddr_in6, addr);
|
const auto *ipAddr = TYPED_ADDR(struct sockaddr_in6, addr);
|
||||||
return (
|
return (
|
||||||
addr->m_len == (socklen_t)sizeof(struct sockaddr_in6) &&
|
addr->m_len == (socklen_t)sizeof(struct sockaddr_in6) &&
|
||||||
memcmp(
|
memcmp(
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ void EventQueue::loop()
|
||||||
LOG((CLOG_DEBUG "event queue is ready"));
|
LOG((CLOG_DEBUG "event queue is ready"));
|
||||||
while (!m_pending.empty()) {
|
while (!m_pending.empty()) {
|
||||||
LOG((CLOG_DEBUG "add pending events to buffer"));
|
LOG((CLOG_DEBUG "add pending events to buffer"));
|
||||||
Event &event = m_pending.front();
|
const Event &event = m_pending.front();
|
||||||
addEventToBuffer(event);
|
addEventToBuffer(event);
|
||||||
m_pending.pop();
|
m_pending.pop();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -97,11 +97,11 @@ int ClipboardChunk::assemble(deskflow::IStream *stream, std::string &dataCached,
|
||||||
|
|
||||||
void ClipboardChunk::send(deskflow::IStream *stream, void *data)
|
void ClipboardChunk::send(deskflow::IStream *stream, void *data)
|
||||||
{
|
{
|
||||||
auto *clipboardData = static_cast<ClipboardChunk *>(data);
|
const auto *clipboardData = static_cast<ClipboardChunk *>(data);
|
||||||
|
|
||||||
LOG((CLOG_DEBUG1 "sending clipboard chunk"));
|
LOG((CLOG_DEBUG1 "sending clipboard chunk"));
|
||||||
|
|
||||||
char *chunk = clipboardData->m_chunk;
|
const char *chunk = clipboardData->m_chunk;
|
||||||
ClipboardID id = chunk[0];
|
ClipboardID id = chunk[0];
|
||||||
uint32_t sequence;
|
uint32_t sequence;
|
||||||
std::memcpy(&sequence, &chunk[1], 4);
|
std::memcpy(&sequence, &chunk[1], 4);
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@ void ServerConfig::commit()
|
||||||
settings().beginWriteArray("screens");
|
settings().beginWriteArray("screens");
|
||||||
for (int i = 0; i < screens().size(); i++) {
|
for (int i = 0; i < screens().size(); i++) {
|
||||||
settings().setArrayIndex(i);
|
settings().setArrayIndex(i);
|
||||||
auto &screen = screens()[i];
|
const auto &screen = screens()[i];
|
||||||
screen.saveSettings(settings());
|
screen.saveSettings(settings());
|
||||||
auto screenName = Settings::value(Settings::Core::ScreenName).toString();
|
auto screenName = Settings::value(Settings::Core::ScreenName).toString();
|
||||||
if (screen.isServer() && screenName != screen.name()) {
|
if (screen.isServer() && screenName != screen.name()) {
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ AddClientDialog::AddClientDialog(const QString &clientName, QWidget *parent)
|
||||||
ui->m_pDialogButtonBox->setLayoutDirection(Qt::RightToLeft);
|
ui->m_pDialogButtonBox->setLayoutDirection(Qt::RightToLeft);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QPushButton *advanced = ui->m_pDialogButtonBox->addButton("Advanced", QDialogButtonBox::HelpRole);
|
const auto *advanced = ui->m_pDialogButtonBox->addButton(QStringLiteral("Advanced"), QDialogButtonBox::HelpRole);
|
||||||
connect(advanced, &QPushButton::clicked, this, &AddClientDialog::handleButtonAdvanced);
|
connect(advanced, &QPushButton::clicked, this, &AddClientDialog::handleButtonAdvanced);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -361,7 +361,7 @@ void SecureSocket::initContext(bool server)
|
||||||
}
|
}
|
||||||
|
|
||||||
// create new context from method
|
// create new context from method
|
||||||
auto *m = const_cast<SSL_METHOD *>(method);
|
const auto *m = const_cast<SSL_METHOD *>(method);
|
||||||
m_ssl->m_context = SSL_CTX_new(m);
|
m_ssl->m_context = SSL_CTX_new(m);
|
||||||
|
|
||||||
// Prevent the usage of of all version prior to TLSv1.2 as they are known to
|
// Prevent the usage of of all version prior to TLSv1.2 as they are known to
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,7 @@ void SocketMultiplexer::serviceThread(void *)
|
||||||
JobCursor cursor = newCursor();
|
JobCursor cursor = newCursor();
|
||||||
JobCursor jobCursor = nextCursor(cursor);
|
JobCursor jobCursor = nextCursor(cursor);
|
||||||
while (jobCursor != m_socketJobs.end()) {
|
while (jobCursor != m_socketJobs.end()) {
|
||||||
if (ISocketMultiplexerJob *job = *jobCursor; job) {
|
if (const ISocketMultiplexerJob *job = *jobCursor; job) {
|
||||||
pfd.m_socket = job->getSocket();
|
pfd.m_socket = job->getSocket();
|
||||||
pfd.m_events = 0;
|
pfd.m_events = 0;
|
||||||
if (job->isReadable()) {
|
if (job->isReadable()) {
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ bool XWindowsClipboard::addSimpleRequest(Window requestor, Atom target, ::Time t
|
||||||
} else if (target == m_atomTimestamp) {
|
} else if (target == m_atomTimestamp) {
|
||||||
type = getTimestampData(data, &format);
|
type = getTimestampData(data, &format);
|
||||||
} else {
|
} else {
|
||||||
IXWindowsClipboardConverter *converter = getConverter(target);
|
const IXWindowsClipboardConverter *converter = getConverter(target);
|
||||||
if (converter != nullptr) {
|
if (converter != nullptr) {
|
||||||
IClipboard::EFormat clipboardFormat = converter->getFormat();
|
IClipboard::EFormat clipboardFormat = converter->getFormat();
|
||||||
if (m_added[clipboardFormat]) {
|
if (m_added[clipboardFormat]) {
|
||||||
|
|
@ -190,7 +190,7 @@ bool XWindowsClipboard::processRequest(Window requestor, ::Time /*time*/, Atom p
|
||||||
// first property but we'll check 'em all if we have to.
|
// first property but we'll check 'em all if we have to.
|
||||||
ReplyList &replies = index->second;
|
ReplyList &replies = index->second;
|
||||||
for (auto index2 = replies.begin(); index2 != replies.end(); ++index2) {
|
for (auto index2 = replies.begin(); index2 != replies.end(); ++index2) {
|
||||||
Reply *reply = *index2;
|
const Reply *reply = *index2;
|
||||||
if (reply->m_replied && reply->m_property == property) {
|
if (reply->m_replied && reply->m_property == property) {
|
||||||
// if reply is complete then remove it and start the
|
// if reply is complete then remove it and start the
|
||||||
// next one.
|
// next one.
|
||||||
|
|
@ -467,7 +467,7 @@ void XWindowsClipboard::icccmFillCache()
|
||||||
// try each converter in order (because they're in order of
|
// try each converter in order (because they're in order of
|
||||||
// preference).
|
// preference).
|
||||||
for (ConverterList::const_iterator index = m_converters.begin(); index != m_converters.end(); ++index) {
|
for (ConverterList::const_iterator index = m_converters.begin(); index != m_converters.end(); ++index) {
|
||||||
IXWindowsClipboardConverter *converter = *index;
|
const IXWindowsClipboardConverter *converter = *index;
|
||||||
|
|
||||||
// skip already handled targets
|
// skip already handled targets
|
||||||
if (m_added[converter->getFormat()]) {
|
if (m_added[converter->getFormat()]) {
|
||||||
|
|
@ -692,7 +692,7 @@ void XWindowsClipboard::motifFillCache()
|
||||||
// try each converter in order (because they're in order of
|
// try each converter in order (because they're in order of
|
||||||
// preference).
|
// preference).
|
||||||
for (ConverterList::const_iterator index = m_converters.begin(); index != m_converters.end(); ++index) {
|
for (ConverterList::const_iterator index = m_converters.begin(); index != m_converters.end(); ++index) {
|
||||||
IXWindowsClipboardConverter *converter = *index;
|
const IXWindowsClipboardConverter *converter = *index;
|
||||||
|
|
||||||
// skip already handled targets
|
// skip already handled targets
|
||||||
if (m_added[converter->getFormat()]) {
|
if (m_added[converter->getFormat()]) {
|
||||||
|
|
@ -1120,7 +1120,7 @@ Atom XWindowsClipboard::getTargetsData(std::string &data, int *format) const
|
||||||
|
|
||||||
// add targets we can convert to
|
// add targets we can convert to
|
||||||
for (auto index = m_converters.begin(); index != m_converters.end(); ++index) {
|
for (auto index = m_converters.begin(); index != m_converters.end(); ++index) {
|
||||||
IXWindowsClipboardConverter *converter = *index;
|
const IXWindowsClipboardConverter *converter = *index;
|
||||||
|
|
||||||
// skip formats we don't have
|
// skip formats we don't have
|
||||||
if (m_added[converter->getFormat()]) {
|
if (m_added[converter->getFormat()]) {
|
||||||
|
|
|
||||||
|
|
@ -629,7 +629,7 @@ void XWindowsKeyState::updateKeysymMapXKB(deskflow::KeyMap &keyMap)
|
||||||
int eGroup = getEffectiveGroup(keycode, group);
|
int eGroup = getEffectiveGroup(keycode, group);
|
||||||
|
|
||||||
// get key info
|
// get key info
|
||||||
XkbKeyTypePtr type = XkbKeyKeyType(m_xkb, keycode, eGroup);
|
const XkbKeyTypePtr type = XkbKeyKeyType(m_xkb, keycode, eGroup);
|
||||||
|
|
||||||
// set modifiers the item is sensitive to
|
// set modifiers the item is sensitive to
|
||||||
item.m_sensitive = type->mods.mask;
|
item.m_sensitive = type->mods.mask;
|
||||||
|
|
@ -664,7 +664,7 @@ void XWindowsKeyState::updateKeysymMapXKB(deskflow::KeyMap &keyMap)
|
||||||
bool isModifier = false;
|
bool isModifier = false;
|
||||||
uint32_t modifierMask = m_xkb->map->modmap[keycode];
|
uint32_t modifierMask = m_xkb->map->modmap[keycode];
|
||||||
if (XkbKeyHasActions(m_xkb, keycode) == True) {
|
if (XkbKeyHasActions(m_xkb, keycode) == True) {
|
||||||
XkbAction *action = XkbKeyActionEntry(m_xkb, keycode, level, eGroup);
|
const XkbAction *action = XkbKeyActionEntry(m_xkb, keycode, level, eGroup);
|
||||||
if (action->type == XkbSA_SetMods || action->type == XkbSA_LockMods) {
|
if (action->type == XkbSA_SetMods || action->type == XkbSA_LockMods) {
|
||||||
isModifier = true;
|
isModifier = true;
|
||||||
|
|
||||||
|
|
@ -788,7 +788,7 @@ void XWindowsKeyState::updateKeysymMapXKB(deskflow::KeyMap &keyMap)
|
||||||
|
|
||||||
void XWindowsKeyState::remapKeyModifiers(KeyID id, int32_t group, deskflow::KeyMap::KeyItem &item, void *vself)
|
void XWindowsKeyState::remapKeyModifiers(KeyID id, int32_t group, deskflow::KeyMap::KeyItem &item, void *vself)
|
||||||
{
|
{
|
||||||
auto *self = static_cast<XWindowsKeyState *>(vself);
|
const auto *self = static_cast<XWindowsKeyState *>(vself);
|
||||||
item.m_required = self->mapModifiersFromX(XkbBuildCoreState(item.m_required, group));
|
item.m_required = self->mapModifiersFromX(XkbBuildCoreState(item.m_required, group));
|
||||||
item.m_sensitive = self->mapModifiersFromX(XkbBuildCoreState(item.m_sensitive, group));
|
item.m_sensitive = self->mapModifiersFromX(XkbBuildCoreState(item.m_sensitive, group));
|
||||||
}
|
}
|
||||||
|
|
@ -804,13 +804,13 @@ bool XWindowsKeyState::hasModifiersXKB() const
|
||||||
int numGroups = XkbKeyNumGroups(m_xkb, keycode);
|
int numGroups = XkbKeyNumGroups(m_xkb, keycode);
|
||||||
for (int group = 0; group < numGroups; ++group) {
|
for (int group = 0; group < numGroups; ++group) {
|
||||||
// iterate over all shift levels for the button (including none)
|
// iterate over all shift levels for the button (including none)
|
||||||
XkbKeyTypePtr type = XkbKeyKeyType(m_xkb, keycode, group);
|
const XkbKeyTypePtr type = XkbKeyKeyType(m_xkb, keycode, group);
|
||||||
for (int j = -1; j < type->map_count; ++j) {
|
for (int j = -1; j < type->map_count; ++j) {
|
||||||
if (j != -1 && !type->map[j].active) {
|
if (j != -1 && !type->map[j].active) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
int level = ((j == -1) ? 0 : type->map[j].level);
|
int level = ((j == -1) ? 0 : type->map[j].level);
|
||||||
XkbAction *action = XkbKeyActionEntry(m_xkb, keycode, level, group);
|
const XkbAction *action = XkbKeyActionEntry(m_xkb, keycode, level, group);
|
||||||
if (action->type == XkbSA_SetMods || action->type == XkbSA_LockMods) {
|
if (action->type == XkbSA_SetMods || action->type == XkbSA_LockMods) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1112,7 +1112,7 @@ IKeyState *XWindowsScreen::getKeyState() const
|
||||||
|
|
||||||
Bool XWindowsScreen::findKeyEvent(Display *, XEvent *xevent, XPointer arg)
|
Bool XWindowsScreen::findKeyEvent(Display *, XEvent *xevent, XPointer arg)
|
||||||
{
|
{
|
||||||
auto *filter = reinterpret_cast<KeyEventFilter *>(arg);
|
const auto *filter = reinterpret_cast<KeyEventFilter *>(arg);
|
||||||
return (xevent->type == filter->m_event && xevent->xkey.window == filter->m_window &&
|
return (xevent->type == filter->m_event && xevent->xkey.window == filter->m_window &&
|
||||||
xevent->xkey.time == filter->m_time && xevent->xkey.keycode == filter->m_keycode)
|
xevent->xkey.time == filter->m_time && xevent->xkey.keycode == filter->m_keycode)
|
||||||
? True
|
? True
|
||||||
|
|
@ -1332,7 +1332,7 @@ void XWindowsScreen::handleSystemEvent(const Event &event, void *)
|
||||||
default:
|
default:
|
||||||
#if HAVE_XKB_EXTENSION
|
#if HAVE_XKB_EXTENSION
|
||||||
if (m_xkb && xevent->type == m_xkbEventBase) {
|
if (m_xkb && xevent->type == m_xkbEventBase) {
|
||||||
auto *xkbEvent = reinterpret_cast<XkbEvent *>(xevent);
|
const auto *xkbEvent = reinterpret_cast<XkbEvent *>(xevent);
|
||||||
switch (xkbEvent->any.xkb_type) {
|
switch (xkbEvent->any.xkb_type) {
|
||||||
case XkbMapNotify:
|
case XkbMapNotify:
|
||||||
refreshKeyboard(xevent);
|
refreshKeyboard(xevent);
|
||||||
|
|
|
||||||
|
|
@ -1875,7 +1875,7 @@ void XWindowsUtil::appendTimeData(std::string &data, Time time)
|
||||||
|
|
||||||
Bool XWindowsUtil::propertyNotifyPredicate(Display *, XEvent *xevent, XPointer arg)
|
Bool XWindowsUtil::propertyNotifyPredicate(Display *, XEvent *xevent, XPointer arg)
|
||||||
{
|
{
|
||||||
auto *filter = reinterpret_cast<PropertyNotifyPredicateInfo *>(arg);
|
const auto *filter = reinterpret_cast<PropertyNotifyPredicateInfo *>(arg);
|
||||||
return (xevent->type == PropertyNotify && xevent->xproperty.window == filter->m_window &&
|
return (xevent->type == PropertyNotify && xevent->xproperty.window == filter->m_window &&
|
||||||
xevent->xproperty.atom == filter->m_property && xevent->xproperty.state == PropertyNewValue)
|
xevent->xproperty.atom == filter->m_property && xevent->xproperty.state == PropertyNewValue)
|
||||||
? True
|
? True
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ InputFilter::EFilterStatus InputFilter::KeystrokeCondition::match(const Event &e
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if it's our hotkey
|
// check if it's our hotkey
|
||||||
if (auto *kinfo = static_cast<IPlatformScreen::HotKeyInfo *>(event.getData()); kinfo->m_id != m_id) {
|
if (const auto *kinfo = static_cast<IPlatformScreen::HotKeyInfo *>(event.getData()); kinfo->m_id != m_id) {
|
||||||
return kNoMatch;
|
return kNoMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -156,7 +156,7 @@ InputFilter::EFilterStatus InputFilter::MouseButtonCondition::match(const Event
|
||||||
|
|
||||||
// check if it's the right button and modifiers. ignore modifiers
|
// check if it's the right button and modifiers. ignore modifiers
|
||||||
// that cannot be combined with a mouse button.
|
// that cannot be combined with a mouse button.
|
||||||
if (auto *minfo = static_cast<IPlatformScreen::ButtonInfo *>(event.getData());
|
if (const auto *minfo = static_cast<IPlatformScreen::ButtonInfo *>(event.getData());
|
||||||
minfo->m_button != m_button || (minfo->m_mask & ~s_ignoreMask) != m_mask) {
|
minfo->m_button != m_button || (minfo->m_mask & ~s_ignoreMask) != m_mask) {
|
||||||
return kNoMatch;
|
return kNoMatch;
|
||||||
}
|
}
|
||||||
|
|
@ -184,7 +184,7 @@ std::string InputFilter::ScreenConnectedCondition::format() const
|
||||||
InputFilter::EFilterStatus InputFilter::ScreenConnectedCondition::match(const Event &event)
|
InputFilter::EFilterStatus InputFilter::ScreenConnectedCondition::match(const Event &event)
|
||||||
{
|
{
|
||||||
if (event.getType() == EventTypes::ServerConnected) {
|
if (event.getType() == EventTypes::ServerConnected) {
|
||||||
auto *info = static_cast<Server::ScreenConnectedInfo *>(event.getData());
|
const auto *info = static_cast<Server::ScreenConnectedInfo *>(event.getData());
|
||||||
if (m_screen == info->m_screen || m_screen.empty()) {
|
if (m_screen == info->m_screen || m_screen.empty()) {
|
||||||
return kActivate;
|
return kActivate;
|
||||||
}
|
}
|
||||||
|
|
@ -288,7 +288,7 @@ void InputFilter::SwitchToScreenAction::perform(const Event &event)
|
||||||
// event if it has one.
|
// event if it has one.
|
||||||
std::string screen = m_screen;
|
std::string screen = m_screen;
|
||||||
if (screen.empty() && event.getType() == EventTypes::ServerConnected) {
|
if (screen.empty() && event.getType() == EventTypes::ServerConnected) {
|
||||||
auto *info = static_cast<Server::ScreenConnectedInfo *>(event.getData());
|
const auto *info = static_cast<Server::ScreenConnectedInfo *>(event.getData());
|
||||||
screen = info->m_screen;
|
screen = info->m_screen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -440,7 +440,7 @@ void Server::switchScreen(BaseClientProxy *dst, int32_t x, int32_t y, bool forSc
|
||||||
// primary screen.
|
// primary screen.
|
||||||
if (m_active == m_primaryClient && m_enableClipboard) {
|
if (m_active == m_primaryClient && m_enableClipboard) {
|
||||||
for (ClipboardID id = 0; id < kClipboardEnd; ++id) {
|
for (ClipboardID id = 0; id < kClipboardEnd; ++id) {
|
||||||
ClipboardInfo &clipboard = m_clipboards[id];
|
const ClipboardInfo &clipboard = m_clipboards[id];
|
||||||
if (clipboard.m_clipboardOwner == getName(m_primaryClient)) {
|
if (clipboard.m_clipboardOwner == getName(m_primaryClient)) {
|
||||||
onClipboardChanged(m_primaryClient, id, clipboard.m_clipboardSeqNum);
|
onClipboardChanged(m_primaryClient, id, clipboard.m_clipboardSeqNum);
|
||||||
}
|
}
|
||||||
|
|
@ -1229,7 +1229,7 @@ void Server::handleClipboardChanged(const Event &event, void *vclient)
|
||||||
|
|
||||||
void Server::handleKeyDownEvent(const Event &event, void *)
|
void Server::handleKeyDownEvent(const Event &event, void *)
|
||||||
{
|
{
|
||||||
auto *info = static_cast<IPlatformScreen::KeyInfo *>(event.getData());
|
const auto *info = static_cast<IPlatformScreen::KeyInfo *>(event.getData());
|
||||||
auto lang = AppUtil::instance().getCurrentLanguageCode();
|
auto lang = AppUtil::instance().getCurrentLanguageCode();
|
||||||
onKeyDown(info->m_key, info->m_mask, info->m_button, lang, info->m_screens);
|
onKeyDown(info->m_key, info->m_mask, info->m_button, lang, info->m_screens);
|
||||||
}
|
}
|
||||||
|
|
@ -1242,38 +1242,38 @@ void Server::handleKeyUpEvent(const Event &event, void *)
|
||||||
|
|
||||||
void Server::handleKeyRepeatEvent(const Event &event, void *)
|
void Server::handleKeyRepeatEvent(const Event &event, void *)
|
||||||
{
|
{
|
||||||
auto *info = static_cast<IPlatformScreen::KeyInfo *>(event.getData());
|
const auto *info = static_cast<IPlatformScreen::KeyInfo *>(event.getData());
|
||||||
auto lang = AppUtil::instance().getCurrentLanguageCode();
|
auto lang = AppUtil::instance().getCurrentLanguageCode();
|
||||||
onKeyRepeat(info->m_key, info->m_mask, info->m_count, info->m_button, lang);
|
onKeyRepeat(info->m_key, info->m_mask, info->m_count, info->m_button, lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Server::handleButtonDownEvent(const Event &event, void *)
|
void Server::handleButtonDownEvent(const Event &event, void *)
|
||||||
{
|
{
|
||||||
auto *info = static_cast<IPlatformScreen::ButtonInfo *>(event.getData());
|
const auto *info = static_cast<IPlatformScreen::ButtonInfo *>(event.getData());
|
||||||
onMouseDown(info->m_button);
|
onMouseDown(info->m_button);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Server::handleButtonUpEvent(const Event &event, void *)
|
void Server::handleButtonUpEvent(const Event &event, void *)
|
||||||
{
|
{
|
||||||
auto *info = static_cast<IPlatformScreen::ButtonInfo *>(event.getData());
|
const auto *info = static_cast<IPlatformScreen::ButtonInfo *>(event.getData());
|
||||||
onMouseUp(info->m_button);
|
onMouseUp(info->m_button);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Server::handleMotionPrimaryEvent(const Event &event, void *)
|
void Server::handleMotionPrimaryEvent(const Event &event, void *)
|
||||||
{
|
{
|
||||||
auto *info = static_cast<IPlatformScreen::MotionInfo *>(event.getData());
|
const auto *info = static_cast<IPlatformScreen::MotionInfo *>(event.getData());
|
||||||
onMouseMovePrimary(info->m_x, info->m_y);
|
onMouseMovePrimary(info->m_x, info->m_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Server::handleMotionSecondaryEvent(const Event &event, void *)
|
void Server::handleMotionSecondaryEvent(const Event &event, void *)
|
||||||
{
|
{
|
||||||
auto *info = static_cast<IPlatformScreen::MotionInfo *>(event.getData());
|
const auto *info = static_cast<IPlatformScreen::MotionInfo *>(event.getData());
|
||||||
onMouseMoveSecondary(info->m_x, info->m_y);
|
onMouseMoveSecondary(info->m_x, info->m_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Server::handleWheelEvent(const Event &event, void *)
|
void Server::handleWheelEvent(const Event &event, void *)
|
||||||
{
|
{
|
||||||
auto *info = static_cast<IPlatformScreen::WheelInfo *>(event.getData());
|
const auto *info = static_cast<IPlatformScreen::WheelInfo *>(event.getData());
|
||||||
onMouseWheel(info->m_xDelta, info->m_yDelta);
|
onMouseWheel(info->m_xDelta, info->m_yDelta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1335,7 +1335,7 @@ void Server::handleSwitchToScreenEvent(const Event &event, void *)
|
||||||
|
|
||||||
void Server::handleSwitchInDirectionEvent(const Event &event, void *)
|
void Server::handleSwitchInDirectionEvent(const Event &event, void *)
|
||||||
{
|
{
|
||||||
auto *info = static_cast<SwitchInDirectionInfo *>(event.getData());
|
const auto *info = static_cast<SwitchInDirectionInfo *>(event.getData());
|
||||||
|
|
||||||
// jump to screen in chosen direction from center of this screen
|
// jump to screen in chosen direction from center of this screen
|
||||||
int32_t x = m_x;
|
int32_t x = m_x;
|
||||||
|
|
@ -1350,7 +1350,7 @@ void Server::handleSwitchInDirectionEvent(const Event &event, void *)
|
||||||
|
|
||||||
void Server::handleKeyboardBroadcastEvent(const Event &event, void *)
|
void Server::handleKeyboardBroadcastEvent(const Event &event, void *)
|
||||||
{
|
{
|
||||||
auto *info = (KeyboardBroadcastInfo *)event.getData();
|
const auto *info = (KeyboardBroadcastInfo *)event.getData();
|
||||||
|
|
||||||
// choose new state
|
// choose new state
|
||||||
bool newState;
|
bool newState;
|
||||||
|
|
@ -1382,7 +1382,7 @@ void Server::handleKeyboardBroadcastEvent(const Event &event, void *)
|
||||||
|
|
||||||
void Server::handleLockCursorToScreenEvent(const Event &event, void *)
|
void Server::handleLockCursorToScreenEvent(const Event &event, void *)
|
||||||
{
|
{
|
||||||
auto *info = (LockCursorToScreenInfo *)event.getData();
|
const auto *info = (LockCursorToScreenInfo *)event.getData();
|
||||||
|
|
||||||
// choose new state
|
// choose new state
|
||||||
bool newState;
|
bool newState;
|
||||||
|
|
@ -2018,7 +2018,7 @@ void Server::removeOldClient(BaseClientProxy *client)
|
||||||
|
|
||||||
void Server::forceLeaveClient(const BaseClientProxy *client)
|
void Server::forceLeaveClient(const BaseClientProxy *client)
|
||||||
{
|
{
|
||||||
if (BaseClientProxy *active = (m_activeSaver != nullptr) ? m_activeSaver : m_active; active == client) {
|
if (const auto *active = (m_activeSaver != nullptr) ? m_activeSaver : m_active; active == client) {
|
||||||
// record new position (center of primary screen)
|
// record new position (center of primary screen)
|
||||||
m_primaryClient->getCursorCenter(m_x, m_y);
|
m_primaryClient->getCursorCenter(m_x, m_y);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue