2012-06-10 16:50:54 +00:00
|
|
|
/*
|
2024-09-17 19:00:25 +00:00
|
|
|
* Deskflow -- mouse and keyboard sharing utility
|
2016-09-07 14:24:00 +00:00
|
|
|
* Copyright (C) 2012-2016 Symless Ltd.
|
2012-09-04 02:09:56 +00:00
|
|
|
* Copyright (C) 2002 Chris Schoeneman
|
2024-07-02 19:07:06 +00:00
|
|
|
*
|
2012-06-10 16:50:54 +00:00
|
|
|
* This package is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
2015-05-03 02:33:52 +00:00
|
|
|
* found in the file LICENSE that should have accompanied this file.
|
2024-07-02 19:07:06 +00:00
|
|
|
*
|
2012-06-10 16:50:54 +00:00
|
|
|
* 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/>.
|
|
|
|
|
*/
|
|
|
|
|
|
2014-02-28 12:36:45 +00:00
|
|
|
#include "server/ClientProxy1_1.h"
|
2024-09-17 19:00:25 +00:00
|
|
|
#include "deskflow/AppUtil.h"
|
2014-02-28 12:36:45 +00:00
|
|
|
|
|
|
|
|
#include "base/Log.h"
|
2024-09-17 19:00:25 +00:00
|
|
|
#include "deskflow/ProtocolUtil.h"
|
2014-02-28 12:36:45 +00:00
|
|
|
|
2012-06-10 16:50:54 +00:00
|
|
|
#include <cstring>
|
|
|
|
|
|
|
|
|
|
//
|
2014-11-11 13:51:47 +00:00
|
|
|
// ClientProxy1_1
|
2012-06-10 16:50:54 +00:00
|
|
|
//
|
|
|
|
|
|
2024-07-16 13:36:44 +00:00
|
|
|
ClientProxy1_1::ClientProxy1_1(
|
2024-09-17 19:00:25 +00:00
|
|
|
const String &name, deskflow::IStream *stream, IEventQueue *events)
|
2024-07-02 19:07:06 +00:00
|
|
|
: ClientProxy1_0(name, stream, events) {
|
|
|
|
|
// do nothing
|
2012-06-10 16:50:54 +00:00
|
|
|
}
|
|
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
ClientProxy1_1::~ClientProxy1_1() {
|
|
|
|
|
// do nothing
|
2012-06-10 16:50:54 +00:00
|
|
|
}
|
|
|
|
|
|
2024-07-16 13:36:44 +00:00
|
|
|
void ClientProxy1_1::keyDown(
|
|
|
|
|
KeyID key, KeyModifierMask mask, KeyButton button, const String &) {
|
|
|
|
|
LOG(
|
|
|
|
|
(CLOG_DEBUG1 "send key down to \"%s\" id=%d, mask=0x%04x, button=0x%04x",
|
2024-07-02 19:07:06 +00:00
|
|
|
getName().c_str(), key, mask, button));
|
|
|
|
|
ProtocolUtil::writef(getStream(), kMsgDKeyDown, key, mask, button);
|
2012-06-10 16:50:54 +00:00
|
|
|
}
|
|
|
|
|
|
2024-07-16 13:36:44 +00:00
|
|
|
void ClientProxy1_1::keyRepeat(
|
|
|
|
|
KeyID key, KeyModifierMask mask, SInt32 count, KeyButton button,
|
|
|
|
|
const String &lang) {
|
|
|
|
|
LOG(
|
|
|
|
|
(CLOG_DEBUG1 "send key repeat to \"%s\" id=%d, mask=0x%04x, count=%d, "
|
2024-07-02 19:07:06 +00:00
|
|
|
"button=0x%04x, lang=\"%s\"",
|
|
|
|
|
getName().c_str(), key, mask, count, button, lang.c_str()));
|
2024-07-16 13:36:44 +00:00
|
|
|
ProtocolUtil::writef(
|
|
|
|
|
getStream(), kMsgDKeyRepeat, key, mask, count, button, &lang);
|
2012-06-10 16:50:54 +00:00
|
|
|
}
|
|
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
void ClientProxy1_1::keyUp(KeyID key, KeyModifierMask mask, KeyButton button) {
|
2024-07-16 13:36:44 +00:00
|
|
|
LOG(
|
|
|
|
|
(CLOG_DEBUG1 "send key up to \"%s\" id=%d, mask=0x%04x, button=0x%04x",
|
2024-07-02 19:07:06 +00:00
|
|
|
getName().c_str(), key, mask, button));
|
|
|
|
|
ProtocolUtil::writef(getStream(), kMsgDKeyUp, key, mask, button);
|
2012-06-10 16:50:54 +00:00
|
|
|
}
|