Skip to content

Commit

Permalink
SYNERGY-1287 display language notifications only on client side (desk…
Browse files Browse the repository at this point in the history
…flow#7111)

* SYNERGY-1287 Display language notification only on client side

* SYNERGY-1287 Always show notification on the client side

* Update ChangeLog

* Fix doxygen job
  • Loading branch information
SerhiiGadzhilov authored Oct 21, 2021
1 parent 5e2d355 commit 940e2ec
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 41 deletions.
2 changes: 1 addition & 1 deletion CI/job-doxygen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ jobs:
condition: eq(variables['Build.SourceBranch'], 'refs/heads/master')

pool:
vmImage: 'ubuntu-16.04'
vmImage: 'ubuntu-latest'

steps:
- script: |
Expand Down
2 changes: 1 addition & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ v1.14.2-snapshot
===========
Bug fixes:
- #7070 Fix radio button shifted focus on macOS
- #7038 | #7104 Fix client and server different keyboard layout errors
- #7038 | #7104 | #7111 Fix client and server different keyboard layout errors
- #7078 Fix clipboard re-enables automatically
- #7077 Fix Ubuntu, CentOS and Debian build after SYNERGY-1161
- #7080 Add trace if the system can't open file with trusted fingerprints
Expand Down
19 changes: 6 additions & 13 deletions src/lib/client/Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -752,10 +752,7 @@ Client::handleHello(const Event&, void*)

// say hello back
LOG((CLOG_DEBUG1 "say hello version %d.%d", helloBackMajor, helloBackMinor));
auto localLanguages = m_languageManager.getSerializedLocalLanguages();
ProtocolUtil::writef(m_stream, kMsgHelloBack,
helloBackMajor,
helloBackMinor, & m_name, &localLanguages);
ProtocolUtil::writef(m_stream, kMsgHelloBack, helloBackMajor, helloBackMinor, &m_name);

// now connected but waiting to complete handshake
setupScreen();
Expand Down Expand Up @@ -820,15 +817,11 @@ Client::onFileRecieveCompleted()
void
Client::checkMissedLanguages() const
{
if (m_args.m_enableLangSync) {
auto missedLanguages = m_languageManager.getMissedLanguages();
if (!missedLanguages.empty()) {
AppUtil::instance().showNotification("Language synchronization error",
"These languages are required for the client to work: " + missedLanguages);
}
}
else {
LOG((CLOG_DEBUG "Language sync logic is disabled."));
auto missedLanguages = m_languageManager.getMissedLanguages();
if (!missedLanguages.empty()) {
AppUtil::instance().showNotification("Language synchronization error",
"You need to install these languages on this computer to enable support for multiple languages: "
+ missedLanguages);
}
}

Expand Down
6 changes: 1 addition & 5 deletions src/lib/server/ClientProxyUnknown.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,9 @@ ClientProxyUnknown::handleData(const Event&, void*)

// parse the reply to hello
SInt16 major, minor;
String remoteLanguages;
if (!ProtocolUtil::readf(m_stream, kMsgHelloBack,
&major, &minor, &name, &remoteLanguages)) {
if (!ProtocolUtil::readf(m_stream, kMsgHelloBack, &major, &minor, &name)) {
throw XBadClient();
}
m_languageManager.setRemoteLanguages(remoteLanguages);
m_server->setLanguageManager(m_languageManager);

// disallow invalid version numbers
if (major <= 0 || minor < 0) {
Expand Down
12 changes: 0 additions & 12 deletions src/lib/server/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,6 @@ Server::adoptClient(BaseClientProxy* client)
client->screensaver(true);
}

checkMissedLanguages();

// send notification
Server::ScreenConnectedInfo* info =
new Server::ScreenConnectedInfo(getName(client));
Expand Down Expand Up @@ -1933,16 +1931,6 @@ Server::sendDragInfo(BaseClientProxy* newScreen)
}
}

void
Server::checkMissedLanguages() const
{
auto missedLanguages = m_languageManager.getMissedLanguages();
if (!missedLanguages.empty()) {
AppUtil::instance().showNotification("Language synchronization error",
"These languages are required for the server to work: " + missedLanguages);
}
}

void
Server::onMouseMoveSecondary(SInt32 dx, SInt32 dy)
{
Expand Down
7 changes: 0 additions & 7 deletions src/lib/server/Server.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,6 @@ class Server : public INode {
//! Store ClientListener pointer
void setListener(ClientListener* p) { m_clientListener = p; }

//! Set language manager
void setLanguageManager(const synergy::languages::LanguageManager& manager) { m_languageManager = manager; }

//@}
//! @name accessors
//@{
Expand Down Expand Up @@ -377,9 +374,6 @@ class Server : public INode {
// send drag info to new client screen
void sendDragInfo(BaseClientProxy* newScreen);

//Shows notification if there are missed languages
void checkMissedLanguages() const;

public:
bool m_mock;

Expand Down Expand Up @@ -494,5 +488,4 @@ class Server : public INode {

ClientListener* m_clientListener;
lib::synergy::ServerArgs m_args;
synergy::languages::LanguageManager m_languageManager;
};
2 changes: 1 addition & 1 deletion src/lib/synergy/protocol_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "synergy/protocol_types.h"

const char* const kMsgHello = "Synergy%2i%2i%s";
const char* const kMsgHelloBack = "Synergy%2i%2i%s%s";
const char* const kMsgHelloBack = "Synergy%2i%2i%s";
const char* const kMsgCNoop = "CNOP";
const char* const kMsgCClose = "CBYE";
const char* const kMsgCEnter = "CINN%2i%2i%4i%2i";
Expand Down
2 changes: 1 addition & 1 deletion src/lib/synergy/protocol_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ extern const char* const kMsgHello;
// respond to hello from server; secondary -> primary
// $1 = protocol major version number supported by client. $2 =
// protocol minor version number supported by client. $3 = client
// name. $4 = client language list
// name.
extern const char* const kMsgHelloBack;


Expand Down

0 comments on commit 940e2ec

Please sign in to comment.