2021-10-25 15:55:09 +00:00
|
|
|
/*
|
2024-09-17 19:00:25 +00:00
|
|
|
* Deskflow -- mouse and keyboard sharing utility
|
2021-10-25 15:55:09 +00:00
|
|
|
* Copyright (C) 2015-2021 Symless Ltd.
|
|
|
|
|
*
|
|
|
|
|
* This package is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* found in the file LICENSE that should have accompanied this file.
|
|
|
|
|
*
|
|
|
|
|
* This package is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
#include "base/Log.h"
|
2024-09-17 19:00:25 +00:00
|
|
|
#include "deskflow/ProtocolUtil.h"
|
|
|
|
|
#include "deskflow/languages/LanguageManager.h"
|
2021-10-25 15:55:09 +00:00
|
|
|
|
|
|
|
|
#include "ClientProxy1_8.h"
|
|
|
|
|
|
2024-07-16 13:36:44 +00:00
|
|
|
ClientProxy1_8::ClientProxy1_8(
|
2024-09-17 19:00:25 +00:00
|
|
|
const String &name, deskflow::IStream *adoptedStream, Server *server,
|
2024-07-16 13:36:44 +00:00
|
|
|
IEventQueue *events)
|
2024-07-02 19:07:06 +00:00
|
|
|
: ClientProxy1_7(name, adoptedStream, server, events) {
|
|
|
|
|
synchronizeLanguages();
|
2021-10-25 15:55:09 +00:00
|
|
|
}
|
|
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
void ClientProxy1_8::synchronizeLanguages() const {
|
2024-09-17 19:00:25 +00:00
|
|
|
deskflow::languages::LanguageManager languageManager;
|
2024-07-02 19:07:06 +00:00
|
|
|
auto localLanguages = languageManager.getSerializedLocalLanguages();
|
|
|
|
|
if (!localLanguages.empty()) {
|
2024-07-16 13:36:44 +00:00
|
|
|
LOG(
|
|
|
|
|
(CLOG_DEBUG1 "send server languages to the client: %s",
|
2024-07-02 19:07:06 +00:00
|
|
|
localLanguages.c_str()));
|
2024-07-16 13:36:44 +00:00
|
|
|
ProtocolUtil::writef(
|
|
|
|
|
getStream(), kMsgDLanguageSynchronisation, &localLanguages);
|
2024-07-02 19:07:06 +00:00
|
|
|
} else {
|
|
|
|
|
LOG((CLOG_ERR "failed to read server languages"));
|
|
|
|
|
}
|
2021-10-25 15:55:09 +00:00
|
|
|
}
|
|
|
|
|
|
2024-07-16 13:36:44 +00:00
|
|
|
void ClientProxy1_8::keyDown(
|
|
|
|
|
KeyID key, KeyModifierMask mask, KeyButton button, const String &language) {
|
|
|
|
|
LOG(
|
|
|
|
|
(CLOG_DEBUG1
|
2024-07-02 19:07:06 +00:00
|
|
|
"send key down to \"%s\" id=%d, mask=0x%04x, button=0x%04x, language=%s",
|
|
|
|
|
getName().c_str(), key, mask, button, language.c_str()));
|
2024-07-16 13:36:44 +00:00
|
|
|
ProtocolUtil::writef(
|
|
|
|
|
getStream(), kMsgDKeyDownLang, key, mask, button, &language);
|
2021-10-25 15:55:09 +00:00
|
|
|
}
|