id
int64 0
755k
| file_name
stringlengths 3
109
| file_path
stringlengths 13
185
| content
stringlengths 31
9.38M
| size
int64 31
9.38M
| language
stringclasses 1
value | extension
stringclasses 11
values | total_lines
int64 1
340k
| avg_line_length
float64 2.18
149k
| max_line_length
int64 7
2.22M
| alphanum_fraction
float64 0
1
| repo_name
stringlengths 6
65
| repo_stars
int64 100
47.3k
| repo_forks
int64 0
12k
| repo_open_issues
int64 0
3.4k
| repo_license
stringclasses 9
values | repo_extraction_date
stringclasses 92
values | exact_duplicates_redpajama
bool 2
classes | near_duplicates_redpajama
bool 2
classes | exact_duplicates_githubcode
bool 2
classes | exact_duplicates_stackv2
bool 1
class | exact_duplicates_stackv1
bool 2
classes | near_duplicates_githubcode
bool 2
classes | near_duplicates_stackv1
bool 2
classes | near_duplicates_stackv2
bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
13,784
|
ServerTaskBarReceiver.h
|
deskflow_deskflow/src/lib/deskflow/ServerTaskBarReceiver.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2003 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "arch/IArchTaskBarReceiver.h"
#include "base/Event.h"
#include "base/EventTypes.h"
#include "base/String.h"
#include "common/stdvector.h"
#include "deskflow/ServerApp.h"
#include "server/Server.h"
class IEventQueue;
//! Implementation of IArchTaskBarReceiver for the deskflow server
class ServerTaskBarReceiver : public IArchTaskBarReceiver
{
public:
ServerTaskBarReceiver(IEventQueue *events);
virtual ~ServerTaskBarReceiver();
//! @name manipulators
//@{
//! Update status
/*!
Determine the status and query required information from the server.
*/
void updateStatus(Server *, const String &errorMsg);
void updateStatus(INode *n, const String &errorMsg)
{
updateStatus((Server *)n, errorMsg);
}
//@}
// IArchTaskBarReceiver overrides
virtual void showStatus() = 0;
virtual void runMenu(int x, int y) = 0;
virtual void primaryAction() = 0;
virtual void lock() const;
virtual void unlock() const;
virtual const Icon getIcon() const = 0;
virtual std::string getToolTip() const;
protected:
typedef std::vector<String> Clients;
enum EState
{
kNotRunning,
kNotWorking,
kNotConnected,
kConnected,
kMaxState
};
//! Get status
EState getStatus() const;
//! Get error message
const String &getErrorMessage() const;
//! Get connected clients
const Clients &getClients() const;
//! Quit app
/*!
Causes the application to quit gracefully
*/
void quit();
//! Status change notification
/*!
Called when status changes. The default implementation does
nothing.
*/
virtual void onStatusChanged(Server *server);
private:
EState m_state;
String m_errorMessage;
Clients m_clients;
IEventQueue *m_events;
};
IArchTaskBarReceiver *createTaskBarReceiver(const BufferedLogOutputter *logBuffer, IEventQueue *events);
| 2,580
|
C++
|
.h
| 86
| 27.267442
| 104
| 0.751716
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| true
| false
| false
| false
| false
| false
| false
|
13,785
|
ClientApp.h
|
deskflow_deskflow/src/lib/deskflow/ClientApp.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "deskflow/App.h"
namespace deskflow {
class Screen;
}
class Event;
class Client;
class NetworkAddress;
class Thread;
class ISocketFactory;
namespace deskflow {
class ClientArgs;
}
class ClientApp : public App
{
public:
ClientApp(IEventQueue *events, CreateTaskBarReceiverFunc createTaskBarReceiver);
virtual ~ClientApp();
//
// IApp overrides
//
void parseArgs(int argc, const char *const *argv) override;
void help() override;
const char *daemonName() const override;
const char *daemonInfo() const override;
void loadConfig() override
{
}
bool loadConfig(const String &pathname) override
{
return false;
}
int foregroundStartup(int argc, char **argv) override;
int standardStartup(int argc, char **argv) override;
int runInner(int argc, char **argv, ILogOutputter *outputter, StartupFunc startup) override;
deskflow::Screen *createScreen() override;
int mainLoop() override;
void startNode() override;
//
// App overrides
//
std::string configSection() const override
{
return "client";
}
//
// Regular functions
//
void updateStatus();
void updateStatus(const String &msg);
void resetRestartTimeout();
double nextRestartTimeout();
void handleScreenError(const Event &, void *);
deskflow::Screen *openClientScreen();
void closeClientScreen(deskflow::Screen *screen);
void handleClientRestart(const Event &, void *vtimer);
void scheduleClientRestart(double retryTime);
void handleClientConnected(const Event &, void *);
void handleClientFailed(const Event &e, void *);
void handleClientRefused(const Event &e, void *);
void handleClientDisconnected(const Event &, void *);
Client *openClient(const String &name, const NetworkAddress &address, deskflow::Screen *screen);
void closeClient(Client *client);
bool startClient();
void stopClient();
Client *getClientPtr()
{
return m_client;
}
deskflow::ClientArgs &args() const
{
return (deskflow::ClientArgs &)argsBase();
}
//
// Static functions
//
static ClientApp &instance()
{
return (ClientApp &)App::instance();
}
private:
ISocketFactory *getSocketFactory() const;
Client *m_client;
deskflow::Screen *m_clientScreen;
NetworkAddress *m_serverAddress;
size_t m_lastServerAddressIndex = 0;
};
| 3,053
|
C++
|
.h
| 104
| 26.625
| 98
| 0.749403
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,786
|
App.h
|
deskflow_deskflow/src/lib/deskflow/App.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "base/EventQueue.h"
#include "base/Log.h"
#include "base/String.h"
#include "common/common.h"
#include "deskflow/IApp.h"
#include "ipc/IpcClient.h"
#if SYSAPI_WIN32
#include "deskflow/win32/AppUtilWindows.h"
#elif SYSAPI_UNIX
#include "deskflow/unix/AppUtilUnix.h"
#endif
#include <stdexcept>
class IArchTaskBarReceiver;
class BufferedLogOutputter;
class ILogOutputter;
class FileLogOutputter;
namespace deskflow {
class Screen;
}
class IEventQueue;
class SocketMultiplexer;
typedef IArchTaskBarReceiver *(*CreateTaskBarReceiverFunc)(const BufferedLogOutputter *, IEventQueue *events);
class App : public IApp
{
public:
class XNoEiSupport : public std::runtime_error
{
public:
XNoEiSupport() : std::runtime_error("libei is not supported")
{
}
};
App(IEventQueue *events, CreateTaskBarReceiverFunc createTaskBarReceiver, deskflow::ArgsBase *args);
App(App const &) = delete;
App(App &&) = delete;
virtual ~App();
App &operator=(App const &) = delete;
App &operator=(App &&) = delete;
virtual void help() = 0;
virtual void parseArgs(int argc, const char *const *argv) = 0;
virtual void loadConfig() = 0;
virtual bool loadConfig(const String &pathname) = 0;
virtual const char *daemonInfo() const = 0;
virtual std::string configSection() const = 0;
virtual void version();
virtual void setByeFunc(void (*bye)(int))
{
m_bye = bye;
}
virtual void bye(int error)
{
m_bye(error);
}
virtual IEventQueue *getEvents() const
{
return m_events;
}
ARCH_APP_UTIL &appUtil()
{
return m_appUtil;
}
deskflow::ArgsBase &argsBase() const
{
return *m_args;
}
int run(int argc, char **argv);
int daemonMainLoop(int, const char **);
void setupFileLogging();
void loggingFilterWarning();
void initApp(int argc, const char **argv);
void initApp(int argc, char **argv)
{
initApp(argc, (const char **)argv);
}
void setEvents(EventQueue &events)
{
m_events = &events;
}
void setSocketMultiplexer(SocketMultiplexer *sm)
{
m_socketMultiplexer = sm;
}
virtual IArchTaskBarReceiver *taskBarReceiver() const
{
return m_taskBarReceiver;
}
SocketMultiplexer *getSocketMultiplexer() const
{
return m_socketMultiplexer;
}
static App &instance()
{
assert(s_instance != nullptr);
return *s_instance;
}
void (*m_bye)(int);
private:
void handleIpcMessage(const Event &, void *);
protected:
void initIpcClient();
void cleanupIpcClient();
void runEventsLoop(void *);
IArchTaskBarReceiver *m_taskBarReceiver;
bool m_suspended;
IEventQueue *m_events;
private:
deskflow::ArgsBase *m_args;
static App *s_instance;
FileLogOutputter *m_fileLog;
CreateTaskBarReceiverFunc m_createTaskBarReceiver;
ARCH_APP_UTIL m_appUtil;
IpcClient *m_ipcClient;
SocketMultiplexer *m_socketMultiplexer;
};
class MinimalApp : public App
{
public:
MinimalApp();
virtual ~MinimalApp();
// IApp overrides
virtual int standardStartup(int argc, char **argv) override;
virtual int runInner(int argc, char **argv, ILogOutputter *outputter, StartupFunc startup) override;
virtual void startNode() override;
virtual int mainLoop() override;
virtual int foregroundStartup(int argc, char **argv) override;
virtual deskflow::Screen *createScreen() override;
virtual void loadConfig() override;
virtual bool loadConfig(const String &pathname) override;
virtual const char *daemonInfo() const override;
virtual const char *daemonName() const override;
virtual void parseArgs(int argc, const char *const *argv) override;
//
// App overrides
//
std::string configSection() const override
{
return "";
}
private:
Arch m_arch;
Log m_log;
EventQueue m_events;
};
#if WINAPI_MSWINDOWS
#define DAEMON_RUNNING(running_) ArchMiscWindows::daemonRunning(running_)
#else
#define DAEMON_RUNNING(running_)
#endif
#define HELP_COMMON_INFO_1 \
" -d, --debug <level> filter out log messages with priority below " \
"level.\n" \
" level may be: FATAL, ERROR, WARNING, NOTE, " \
"INFO,\n" \
" DEBUG, DEBUG1, DEBUG2.\n" \
" -n, --name <screen-name> use screen-name instead the hostname to " \
"identify\n" \
" this screen in the configuration.\n" \
" -1, --no-restart do not try to restart on failure.\n" \
"* --restart restart the server automatically if it fails.\n" \
" -l --log <file> write log messages to file.\n" \
" --no-tray disable the system tray icon.\n" \
" --enable-drag-drop enable file drag & drop.\n" \
" --enable-crypto enable TLS encryption.\n" \
" --tls-cert specify the path to the TLS certificate file.\n"
#define HELP_COMMON_INFO_2 \
" -h, --help display this help and exit.\n" \
" --version display version information and exit.\n"
#define HELP_COMMON_ARGS \
" [--name <screen-name>]" \
" [--restart|--no-restart]" \
" [--debug <level>]"
// system args (windows/unix)
#if SYSAPI_UNIX
// unix daemon mode args
#define HELP_SYS_ARGS " [--daemon|--no-daemon]"
#define HELP_SYS_INFO \
" -f, --no-daemon run in the foreground.\n" \
"* --daemon run as a daemon.\n"
#elif SYSAPI_WIN32
// windows args
#define HELP_SYS_ARGS " [--service <action>] [--relaunch] [--exit-pause]"
#define HELP_SYS_INFO \
" --service <action> manage the windows service, valid options " \
"are:\n" \
" install/uninstall/start/stop\n" \
" --relaunch persistently relaunches process in current " \
"user \n" \
" session (useful for vista and upward).\n" \
" --exit-pause wait for key press on exit, can be useful for\n" \
" reading error messages that occur on exit.\n"
#endif
#if !defined(WINAPI_LIBEI) && WINAPI_XWINDOWS
const auto kHelpNoWayland = "\n"
"Your Linux distribution does not support Wayland EI (emulated input)\n"
"which is required for Wayland support. Please use a Linux distribution\n"
"that supports Wayland EI.\n";
#else
const auto kHelpNoWayland = "";
#endif
| 9,208
|
C++
|
.h
| 217
| 39.387097
| 120
| 0.518589
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| true
| false
| false
| false
| false
| false
| false
|
13,787
|
key_types.h
|
deskflow_deskflow/src/lib/deskflow/key_types.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "common/basic_types.h"
//! Key ID
/*!
Type to hold a key symbol identifier. The encoding is UTF-32, using
U+E000 through U+EFFF for the various control keys (e.g. arrow
keys, function keys, modifier keys, etc).
*/
typedef UInt32 KeyID;
//! Key Code
/*!
Type to hold a physical key identifier. That is, it identifies a
physical key on the keyboard. KeyButton 0 is reserved to be an
invalid key; platforms that use 0 as a physical key identifier
will have to remap that value to some arbitrary unused id.
*/
typedef UInt16 KeyButton;
//! Modifier key mask
/*!
Type to hold a bitmask of key modifiers (e.g. shift keys).
*/
typedef UInt32 KeyModifierMask;
//! Modifier key ID
/*!
Type to hold the id of a key modifier (e.g. a shift key).
*/
typedef UInt32 KeyModifierID;
//! @name Modifier key masks
//@{
static const KeyModifierMask KeyModifierShift = 0x0001;
static const KeyModifierMask KeyModifierControl = 0x0002;
static const KeyModifierMask KeyModifierAlt = 0x0004;
static const KeyModifierMask KeyModifierMeta = 0x0008;
static const KeyModifierMask KeyModifierSuper = 0x0010;
static const KeyModifierMask KeyModifierAltGr = 0x0020;
static const KeyModifierMask KeyModifierLevel5Lock = 0x0040;
static const KeyModifierMask KeyModifierCapsLock = 0x1000;
static const KeyModifierMask KeyModifierNumLock = 0x2000;
static const KeyModifierMask KeyModifierScrollLock = 0x4000;
//@}
//! @name Modifier key bits
//@{
static const UInt32 kKeyModifierBitNone = 16;
static const UInt32 kKeyModifierBitShift = 0;
static const UInt32 kKeyModifierBitControl = 1;
static const UInt32 kKeyModifierBitAlt = 2;
static const UInt32 kKeyModifierBitMeta = 3;
static const UInt32 kKeyModifierBitSuper = 4;
static const UInt32 kKeyModifierBitAltGr = 5;
static const UInt32 kKeyModifierBitLevel5Lock = 6;
static const UInt32 kKeyModifierBitCapsLock = 12;
static const UInt32 kKeyModifierBitNumLock = 13;
static const UInt32 kKeyModifierBitScrollLock = 14;
static const SInt32 kKeyModifierNumBits = 16;
//@}
//! @name Modifier key identifiers
//@{
static const KeyModifierID kKeyModifierIDNull = 0;
static const KeyModifierID kKeyModifierIDShift = 1;
static const KeyModifierID kKeyModifierIDControl = 2;
static const KeyModifierID kKeyModifierIDAlt = 3;
static const KeyModifierID kKeyModifierIDMeta = 4;
static const KeyModifierID kKeyModifierIDSuper = 5;
static const KeyModifierID kKeyModifierIDAltGr = 6;
static const KeyModifierID kKeyModifierIDLast = 7;
//@}
//! @name Key identifiers
//@{
// all identifiers except kKeyNone and those in 0xE000 to 0xE0FF
// inclusive are equal to the corresponding X11 keysym - 0x1000.
// no key
static const KeyID kKeyNone = 0x0000;
// TTY functions
static const KeyID kKeyBackSpace = 0xEF08; /* back space, back char */
static const KeyID kKeyTab = 0xEF09;
static const KeyID kKeyLinefeed = 0xEF0A; /* Linefeed, LF */
static const KeyID kKeyClear = 0xEF0B;
static const KeyID kKeyReturn = 0xEF0D; /* Return, enter */
static const KeyID kKeyPause = 0xEF13; /* Pause, hold */
static const KeyID kKeyScrollLock = 0xEF14;
static const KeyID kKeySysReq = 0xEF15;
static const KeyID kKeyEscape = 0xEF1B;
static const KeyID kKeyHenkan = 0xEF23; /* Start/Stop Conversion */
static const KeyID kKeyKana = 0xEF26; /* Kana */
static const KeyID kKeyHiraganaKatakana = 0xEF27; /* Hiragana/Katakana toggle */
static const KeyID kKeyZenkaku = 0xEF2A; /* Zenkaku/Hankaku */
static const KeyID kKeyKanzi = 0xEF2A; /* Kanzi */
static const KeyID kKeyHangul = 0xEF31; /* Hangul */
static const KeyID kKeyHanja = 0xEF34; /* Hanja */
static const KeyID kKeyDelete = 0xEFFF; /* Delete, rubout */
// cursor control
static const KeyID kKeyHome = 0xEF50;
static const KeyID kKeyLeft = 0xEF51; /* Move left, left arrow */
static const KeyID kKeyUp = 0xEF52; /* Move up, up arrow */
static const KeyID kKeyRight = 0xEF53; /* Move right, right arrow */
static const KeyID kKeyDown = 0xEF54; /* Move down, down arrow */
static const KeyID kKeyPageUp = 0xEF55;
static const KeyID kKeyPageDown = 0xEF56;
static const KeyID kKeyEnd = 0xEF57; /* EOL */
static const KeyID kKeyBegin = 0xEF58; /* BOL */
// misc functions
static const KeyID kKeySelect = 0xEF60; /* Select, mark */
static const KeyID kKeyPrint = 0xEF61;
static const KeyID kKeyExecute = 0xEF62; /* Execute, run, do */
static const KeyID kKeyInsert = 0xEF63; /* Insert, insert here */
static const KeyID kKeyUndo = 0xEF65; /* Undo, oops */
static const KeyID kKeyRedo = 0xEF66; /* redo, again */
static const KeyID kKeyMenu = 0xEF67;
static const KeyID kKeyFind = 0xEF68; /* Find, search */
static const KeyID kKeyCancel = 0xEF69; /* Cancel, stop, abort, exit */
static const KeyID kKeyHelp = 0xEF6A; /* Help */
static const KeyID kKeyBreak = 0xEF6B;
static const KeyID kKeyAltGr = 0xEF7E; /* Character set switch */
static const KeyID kKeyNumLock = 0xEF7F;
// keypad
static const KeyID kKeyKP_Space = 0xEF80; /* space */
static const KeyID kKeyKP_Tab = 0xEF89;
static const KeyID kKeyKP_Enter = 0xEF8D; /* enter */
static const KeyID kKeyKP_F1 = 0xEF91; /* PF1, KP_A, ... */
static const KeyID kKeyKP_F2 = 0xEF92;
static const KeyID kKeyKP_F3 = 0xEF93;
static const KeyID kKeyKP_F4 = 0xEF94;
static const KeyID kKeyKP_Home = 0xEF95;
static const KeyID kKeyKP_Left = 0xEF96;
static const KeyID kKeyKP_Up = 0xEF97;
static const KeyID kKeyKP_Right = 0xEF98;
static const KeyID kKeyKP_Down = 0xEF99;
static const KeyID kKeyKP_PageUp = 0xEF9A;
static const KeyID kKeyKP_PageDown = 0xEF9B;
static const KeyID kKeyKP_End = 0xEF9C;
static const KeyID kKeyKP_Begin = 0xEF9D;
static const KeyID kKeyKP_Insert = 0xEF9E;
static const KeyID kKeyKP_Delete = 0xEF9F;
static const KeyID kKeyKP_Equal = 0xEFBD; /* equals */
static const KeyID kKeyKP_Multiply = 0xEFAA;
static const KeyID kKeyKP_Add = 0xEFAB;
static const KeyID kKeyKP_Separator = 0xEFAC; /* separator, often comma */
static const KeyID kKeyKP_Subtract = 0xEFAD;
static const KeyID kKeyKP_Decimal = 0xEFAE;
static const KeyID kKeyKP_Divide = 0xEFAF;
static const KeyID kKeyKP_0 = 0xEFB0;
static const KeyID kKeyKP_1 = 0xEFB1;
static const KeyID kKeyKP_2 = 0xEFB2;
static const KeyID kKeyKP_3 = 0xEFB3;
static const KeyID kKeyKP_4 = 0xEFB4;
static const KeyID kKeyKP_5 = 0xEFB5;
static const KeyID kKeyKP_6 = 0xEFB6;
static const KeyID kKeyKP_7 = 0xEFB7;
static const KeyID kKeyKP_8 = 0xEFB8;
static const KeyID kKeyKP_9 = 0xEFB9;
// function keys
static const KeyID kKeyF1 = 0xEFBE;
static const KeyID kKeyF2 = 0xEFBF;
static const KeyID kKeyF3 = 0xEFC0;
static const KeyID kKeyF4 = 0xEFC1;
static const KeyID kKeyF5 = 0xEFC2;
static const KeyID kKeyF6 = 0xEFC3;
static const KeyID kKeyF7 = 0xEFC4;
static const KeyID kKeyF8 = 0xEFC5;
static const KeyID kKeyF9 = 0xEFC6;
static const KeyID kKeyF10 = 0xEFC7;
static const KeyID kKeyF11 = 0xEFC8;
static const KeyID kKeyF12 = 0xEFC9;
static const KeyID kKeyF13 = 0xEFCA;
static const KeyID kKeyF14 = 0xEFCB;
static const KeyID kKeyF15 = 0xEFCC;
static const KeyID kKeyF16 = 0xEFCD;
static const KeyID kKeyF17 = 0xEFCE;
static const KeyID kKeyF18 = 0xEFCF;
static const KeyID kKeyF19 = 0xEFD0;
static const KeyID kKeyF20 = 0xEFD1;
static const KeyID kKeyF21 = 0xEFD2;
static const KeyID kKeyF22 = 0xEFD3;
static const KeyID kKeyF23 = 0xEFD4;
static const KeyID kKeyF24 = 0xEFD5;
static const KeyID kKeyF25 = 0xEFD6;
static const KeyID kKeyF26 = 0xEFD7;
static const KeyID kKeyF27 = 0xEFD8;
static const KeyID kKeyF28 = 0xEFD9;
static const KeyID kKeyF29 = 0xEFDA;
static const KeyID kKeyF30 = 0xEFDB;
static const KeyID kKeyF31 = 0xEFDC;
static const KeyID kKeyF32 = 0xEFDD;
static const KeyID kKeyF33 = 0xEFDE;
static const KeyID kKeyF34 = 0xEFDF;
static const KeyID kKeyF35 = 0xEFE0;
// modifiers
static const KeyID kKeyShift_L = 0xEFE1; /* Left shift */
static const KeyID kKeyShift_R = 0xEFE2; /* Right shift */
static const KeyID kKeyControl_L = 0xEFE3; /* Left control */
static const KeyID kKeyControl_R = 0xEFE4; /* Right control */
static const KeyID kKeyCapsLock = 0xEFE5; /* Caps lock */
static const KeyID kKeyShiftLock = 0xEFE6; /* Shift lock */
static const KeyID kKeyMeta_L = 0xEFE7; /* Left meta */
static const KeyID kKeyMeta_R = 0xEFE8; /* Right meta */
static const KeyID kKeyAlt_L = 0xEFE9; /* Left alt */
static const KeyID kKeyAlt_R = 0xEFEA; /* Right alt */
static const KeyID kKeySuper_L = 0xEFEB; /* Left super */
static const KeyID kKeySuper_R = 0xEFEC; /* Right super */
static const KeyID kKeyHyper_L = 0xEFED; /* Left hyper */
static const KeyID kKeyHyper_R = 0xEFEE; /* Right hyper */
// multi-key character composition
static const KeyID kKeyCompose = 0xEF20;
static const KeyID kKeyDeadGrave = 0x0300;
static const KeyID kKeyDeadAcute = 0x0301;
static const KeyID kKeyDeadCircumflex = 0x0302;
static const KeyID kKeyDeadTilde = 0x0303;
static const KeyID kKeyDeadMacron = 0x0304;
static const KeyID kKeyDeadBreve = 0x0306;
static const KeyID kKeyDeadAbovedot = 0x0307;
static const KeyID kKeyDeadDiaeresis = 0x0308;
static const KeyID kKeyDeadAbovering = 0x030a;
static const KeyID kKeyDeadDoubleacute = 0x030b;
static const KeyID kKeyDeadCaron = 0x030c;
static const KeyID kKeyDeadCedilla = 0x0327;
static const KeyID kKeyDeadOgonek = 0x0328;
// more function and modifier keys
static const KeyID kKeyLeftTab = 0xEE20;
// update modifiers
static const KeyID kKeySetModifiers = 0xEE06;
static const KeyID kKeyClearModifiers = 0xEE07;
// group change
static const KeyID kKeyNextGroup = 0xEE08;
static const KeyID kKeyPrevGroup = 0xEE0A;
// extended keys
static const KeyID kKeyEject = 0xE001;
static const KeyID kKeySleep = 0xE05F;
static const KeyID kKeyWWWBack = 0xE0A6;
static const KeyID kKeyWWWForward = 0xE0A7;
static const KeyID kKeyWWWRefresh = 0xE0A8;
static const KeyID kKeyWWWStop = 0xE0A9;
static const KeyID kKeyWWWSearch = 0xE0AA;
static const KeyID kKeyWWWFavorites = 0xE0AB;
static const KeyID kKeyWWWHome = 0xE0AC;
static const KeyID kKeyAudioMute = 0xE0AD;
static const KeyID kKeyAudioDown = 0xE0AE;
static const KeyID kKeyAudioUp = 0xE0AF;
static const KeyID kKeyAudioNext = 0xE0B0;
static const KeyID kKeyAudioPrev = 0xE0B1;
static const KeyID kKeyAudioStop = 0xE0B2;
static const KeyID kKeyAudioPlay = 0xE0B3;
static const KeyID kKeyAppMail = 0xE0B4;
static const KeyID kKeyAppMedia = 0xE0B5;
static const KeyID kKeyAppUser1 = 0xE0B6;
static const KeyID kKeyAppUser2 = 0xE0B7;
static const KeyID kKeyBrightnessDown = 0xE0B8;
static const KeyID kKeyBrightnessUp = 0xE0B9;
static const KeyID kKeyMissionControl = 0xE0C0;
static const KeyID kKeyLaunchpad = 0xE0C1;
//@}
struct KeyNameMapEntry
{
const char *m_name;
KeyID m_id;
};
struct KeyModifierNameMapEntry
{
const char *m_name;
KeyModifierMask m_mask;
};
//! Key name to KeyID table
/*!
A table of key names to the corresponding KeyID. Only the keys listed
above plus non-alphanumeric ASCII characters are in the table. The end
of the table is the first pair with a NULL m_name.
*/
extern const struct KeyNameMapEntry kKeyNameMap[];
//! Modifier key name to KeyModifierMask table
/*!
A table of modifier key names to the corresponding KeyModifierMask.
The end of the table is the first pair with a NULL m_name.
*/
extern const struct KeyModifierNameMapEntry kModifierNameMap[];
| 12,046
|
C++
|
.h
| 290
| 40.365517
| 80
| 0.779881
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| true
| false
| false
| false
| false
| false
| false
|
13,788
|
mouse_types.h
|
deskflow_deskflow/src/lib/deskflow/mouse_types.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "base/EventTypes.h"
//! Mouse button ID
/*!
Type to hold a mouse button identifier.
*/
typedef UInt8 ButtonID;
//! @name Mouse button identifiers
//@{
static const ButtonID kButtonNone = 0;
static const ButtonID kButtonLeft = 1;
static const ButtonID kButtonMiddle = 2;
static const ButtonID kButtonRight = 3;
static const ButtonID kButtonExtra0 = 4;
static const ButtonID kButtonExtra1 = 5;
static const ButtonID kMacButtonRight = 2;
static const ButtonID kMacButtonMiddle = 3;
//@}
static const UInt8 NumButtonIDs = 5;
| 1,279
|
C++
|
.h
| 36
| 33.916667
| 72
| 0.774454
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,789
|
ArgParser.h
|
deskflow_deskflow/src/lib/deskflow/ArgParser.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2014-2016 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/>.
*/
#pragma once
#include "base/String.h"
#include "common/stdvector.h"
namespace deskflow {
class ArgsBase;
class ServerArgs;
class ClientArgs;
} // namespace deskflow
class App;
class ArgParser
{
public:
ArgParser(App *app);
bool parseServerArgs(deskflow::ServerArgs &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 parseGenericArgs(int argc, const char *const *argv, int &i);
bool parseDeprecatedArgs(int argc, const char *const *argv, int &i);
void setArgsBase(deskflow::ArgsBase &argsBase)
{
m_argsBase = &argsBase;
}
static bool isArg(
int argi, int argc, const char *const *argv, const char *name1, const char *name2, int minRequiredParameters = 0
);
static void splitCommandString(String &command, std::vector<String> &argv);
static bool searchDoubleQuotes(String &command, size_t &left, size_t &right, size_t startPos = 0);
static void removeDoubleQuotes(String &arg);
static const char **getArgv(std::vector<String> &argsArray);
static String assembleCommand(std::vector<String> &argsArray, String ignoreArg = "", int parametersRequired = 0);
static deskflow::ArgsBase &argsBase()
{
return *m_argsBase;
}
private:
void updateCommonArgs(const char *const *argv);
bool checkUnexpectedArgs();
private:
App *m_app;
static deskflow::ArgsBase *m_argsBase;
};
| 2,225
|
C++
|
.h
| 57
| 36.508772
| 120
| 0.754638
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| true
| false
| false
| false
| false
| false
| false
|
13,790
|
IAppUtil.h
|
deskflow_deskflow/src/lib/deskflow/IAppUtil.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "base/String.h"
#include "common/IInterface.h"
#include "deskflow/IApp.h"
class IAppUtil : public IInterface
{
public:
virtual void adoptApp(IApp *app) = 0;
virtual IApp &app() const = 0;
virtual int run(int argc, char **argv) = 0;
virtual void beforeAppExit() = 0;
virtual void startNode() = 0;
virtual std::vector<String> getKeyboardLayoutList() = 0;
virtual String getCurrentLanguageCode() = 0;
virtual void showNotification(const String &title, const String &text) const = 0;
};
| 1,254
|
C++
|
.h
| 33
| 35.939394
| 83
| 0.751232
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,791
|
IScreen.h
|
deskflow_deskflow/src/lib/deskflow/IScreen.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2003 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "base/Event.h"
#include "base/EventTypes.h"
#include "common/IInterface.h"
#include "deskflow/clipboard_types.h"
class IClipboard;
//! Screen interface
/*!
This interface defines the methods common to all screens.
*/
class IScreen : public IInterface
{
public:
struct ClipboardInfo
{
public:
ClipboardID m_id;
UInt32 m_sequenceNumber;
};
//! @name accessors
//@{
//! Get event target
/*!
Returns the target used for events created by this object.
*/
virtual void *getEventTarget() const = 0;
//! Get clipboard
/*!
Save the contents of the clipboard indicated by \c id and return
true iff successful.
*/
virtual bool getClipboard(ClipboardID id, IClipboard *) const = 0;
//! Get screen shape
/*!
Return the position of the upper-left corner of the screen in \c x and
\c y and the size of the screen in \c width and \c height.
*/
virtual void getShape(SInt32 &x, SInt32 &y, SInt32 &width, SInt32 &height) const = 0;
//! Get cursor position
/*!
Return the current position of the cursor in \c x and \c y.
*/
virtual void getCursorPos(SInt32 &x, SInt32 &y) const = 0;
//@}
};
| 1,900
|
C++
|
.h
| 62
| 28.16129
| 87
| 0.728665
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| true
| false
| false
| false
| false
| false
| false
|
13,792
|
IClient.h
|
deskflow_deskflow/src/lib/deskflow/IClient.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "base/String.h"
#include "deskflow/IScreen.h"
#include "deskflow/clipboard_types.h"
#include "deskflow/key_types.h"
#include "deskflow/mouse_types.h"
#include "deskflow/option_types.h"
//! Client interface
/*!
This interface defines the methods necessary for the server to
communicate with a client.
*/
class IClient : public IScreen
{
public:
//! @name manipulators
//@{
//! Enter screen
/*!
Enter the screen. The cursor should be warped to \p xAbs,yAbs.
\p mask is the expected toggle button state and the client should
update its state to match. \p forScreensaver is true iff the
screen is being entered because the screen saver is starting.
Subsequent clipboard events should report \p seqNum.
*/
virtual void enter(SInt32 xAbs, SInt32 yAbs, UInt32 seqNum, KeyModifierMask mask, bool forScreensaver) = 0;
//! Leave screen
/*!
Leave the screen. Return false iff the user may not leave the
client's screen (because, for example, a button is down).
*/
virtual bool leave() = 0;
//! Set clipboard
/*!
Update the client's clipboard. This implies that the client's
clipboard is now up to date. If the client's clipboard was
already known to be up to date then this may do nothing. \c data
has marshalled clipboard data.
*/
virtual void setClipboard(ClipboardID, const IClipboard *) = 0;
//! Grab clipboard
/*!
Grab (i.e. take ownership of) the client's clipboard. Since this
is called when another client takes ownership of the clipboard it
implies that the client's clipboard is out of date.
*/
virtual void grabClipboard(ClipboardID) = 0;
//! Mark clipboard dirty
/*!
Mark the client's clipboard as dirty (out of date) or clean (up to
date).
*/
virtual void setClipboardDirty(ClipboardID, bool dirty) = 0;
//! Notify of key press
/*!
Synthesize key events to generate a press of key \c id. If possible
match the given modifier mask. The KeyButton identifies the physical
key on the server that generated this key down. The client must
ensure that a key up or key repeat that uses the same KeyButton will
synthesize an up or repeat for the same client key synthesized by
keyDown().
*/
virtual void keyDown(KeyID id, KeyModifierMask, KeyButton, const String &) = 0;
//! Notify of key repeat
/*!
Synthesize key events to generate a press and release of key \c id
\c count times. If possible match the given modifier mask.
*/
virtual void keyRepeat(KeyID id, KeyModifierMask, SInt32 count, KeyButton, const String &lang) = 0;
//! Notify of key release
/*!
Synthesize key events to generate a release of key \c id. If possible
match the given modifier mask.
*/
virtual void keyUp(KeyID id, KeyModifierMask, KeyButton) = 0;
//! Notify of mouse press
/*!
Synthesize mouse events to generate a press of mouse button \c id.
*/
virtual void mouseDown(ButtonID id) = 0;
//! Notify of mouse release
/*!
Synthesize mouse events to generate a release of mouse button \c id.
*/
virtual void mouseUp(ButtonID id) = 0;
//! Notify of mouse motion
/*!
Synthesize mouse events to generate mouse motion to the absolute
screen position \c xAbs,yAbs.
*/
virtual void mouseMove(SInt32 xAbs, SInt32 yAbs) = 0;
//! Notify of mouse motion
/*!
Synthesize mouse events to generate mouse motion by the relative
amount \c xRel,yRel.
*/
virtual void mouseRelativeMove(SInt32 xRel, SInt32 yRel) = 0;
//! Notify of mouse wheel motion
/*!
Synthesize mouse events to generate mouse wheel motion of \c xDelta
and \c yDelta. Deltas are positive for motion away from the user or
to the right and negative for motion towards the user or to the left.
Each wheel click should generate a delta of +/-120.
*/
virtual void mouseWheel(SInt32 xDelta, SInt32 yDelta) = 0;
//! Notify of screen saver change
virtual void screensaver(bool activate) = 0;
//! Notify of options changes
/*!
Reset all options to their default values.
*/
virtual void resetOptions() = 0;
//! Notify of options changes
/*!
Set options to given values. Ignore unknown options and don't
modify our options that aren't given in \c options.
*/
virtual void setOptions(const OptionsList &options) = 0;
//@}
//! @name accessors
//@{
//! Get client name
/*!
Return the client's name.
*/
virtual String getName() const = 0;
//@}
// IScreen overrides
virtual void *getEventTarget() const = 0;
virtual bool getClipboard(ClipboardID id, IClipboard *) const = 0;
virtual void getShape(SInt32 &x, SInt32 &y, SInt32 &width, SInt32 &height) const = 0;
virtual void getCursorPos(SInt32 &x, SInt32 &y) const = 0;
};
| 5,449
|
C++
|
.h
| 150
| 33.506667
| 109
| 0.73351
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| true
| false
| false
| false
| false
| false
| false
|
13,793
|
AppUtil.h
|
deskflow_deskflow/src/lib/deskflow/AppUtil.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "deskflow/IAppUtil.h"
#include "deskflow/XDeskflow.h"
class AppUtil : public IAppUtil
{
public:
AppUtil();
virtual ~AppUtil();
virtual void adoptApp(IApp *app);
IApp &app() const;
virtual void exitApp(int code)
{
throw XExitApp(code);
}
static AppUtil &instance();
static void exitAppStatic(int code)
{
instance().exitApp(code);
}
virtual void beforeAppExit()
{
}
private:
IApp *m_app;
static AppUtil *s_instance;
};
| 1,215
|
C++
|
.h
| 43
| 25.813953
| 72
| 0.741852
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,794
|
DaemonApp.h
|
deskflow_deskflow/src/lib/deskflow/DaemonApp.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012 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/>.
*/
#pragma once
#include "ipc/IpcServer.h"
#include <memory>
#include <string>
class Event;
class IpcLogOutputter;
class FileLogOutputter;
#if SYSAPI_WIN32
class MSWindowsWatchdog;
#endif
extern const char *const kLogFilename;
class DaemonApp
{
public:
DaemonApp();
~DaemonApp();
int run(int argc, char **argv);
void mainLoop(bool logToFile, bool foreground = false);
private:
void daemonize();
void foregroundError(const char *message);
std::string logFilename();
void handleIpcMessage(const Event &, void *);
public:
static DaemonApp *s_instance;
#if SYSAPI_WIN32
std::unique_ptr<MSWindowsWatchdog> m_watchdog;
#endif
private:
std::unique_ptr<IpcServer> m_ipcServer;
std::unique_ptr<IpcLogOutputter> m_ipcLogOutputter;
std::unique_ptr<IEventQueue> m_events;
std::unique_ptr<FileLogOutputter> m_fileLogOutputter;
};
| 1,540
|
C++
|
.h
| 50
| 28.7
| 72
| 0.772666
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,796
|
INode.h
|
deskflow_deskflow/src/lib/deskflow/INode.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "common/IInterface.h"
class INode : IInterface
{
};
| 807
|
C++
|
.h
| 22
| 34.818182
| 72
| 0.762148
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,797
|
IKeyState.h
|
deskflow_deskflow/src/lib/deskflow/IKeyState.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2003 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "base/Event.h"
#include "base/EventTypes.h"
#include "base/IEventQueue.h"
#include "base/String.h"
#include "common/IInterface.h"
#include "common/stdset.h"
#include "deskflow/key_types.h"
//! Key state interface
/*!
This interface provides access to set and query the keyboard state and
to synthesize key events.
*/
class IKeyState : public IInterface
{
public:
IKeyState(IEventQueue *events);
enum
{
kNumButtons = 0x200
};
//! Key event data
class KeyInfo
{
public:
static KeyInfo *alloc(KeyID, KeyModifierMask, KeyButton, SInt32 count);
static KeyInfo *alloc(KeyID, KeyModifierMask, KeyButton, SInt32 count, const std::set<String> &destinations);
static KeyInfo *alloc(const KeyInfo &);
static bool isDefault(const char *screens);
static bool contains(const char *screens, const String &name);
static bool equal(const KeyInfo *, const KeyInfo *);
static String join(const std::set<String> &destinations);
static void split(const char *screens, std::set<String> &);
public:
KeyID m_key;
KeyModifierMask m_mask;
KeyButton m_button;
SInt32 m_count;
char *m_screens;
char m_screensBuffer[1];
};
typedef std::set<KeyButton> KeyButtonSet;
//! @name manipulators
//@{
//! Update the keyboard map
/*!
Causes the key state to get updated to reflect the current keyboard
mapping.
*/
virtual void updateKeyMap() = 0;
//! Update the key state
/*!
Causes the key state to get updated to reflect the physical keyboard
state.
*/
virtual void updateKeyState() = 0;
//! Set half-duplex mask
/*!
Sets which modifier toggle keys are half-duplex. A half-duplex
toggle key doesn't report a key release when toggled on and
doesn't report a key press when toggled off.
*/
virtual void setHalfDuplexMask(KeyModifierMask) = 0;
//! Fake a key press
/*!
Synthesizes a key press event and updates the key state.
*/
virtual void fakeKeyDown(KeyID id, KeyModifierMask mask, KeyButton button, const String &lang) = 0;
//! Fake a key repeat
/*!
Synthesizes a key repeat event and updates the key state.
*/
virtual bool fakeKeyRepeat(KeyID id, KeyModifierMask mask, SInt32 count, KeyButton button, const String &lang) = 0;
//! Fake a key release
/*!
Synthesizes a key release event and updates the key state.
*/
virtual bool fakeKeyUp(KeyButton button) = 0;
//! Fake key releases for all fake pressed keys
/*!
Synthesizes a key release event for every key that is synthetically
pressed and updates the key state.
*/
virtual void fakeAllKeysUp() = 0;
//! Fake ctrl+alt+del
/*!
Synthesize a press of ctrl+alt+del. Return true if processing is
complete and false if normal key processing should continue.
*/
virtual bool fakeCtrlAltDel() = 0;
//! Fake a media key
/*!
Synthesizes a media key down and up. Only Mac would implement this by
use cocoa appkit framework.
*/
virtual bool fakeMediaKey(KeyID id) = 0;
//@}
//! @name accessors
//@{
//! Test if key is pressed
/*!
Returns true iff the given key is down. Half-duplex toggles
always return false.
*/
virtual bool isKeyDown(KeyButton) const = 0;
//! Get the active modifiers
/*!
Returns the modifiers that are currently active according to our
shadowed state.
*/
virtual KeyModifierMask getActiveModifiers() const = 0;
//! Get the active modifiers from OS
/*!
Returns the modifiers that are currently active according to the
operating system.
*/
virtual KeyModifierMask pollActiveModifiers() const = 0;
//! Get the active keyboard layout from OS
/*!
Returns the active keyboard layout according to the operating system.
*/
virtual SInt32 pollActiveGroup() const = 0;
//! Get the keys currently pressed from OS
/*!
Adds any keys that are currently pressed according to the operating
system to \p pressedKeys.
*/
virtual void pollPressedKeys(KeyButtonSet &pressedKeys) const = 0;
//@}
};
| 4,746
|
C++
|
.h
| 147
| 29.244898
| 117
| 0.731745
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| true
| false
| false
| false
| false
| false
| false
|
13,798
|
Config.h
|
deskflow_deskflow/src/lib/deskflow/Config.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2024 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/>.
*/
#pragma once
#include <stdexcept>
#include <string>
#include <vector>
namespace deskflow {
//! App configuration
/*!
Parses a configuration file describing start args and potentially other
configuration options in future. The configuration file is in TOML format.
Initially this class was created to as a developer convenience; it is a
convenient place to specify args without needing to fiddle with IDE configs.
*/
class Config
{
public:
class ParseError : public std::runtime_error
{
public:
explicit ParseError() : std::runtime_error("failed to parse config file")
{
}
};
class NoConfigFilenameError : public std::runtime_error
{
public:
explicit NoConfigFilenameError() : std::runtime_error("no config file specified")
{
}
};
explicit Config(const std::string &filename, const std::string §ion);
bool load(const std::string &firstArg);
const char *const *argv() const;
int argc() const;
private:
std::string m_filename;
std::string m_section;
std::vector<std::string> m_args;
std::vector<const char *> m_argv;
};
} // namespace deskflow
| 1,797
|
C++
|
.h
| 56
| 29.642857
| 85
| 0.751011
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,799
|
KeyState.h
|
deskflow_deskflow/src/lib/deskflow/KeyState.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "deskflow/IKeyState.h"
#include "deskflow/KeyMap.h"
//! Core key state
/*!
This class provides key state services. Subclasses must implement a few
platform specific methods.
*/
class KeyState : public IKeyState
{
public:
KeyState(IEventQueue *events, std::vector<String> layouts, bool isLangSyncEnabled);
KeyState(IEventQueue *events, deskflow::KeyMap &keyMap, std::vector<String> layouts, bool isLangSyncEnabled);
virtual ~KeyState();
//! @name manipulators
//@{
//! Handle key event
/*!
Sets the state of \p button to down or up and updates the current
modifier state to \p newState. This method should be called by
primary screens only in response to local events. For auto-repeat
set \p down to \c true. Overrides must forward to the superclass.
*/
virtual void onKey(KeyButton button, bool down, KeyModifierMask newState);
//! Post a key event
/*!
Posts a key event. This may adjust the event or post additional
events in some circumstances. If this is overridden it must forward
to the superclass.
*/
virtual void sendKeyEvent(
void *target, bool press, bool isAutoRepeat, KeyID key, KeyModifierMask mask, SInt32 count, KeyButton button
);
//@}
//! @name accessors
//@{
//@}
void updateKeyMap(deskflow::KeyMap *existing);
// IKeyState overrides
void updateKeyMap() override
{
this->updateKeyMap(nullptr);
}
void updateKeyState() override;
void setHalfDuplexMask(KeyModifierMask) override;
void fakeKeyDown(KeyID id, KeyModifierMask mask, KeyButton button, const String &lang) override;
bool fakeKeyRepeat(KeyID id, KeyModifierMask mask, SInt32 count, KeyButton button, const String &lang) override;
bool fakeKeyUp(KeyButton button) override;
void fakeAllKeysUp() override;
bool fakeMediaKey(KeyID id) override;
bool isKeyDown(KeyButton) const override;
KeyModifierMask getActiveModifiers() const override;
// Left abstract
virtual bool fakeCtrlAltDel() override = 0;
virtual KeyModifierMask pollActiveModifiers() const override = 0;
virtual SInt32 pollActiveGroup() const override = 0;
virtual void pollPressedKeys(KeyButtonSet &pressedKeys) const override = 0;
SInt32 getKeyState(KeyButton keyButton)
{
return m_keys[keyButton];
}
protected:
typedef deskflow::KeyMap::Keystroke Keystroke;
//! @name protected manipulators
//@{
//! Get the keyboard map
/*!
Fills \p keyMap with the current keyboard map.
*/
virtual void getKeyMap(deskflow::KeyMap &keyMap) = 0;
//! Fake a key event
/*!
Synthesize an event for \p keystroke.
*/
virtual void fakeKey(const Keystroke &keystroke) = 0;
//! Get the active modifiers
/*!
Returns the modifiers that are currently active according to our
shadowed state. The state may be modified.
*/
virtual KeyModifierMask &getActiveModifiersRValue();
//@}
//! @name protected accessors
//@{
//! Compute a group number
/*!
Returns the number of the group \p offset groups after group \p group.
*/
SInt32 getEffectiveGroup(SInt32 group, SInt32 offset) const;
//! Check if key is ignored
/*!
Returns \c true if and only if the key should always be ignored.
The default returns \c true only for the toggle keys.
*/
virtual bool isIgnoredKey(KeyID key, KeyModifierMask mask) const;
//! Get button for a KeyID
/*!
Return the button mapped to key \p id in group \p group if any,
otherwise returns 0.
*/
KeyButton getButton(KeyID id, SInt32 group) const;
//@}
private:
typedef deskflow::KeyMap::Keystrokes Keystrokes;
typedef deskflow::KeyMap::ModifierToKeys ModifierToKeys;
public:
struct AddActiveModifierContext
{
public:
AddActiveModifierContext(SInt32 group, KeyModifierMask mask, ModifierToKeys &activeModifiers);
public:
SInt32 m_activeGroup;
KeyModifierMask m_mask;
ModifierToKeys &m_activeModifiers;
private:
// not implemented
AddActiveModifierContext(const AddActiveModifierContext &);
AddActiveModifierContext &operator=(const AddActiveModifierContext &);
};
private:
class ButtonToKeyLess
{
public:
bool operator()(
const deskflow::KeyMap::ButtonToKeyMap::value_type &a, const deskflow::KeyMap::ButtonToKeyMap::value_type b
) const
{
return (a.first < b.first);
}
};
// not implemented
KeyState(const KeyState &);
KeyState &operator=(const KeyState &);
// called by all ctors.
void init();
// adds alias key sequences. these are sequences that are equivalent
// to other sequences.
void addAliasEntries();
// adds non-keypad key sequences for keypad KeyIDs
void addKeypadEntries();
// adds key sequences for combination KeyIDs (those built using
// dead keys)
void addCombinationEntries();
// synthesize key events. synthesize auto-repeat events count times.
void fakeKeys(const Keystrokes &, UInt32 count);
// update key state to match changes to modifiers
void updateModifierKeyState(KeyButton button, const ModifierToKeys &oldModifiers, const ModifierToKeys &newModifiers);
// active modifiers collection callback
static void addActiveModifierCB(KeyID id, SInt32 group, deskflow::KeyMap::KeyItem &keyItem, void *vcontext);
private:
// must be declared before m_keyMap. used when this class owns the key map.
deskflow::KeyMap *m_keyMapPtr;
// the keyboard map
deskflow::KeyMap &m_keyMap;
// current modifier state
KeyModifierMask m_mask;
// the active modifiers and the buttons activating them
ModifierToKeys m_activeModifiers;
// current keyboard state (> 0 if pressed, 0 otherwise). this is
// initialized to the keyboard state according to the system then
// it tracks synthesized events.
SInt32 m_keys[kNumButtons];
// synthetic keyboard state (> 0 if pressed, 0 otherwise). this
// tracks the synthesized keyboard state. if m_keys[n] > 0 but
// m_syntheticKeys[n] == 0 then the key was pressed locally and
// not synthesized yet.
SInt32 m_syntheticKeys[kNumButtons];
// client data for each pressed key
UInt32 m_keyClientData[kNumButtons];
// server keyboard state. an entry is 0 if not the key isn't pressed
// otherwise it's the local KeyButton synthesized for the server key.
KeyButton m_serverKeys[kNumButtons];
IEventQueue *m_events;
bool m_isLangSyncEnabled;
};
| 7,078
|
C++
|
.h
| 192
| 33.697917
| 120
| 0.751827
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| true
| false
| false
| false
| false
| false
| false
|
13,800
|
clipboard_types.h
|
deskflow_deskflow/src/lib/deskflow/clipboard_types.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "common/basic_types.h"
//! Clipboard ID
/*!
Type to hold a clipboard identifier.
*/
typedef UInt8 ClipboardID;
//! @name Clipboard identifiers
//@{
// clipboard identifiers. kClipboardClipboard is what is normally
// considered the clipboard (e.g. the cut/copy/paste menu items
// affect it). kClipboardSelection is the selection on those
// platforms that can treat the selection as a clipboard (e.g. X
// windows). clipboard identifiers must be sequential starting
// at zero.
static const ClipboardID kClipboardClipboard = 0;
static const ClipboardID kClipboardSelection = 1;
// the number of clipboards (i.e. one greater than the last clipboard id)
static const ClipboardID kClipboardEnd = 2;
//@}
| 1,462
|
C++
|
.h
| 37
| 37.945946
| 73
| 0.771127
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| true
| true
| false
| false
| false
| false
| false
| false
|
13,801
|
ClientTaskBarReceiver.h
|
deskflow_deskflow/src/lib/deskflow/ClientTaskBarReceiver.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2003 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "arch/IArchTaskBarReceiver.h"
#include "base/String.h"
#include "base/log_outputters.h"
#include "client/Client.h"
class IEventQueue;
//! Implementation of IArchTaskBarReceiver for the deskflow server
class ClientTaskBarReceiver : public IArchTaskBarReceiver
{
public:
ClientTaskBarReceiver(IEventQueue *events);
virtual ~ClientTaskBarReceiver();
//! @name manipulators
//@{
//! Update status
/*!
Determine the status and query required information from the client.
*/
void updateStatus(Client *, const String &errorMsg);
void updateStatus(INode *n, const String &errorMsg)
{
updateStatus((Client *)n, errorMsg);
}
//@}
// IArchTaskBarReceiver overrides
virtual void showStatus() = 0;
virtual void runMenu(int x, int y) = 0;
virtual void primaryAction() = 0;
virtual void lock() const;
virtual void unlock() const;
virtual const Icon getIcon() const = 0;
virtual std::string getToolTip() const;
virtual void cleanup()
{
}
protected:
enum EState
{
kNotRunning,
kNotWorking,
kNotConnected,
kConnecting,
kConnected,
kMaxState
};
//! Get status
EState getStatus() const;
//! Get error message
const String &getErrorMessage() const;
//! Quit app
/*!
Causes the application to quit gracefully
*/
void quit();
//! Status change notification
/*!
Called when status changes. The default implementation does nothing.
*/
virtual void onStatusChanged(Client *client);
private:
EState m_state;
String m_errorMessage;
String m_server;
IEventQueue *m_events;
};
IArchTaskBarReceiver *createTaskBarReceiver(const BufferedLogOutputter *logBuffer, IEventQueue *events);
| 2,439
|
C++
|
.h
| 83
| 26.578313
| 104
| 0.748718
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| true
| false
| false
| false
| false
| false
| false
|
13,803
|
IApp.h
|
deskflow_deskflow/src/lib/deskflow/IApp.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2012 Nick Bolton
*
* 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/>.
*/
#pragma once
#include "common/IInterface.h"
typedef int (*StartupFunc)(int, char **);
namespace deskflow {
class ArgsBase;
}
class ILogOutputter;
class IArchTaskBarReceiver;
namespace deskflow {
class Screen;
}
class IEventQueue;
class IApp : public IInterface
{
public:
virtual void setByeFunc(void (*bye)(int)) = 0;
virtual deskflow::ArgsBase &argsBase() const = 0;
virtual int standardStartup(int argc, char **argv) = 0;
virtual int runInner(int argc, char **argv, ILogOutputter *outputter, StartupFunc startup) = 0;
virtual void startNode() = 0;
virtual IArchTaskBarReceiver *taskBarReceiver() const = 0;
virtual void bye(int error) = 0;
virtual int mainLoop() = 0;
virtual void initApp(int argc, const char **argv) = 0;
virtual const char *daemonName() const = 0;
virtual int foregroundStartup(int argc, char **argv) = 0;
virtual deskflow::Screen *createScreen() = 0;
virtual IEventQueue *getEvents() const = 0;
};
| 1,677
|
C++
|
.h
| 46
| 34.413043
| 97
| 0.752615
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,804
|
IScreenSaver.h
|
deskflow_deskflow/src/lib/deskflow/IScreenSaver.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "base/Event.h"
#include "common/IInterface.h"
//! Screen saver interface
/*!
This interface defines the methods common to all screen savers.
*/
class IScreenSaver : public IInterface
{
public:
// note -- the c'tor/d'tor must *not* enable/disable the screen saver
//! @name manipulators
//@{
//! Enable screen saver
/*!
Enable the screen saver, restoring the screen saver settings to
what they were when disable() was previously called. If disable()
wasn't previously called then it should keep the current settings
or use reasonable defaults.
*/
virtual void enable() = 0;
//! Disable screen saver
/*!
Disable the screen saver, saving the old settings for the next
call to enable().
*/
virtual void disable() = 0;
//! Activate screen saver
/*!
Activate (i.e. show) the screen saver.
*/
virtual void activate() = 0;
//! Deactivate screen saver
/*!
Deactivate (i.e. hide) the screen saver, reseting the screen saver
timer.
*/
virtual void deactivate() = 0;
//@}
//! @name accessors
//@{
//! Test if screen saver on
/*!
Returns true iff the screen saver is currently active (showing).
*/
virtual bool isActive() const = 0;
//@}
};
| 1,966
|
C++
|
.h
| 65
| 27.692308
| 72
| 0.721164
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,805
|
IClipboard.h
|
deskflow_deskflow/src/lib/deskflow/IClipboard.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "base/EventTypes.h"
#include "base/String.h"
#include "common/IInterface.h"
//! Clipboard interface
/*!
This interface defines the methods common to all clipboards.
*/
class IClipboard : public IInterface
{
public:
//! Timestamp type
/*!
Timestamp type. Timestamps are in milliseconds from some
arbitrary starting time. Timestamps will wrap around to 0
after about 49 3/4 days.
*/
typedef UInt32 Time;
//! Clipboard formats
/*!
The list of known clipboard formats. kNumFormats must be last and
formats must be sequential starting from zero. Clipboard data set
via add() and retrieved via get() must be in one of these formats.
Platform dependent clipboard subclasses can and should present any
suitable formats derivable from these formats.
\c kText is a text format encoded in UTF-8. Newlines are LF (not
CR or LF/CR).
\c kBitmap is an image format. The data is a BMP file without the
14 byte header (i.e. starting at the INFOHEADER) and with the image
data immediately following the 40 byte INFOHEADER.
\c kHTML is a text format encoded in UTF-8 and containing a valid
HTML fragment (but not necessarily a complete HTML document).
Newlines are LF.
*/
enum EFormat
{
kText, //!< Text format, UTF-8, newline is LF
kHTML, //!< HTML format, HTML fragment, UTF-8, newline is LF
kBitmap, //!< Bitmap format, BMP 24/32bpp, BI_RGB
kNumFormats //!< The number of clipboard formats
};
//! @name manipulators
//@{
//! Empty clipboard
/*!
Take ownership of the clipboard and clear all data from it.
This must be called between a successful open() and close().
Return false if the clipboard ownership could not be taken;
the clipboard should not be emptied in this case.
*/
virtual bool empty() = 0;
//! Add data
/*!
Add data in the given format to the clipboard. May only be
called after a successful empty().
*/
virtual void add(EFormat, const String &data) = 0;
//@}
//! @name accessors
//@{
//! Open clipboard
/*!
Open the clipboard. Return true iff the clipboard could be
opened. If open() returns true then the client must call
close() at some later time; if it returns false then close()
must not be called. \c time should be the current time or
a time in the past when the open should effectively have taken
place.
*/
virtual bool open(Time time) const = 0;
//! Close clipboard
/*!
Close the clipboard. close() must match a preceding successful
open(). This signals that the clipboard has been filled with
all the necessary data or all data has been read. It does not
mean the clipboard ownership should be released (if it was
taken).
*/
virtual void close() const = 0;
//! Get time
/*!
Return the timestamp passed to the last successful open().
*/
virtual Time getTime() const = 0;
//! Check for data
/*!
Return true iff the clipboard contains data in the given
format. Must be called between a successful open() and close().
*/
virtual bool has(EFormat) const = 0;
//! Get data
/*!
Return the data in the given format. Returns the empty string
if there is no data in that format. Must be called between
a successful open() and close().
*/
virtual String get(EFormat) const = 0;
//! Marshall clipboard data
/*!
Merge \p clipboard's data into a single buffer that can be later
unmarshalled to restore the clipboard and return the buffer.
*/
static String marshall(const IClipboard *clipboard);
//! Unmarshall clipboard data
/*!
Extract marshalled clipboard data and store it in \p clipboard.
Sets the clipboard time to \c time.
*/
static void unmarshall(IClipboard *clipboard, const String &data, Time time);
//! Copy clipboard
/*!
Transfers all the data in one clipboard to another. The
clipboards can be of any concrete clipboard type (and
they don't have to be the same type). This also sets
the destination clipboard's timestamp to source clipboard's
timestamp. Returns true iff the copy succeeded.
*/
static bool copy(IClipboard *dst, const IClipboard *src);
//! Copy clipboard
/*!
Transfers all the data in one clipboard to another. The
clipboards can be of any concrete clipboard type (and they
don't have to be the same type). This also sets the
timestamp to \c time. Returns true iff the copy succeeded.
*/
static bool copy(IClipboard *dst, const IClipboard *src, Time);
//@}
private:
static UInt32 readUInt32(const char *);
static void writeUInt32(String *, UInt32);
};
| 5,331
|
C++
|
.h
| 148
| 33.114865
| 79
| 0.729897
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,806
|
ServerApp.h
|
deskflow_deskflow/src/lib/deskflow/ServerApp.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "arch/Arch.h"
#include "arch/IArchMultithread.h"
#include "base/EventTypes.h"
#include "base/String.h"
#include "deskflow/App.h"
#include "net/NetworkAddress.h"
#include "server/Config.h"
enum EServerState
{
kUninitialized,
kInitializing,
kInitializingToStart,
kInitialized,
kStarting,
kStarted
};
class Server;
namespace deskflow {
class Screen;
}
class ClientListener;
class EventQueueTimer;
class ILogOutputter;
class IEventQueue;
class ISocketFactory;
namespace deskflow {
class ServerArgs;
}
class ServerApp : public App
{
using ServerConfig = deskflow::server::Config;
public:
ServerApp(IEventQueue *events, CreateTaskBarReceiverFunc createTaskBarReceiver);
virtual ~ServerApp();
//
// IApp overrides
//
void parseArgs(int argc, const char *const *argv) override;
void help() override;
const char *daemonName() const override;
const char *daemonInfo() const override;
void loadConfig() override;
bool loadConfig(const String &pathname) override;
deskflow::Screen *createScreen() override;
int mainLoop() override;
int runInner(int argc, char **argv, ILogOutputter *outputter, StartupFunc startup) override;
int standardStartup(int argc, char **argv) override;
int foregroundStartup(int argc, char **argv) override;
void startNode() override;
//
// App overrides
//
std::string configSection() const override
{
return "server";
}
//
// Regular functions
//
void reloadConfig(const Event &, void *);
void forceReconnect(const Event &, void *);
void resetServer(const Event &, void *);
void handleClientConnected(const Event &, void *vlistener);
void handleClientsDisconnected(const Event &, void *);
void closeServer(Server *server);
void stopRetryTimer();
void updateStatus();
void updateStatus(const String &msg);
void closeClientListener(ClientListener *listen);
void stopServer();
void closePrimaryClient(PrimaryClient *primaryClient);
void closeServerScreen(deskflow::Screen *screen);
void cleanupServer();
bool initServer();
void retryHandler(const Event &, void *);
deskflow::Screen *openServerScreen();
PrimaryClient *openPrimaryClient(const String &name, deskflow::Screen *screen);
void handleScreenError(const Event &, void *);
void handleSuspend(const Event &, void *);
void handleResume(const Event &, void *);
ClientListener *openClientListener(const NetworkAddress &address);
Server *openServer(ServerConfig &config, PrimaryClient *primaryClient);
void handleNoClients(const Event &, void *);
bool startServer();
Server *getServerPtr()
{
return m_server;
}
deskflow::ServerArgs &args() const
{
return (deskflow::ServerArgs &)argsBase();
}
//
// Static functions
//
static void reloadSignalHandler(Arch::ESignal, void *);
static ServerApp &instance()
{
return (ServerApp &)App::instance();
}
private:
void handleScreenSwitched(const Event &, void *data);
ISocketFactory *getSocketFactory() const;
NetworkAddress getAddress(const NetworkAddress &address) const;
Server *m_server;
EServerState m_serverState;
deskflow::Screen *m_serverScreen;
PrimaryClient *m_primaryClient;
ClientListener *m_listener;
EventQueueTimer *m_timer;
NetworkAddress *m_deskflowAddress;
#if SYSAPI_WIN32
inline static const std::string CONFIG_NAME = "%s.sgc", kAppName;
#elif SYSAPI_UNIX
inline static const std::string CONFIG_NAME = "%s.conf", kAppName;
#endif
};
| 4,204
|
C++
|
.h
| 135
| 28.540741
| 94
| 0.7608
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,807
|
ClientArgs.h
|
deskflow_deskflow/src/lib/deskflow/ClientArgs.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2014-2016 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/>.
*/
#pragma once
#include "ArgsBase.h"
namespace deskflow {
enum ClientScrollDirection
{
SERVER = 1,
INVERT_SERVER = -1
};
class ClientArgs : public ArgsBase
{
/// Public functions
public:
ClientArgs();
~ClientArgs() override;
public:
int m_yscroll = 0;
bool m_enableLangSync = false; /// @brief Should keyboard input be in same language as on server
/**
* @brief m_clientScrollDirection
* This option is responcible for scroll direction on client side.
*/
ClientScrollDirection m_clientScrollDirection = ClientScrollDirection::SERVER;
/**
* @brief m_hostMode - activates host mode.
* Client starts a listener and waits for a server connection.
*/
bool m_hostMode = false;
/**
* @brief m_serverAddress stores deskflow server address
*/
std::string m_serverAddress;
};
} // namespace deskflow
| 1,539
|
C++
|
.h
| 49
| 28.877551
| 98
| 0.746622
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,808
|
KeyMap.h
|
deskflow_deskflow/src/lib/deskflow/KeyMap.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2005 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "base/String.h"
#include "common/stdmap.h"
#include "common/stdset.h"
#include "common/stdvector.h"
#include "deskflow/key_types.h"
#ifdef TEST_ENV
#include "gtest/gtest_prod.h"
#endif
namespace deskflow {
//! Key map
/*!
This class provides a keyboard mapping.
*/
class KeyMap
{
public:
KeyMap();
virtual ~KeyMap();
//! KeyID synthesis info
/*!
This structure contains the information necessary to synthesize a
keystroke that generates a KeyID (stored elsewhere). \c m_sensitive
lists the modifiers that the key is affected by and must therefore
be in the correct state, which is listed in \c m_required. If the
key is mapped to a modifier, that modifier is in \c m_generates and
is not in \c m_sensitive.
*/
struct KeyItem
{
public:
KeyID m_id{}; //!< KeyID
SInt32 m_group{}; //!< Group for key
KeyButton m_button{}; //!< Button to generate KeyID
KeyModifierMask m_required{}; //!< Modifiers required for KeyID
KeyModifierMask m_sensitive{}; //!< Modifiers key is sensitive to
KeyModifierMask m_generates{}; //!< Modifiers key is mapped to
bool m_dead{}; //!< \c true if this is a dead KeyID
bool m_lock{}; //!< \c true if this locks a modifier
UInt32 m_client{}; //!< Client data
public:
bool operator==(const KeyItem &) const;
};
//! The KeyButtons needed to synthesize a KeyID
/*!
An ordered list of \c KeyItems produces a particular KeyID. If
the KeyID can be synthesized directly then there is one entry in
the list. If dead keys are required then they're listed first.
A list is the minimal set of keystrokes necessary to synthesize
the KeyID, so it doesn't include no-ops. A list does not include
any modifier keys unless the KeyID is a modifier, in which case
it has exactly one KeyItem for the modifier itself.
*/
typedef std::vector<KeyItem> KeyItemList;
//! A keystroke
class Keystroke
{
public:
enum EType
{
kButton, //!< Synthesize button
kGroup //!< Set new group
};
Keystroke(KeyButton, bool press, bool repeat, UInt32 clientData);
Keystroke(SInt32 group, bool absolute, bool restore);
public:
struct Button
{
public:
KeyButton m_button{}; //!< Button to synthesize
bool m_press{}; //!< \c true iff press
bool m_repeat{}; //!< \c true iff for an autorepeat
UInt32 m_client{}; //!< Client data
};
struct Group
{
public:
SInt32 m_group{}; //!< Group/offset to change to/by
bool m_absolute{}; //!< \c true iff change to, else by
bool m_restore{}; //!< \c true iff for restoring state
};
union Data
{
public:
Button m_button;
Group m_group;
};
EType m_type{};
Data m_data{};
};
//! A sequence of keystrokes
typedef std::vector<Keystroke> Keystrokes;
//! A mapping of a modifier to keys for that modifier
typedef std::multimap<KeyModifierMask, KeyItem> ModifierToKeys;
//! A set of buttons
typedef std::map<KeyButton, const KeyItem *> ButtonToKeyMap;
//! Callback type for \c foreachKey
typedef void (*ForeachKeyCallback)(KeyID, SInt32 group, KeyItem &, void *userData);
//! @name manipulators
//@{
//! Swap with another \c KeyMap
virtual void swap(KeyMap &);
//! Add a key entry
/*!
Adds \p item to the entries for the item's id and group. The
\c m_dead member is set automatically.
*/
void addKeyEntry(const KeyItem &item);
//! Add an alias key entry
/*!
If \p targetID with the modifiers given by \p targetRequired and
\p targetSensitive is not available in group \p group then find an
entry for \p sourceID with modifiers given by \p sourceRequired and
\p sourceSensitive in any group with exactly one item and, if found,
add a new item just like it except using id \p targetID. This
effectively makes the \p sourceID an alias for \p targetID (i.e. we
can generate \p targetID using \p sourceID).
*/
void addKeyAliasEntry(
KeyID targetID, SInt32 group, KeyModifierMask targetRequired, KeyModifierMask targetSensitive, KeyID sourceID,
KeyModifierMask sourceRequired, KeyModifierMask sourceSensitive
);
//! Add a key sequence entry
/*!
Adds the sequence of keys \p keys (\p numKeys elements long) to
synthesize key \p id in group \p group. This looks up in the
map each key in \p keys. If all are found then each key is
converted to the button for that key and the buttons are added
as the entry for \p id. If \p id is already in the map or at
least one key in \p keys is not in the map then nothing is added
and this returns \c false, otherwise it returns \c true.
*/
bool addKeyCombinationEntry(KeyID id, SInt32 group, const KeyID *keys, UInt32 numKeys);
//! Enable composition across groups
/*!
If called then the keyboard map will allow switching between groups
during key composition. Not all systems allow that.
*/
void allowGroupSwitchDuringCompose();
//! Add a half-duplex button
/*!
Records that button \p button is a half-duplex key. This is called
when translating the system's keyboard map. It's independent of the
half-duplex modifier calls.
*/
void addHalfDuplexButton(KeyButton button);
//! Remove all half-duplex modifiers
/*!
Removes all half-duplex modifiers. This is called to set user
configurable half-duplex settings.
*/
void clearHalfDuplexModifiers();
//! Add a half-duplex modifier
/*!
Records that modifier key \p key is half-duplex. This is called to
set user configurable half-duplex settings.
*/
virtual void addHalfDuplexModifier(KeyID key);
//! Finish adding entries
/*!
Called after adding entries, this does some internal housekeeping.
*/
virtual void finish();
//! Iterate over all added keys items
/*!
Calls \p cb for every key item.
*/
virtual void foreachKey(ForeachKeyCallback cb, void *userData);
//@}
//! @name accessors
//@{
//! Map key press/repeat to keystrokes.
/*!
Converts press/repeat of key \p id in group \p group with current
modifiers as given in \p currentState and the desired modifiers in
\p desiredMask into the keystrokes necessary to synthesize that key
event in \p keys. It returns the \c KeyItem of the key being
pressed/repeated, or NULL if the key cannot be mapped.
*/
virtual const KeyItem *mapKey(
Keystrokes &keys, KeyID id, SInt32 group, ModifierToKeys &activeModifiers, KeyModifierMask ¤tState,
KeyModifierMask desiredMask, bool isAutoRepeat, const String &lang
) const;
void setLanguageData(std::vector<String> layouts);
//! Get number of groups
/*!
Returns the number of keyboard groups (independent layouts) in the map.
*/
SInt32 getNumGroups() const;
//! Compute a group number
/*!
Returns the number of the group \p offset groups after group \p group.
*/
SInt32 getEffectiveGroup(SInt32 group, SInt32 offset) const;
//! Find key entry compatible with modifiers
/*!
Returns the \c KeyItemList for the first entry for \p id in group
\p group that is compatible with the given modifiers, or NULL
if there isn't one. A button list is compatible with a modifiers
if it is either insensitive to all modifiers in \p sensitive or
it requires the modifiers to be in the state indicated by \p required
for every modifier indicated by \p sensitive.
*/
const KeyItemList *
findCompatibleKey(KeyID id, SInt32 group, KeyModifierMask required, KeyModifierMask sensitive) const;
//! Test if modifier is half-duplex
/*!
Returns \c true iff modifier key \p key or button \p button is
half-duplex.
*/
virtual bool isHalfDuplex(KeyID key, KeyButton button) const;
//! Test if modifiers indicate a command
/*!
Returns \c true iff the modifiers in \p mask contain any command
modifiers. A command modifier is used for keyboard shortcuts and
hotkeys, Rather than trying to synthesize a character, a command
is trying to synthesize a particular set of buttons. So it's not
important to match the shift or AltGr state to achieve a character
but it is important to match the modifier state exactly.
*/
bool isCommand(KeyModifierMask mask) const;
// Get the modifiers that indicate a command
/*!
Returns the modifiers that when combined with other keys indicate
a command (e.g. shortcut or hotkey).
*/
KeyModifierMask getCommandModifiers() const;
//! Get buttons from modifier map
/*!
Put all the keys in \p modifiers into \p keys.
*/
static void collectButtons(const ModifierToKeys &modifiers, ButtonToKeyMap &keys);
//! Set modifier key state
/*!
Sets the modifier key state (\c m_generates and \c m_lock) in \p item
based on the \c m_id in \p item.
*/
static void initModifierKey(KeyItem &item);
//! Test for a dead key
/*!
Returns \c true if \p key is a dead key.
*/
static bool isDeadKey(KeyID key);
//! Get corresponding dead key
/*!
Returns the dead key corresponding to \p key if one exists, otherwise
return \c kKeyNone. This returns \p key if it's already a dead key.
*/
static KeyID getDeadKey(KeyID key);
//! Get string for a key and modifier mask
/*!
Converts a key and modifier mask into a string representing the
combination.
*/
static String formatKey(KeyID key, KeyModifierMask);
//! Parse a string into a key
/*!
Converts a string into a key. Returns \c true on success and \c false
if the string cannot be parsed.
*/
static bool parseKey(const String &, KeyID &);
//! Parse a string into a modifier mask
/*!
Converts a string into a modifier mask. Returns \c true on success
and \c false if the string cannot be parsed. The modifiers plus any
remaining leading and trailing whitespace is stripped from the input
string.
*/
static bool parseModifiers(String &, KeyModifierMask &);
//@}
#ifdef TEST_ENV
private:
FRIEND_TEST(KeyMapTests, findBestKey_requiredDown_matchExactFirstItem);
FRIEND_TEST(KeyMapTests, findBestKey_requiredAndExtraSensitiveDown_matchExactFirstItem);
FRIEND_TEST(KeyMapTests, findBestKey_requiredAndExtraSensitiveDown_matchExactSecondItem);
FRIEND_TEST(KeyMapTests, findBestKey_extraSensitiveDown_matchExactSecondItem);
FRIEND_TEST(KeyMapTests, findBestKey_noRequiredDown_matchOneRequiredChangeItem);
FRIEND_TEST(KeyMapTests, findBestKey_onlyOneRequiredDown_matchTwoRequiredChangesItem);
FRIEND_TEST(KeyMapTests, findBestKey_noRequiredDown_cannotMatch);
#endif
private:
//! Ways to synthesize a key
enum EKeystroke
{
kKeystrokePress, //!< Synthesize a press
kKeystrokeRelease, //!< Synthesize a release
kKeystrokeRepeat, //!< Synthesize an autorepeat
kKeystrokeClick, //!< Synthesize a press and release
kKeystrokeModify, //!< Synthesize pressing a modifier
kKeystrokeUnmodify //!< Synthesize releasing a modifier
};
// A list of ways to synthesize a KeyID
typedef std::vector<KeyItemList> KeyEntryList;
// computes the number of groups
SInt32 findNumGroups() const;
// computes the map of modifiers to the keys that generate the modifiers
void setModifierKeys();
// maps a command key. a command key is a keyboard shortcut and we're
// trying to synthesize a button press with an exact sets of modifiers,
// not trying to synthesize a character. so we just need to find the
// right button and synthesize the requested modifiers without regard
// to what character they would synthesize. we disallow multikey
// entries since they don't make sense as hotkeys.
const KeyItem *mapCommandKey(
Keystrokes &keys, KeyID id, SInt32 group, ModifierToKeys &activeModifiers, KeyModifierMask ¤tState,
KeyModifierMask desiredMask, bool isAutoRepeat, const String &lang
) const;
// maps a character key. a character key is trying to synthesize a
// particular KeyID and isn't entirely concerned with the modifiers
// used to do it.
const KeyItem *mapCharacterKey(
Keystrokes &keys, KeyID id, SInt32 group, ModifierToKeys &activeModifiers, KeyModifierMask ¤tState,
KeyModifierMask desiredMask, bool isAutoRepeat, const String &lang
) const;
// maps a modifier key
const KeyItem *mapModifierKey(
Keystrokes &keys, KeyID id, SInt32 group, ModifierToKeys &activeModifiers, KeyModifierMask ¤tState,
KeyModifierMask desiredMask, bool isAutoRepeat, const String &lang
) const;
// returns the index into \p entryList of the KeyItemList requiring
// the fewest modifier changes between \p currentState and
// \p desiredState.
SInt32 findBestKey(const KeyEntryList &entryList, KeyModifierMask desiredState) const;
// gets the \c KeyItem used to synthesize the modifier who's bit is
// given by \p modifierBit in group \p group and does not synthesize
// the key \p button.
const KeyItem *keyForModifier(KeyButton button, SInt32 group, SInt32 modifierBit) const;
// fills \p keystrokes with the keys to synthesize the key in
// \p keyItem taking the modifiers into account. returns \c true
// iff successful and sets \p currentState to the
// resulting modifier state.
bool keysForKeyItem(
const KeyItem &keyItem, SInt32 &group, ModifierToKeys &activeModifiers, KeyModifierMask ¤tState,
KeyModifierMask desiredState, KeyModifierMask overrideModifiers, bool isAutoRepeat, Keystrokes &keystrokes,
const String &lang
) const;
// fills \p keystrokes with the keys to synthesize the modifiers
// in \p desiredModifiers from the active modifiers listed in
// \p activeModifiers not including the key in \p keyItem.
// returns \c true iff successful.
bool keysToRestoreModifiers(
const KeyItem &keyItem, SInt32 group, ModifierToKeys &activeModifiers, KeyModifierMask ¤tState,
const ModifierToKeys &desiredModifiers, Keystrokes &keystrokes
) const;
// fills \p keystrokes and \p undo with the keys to change the
// current modifier state in \p currentState to match the state in
// \p requiredState for each modifier indicated in \p sensitiveMask.
// returns \c true iff successful and sets \p currentState to the
// resulting modifier state.
bool keysForModifierState(
KeyButton button, SInt32 group, ModifierToKeys &activeModifiers, KeyModifierMask ¤tState,
KeyModifierMask requiredState, KeyModifierMask sensitiveMask, KeyModifierMask notRequiredMask,
Keystrokes &keystrokes
) const;
// Adds keystrokes to synthesize key \p keyItem in mode \p type to
// \p keystrokes and to undo the synthesis to \p undo.
void addKeystrokes(
EKeystroke type, const KeyItem &keyItem, ModifierToKeys &activeModifiers, KeyModifierMask ¤tState,
Keystrokes &keystrokes
) const;
// Returns the number of modifiers indicated in \p state.
static SInt32 getNumModifiers(KeyModifierMask state);
// Initialize key name/id maps
static void initKeyNameMaps();
// Ways to synthesize a KeyID over multiple keyboard groups
typedef std::vector<KeyEntryList> KeyGroupTable;
void addGroupToKeystroke(Keystrokes &keys, SInt32 &group, const String &lang) const;
SInt32 getLanguageGroupID(SInt32 group, const String &lang) const;
const KeyItemList *
getKeyItemList(const KeyGroupTable &keyGroupTable, SInt32 group, KeyModifierMask desiredMask) const;
// not implemented
KeyMap(const KeyMap &);
KeyMap &operator=(const KeyMap &);
private:
// Table of KeyID to ways to synthesize that KeyID
typedef std::map<KeyID, KeyGroupTable> KeyIDMap;
// List of KeyItems that generate a particular modifier
typedef std::vector<const KeyItem *> ModifierKeyItemList;
// Map a modifier to the KeyItems that synthesize that modifier
typedef std::vector<ModifierKeyItemList> ModifierToKeyTable;
// A set of keys
typedef std::set<KeyID> KeySet;
// A set of buttons
typedef std::set<KeyButton> KeyButtonSet;
// Key maps for parsing/formatting
typedef std::map<String, KeyID, deskflow::string::CaselessCmp> NameToKeyMap;
typedef std::map<String, KeyModifierMask, deskflow::string::CaselessCmp> NameToModifierMap;
typedef std::map<KeyID, String> KeyToNameMap;
typedef std::map<KeyModifierMask, String> ModifierToNameMap;
// KeyID info
KeyIDMap m_keyIDMap;
SInt32 m_numGroups;
ModifierToKeyTable m_modifierKeys;
// composition info
bool m_composeAcrossGroups;
// half-duplex info
KeyButtonSet m_halfDuplex; // half-duplex set by deskflow
KeySet m_halfDuplexMods; // half-duplex set by user
// dummy KeyItem for changing modifiers
KeyItem m_modifierKeyItem;
// Language sync data
std::vector<String> m_keyboardLayouts;
// parsing/formatting tables
static NameToKeyMap *s_nameToKeyMap;
static NameToModifierMap *s_nameToModifierMap;
static KeyToNameMap *s_keyToNameMap;
static ModifierToNameMap *s_modifierToNameMap;
};
} // namespace deskflow
| 17,729
|
C++
|
.h
| 426
| 38.138498
| 116
| 0.742904
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,809
|
XScreen.h
|
deskflow_deskflow/src/lib/deskflow/XScreen.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "base/XBase.h"
//! Generic screen exception
XBASE_SUBCLASS(XScreen, XBase);
//! Cannot open screen exception
/*!
Thrown when a screen cannot be opened or initialized.
*/
XBASE_SUBCLASS_WHAT(XScreenOpenFailure, XScreen);
//! XInput exception
/*!
Thrown when an XInput error occurs
*/
XBASE_SUBCLASS_WHAT(XScreenXInputFailure, XScreen);
//! Screen unavailable exception
/*!
Thrown when a screen cannot be opened or initialized but retrying later
may be successful.
*/
class XScreenUnavailable : public XScreenOpenFailure
{
public:
/*!
\c timeUntilRetry is the suggested time the caller should wait until
trying to open the screen again.
*/
XScreenUnavailable(double timeUntilRetry);
virtual ~XScreenUnavailable() _NOEXCEPT;
//! @name manipulators
//@{
//! Get retry time
/*!
Returns the suggested time to wait until retrying to open the screen.
*/
double getRetryTime() const;
//@}
protected:
virtual String getWhat() const throw();
private:
double m_timeUntilRetry;
};
| 1,763
|
C++
|
.h
| 58
| 28.37931
| 72
| 0.766234
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| true
| true
| false
| false
| false
| false
| false
| false
|
13,810
|
ArgsBase.h
|
deskflow_deskflow/src/lib/deskflow/ArgsBase.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012 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/>.
*/
#pragma once
#include "base/String.h"
namespace deskflow {
/**
* @brief This is the base Argument class that will store the generic
* arguments passed into the applications this will be derived
* from and expanded to include application specific arguments
*/
class ArgsBase
{
public:
ArgsBase() = default;
virtual ~ArgsBase();
/// @brief This sets the type of the derived class
enum Type
{
kBase,
kServer,
kClient
};
/// @brief Stores what type of object this is
Type m_classType = kBase;
/// @brief Should run as a daemon
bool m_daemon = true;
/// @brief Should the app restart automatically
bool m_restartable = true;
/// @brief Should the app use hooks
bool m_noHooks = false;
/// @brief The filename of the running process
const char *m_pname = nullptr;
/// @brief The logging level of the application
const char *m_logFilter = nullptr;
/// @brief The full path to the logfile
const char *m_logFile = nullptr;
/// @brief Contains the X-Server display to use
const char *m_display = nullptr;
/// @brief The name of the current computer
String m_name;
/// @brief Should the app add a tray icon
bool m_disableTray = false;
/// @brief Tell the client to talk through IPC to the daemon
bool m_enableIpc = false;
/// @brief Should drag drop support be enabled
bool m_enableDragDrop = false;
/// @brief Will cause the application to exit with OK code when set to true
bool m_shouldExitOk = false;
/// @brief Will cause the application to exit with fail code when set to true
bool m_shouldExitFail = false;
/// @brief Bind to this address
String m_deskflowAddress;
/// @brief Should the connections be TLS encrypted
bool m_enableCrypto = false;
/// @brief The dir to load settings from
String m_profileDirectory;
/// @brief The dir to load plugins from
String m_pluginDirectory;
/// @brief Contains the location of the TLS certificate file
String m_tlsCertFile;
/// @brief Stop this computer from sleeping
bool m_preventSleep = false;
#if SYSAPI_WIN32
bool m_debugServiceWait = false;
bool m_pauseOnExit = false;
bool m_stopOnDeskSwitch = false;
#endif
#if WINAPI_XWINDOWS
bool m_disableXInitThreads = false;
#endif
protected:
/// @brief deletes pointers and sets the value to null
template <class T> static inline void destroy(T *&p)
{
delete p;
p = 0;
}
};
} // namespace deskflow
| 3,139
|
C++
|
.h
| 93
| 30.870968
| 79
| 0.730285
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,811
|
IPrimaryScreen.h
|
deskflow_deskflow/src/lib/deskflow/IPrimaryScreen.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2003 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "base/Event.h"
#include "base/EventTypes.h"
#include "common/IInterface.h"
#include "deskflow/key_types.h"
#include "deskflow/mouse_types.h"
//! Primary screen interface
/*!
This interface defines the methods common to all platform dependent
primary screen implementations.
*/
class IPrimaryScreen : public IInterface
{
public:
//! Button event data
class ButtonInfo
{
public:
static ButtonInfo *alloc(ButtonID, KeyModifierMask);
static ButtonInfo *alloc(const ButtonInfo &);
static bool equal(const ButtonInfo *, const ButtonInfo *);
public:
ButtonID m_button;
KeyModifierMask m_mask;
};
//! Motion event data
class MotionInfo
{
public:
static MotionInfo *alloc(SInt32 x, SInt32 y);
public:
SInt32 m_x;
SInt32 m_y;
};
//! Wheel motion event data
class WheelInfo
{
public:
static WheelInfo *alloc(SInt32 xDelta, SInt32 yDelta);
public:
SInt32 m_xDelta;
SInt32 m_yDelta;
};
//! Hot key event data
class HotKeyInfo
{
public:
static HotKeyInfo *alloc(UInt32 id);
public:
UInt32 m_id;
};
class EiConnectInfo
{
public:
static EiConnectInfo *alloc(int fd);
public:
int m_fd;
};
//! @name manipulators
//@{
//! Update configuration
/*!
This is called when the configuration has changed. \c activeSides
is a bitmask of EDirectionMask indicating which sides of the
primary screen are linked to clients. Override to handle the
possible change in jump zones.
*/
virtual void reconfigure(UInt32 activeSides) = 0;
//! Warp cursor
/*!
Warp the cursor to the absolute coordinates \c x,y. Also
discard input events up to and including the warp before
returning.
*/
virtual void warpCursor(SInt32 x, SInt32 y) = 0;
//! Register a system hotkey
/*!
Registers a system-wide hotkey. The screen should arrange for an event
to be delivered to itself when the hot key is pressed or released. When
that happens the screen should post a \c getHotKeyDownEvent() or
\c getHotKeyUpEvent(), respectively. The hot key is key \p key with
exactly the modifiers \p mask. Returns 0 on failure otherwise an id
that can be used to unregister the hotkey.
A hot key is a set of modifiers and a key, which may itself be a modifier.
The hot key is pressed when the hot key's modifiers and only those
modifiers are logically down (active) and the key is pressed. The hot
key is released when the key is released, regardless of the modifiers.
The hot key event should be generated no matter what window or application
has the focus. No other window or application should receive the key
press or release events (they can and should see the modifier key events).
When the key is a modifier, it's acceptable to allow the user to press
the modifiers in any order or to require the user to press the given key
last.
*/
virtual UInt32 registerHotKey(KeyID key, KeyModifierMask mask) = 0;
//! Unregister a system hotkey
/*!
Unregisters a previously registered hot key.
*/
virtual void unregisterHotKey(UInt32 id) = 0;
//! Prepare to synthesize input on primary screen
/*!
Prepares the primary screen to receive synthesized input. We do not
want to receive this synthesized input as user input so this method
ensures that we ignore it. Calls to \c fakeInputBegin() may not be
nested.
*/
virtual void fakeInputBegin() = 0;
//! Done synthesizing input on primary screen
/*!
Undoes whatever \c fakeInputBegin() did.
*/
virtual void fakeInputEnd() = 0;
//@}
//! @name accessors
//@{
//! Get jump zone size
/*!
Return the jump zone size, the size of the regions on the edges of
the screen that cause the cursor to jump to another screen.
*/
virtual SInt32 getJumpZoneSize() const = 0;
//! Test if mouse is pressed
/*!
Return true if any mouse button is currently pressed. Ideally,
"current" means up to the last processed event but it can mean
the current physical mouse button state.
*/
virtual bool isAnyMouseButtonDown(UInt32 &buttonID) const = 0;
//! Get cursor center position
/*!
Return the cursor center position which is where we park the
cursor to compute cursor motion deltas and should be far from
the edges of the screen, typically the center.
*/
virtual void getCursorCenter(SInt32 &x, SInt32 &y) const = 0;
//@}
};
| 5,139
|
C++
|
.h
| 155
| 30.116129
| 76
| 0.738911
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| true
| false
| false
| false
| false
| false
| false
|
13,812
|
IPlatformScreen.h
|
deskflow_deskflow/src/lib/deskflow/IPlatformScreen.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "deskflow/DragInformation.h"
#include "deskflow/IKeyState.h"
#include "deskflow/IPrimaryScreen.h"
#include "deskflow/IScreen.h"
#include "deskflow/ISecondaryScreen.h"
#include "deskflow/clipboard_types.h"
#include "deskflow/option_types.h"
class IClipboard;
//! Screen interface
/*!
This interface defines the methods common to all platform dependent
screen implementations that are used by both primary and secondary
screens.
*/
class IPlatformScreen : public IScreen, public IPrimaryScreen, public ISecondaryScreen, public IKeyState
{
public:
//! @name manipulators
//@{
IPlatformScreen(IEventQueue *events) : IKeyState(events)
{
}
//! Enable screen
/*!
Enable the screen, preparing it to report system and user events.
For a secondary screen it also means preparing to synthesize events
and hiding the cursor.
*/
virtual void enable() = 0;
//! Disable screen
/*!
Undoes the operations in enable() and events should no longer
be reported.
*/
virtual void disable() = 0;
//! Enter screen
/*!
Called when the user navigates to this screen.
*/
virtual void enter() = 0;
//! Leave screen
/*!
Called when the user navigates off the screen. Returns true if
the leave can proceed. A typical reason for failure is being
unable to install the keyboard and mouse snoopers on a primary
screen. Secondary screens should not fail.
*/
virtual bool canLeave() = 0;
//! Leave screen
/*!
Called when the user navigates off the screen. Should be gated
by canLeave().
*/
virtual void leave() = 0;
//! Set clipboard
/*!
Set the contents of the system clipboard indicated by \c id.
*/
virtual bool setClipboard(ClipboardID id, const IClipboard *) = 0;
//! Check clipboard owner
/*!
Check ownership of all clipboards and post grab events for any that
have changed. This is used as a backup in case the system doesn't
reliably report clipboard ownership changes.
*/
virtual void checkClipboards() = 0;
//! Open screen saver
/*!
Open the screen saver. If \c notify is true then this object must
send events when the screen saver activates or deactivates until
\c closeScreensaver() is called. If \c notify is false then the
screen saver is disabled and restored on \c closeScreensaver().
*/
virtual void openScreensaver(bool notify) = 0;
//! Close screen saver
/*!
// Close the screen saver. Stop reporting screen saver activation
and deactivation and, if the screen saver was disabled by
openScreensaver(), enable the screen saver.
*/
virtual void closeScreensaver() = 0;
//! Activate/deactivate screen saver
/*!
Forcibly activate the screen saver if \c activate is true otherwise
forcibly deactivate it.
*/
virtual void screensaver(bool activate) = 0;
//! Notify of options changes
/*!
Reset all options to their default values.
*/
virtual void resetOptions() = 0;
//! Notify of options changes
/*!
Set options to given values. Ignore unknown options and don't
modify options that aren't given in \c options.
*/
virtual void setOptions(const OptionsList &options) = 0;
//! Set clipboard sequence number
/*!
Sets the sequence number to use in subsequent clipboard events.
*/
virtual void setSequenceNumber(UInt32) = 0;
//! Change dragging status
virtual void setDraggingStarted(bool started) = 0;
//! Determine the name of the app causing a secure input state
/*!
On MacOS check which app causes a secure input state to be enabled. No
alternative on other platforms
*/
virtual String getSecureInputApp() const = 0;
//@}
//! @name accessors
//@{
//! Test if is primary screen
/*!
Return true iff this screen is a primary screen.
*/
virtual bool isPrimary() const = 0;
//@}
// IScreen overrides
virtual void *getEventTarget() const = 0;
virtual bool getClipboard(ClipboardID id, IClipboard *) const = 0;
virtual void getShape(SInt32 &x, SInt32 &y, SInt32 &width, SInt32 &height) const = 0;
virtual void getCursorPos(SInt32 &x, SInt32 &y) const = 0;
// IPrimaryScreen overrides
virtual void reconfigure(UInt32 activeSides) = 0;
virtual void warpCursor(SInt32 x, SInt32 y) = 0;
virtual UInt32 registerHotKey(KeyID key, KeyModifierMask mask) = 0;
virtual void unregisterHotKey(UInt32 id) = 0;
virtual void fakeInputBegin() = 0;
virtual void fakeInputEnd() = 0;
virtual SInt32 getJumpZoneSize() const = 0;
virtual bool isAnyMouseButtonDown(UInt32 &buttonID) const = 0;
virtual void getCursorCenter(SInt32 &x, SInt32 &y) const = 0;
// ISecondaryScreen overrides
virtual void fakeMouseButton(ButtonID id, bool press) = 0;
virtual void fakeMouseMove(SInt32 x, SInt32 y) = 0;
virtual void fakeMouseRelativeMove(SInt32 dx, SInt32 dy) const = 0;
virtual void fakeMouseWheel(SInt32 xDelta, SInt32 yDelta) const = 0;
// IKeyState overrides
virtual void updateKeyMap() = 0;
virtual void updateKeyState() = 0;
virtual void setHalfDuplexMask(KeyModifierMask) = 0;
virtual void fakeKeyDown(KeyID id, KeyModifierMask mask, KeyButton button, const String &lang) = 0;
virtual bool fakeKeyRepeat(KeyID id, KeyModifierMask mask, SInt32 count, KeyButton button, const String &lang) = 0;
virtual bool fakeKeyUp(KeyButton button) = 0;
virtual void fakeAllKeysUp() = 0;
virtual bool fakeCtrlAltDel() = 0;
virtual bool fakeMediaKey(KeyID id);
virtual bool isKeyDown(KeyButton) const = 0;
virtual KeyModifierMask getActiveModifiers() const = 0;
virtual KeyModifierMask pollActiveModifiers() const = 0;
virtual SInt32 pollActiveGroup() const = 0;
virtual void pollPressedKeys(KeyButtonSet &pressedKeys) const = 0;
virtual String &getDraggingFilename() = 0;
virtual void clearDraggingFilename() = 0;
virtual bool isDraggingStarted() = 0;
virtual bool isFakeDraggingStarted() = 0;
virtual void fakeDraggingFiles(DragFileList fileList) = 0;
virtual const String &getDropTarget() const = 0;
protected:
//! Handle system event
/*!
A platform screen is expected to install a handler for system
events in its c'tor like so:
\code
m_events->adoptHandler(Event::kSystem,
m_events->getSystemTarget(),
new TMethodEventJob<CXXXPlatformScreen>(this,
&CXXXPlatformScreen::handleSystemEvent));
\endcode
It should remove the handler in its d'tor. Override the
\c handleSystemEvent() method to process system events.
It should post the events \c IScreen as appropriate.
A primary screen has further responsibilities. It should post
the events in \c IPrimaryScreen as appropriate. It should also
call \c onKey() on its \c KeyState whenever a key is pressed
or released (but not for key repeats). And it should call
\c updateKeyMap() on its \c KeyState if necessary when the keyboard
mapping changes.
The target of all events should be the value returned by
\c getEventTarget().
*/
virtual void handleSystemEvent(const Event &event, void *) = 0;
};
| 7,780
|
C++
|
.h
| 204
| 34.921569
| 117
| 0.742444
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,813
|
Clipboard.h
|
deskflow_deskflow/src/lib/deskflow/Clipboard.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "deskflow/IClipboard.h"
//! Memory buffer clipboard
/*!
This class implements a clipboard that stores data in memory.
*/
class Clipboard : public IClipboard
{
public:
Clipboard();
virtual ~Clipboard();
//! @name manipulators
//@{
//! Unmarshall clipboard data
/*!
Extract marshalled clipboard data and store it in this clipboard.
Sets the clipboard time to \c time.
*/
void unmarshall(const String &data, Time time);
//@}
//! @name accessors
//@{
//! Marshall clipboard data
/*!
Merge this clipboard's data into a single buffer that can be later
unmarshalled to restore the clipboard and return the buffer.
*/
String marshall() const;
//@}
// IClipboard overrides
virtual bool empty();
virtual void add(EFormat, const String &data);
virtual bool open(Time) const;
virtual void close() const;
virtual Time getTime() const;
virtual bool has(EFormat) const;
virtual String get(EFormat) const;
private:
mutable bool m_open;
mutable Time m_time;
bool m_owner;
Time m_timeOwned;
bool m_added[kNumFormats];
String m_data[kNumFormats];
};
| 1,861
|
C++
|
.h
| 62
| 27.5
| 72
| 0.741196
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,814
|
DropHelper.h
|
deskflow_deskflow/src/lib/deskflow/DropHelper.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2014-2016 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/>.
*/
#pragma once
#include "base/String.h"
#include "deskflow/DragInformation.h"
class DropHelper
{
public:
static void writeToDir(const String &destination, DragFileList &fileList, String &data);
};
| 891
|
C++
|
.h
| 24
| 35.291667
| 90
| 0.769676
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,815
|
Chunk.h
|
deskflow_deskflow/src/lib/deskflow/Chunk.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2015-2016 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/>.
*/
#pragma once
#include "common/basic_types.h"
#include <base/EventTypes.h>
class Chunk : public EventData
{
public:
Chunk(size_t size);
Chunk(Chunk const &) = delete;
Chunk(Chunk &&) = delete;
~Chunk() override;
Chunk &operator=(Chunk const &) = delete;
Chunk &operator=(Chunk &&) = delete;
public:
size_t m_dataSize;
char *m_chunk;
};
| 1,047
|
C++
|
.h
| 32
| 30.59375
| 72
| 0.739604
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,816
|
ProtocolUtil.h
|
deskflow_deskflow/src/lib/deskflow/ProtocolUtil.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "base/EventTypes.h"
#include "io/XIO.h"
#include <stdarg.h>
namespace deskflow {
class IStream;
}
//! Deskflow protocol utilities
/*!
This class provides various functions for implementing the deskflow
protocol.
*/
class ProtocolUtil
{
public:
//! Write formatted data
/*!
Write formatted binary data to a stream. \c fmt consists of
regular characters and format specifiers. Format specifiers
begin with \%. All characters not part of a format specifier
are regular and are transmitted unchanged.
Format specifiers are:
- \%\% -- literal `\%'
- \%1i -- converts integer argument to 1 byte integer
- \%2i -- converts integer argument to 2 byte integer in NBO
- \%4i -- converts integer argument to 4 byte integer in NBO
- \%1I -- converts std::vector<UInt8>* to 1 byte integers
- \%2I -- converts std::vector<UInt16>* to 2 byte integers in NBO
- \%4I -- converts std::vector<UInt32>* to 4 byte integers in NBO
- \%s -- converts String* to stream of bytes
- \%S -- converts integer N and const UInt8* to stream of N bytes
*/
static void writef(deskflow::IStream *, const char *fmt, ...);
//! Read formatted data
/*!
Read formatted binary data from a buffer. This performs the
reverse operation of writef(). Returns true if the entire
format was successfully parsed, false otherwise.
Format specifiers are:
- \%\% -- read (and discard) a literal `\%'
- \%1i -- reads a 1 byte integer; argument is a SInt32* or UInt32*
- \%2i -- reads an NBO 2 byte integer; arg is SInt32* or UInt32*
- \%4i -- reads an NBO 4 byte integer; arg is SInt32* or UInt32*
- \%1I -- reads 1 byte integers; arg is std::vector<UInt8>*
- \%2I -- reads NBO 2 byte integers; arg is std::vector<UInt16>*
- \%4I -- reads NBO 4 byte integers; arg is std::vector<UInt32>*
- \%s -- reads bytes; argument must be a String*, \b not a char*
*/
static bool readf(deskflow::IStream *, const char *fmt, ...);
private:
static void vwritef(deskflow::IStream *, const char *fmt, UInt32 size, va_list);
static void vreadf(deskflow::IStream *, const char *fmt, va_list);
static UInt32 getLength(const char *fmt, va_list);
static void writef(std::vector<UInt8> &, const char *fmt, va_list);
static UInt32 eatLength(const char **fmt);
static void read(deskflow::IStream *, void *, UInt32);
/**
* @brief Handles 1,2, or 4 byte Integers
*/
static UInt8 read1ByteInt(deskflow::IStream *stream);
static UInt16 read2BytesInt(deskflow::IStream *stream);
static UInt32 read4BytesInt(deskflow::IStream *stream);
/**
* @brief Handles a Vector of integers
*/
static void readVector1ByteInt(deskflow::IStream *, std::vector<UInt8> &);
static void readVector2BytesInt(deskflow::IStream *, std::vector<UInt16> &);
static void readVector4BytesInt(deskflow::IStream *, std::vector<UInt32> &);
/**
* @brief Handles an array of bytes
*/
static void readBytes(deskflow::IStream *, UInt32, String *);
};
//! Mismatched read exception
/*!
Thrown by ProtocolUtil::readf() when the data being read does not
match the format.
*/
class XIOReadMismatch : public XIO
{
public:
// XBase overrides
virtual String getWhat() const throw();
};
| 3,983
|
C++
|
.h
| 101
| 36.930693
| 82
| 0.714323
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,817
|
protocol_types.h
|
deskflow_deskflow/src/lib/deskflow/protocol_types.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "base/EventTypes.h"
// protocol version number
// 1.0: initial protocol
// 1.1: adds KeyCode to key press, release, and repeat
// 1.2: adds mouse relative motion
// 1.3: adds keep alive and deprecates heartbeats,
// adds horizontal mouse scrolling
// 1.4: adds crypto support
// 1.5: adds file transfer and removes home brew crypto
// 1.6: adds clipboard streaming
// 1.7 adds security input notifications
// 1.8 adds language synchronization functionality
// NOTE: with new version, deskflow minor version should increment
static const SInt16 kProtocolMajorVersion = 1;
static const SInt16 kProtocolMinorVersion = 8;
// default contact port number
static const UInt16 kDefaultPort = 24800;
// maximum total length for greeting returned by client
static const UInt32 kMaxHelloLength = 1024;
// time between kMsgCKeepAlive (in seconds). a non-positive value disables
// keep alives. this is the default rate that can be overridden using an
// option.
static const double kKeepAliveRate = 3.0;
// number of skipped kMsgCKeepAlive messages that indicates a problem
static const double kKeepAlivesUntilDeath = 3.0;
// obsolete heartbeat stuff
static const double kHeartRate = -1.0;
static const double kHeartBeatsUntilDeath = 3.0;
// direction constants
enum EDirection
{
kNoDirection,
kLeft,
kRight,
kTop,
kBottom,
kFirstDirection = kLeft,
kLastDirection = kBottom,
kNumDirections = kLastDirection - kFirstDirection + 1
};
enum EDirectionMask
{
kNoDirMask = 0,
kLeftMask = 1 << kLeft,
kRightMask = 1 << kRight,
kTopMask = 1 << kTop,
kBottomMask = 1 << kBottom
};
// Data transfer constants
enum EDataTransfer
{
kDataStart = 1,
kDataChunk = 2,
kDataEnd = 3
};
// Data received constants
enum EDataReceived
{
kStart,
kNotFinish,
kFinish,
kError
};
//
// message codes (trailing NUL is not part of code). in comments, $n
// refers to the n'th argument (counting from one). message codes are
// always 4 bytes optionally followed by message specific parameters
// except those for the greeting handshake.
//
//
// positions and sizes are signed 16 bit integers.
//
//
// greeting handshake messages
//
// used to say hello back to the server as Synergy
extern const char *const kSynergyProtocolName;
// used to say hello back to the server as Barrier
extern const char *const kBarrierProtocolName;
// say hello to client; primary -> secondary
// $1 = protocol major version number supported by server. $2 =
// protocol minor version number supported by server. $3 = server
// keyboard layout list.
extern const char *const kMsgHello;
// args part of kMsgHello.
// used as part of a dynamic hello message.
// this can be superseded by kMsgHello once `ProtocolUtil::writef`
// supports fixed length strings (e.g. %7s).
extern const char *const kMsgHelloArgs;
// 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.
extern const char *const kMsgHelloBack;
// args part of kMsgHelloBack.
// used as part of a dynamic hello message.
// this can be superseded by kMsgHelloBack once `ProtocolUtil::writef`
// supports fixed length strings (e.g. %7s).
extern const char *const kMsgHelloBackArgs;
//
// command codes
//
// no operation; secondary -> primary
extern const char *const kMsgCNoop;
// close connection; primary -> secondary
extern const char *const kMsgCClose;
// enter screen: primary -> secondary
// entering screen at screen position $1 = x, $2 = y. x,y are
// absolute screen coordinates. $3 = sequence number, which is
// used to order messages between screens. the secondary screen
// must return this number with some messages. $4 = modifier key
// mask. this will have bits set for each toggle modifier key
// that is activated on entry to the screen. the secondary screen
// should adjust its toggle modifiers to reflect that state.
extern const char *const kMsgCEnter;
// leave screen: primary -> secondary
// leaving screen. the secondary screen should send clipboard
// data in response to this message for those clipboards that
// it has grabbed (i.e. has sent a kMsgCClipboard for and has
// not received a kMsgCClipboard for with a greater sequence
// number) and that were grabbed or have changed since the
// last leave.
extern const char *const kMsgCLeave;
// grab clipboard: primary <-> secondary
// sent by screen when some other app on that screen grabs a
// clipboard. $1 = the clipboard identifier, $2 = sequence number.
// secondary screens must use the sequence number passed in the
// most recent kMsgCEnter. the primary always sends 0.
extern const char *const kMsgCClipboard;
// screensaver change: primary -> secondary
// screensaver on primary has started ($1 == 1) or closed ($1 == 0)
extern const char *const kMsgCScreenSaver;
// reset options: primary -> secondary
// client should reset all of its options to their defaults.
extern const char *const kMsgCResetOptions;
// resolution change acknowledgment: primary -> secondary
// sent by primary in response to a secondary screen's kMsgDInfo.
// this is sent for every kMsgDInfo, whether or not the primary
// had sent a kMsgQInfo.
extern const char *const kMsgCInfoAck;
// keep connection alive: primary <-> secondary
// sent by the server periodically to verify that connections are still
// up and running. clients must reply in kind on receipt. if the server
// gets an error sending the message or does not receive a reply within
// a reasonable time then the server disconnects the client. if the
// client doesn't receive these (or any message) periodically then it
// should disconnect from the server. the appropriate interval is
// defined by an option.
extern const char *const kMsgCKeepAlive;
//
// data codes
//
// The same as kMsgDKeyDown but with languageCode
// $4 = languageCode
extern const char *const kMsgDKeyDownLang;
// key pressed: primary -> secondary
// $1 = KeyID, $2 = KeyModifierMask, $3 = KeyButton
// the KeyButton identifies the physical key on the primary used to
// generate this key. the secondary should note the KeyButton along
// with the physical key it uses to generate the key press. on
// release, the secondary can then use the primary's KeyButton to
// find its corresponding physical key and release it. this is
// necessary because the KeyID on release may not be the KeyID of
// the press. this can happen with combining (dead) keys or if
// the keyboard layouts are not identical and the user releases
// a modifier key before releasing the modified key.
// languageCode is parameter which helps client to react on unknwon
// language letters
extern const char *const kMsgDKeyDown;
// key pressed 1.0: same as above but without KeyButton
extern const char *const kMsgDKeyDown1_0;
// key auto-repeat: primary -> secondary
// $1 = KeyID, $2 = KeyModifierMask, $3 = number of repeats, $4 = KeyButton
// $5 =language code
extern const char *const kMsgDKeyRepeat;
// key auto-repeat 1.0: same as above but without KeyButton
extern const char *const kMsgDKeyRepeat1_0;
// key released: primary -> secondary
// $1 = KeyID, $2 = KeyModifierMask, $3 = KeyButton
extern const char *const kMsgDKeyUp;
// key released 1.0: same as above but without KeyButton
extern const char *const kMsgDKeyUp1_0;
// mouse button pressed: primary -> secondary
// $1 = ButtonID
extern const char *const kMsgDMouseDown;
// mouse button released: primary -> secondary
// $1 = ButtonID
extern const char *const kMsgDMouseUp;
// mouse moved: primary -> secondary
// $1 = x, $2 = y. x,y are absolute screen coordinates.
extern const char *const kMsgDMouseMove;
// relative mouse move: primary -> secondary
// $1 = dx, $2 = dy. dx,dy are motion deltas.
extern const char *const kMsgDMouseRelMove;
// mouse scroll: primary -> secondary
// $1 = xDelta, $2 = yDelta. the delta should be +120 for one tick forward
// (away from the user) or right and -120 for one tick backward (toward
// the user) or left.
extern const char *const kMsgDMouseWheel;
// mouse vertical scroll: primary -> secondary
// like as kMsgDMouseWheel except only sends $1 = yDelta.
extern const char *const kMsgDMouseWheel1_0;
// clipboard data: primary <-> secondary
// $2 = sequence number, $3 = mark $4 = clipboard data. the sequence number
// is 0 when sent by the primary. secondary screens should use the
// sequence number from the most recent kMsgCEnter. $1 = clipboard
// identifier.
extern const char *const kMsgDClipboard;
// client data: secondary -> primary
// $1 = coordinate of leftmost pixel on secondary screen,
// $2 = coordinate of topmost pixel on secondary screen,
// $3 = width of secondary screen in pixels,
// $4 = height of secondary screen in pixels,
// $5 = size of warp zone, (obsolete)
// $6, $7 = the x,y position of the mouse on the secondary screen.
//
// the secondary screen must send this message in response to the
// kMsgQInfo message. it must also send this message when the
// screen's resolution changes. in this case, the secondary screen
// should ignore any kMsgDMouseMove messages until it receives a
// kMsgCInfoAck in order to prevent attempts to move the mouse off
// the new screen area.
extern const char *const kMsgDInfo;
// set options: primary -> secondary
// client should set the given option/value pairs. $1 = option/value
// pairs.
extern const char *const kMsgDSetOptions;
// file data: primary <-> secondary
// transfer file data. A mark is used in the first byte.
// 0 means the content followed is the file size.
// 1 means the content followed is the chunk data.
// 2 means the file transfer is finished.
extern const char *const kMsgDFileTransfer;
// drag infomation: primary <-> secondary
// transfer drag infomation. The first 2 bytes are used for storing
// the number of dragging objects. Then the following string consists
// of each object's directory.
extern const char *const kMsgDDragInfo;
// secure input notification: primary -> secondary
// $1 = app. app only obtainable on MacOS since that's the only
// platform facing secure input problems
extern const char *const kMsgDSecureInputNotification;
// language synchronization: primary -> secondary
// $1 = List of server languages
extern const char *const kMsgDLanguageSynchronisation;
//
// query codes
//
// query screen info: primary -> secondary
// client should reply with a kMsgDInfo.
extern const char *const kMsgQInfo;
//
// error codes
//
// incompatible versions: primary -> secondary
// $1 = major version of primary, $2 = minor version of primary.
extern const char *const kMsgEIncompatible;
// name provided when connecting is already in use: primary -> secondary
extern const char *const kMsgEBusy;
// unknown client: primary -> secondary
// name provided when connecting is not in primary's screen
// configuration map.
extern const char *const kMsgEUnknown;
// protocol violation: primary -> secondary
// primary should disconnect after sending this message.
extern const char *const kMsgEBad;
//
// structures
//
//! Screen information
/*!
This class contains information about a screen.
*/
class ClientInfo
{
public:
//! Screen position
/*!
The position of the upper-left corner of the screen. This is
typically 0,0.
*/
SInt32 m_x, m_y;
//! Screen size
/*!
The size of the screen in pixels.
*/
SInt32 m_w, m_h;
//! Obsolete (jump zone size)
SInt32 obsolete1;
//! Mouse position
/*!
The current location of the mouse cursor.
*/
SInt32 m_mx, m_my;
};
| 12,366
|
C++
|
.h
| 313
| 38.015974
| 76
| 0.758736
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| true
| false
| false
| false
| false
| false
| false
|
13,818
|
LanguageManager.h
|
deskflow_deskflow/src/lib/deskflow/languages/LanguageManager.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2014-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/>.
*/
#pragma once
#include "base/String.h"
#include "deskflow/AppUtil.h"
#include <vector>
namespace deskflow {
namespace languages {
class LanguageManager
{
std::vector<String> m_remoteLanguages;
std::vector<String> m_localLanguages;
public:
explicit LanguageManager(const std::vector<String> &localLanguages = AppUtil::instance().getKeyboardLayoutList());
/**
* @brief setRemoteLanguages sets remote languages
* @param remoteLanguages is a string with sericalized languages
*/
void setRemoteLanguages(const String &remoteLanguages);
/**
* @brief getRemoteLanguages getter for remote languages
* @return vector of remote languages
*/
const std::vector<String> &getRemoteLanguages() const;
/**
* @brief getLocalLanguages getter for local languages
* @return vector of local languages
*/
const std::vector<String> &getLocalLanguages() const;
/**
* @brief getMissedLanguages getter for missed languages on local machine
* @return difference between remote and local languages as a coma separated
* string
*/
String getMissedLanguages() const;
/**
* @brief getSerializedLocalLanguages getter for local serialized languages
* @return serialized local languages as a string
*/
String getSerializedLocalLanguages() const;
/**
* @brief isLanguageInstalled checks if language is installed
* @param language which should be checked
* @return true if the specified language is installed
*/
bool isLanguageInstalled(const String &language) const;
};
} // namespace languages
} // namespace deskflow
| 2,277
|
C++
|
.h
| 63
| 33.269841
| 116
| 0.762381
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,819
|
AppUtilWindows.h
|
deskflow_deskflow/src/lib/deskflow/win32/AppUtilWindows.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "deskflow/AppUtil.h"
#define WIN32_LEAN_AND_MEAN
#include "Windows.h"
#define ARCH_APP_UTIL AppUtilWindows
class IEventQueue;
enum AppExitMode
{
kExitModeNormal,
kExitModeDaemon
};
class AppUtilWindows : public AppUtil
{
public:
AppUtilWindows(IEventQueue *events);
virtual ~AppUtilWindows();
static AppUtilWindows &instance();
int daemonNTStartup(int, char **);
int daemonNTMainLoop(int argc, const char **argv);
void debugServiceWait();
int run(int argc, char **argv) override;
void exitApp(int code) override;
void beforeAppExit() override;
void startNode() override;
std::vector<String> getKeyboardLayoutList() override;
String getCurrentLanguageCode() override;
HKL getCurrentKeyboardLayout() const;
void showNotification(const String &title, const String &text) const override;
private:
AppExitMode m_exitMode;
IEventQueue *m_events;
static BOOL WINAPI consoleHandler(DWORD Event);
};
| 1,692
|
C++
|
.h
| 50
| 31.54
| 80
| 0.777437
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,820
|
ISO639Table.h
|
deskflow_deskflow/src/lib/deskflow/unix/ISO639Table.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "base/String.h"
// copy from
// https://www.loc.gov/standards/iso639-2/php/code_list.php
// 10.06.2021
// first param - ISO 639-2, second param - 639-1
const std::vector<std::pair<String, String>> ISO_Table = {
std::make_pair("aar", "aa"), std::make_pair("abk", "ab"), std::make_pair("afr", "af"), std::make_pair("aka", "ak"),
std::make_pair("sqi", "sq"), std::make_pair("amh", "am"), std::make_pair("ara", "ar"), std::make_pair("arg", "an"),
std::make_pair("hye", "hy"), std::make_pair("asm", "as"), std::make_pair("ava", "av"), std::make_pair("ave", "ae"),
std::make_pair("aym", "ay"), std::make_pair("aze", "az"), std::make_pair("bak", "ba"), std::make_pair("bam", "bm"),
std::make_pair("eus", "eu"), std::make_pair("bel", "be"), std::make_pair("ben", "bn"), std::make_pair("bih", "bh"),
std::make_pair("bis", "bi"), std::make_pair("bod", "bo"), std::make_pair("bos", "bs"), std::make_pair("bre", "br"),
std::make_pair("bul", "bg"), std::make_pair("mya", "my"), std::make_pair("cat", "ca"), std::make_pair("ces", "cs"),
std::make_pair("cha", "ch"), std::make_pair("che", "ce"), std::make_pair("zho", "zh"), std::make_pair("chu", "cu"),
std::make_pair("chv", "cv"), std::make_pair("cor", "kw"), std::make_pair("cos", "co"), std::make_pair("cre", "cr"),
std::make_pair("cym", "cy"), std::make_pair("ces", "cs"), std::make_pair("dan", "da"), std::make_pair("deu", "de"),
std::make_pair("div", "dv"), std::make_pair("nld", "nl"), std::make_pair("dzo", "dz"), std::make_pair("ell", "el"),
std::make_pair("eng", "en"), std::make_pair("epo", "eo"), std::make_pair("est", "et"), std::make_pair("eus", "eu"),
std::make_pair("ewe", "ee"), std::make_pair("fao", "fo"), std::make_pair("fas", "fa"), std::make_pair("fij", "fj"),
std::make_pair("fin", "fi"), std::make_pair("fra", "fr"), std::make_pair("fra", "fr"), std::make_pair("fry", "fy"),
std::make_pair("ful", "ff"), std::make_pair("kat", "ka"), std::make_pair("deu", "de"), std::make_pair("gla", "gd"),
std::make_pair("gle", "ga"), std::make_pair("glg", "gl"), std::make_pair("glv", "gv"), std::make_pair("ell", "el"),
std::make_pair("grn", "gn"), std::make_pair("guj", "gu"), std::make_pair("hat", "ht"), std::make_pair("hau", "ha"),
std::make_pair("heb", "he"), std::make_pair("her", "hz"), std::make_pair("hin", "hi"), std::make_pair("hmo", "ho"),
std::make_pair("hrv", "hr"), std::make_pair("hun", "hu"), std::make_pair("hye", "hy"), std::make_pair("ibo", "ig"),
std::make_pair("isl", "is"), std::make_pair("ido", "io"), std::make_pair("iii", "ii"), std::make_pair("iku", "iu"),
std::make_pair("ile", "ie"), std::make_pair("ina", "ia"), std::make_pair("ind", "id"), std::make_pair("ipk", "ik"),
std::make_pair("isl", "is"), std::make_pair("ita", "it"), std::make_pair("jav", "jv"), std::make_pair("jpn", "ja"),
std::make_pair("kal", "kl"), std::make_pair("kan", "kn"), std::make_pair("kas", "ks"), std::make_pair("kat", "ka"),
std::make_pair("kau", "kr"), std::make_pair("kaz", "kk"), std::make_pair("khm", "km"), std::make_pair("kik", "ki"),
std::make_pair("kin", "rw"), std::make_pair("kir", "ky"), std::make_pair("kom", "kv"), std::make_pair("kon", "kg"),
std::make_pair("kor", "ko"), std::make_pair("kua", "kj"), std::make_pair("kur", "ku"), std::make_pair("lao", "lo"),
std::make_pair("lat", "la"), std::make_pair("lav", "lv"), std::make_pair("lim", "li"), std::make_pair("lin", "ln"),
std::make_pair("lit", "lt"), std::make_pair("ltz", "lb"), std::make_pair("lub", "lu"), std::make_pair("lug", "lg"),
std::make_pair("mkd", "mk"), std::make_pair("mah", "mh"), std::make_pair("mal", "ml"), std::make_pair("mri", "mi"),
std::make_pair("mar", "mr"), std::make_pair("msa", "ms"), std::make_pair("mkd", "mk"), std::make_pair("mlg", "mg"),
std::make_pair("mlt", "mt"), std::make_pair("mon", "mn"), std::make_pair("mri", "mi"), std::make_pair("msa", "ms"),
std::make_pair("mya", "my"), std::make_pair("nau", "na"), std::make_pair("nav", "nv"), std::make_pair("nbl", "nr"),
std::make_pair("nde", "nd"), std::make_pair("ndo", "ng"), std::make_pair("nep", "ne"), std::make_pair("nld", "nl"),
std::make_pair("nno", "nn"), std::make_pair("nob", "nb"), std::make_pair("nor", "no"), std::make_pair("nya", "ny"),
std::make_pair("oci", "oc"), std::make_pair("oji", "oj"), std::make_pair("ori", "or"), std::make_pair("orm", "om"),
std::make_pair("oss", "os"), std::make_pair("pan", "pa"), std::make_pair("fas", "fa"), std::make_pair("pli", "pi"),
std::make_pair("pol", "pl"), std::make_pair("por", "pt"), std::make_pair("pus", "ps"), std::make_pair("que", "qu"),
std::make_pair("roh", "rm"), std::make_pair("ron", "ro"), std::make_pair("ron", "ro"), std::make_pair("run", "rn"),
std::make_pair("rus", "ru"), std::make_pair("sag", "sg"), std::make_pair("san", "sa"), std::make_pair("sin", "si"),
std::make_pair("slk", "sk"), std::make_pair("slk", "sk"), std::make_pair("slv", "sl"), std::make_pair("sme", "se"),
std::make_pair("smo", "sm"), std::make_pair("sna", "sn"), std::make_pair("snd", "sd"), std::make_pair("som", "so"),
std::make_pair("sot", "st"), std::make_pair("spa", "es"), std::make_pair("sqi", "sq"), std::make_pair("srd", "sc"),
std::make_pair("srp", "sr"), std::make_pair("ssw", "ss"), std::make_pair("sun", "su"), std::make_pair("swa", "sw"),
std::make_pair("swe", "sv"), std::make_pair("tah", "ty"), std::make_pair("tam", "ta"), std::make_pair("tat", "tt"),
std::make_pair("tel", "te"), std::make_pair("tgk", "tg"), std::make_pair("tgl", "tl"), std::make_pair("tha", "th"),
std::make_pair("bod", "bo"), std::make_pair("tir", "ti"), std::make_pair("ton", "to"), std::make_pair("tsn", "tn"),
std::make_pair("tso", "ts"), std::make_pair("tuk", "tk"), std::make_pair("tur", "tr"), std::make_pair("twi", "tw"),
std::make_pair("uig", "ug"), std::make_pair("ukr", "uk"), std::make_pair("urd", "ur"), std::make_pair("uzb", "uz"),
std::make_pair("ven", "ve"), std::make_pair("vie", "vi"), std::make_pair("vol", "vo"), std::make_pair("cym", "cy"),
std::make_pair("wln", "wa"), std::make_pair("wol", "wo"), std::make_pair("xho", "xh"), std::make_pair("yid", "yi"),
std::make_pair("yor", "yo"), std::make_pair("zha", "za"), std::make_pair("zho", "zh"), std::make_pair("zul", "zu"),
};
| 7,089
|
C++
|
.h
| 76
| 89.342105
| 119
| 0.565906
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,821
|
DeskflowXkbKeyboard.h
|
deskflow_deskflow/src/lib/deskflow/unix/DeskflowXkbKeyboard.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2021 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#if WINAPI_XWINDOWS
#pragma once
#include <X11/XKBlib.h>
#include <X11/extensions/XKBrules.h>
#include <cstdio>
namespace deskflow {
namespace linux {
class DeskflowXkbKeyboard
{
XkbRF_VarDefsRec m_data = {};
public:
DeskflowXkbKeyboard();
DeskflowXkbKeyboard(const DeskflowXkbKeyboard &) = delete;
DeskflowXkbKeyboard &operator=(const DeskflowXkbKeyboard &) = delete;
const char *getLayout() const;
const char *getVariant() const;
~DeskflowXkbKeyboard();
};
} // namespace linux
} // namespace deskflow
#endif // WINAPI_XWINDOWS
| 1,285
|
C++
|
.h
| 38
| 31.736842
| 72
| 0.767799
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,822
|
AppUtilUnix.h
|
deskflow_deskflow/src/lib/deskflow/unix/AppUtilUnix.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "deskflow/AppUtil.h"
#define ARCH_APP_UTIL AppUtilUnix
class IEventQueue;
class AppUtilUnix : public AppUtil
{
public:
AppUtilUnix(IEventQueue *events);
virtual ~AppUtilUnix();
int run(int argc, char **argv) override;
void startNode() override;
std::vector<String> getKeyboardLayoutList() override;
String getCurrentLanguageCode() override;
void showNotification(const String &title, const String &text) const override;
};
| 1,195
|
C++
|
.h
| 32
| 35.21875
| 80
| 0.772688
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,823
|
X11LayoutsParser.h
|
deskflow_deskflow/src/lib/deskflow/unix/X11LayoutsParser.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#if WINAPI_XWINDOWS
#pragma once
#include "base/String.h"
namespace pugi {
class xml_node;
}
class X11LayoutsParser
{
public:
static std::vector<String> getX11LanguageList(const String &pathToEvdevFile);
static String
convertLayotToISO(const String &pathToEvdevFile, const String &layoutLangCode, bool needToReloadFiles = false);
private:
struct Lang
{
String name = "";
std::vector<String> layoutBaseISO639_2;
std::vector<Lang> variants;
};
static bool readXMLConfigItemElem(const pugi::xml_node *root, std::vector<Lang> &langList);
static std::vector<Lang> getAllLanguageData(const String &pathToEvdevFile);
static void appendVectorUniq(const std::vector<String> &source, std::vector<String> &dst);
static void convertLayoutToISO639_2(
const String &pathToEvdevFile, bool needToReloadEvdev, const std::vector<String> &layoutNames,
const std::vector<String> &layoutVariantNames, std::vector<String> &iso639_2Codes
);
static std::vector<String> convertISO639_2ToISO639_1(const std::vector<String> &iso639_2Codes);
};
#endif // WINAPI_XWINDOWS
| 1,831
|
C++
|
.h
| 46
| 37.195652
| 113
| 0.768451
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,824
|
IArchTaskBar.h
|
deskflow_deskflow/src/lib/arch/IArchTaskBar.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2003 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "common/IInterface.h"
class IArchTaskBarReceiver;
//! Interface for architecture dependent task bar control
/*!
This interface defines the task bar icon operations required
by deskflow. Each architecture must implement this interface
though each operation can be a no-op.
*/
class IArchTaskBar : public IInterface
{
public:
//! @name manipulators
//@{
//! Add a receiver
/*!
Add a receiver object to be notified of user and application
events. This should be called before other methods. When
the receiver is added to the task bar, its icon appears on
the task bar.
*/
virtual void addReceiver(IArchTaskBarReceiver *) = 0;
//! Remove a receiver
/*!
Remove a receiver object from the task bar. This removes the
icon from the task bar.
*/
virtual void removeReceiver(IArchTaskBarReceiver *) = 0;
//! Update a receiver
/*!
Updates the display of the receiver on the task bar. This
should be called when the receiver appearance may have changed
(e.g. it's icon or tool tip has changed).
*/
virtual void updateReceiver(IArchTaskBarReceiver *) = 0;
//@}
virtual void init() = 0;
};
| 1,892
|
C++
|
.h
| 55
| 32.036364
| 72
| 0.752188
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,825
|
IArchConsole.h
|
deskflow_deskflow/src/lib/arch/IArchConsole.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "base/ELevel.h"
#include "common/IInterface.h"
//! Interface for architecture dependent console output
/*!
This interface defines the console operations required by
deskflow. Each architecture must implement this interface.
*/
class IArchConsole : public IInterface
{
public:
//! @name manipulators
//@{
//! Open the console
/*!
Opens the console for writing. The console is opened automatically
on the first write so calling this method is optional. Uses \c title
for the console's title if appropriate for the architecture. Calling
this method on an already open console must have no effect.
*/
virtual void openConsole(const char *title) = 0;
//! Close the console
/*!
Close the console. Calling this method on an already closed console
must have no effect.
*/
virtual void closeConsole() = 0;
//! Show the console
/*!
Causes the console to become visible. This generally only makes sense
for a console in a graphical user interface. Other implementations
will do nothing. Iff \p showIfEmpty is \c false then the implementation
may optionally only show the console if it's not empty.
*/
virtual void showConsole(bool showIfEmpty) = 0;
//! Write to the console
/*!
Writes the given string to the console, opening it if necessary.
*/
virtual void writeConsole(ELevel, const char *) = 0;
//@}
};
| 2,124
|
C++
|
.h
| 59
| 33.576271
| 74
| 0.752066
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,826
|
multibyte.h
|
deskflow_deskflow/src/lib/arch/multibyte.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "arch/Arch.h"
#include "common/common.h"
#include <climits>
#include <cstdlib>
#include <cstring>
#if HAVE_LOCALE_H
#include <locale.h>
#endif
#if HAVE_WCHAR_H || defined(_MSC_VER)
#include <wchar.h>
#elif __APPLE__
// wtf? Darwin puts mbtowc() et al. in stdlib
#include <cstdlib>
#else
// platform apparently has no wchar_t support. provide dummy
// implementations. hopefully at least the C++ compiler has
// a built-in wchar_t type.
static inline int mbtowc(wchar_t *dst, const char *src, int n)
{
*dst = static_cast<wchar_t>(*src);
return 1;
}
static inline int wctomb(char *dst, wchar_t src)
{
*dst = static_cast<char>(src);
return 1;
}
#endif
| 1,418
|
C++
|
.h
| 46
| 29.173913
| 72
| 0.742313
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,827
|
ArchDaemonNone.h
|
deskflow_deskflow/src/lib/arch/ArchDaemonNone.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "arch/IArchDaemon.h"
#define ARCH_DAEMON ArchDaemonNone
//! Dummy implementation of IArchDaemon
/*!
This class implements IArchDaemon for a platform that does not have
daemons. The install and uninstall functions do nothing, the query
functions return false, and \c daemonize() simply calls the passed
function and returns its result.
*/
class ArchDaemonNone : public IArchDaemon
{
public:
ArchDaemonNone();
virtual ~ArchDaemonNone();
// IArchDaemon overrides
virtual void installDaemon(
const char *name, const char *description, const char *pathname, const char *commandLine, const char *dependencies
);
virtual void uninstallDaemon(const char *name);
virtual int daemonize(const char *name, DaemonFunc func);
virtual bool canInstallDaemon(const char *name);
virtual bool isDaemonInstalled(const char *name);
virtual void installDaemon();
virtual void uninstallDaemon();
virtual std::string commandLine() const;
};
| 1,705
|
C++
|
.h
| 44
| 36.590909
| 120
| 0.778382
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,828
|
IArchDaemon.h
|
deskflow_deskflow/src/lib/arch/IArchDaemon.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "base/String.h"
#include "common/IInterface.h"
//! Interface for architecture dependent daemonizing
/*!
This interface defines the operations required by deskflow for installing
uninstalling daeamons and daemonizing a process. Each architecture must
implement this interface.
*/
class IArchDaemon : public IInterface
{
public:
typedef int (*DaemonFunc)(int argc, const char **argv);
//! @name manipulators
//@{
//! Install daemon
/*!
Install a daemon. \c name is the name of the daemon passed to the
system and \c description is a short human readable description of
the daemon. \c pathname is the path to the daemon executable.
\c commandLine should \b not include the name of program as the
first argument. If \c allUsers is true then the daemon will be
installed to start at boot time, otherwise it will be installed to
start when the current user logs in. If \p dependencies is not NULL
then it's a concatenation of NUL terminated other daemon names
followed by a NUL; the daemon will be configured to startup after
the listed daemons. Throws an \c XArchDaemon exception on failure.
*/
virtual void installDaemon(
const char *name, const char *description, const char *pathname, const char *commandLine, const char *dependencies
) = 0;
//! Uninstall daemon
/*!
Uninstall a daemon. Throws an \c XArchDaemon on failure.
*/
virtual void uninstallDaemon(const char *name) = 0;
//! Install daemon
/*!
Installs the default daemon.
*/
virtual void installDaemon() = 0;
//! Uninstall daemon
/*!
Uninstalls the default daemon.
*/
virtual void uninstallDaemon() = 0;
//! Daemonize the process
/*!
Daemonize. Throw XArchDaemonFailed on error. \c name is the name
of the daemon. Once daemonized, \c func is invoked and daemonize
returns when and what it does.
Exactly what happens when daemonizing depends on the platform.
<ul>
<li>unix:
Detaches from terminal. \c func gets passed one argument, the
name passed to daemonize().
<li>win32:
Becomes a service. Argument 0 is the name of the service
and the rest are the arguments passed to StartService().
\c func is only called when the service is actually started.
\c func must call \c ArchMiscWindows::runDaemon() to finally
becoming a service. The \c runFunc function passed to \c runDaemon()
must call \c ArchMiscWindows::daemonRunning(true) when it
enters the main loop (i.e. after initialization) and
\c ArchMiscWindows::daemonRunning(false) when it leaves
the main loop. The \c stopFunc function passed to \c runDaemon()
is called when the daemon must exit the main loop and it must cause
\c runFunc to return. \c func should return what \c runDaemon()
returns. \c func or \c runFunc can call
\c ArchMiscWindows::daemonFailed() to indicate startup failure.
</ul>
*/
virtual int daemonize(const char *name, DaemonFunc func) = 0;
//! Check if user has permission to install the daemon
/*!
Returns true iff the caller has permission to install or
uninstall the daemon. Note that even if this method returns
true it's possible that installing/uninstalling the service
may still fail. This method ignores whether or not the
service is already installed.
*/
virtual bool canInstallDaemon(const char *name) = 0;
//! Check if the daemon is installed
/*!
Returns true iff the daemon is installed.
*/
virtual bool isDaemonInstalled(const char *name) = 0;
//@}
//! Get the command line
/*!
Gets the command line with which the application was started.
*/
virtual std::string commandLine() const = 0;
//@}
};
| 4,428
|
C++
|
.h
| 112
| 36.491071
| 120
| 0.743083
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| true
| false
| false
| false
| false
| false
| false
|
13,829
|
Arch.h
|
deskflow_deskflow/src/lib/arch/Arch.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
// TODO: consider whether or not to use either encapsulation (as below)
// or inheritance (as it is now) for the ARCH stuff.
//
// case for encapsulation:
// pros:
// - compiler errors for missing pv implementations are not absolutely bonkers.
// - function names don't have to be so verbose.
// - easier to understand and debug.
// - ctors in IArch implementations can call other implementations.
// cons:
// - slightly more code for calls to ARCH.
// - you'll have to modify each ARCH call.
//
// also, we may want to consider making each encapsulated
// class lazy-loaded so that apps like the daemon don't load
// stuff when they don't need it.
#pragma once
#include "common/common.h"
#if SYSAPI_WIN32
#include "arch/win32/ArchConsoleWindows.h"
#include "arch/win32/ArchDaemonWindows.h"
#include "arch/win32/ArchFileWindows.h"
#include "arch/win32/ArchLogWindows.h"
#include "arch/win32/ArchMultithreadWindows.h"
#include "arch/win32/ArchNetworkWinsock.h"
#include "arch/win32/ArchSleepWindows.h"
#include "arch/win32/ArchStringWindows.h"
#include "arch/win32/ArchSystemWindows.h"
#include "arch/win32/ArchTaskBarWindows.h"
#include "arch/win32/ArchTimeWindows.h"
#elif SYSAPI_UNIX
#include "arch/unix/ArchConsoleUnix.h"
#include "arch/unix/ArchDaemonUnix.h"
#include "arch/unix/ArchFileUnix.h"
#include "arch/unix/ArchLogUnix.h"
#include "arch/unix/ArchNetworkBSD.h"
#include "arch/unix/ArchSleepUnix.h"
#include "arch/unix/ArchStringUnix.h"
#include "arch/unix/ArchSystemUnix.h"
#include "arch/unix/ArchTaskBarXWindows.h"
#include "arch/unix/ArchTimeUnix.h"
#if HAVE_PTHREAD
#include "arch/unix/ArchMultithreadPosix.h"
#endif
#endif
/*!
\def ARCH
This macro evaluates to the singleton Arch object.
*/
#define ARCH (Arch::getInstance())
//! Delegating implementation of architecture dependent interfaces
/*!
This class is a centralized interface to all architecture dependent
interface implementations (except miscellaneous functions). It
instantiates an implementation of each interface and delegates calls
to each method to those implementations. Clients should use the
\c ARCH macro to access this object. Clients must also instantiate
exactly one of these objects before attempting to call any method,
typically at the beginning of \c main().
*/
class Arch : public ARCH_CONSOLE,
public ARCH_DAEMON,
public ARCH_FILE,
public ARCH_LOG,
public ARCH_MULTITHREAD,
public ARCH_NETWORK,
public ARCH_SLEEP,
public ARCH_STRING,
public ARCH_SYSTEM,
public ARCH_TASKBAR,
public ARCH_TIME
{
public:
Arch();
Arch(Arch *arch);
virtual ~Arch();
//! Call init on other arch classes.
/*!
Some arch classes depend on others to exist first. When init is called
these classes will have ARCH available for use.
*/
virtual void init();
//
// accessors
//
//! Return the singleton instance
/*!
The client must have instantiated exactly once Arch object before
calling this function.
*/
static Arch *getInstance();
static void setInstance(Arch *s)
{
s_instance = s;
}
private:
static Arch *s_instance;
};
//! Convenience object to lock/unlock an arch mutex
class ArchMutexLock
{
public:
ArchMutexLock(ArchMutex mutex) : m_mutex(mutex)
{
ARCH->lockMutex(m_mutex);
}
ArchMutexLock(ArchMutexLock const &) = delete;
ArchMutexLock(ArchMutexLock &&) = delete;
~ArchMutexLock()
{
ARCH->unlockMutex(m_mutex);
}
ArchMutexLock &operator=(ArchMutexLock const &) = delete;
ArchMutexLock &operator=(ArchMutexLock &&) = delete;
private:
ArchMutex m_mutex;
};
| 4,397
|
C++
|
.h
| 134
| 30
| 80
| 0.748115
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,830
|
IArchNetwork.h
|
deskflow_deskflow/src/lib/arch/IArchNetwork.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "common/IInterface.h"
#include "common/stdstring.h"
#include <vector>
class ArchThreadImpl;
typedef ArchThreadImpl *ArchThread;
/*!
\class ArchSocketImpl
\brief Internal socket data.
An architecture dependent type holding the necessary data for a socket.
*/
class ArchSocketImpl;
/*!
\var ArchSocket
\brief Opaque socket type.
An opaque type representing a socket.
*/
typedef ArchSocketImpl *ArchSocket;
/*!
\class ArchNetAddressImpl
\brief Internal network address data.
An architecture dependent type holding the necessary data for a network
address.
*/
class ArchNetAddressImpl;
/*!
\var ArchNetAddress
\brief Opaque network address type.
An opaque type representing a network address.
*/
typedef ArchNetAddressImpl *ArchNetAddress;
//! Interface for architecture dependent networking
/*!
This interface defines the networking operations required by
deskflow. Each architecture must implement this interface.
*/
class IArchNetwork : public IInterface
{
public:
//! Supported address families
enum EAddressFamily
{
kUNKNOWN,
kINET,
kINET6,
};
//! Supported socket types
enum ESocketType
{
kDGRAM,
kSTREAM
};
//! Events for \c poll()
/*!
Events for \c poll() are bitmasks and can be combined using the
bitwise operators.
*/
enum
{
kPOLLIN = 1, //!< Socket is readable
kPOLLOUT = 2, //!< Socket is writable
kPOLLERR = 4, //!< The socket is in an error state
kPOLLNVAL = 8 //!< The socket is invalid
};
//! A socket query for \c poll()
class PollEntry
{
public:
//! The socket to query
ArchSocket m_socket;
//! The events to query for
/*!
The events to query for can be any combination of kPOLLIN and
kPOLLOUT.
*/
unsigned short m_events;
//! The result events
unsigned short m_revents;
};
//! @name manipulators
//@{
//! Create a new socket
/*!
The socket is an opaque data type.
*/
virtual ArchSocket newSocket(EAddressFamily, ESocketType) = 0;
//! Copy a socket object
/*!
Returns a reference to to socket referred to by \c s.
*/
virtual ArchSocket copySocket(ArchSocket s) = 0;
//! Release a socket reference
/*!
Deletes the given socket object. This does not destroy the socket
the object referred to until there are no remaining references for
the socket.
*/
virtual void closeSocket(ArchSocket s) = 0;
//! Close socket for further reads
/*!
Calling this disallows future reads on socket \c s.
*/
virtual void closeSocketForRead(ArchSocket s) = 0;
//! Close socket for further writes
/*!
Calling this disallows future writes on socket \c s.
*/
virtual void closeSocketForWrite(ArchSocket s) = 0;
//! Bind socket to address
/*!
Binds socket \c s to the address \c addr.
*/
virtual void bindSocket(ArchSocket s, ArchNetAddress addr) = 0;
//! Listen for connections on socket
/*!
Causes the socket \c s to begin listening for incoming connections.
*/
virtual void listenOnSocket(ArchSocket s) = 0;
//! Accept connection on socket
/*!
Accepts a connection on socket \c s, returning a new socket for the
connection and filling in \c addr with the address of the remote
end. \c addr may be NULL if the remote address isn't required.
The original socket \c s is unaffected and remains in the listening
state. The new socket shares most of the properties of \c s except
it's not in the listening state and it's connected. Returns NULL
if there are no pending connection requests.
*/
virtual ArchSocket acceptSocket(ArchSocket s, ArchNetAddress *addr) = 0;
//! Connect socket
/*!
Connects the socket \c s to the remote address \c addr. Returns
true if the connection succeed immediately, false if the connection
is in progress, and throws if the connection failed immediately.
If it returns false, \c pollSocket() can be used to wait on the
socket for writing to detect when the connection finally succeeds
or fails.
*/
virtual bool connectSocket(ArchSocket s, ArchNetAddress addr) = 0;
//! Check socket state
/*!
Tests the state of \c num sockets for readability and/or writability.
Waits up to \c timeout seconds for some socket to become readable
and/or writable (or indefinitely if \c timeout < 0). Returns the
number of sockets that were readable (if readability was being
queried) or writable (if writablility was being queried) and sets
the \c m_revents members of the entries. \c kPOLLERR and \c kPOLLNVAL
are set in \c m_revents as appropriate. If a socket indicates
\c kPOLLERR then \c throwErrorOnSocket() can be used to determine
the type of error. Returns 0 immediately regardless of the \c timeout
if no valid sockets are selected for testing.
(Cancellation point)
*/
virtual int pollSocket(PollEntry[], int num, double timeout) = 0;
//! Unblock thread in pollSocket()
/*!
Cause a thread that's in a pollSocket() call to return. This
call may return before the thread is unblocked. If the thread is
not in a pollSocket() call this call has no effect.
*/
virtual void unblockPollSocket(ArchThread thread) = 0;
//! Read data from socket
/*!
Read up to \c len bytes from socket \c s in \c buf and return the
number of bytes read. The number of bytes can be less than \c len
if not enough data is available. Returns 0 if the remote end has
disconnected and/or there is no more queued received data.
*/
virtual size_t readSocket(ArchSocket s, void *buf, size_t len) = 0;
//! Write data from socket
/*!
Write up to \c len bytes to socket \c s from \c buf and return the
number of bytes written. The number of bytes can be less than
\c len if the remote end disconnected or the internal buffers fill
up.
*/
virtual size_t writeSocket(ArchSocket s, const void *buf, size_t len) = 0;
//! Check error on socket
/*!
If the socket \c s is in an error state then throws an appropriate
XArchNetwork exception.
*/
virtual void throwErrorOnSocket(ArchSocket s) = 0;
//! Turn Nagle algorithm on or off on socket
/*!
Set socket to send messages immediately (true) or to collect small
messages into one packet (false). Returns the previous state.
*/
virtual bool setNoDelayOnSocket(ArchSocket, bool noDelay) = 0;
//! Turn address reuse on or off on socket
/*!
Allows the address this socket is bound to to be reused while in the
TIME_WAIT state. Returns the previous state.
*/
virtual bool setReuseAddrOnSocket(ArchSocket, bool reuse) = 0;
//! Return local host's name
virtual std::string getHostName() = 0;
//! Create an "any" network address
virtual ArchNetAddress newAnyAddr(EAddressFamily) = 0;
//! Copy a network address
virtual ArchNetAddress copyAddr(ArchNetAddress) = 0;
//! Convert a name to a network address
virtual std::vector<ArchNetAddress> nameToAddr(const std::string &) = 0;
//! Destroy a network address
virtual void closeAddr(ArchNetAddress) = 0;
//! Convert an address to a host name
virtual std::string addrToName(ArchNetAddress) = 0;
//! Convert an address to a string
virtual std::string addrToString(ArchNetAddress) = 0;
//! Get an address's family
virtual EAddressFamily getAddrFamily(ArchNetAddress) = 0;
//! Set the port of an address
virtual void setAddrPort(ArchNetAddress, int port) = 0;
//! Get the port of an address
virtual int getAddrPort(ArchNetAddress) = 0;
//! Test addresses for equality
virtual bool isEqualAddr(ArchNetAddress, ArchNetAddress) = 0;
//! Test for the "any" address
/*!
Returns true if \c addr is the "any" address. \c newAnyAddr()
returns an "any" address.
*/
virtual bool isAnyAddr(ArchNetAddress addr) = 0;
//@}
virtual void init() = 0;
};
| 8,517
|
C++
|
.h
| 243
| 32.106996
| 76
| 0.737968
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| true
| false
| false
| false
| false
| false
| false
|
13,831
|
IArchTaskBarReceiver.h
|
deskflow_deskflow/src/lib/arch/IArchTaskBarReceiver.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2003 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "base/String.h"
#include "common/IInterface.h"
class IScreen;
class INode;
//! Interface for architecture dependent task bar event handling
/*!
This interface defines the task bar icon event handlers required
by deskflow. Each architecture must implement this interface
though each operation can be a no-op.
*/
class IArchTaskBarReceiver : public IInterface
{
public:
// Icon data is architecture dependent
typedef void *Icon;
//! @name manipulators
//@{
//! Show status window
/*!
Open a window displaying current status. This should return
immediately without waiting for the window to be closed.
*/
virtual void showStatus() = 0;
//! Popup menu
/*!
Popup a menu of operations at or around \c x,y and perform the
chosen operation.
*/
virtual void runMenu(int x, int y) = 0;
//! Perform primary action
/*!
Perform the primary (default) action.
*/
virtual void primaryAction() = 0;
//@}
//! @name accessors
//@{
//! Lock receiver
/*!
Locks the receiver from changing state. The receiver should be
locked when querying it's state to ensure consistent results.
Each call to \c lock() must have a matching \c unlock() and
locks cannot be nested.
*/
virtual void lock() const = 0;
//! Unlock receiver
virtual void unlock() const = 0;
//! Get icon
/*!
Returns the icon to display in the task bar. The interface
to set the icon is left to subclasses. Getting and setting
the icon must be thread safe.
*/
virtual const Icon getIcon() const = 0;
//! Get tooltip
/*!
Returns the tool tip to display in the task bar. The interface
to set the tooltip is left to sublclasses. Getting and setting
the icon must be thread safe.
*/
virtual std::string getToolTip() const = 0;
virtual void updateStatus(INode *, const String &errorMsg) = 0;
virtual void cleanup()
{
}
//@}
};
| 2,641
|
C++
|
.h
| 85
| 28.447059
| 72
| 0.730315
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,832
|
IArchSleep.h
|
deskflow_deskflow/src/lib/arch/IArchSleep.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "common/IInterface.h"
//! Interface for architecture dependent sleeping
/*!
This interface defines the sleep operations required by
deskflow. Each architecture must implement this interface.
*/
class IArchSleep : public IInterface
{
public:
//! @name manipulators
//@{
//! Sleep
/*!
Blocks the calling thread for \c timeout seconds. If
\c timeout < 0.0 then the call returns immediately. If \c timeout
== 0.0 then the calling thread yields the CPU.
(cancellation point)
*/
virtual void sleep(double timeout) = 0;
//@}
};
| 1,304
|
C++
|
.h
| 39
| 31.307692
| 72
| 0.750596
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,833
|
vsnprintf.h
|
deskflow_deskflow/src/lib/arch/vsnprintf.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "arch/IArchString.h"
#if HAVE_VSNPRINTF
#if !defined(ARCH_VSNPRINTF)
#define ARCH_VSNPRINTF vsnprintf
#endif
int IArchString::vsnprintf(char *str, int size, const char *fmt, va_list ap)
{
int n = ::ARCH_VSNPRINTF(str, size, fmt, ap);
if (n > size) {
n = -1;
}
return n;
}
#elif SYSAPI_UNIX // !HAVE_VSNPRINTF
#include <stdio.h>
int IArchString::vsnprintf(char *str, int size, const char *fmt, va_list ap)
{
static FILE *bitbucket = fopen("/dev/null", "w");
if (bitbucket == NULL) {
// uh oh
if (size > 0) {
str[0] = '\0';
}
return 0;
} else {
// count the characters using the bitbucket
int n = vfprintf(bitbucket, fmt, ap);
if (n + 1 <= size) {
// it'll fit so print it into str
vsprintf(str, fmt, ap);
}
return n;
}
}
#else // !HAVE_VSNPRINTF && !SYSAPI_UNIX
#error vsnprintf not implemented
#endif // !HAVE_VSNPRINTF
| 1,657
|
C++
|
.h
| 55
| 27.290909
| 76
| 0.69516
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| true
| false
| false
|
13,834
|
XArch.h
|
deskflow_deskflow/src/lib/arch/XArch.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "common/common.h"
#include "common/stdexcept.h"
#include "common/stdstring.h"
//! Generic thread exception
/*!
Exceptions derived from this class are used by the multithreading
library to perform stack unwinding when a thread terminates. These
exceptions must always be rethrown by clients when caught.
*/
class XThread
{
};
//! Thread exception to cancel
/*!
Thrown to cancel a thread. Clients must not throw this type, but
must rethrow it if caught (by XThreadCancel, XThread, or ...).
*/
class XThreadCancel : public XThread
{
};
/*!
\def RETHROW_XTHREAD
Convenience macro to rethrow an XThread exception but ignore other
exceptions. Put this in your catch (...) handler after necessary
cleanup but before leaving or returning from the handler.
*/
#define RETHROW_XTHREAD \
try { \
throw; \
} catch (XThread &) { \
throw; \
} catch (...) { \
}
//! Lazy error message string evaluation
/*!
This class encapsulates platform dependent error string lookup.
Platforms subclass this type, taking an appropriate error code
type in the c'tor and overriding eval() to return the error
string for that error code.
*/
class XArchEval
{
public:
XArchEval()
{
}
virtual ~XArchEval() _NOEXCEPT
{
}
virtual std::string eval() const = 0;
};
//! Generic exception architecture dependent library
class XArch : public std::runtime_error
{
public:
XArch(XArchEval *adopted) : std::runtime_error(adopted->eval())
{
delete adopted;
}
XArch(const std::string &msg) : std::runtime_error(msg)
{
}
virtual ~XArch() _NOEXCEPT
{
}
};
// Macro to declare XArch derived types
#define XARCH_SUBCLASS(name_, super_) \
class name_ : public super_ \
{ \
public: \
name_(XArchEval *adoptedEvaluator) : super_(adoptedEvaluator) \
{ \
} \
name_(const std::string &msg) : super_(msg) \
{ \
} \
}
//! Generic network exception
/*!
Exceptions derived from this class are used by the networking
library to indicate various errors.
*/
XARCH_SUBCLASS(XArchNetwork, XArch);
//! Operation was interrupted
XARCH_SUBCLASS(XArchNetworkInterrupted, XArchNetwork);
//! Network insufficient permission
XARCH_SUBCLASS(XArchNetworkAccess, XArchNetwork);
//! Network insufficient resources
XARCH_SUBCLASS(XArchNetworkResource, XArchNetwork);
//! No support for requested network resource/service
XARCH_SUBCLASS(XArchNetworkSupport, XArchNetwork);
//! Network I/O error
XARCH_SUBCLASS(XArchNetworkIO, XArchNetwork);
//! Network address is unavailable or not local
XARCH_SUBCLASS(XArchNetworkNoAddress, XArchNetwork);
//! Network address in use
XARCH_SUBCLASS(XArchNetworkAddressInUse, XArchNetwork);
//! No route to address
XARCH_SUBCLASS(XArchNetworkNoRoute, XArchNetwork);
//! Socket not connected
XARCH_SUBCLASS(XArchNetworkNotConnected, XArchNetwork);
//! Remote read end of socket has closed
XARCH_SUBCLASS(XArchNetworkShutdown, XArchNetwork);
//! Remote end of socket has disconnected
XARCH_SUBCLASS(XArchNetworkDisconnected, XArchNetwork);
//! Remote end of socket refused connection
XARCH_SUBCLASS(XArchNetworkConnectionRefused, XArchNetwork);
//! Remote end of socket is not responding
XARCH_SUBCLASS(XArchNetworkTimedOut, XArchNetwork);
//! Generic network name lookup erros
XARCH_SUBCLASS(XArchNetworkName, XArchNetwork);
//! The named host is unknown
XARCH_SUBCLASS(XArchNetworkNameUnknown, XArchNetworkName);
//! The named host is known but has no address
XARCH_SUBCLASS(XArchNetworkNameNoAddress, XArchNetworkName);
//! Non-recoverable name server error
XARCH_SUBCLASS(XArchNetworkNameFailure, XArchNetworkName);
//! Temporary name server error
XARCH_SUBCLASS(XArchNetworkNameUnavailable, XArchNetworkName);
//! The named host is known but no supported address
XARCH_SUBCLASS(XArchNetworkNameUnsupported, XArchNetworkName);
//! Generic daemon exception
/*!
Exceptions derived from this class are used by the daemon
library to indicate various errors.
*/
XARCH_SUBCLASS(XArchDaemon, XArch);
//! Could not daemonize
XARCH_SUBCLASS(XArchDaemonFailed, XArchDaemon);
//! Could not install daemon
XARCH_SUBCLASS(XArchDaemonInstallFailed, XArchDaemon);
//! Could not uninstall daemon
XARCH_SUBCLASS(XArchDaemonUninstallFailed, XArchDaemon);
//! Attempted to uninstall a daemon that was not installed
XARCH_SUBCLASS(XArchDaemonUninstallNotInstalled, XArchDaemonUninstallFailed);
| 6,694
|
C++
|
.h
| 154
| 41.597403
| 120
| 0.593298
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,835
|
IArchSystem.h
|
deskflow_deskflow/src/lib/arch/IArchSystem.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "common/IInterface.h"
#include "common/stdstring.h"
//! Interface for architecture dependent system queries
/*!
This interface defines operations for querying system info.
*/
class IArchSystem : public IInterface
{
public:
//! @name accessors
//@{
//! Identify the OS
/*!
Returns a string identifying the operating system.
*/
virtual std::string getOSName() const = 0;
//! Identify the platform
/*!
Returns a string identifying the platform this OS is running on.
*/
virtual std::string getPlatformName() const = 0;
//@}
//! Get a Deskflow setting
/*!
Reads a Deskflow setting from the system.
*/
virtual std::string setting(const std::string &valueName) const = 0;
//@}
//! Set a Deskflow setting
/*!
Writes a Deskflow setting from the system.
*/
virtual void setting(const std::string &valueName, const std::string &valueString) const = 0;
//@}
};
| 1,659
|
C++
|
.h
| 53
| 28.924528
| 95
| 0.734209
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| true
| false
| false
| false
| false
| false
| false
|
13,836
|
IArchFile.h
|
deskflow_deskflow/src/lib/arch/IArchFile.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "base/String.h"
#include "common/IInterface.h"
#include "common/stdstring.h"
//! Interface for architecture dependent file system operations
/*!
This interface defines the file system operations required by
deskflow. Each architecture must implement this interface.
*/
class IArchFile : public IInterface
{
public:
//! @name manipulators
//@{
//! Extract base name
/*!
Find the base name in the given \c pathname.
*/
virtual const char *getBasename(const char *pathname) = 0;
//! Get user's home directory
/*!
Returns the user's home directory. Returns the empty string if
this cannot be determined.
*/
virtual std::string getUserDirectory() = 0;
//! Get system directory
/*!
Returns the ussystem configuration file directory.
*/
virtual std::string getSystemDirectory() = 0;
//! Get installed directory
/*!
Returns the directory in which Deskflow is installed.
*/
virtual std::string getInstalledDirectory() = 0;
//! Get log directory
/*!
Returns the log file directory.
*/
virtual std::string getLogDirectory() = 0;
//! Get plugins directory
/*!
Returns the plugin files directory. If no plugin directory is set,
this will return the plugin folder within the user's profile.
*/
virtual std::string getPluginDirectory() = 0;
//! Get user's profile directory
/*!
Returns the user's profile directory. If no profile directory is set,
this will return the user's profile according to the operating system,
which will depend on which user launched the program.
*/
virtual std::string getProfileDirectory() = 0;
//! Concatenate path components
/*!
Concatenate pathname components with a directory separator
between them. This should not check if the resulting path
is longer than allowed by the system; we'll rely on the
system calls to tell us that.
*/
virtual std::string concatPath(const std::string &prefix, const std::string &suffix) = 0;
//@}
//! Set the user's profile directory
/*
Returns the user's profile directory.
*/
virtual void setProfileDirectory(const String &s) = 0;
//@}
//! Set the user's plugin directory
/*
Returns the user's plugin directory.
*/
virtual void setPluginDirectory(const String &s) = 0;
};
| 3,013
|
C++
|
.h
| 91
| 30.450549
| 91
| 0.739773
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| true
| false
| false
| false
| false
| false
| false
|
13,837
|
IArchLog.h
|
deskflow_deskflow/src/lib/arch/IArchLog.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "base/ELevel.h"
#include "common/IInterface.h"
//! Interface for architecture dependent logging
/*!
This interface defines the logging operations required by
deskflow. Each architecture must implement this interface.
*/
class IArchLog : public IInterface
{
public:
//! @name manipulators
//@{
//! Open the log
/*!
Opens the log for writing. The log must be opened before being
written to.
*/
virtual void openLog(const char *name) = 0;
//! Close the log
/*!
Close the log.
*/
virtual void closeLog() = 0;
//! Show the log
/*!
Causes the log to become visible. This generally only makes sense
for a log in a graphical user interface. Other implementations
will do nothing. Iff \p showIfEmpty is \c false then the implementation
may optionally only show the log if it's not empty.
*/
virtual void showLog(bool showIfEmpty) = 0;
//! Write to the log
/*!
Writes the given string to the log with the given level.
*/
virtual void writeLog(ELevel, const char *) = 0;
//@}
};
| 1,787
|
C++
|
.h
| 56
| 29.517857
| 74
| 0.735926
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,838
|
IArchTime.h
|
deskflow_deskflow/src/lib/arch/IArchTime.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "common/IInterface.h"
//! Interface for architecture dependent time operations
/*!
This interface defines the time operations required by
deskflow. Each architecture must implement this interface.
*/
class IArchTime : public IInterface
{
public:
//! @name manipulators
//@{
//! Get the current time
/*!
Returns the number of seconds since some arbitrary starting time.
This should return as high a precision as reasonable.
*/
virtual double time() = 0;
//@}
};
| 1,237
|
C++
|
.h
| 37
| 31.378378
| 72
| 0.758159
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| true
| true
| false
| false
| false
| false
| false
| false
|
13,839
|
IArchString.h
|
deskflow_deskflow/src/lib/arch/IArchString.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "common/IInterface.h"
#include "common/basic_types.h"
#include <stdarg.h>
//! Interface for architecture dependent string operations
/*!
This interface defines the string operations required by
deskflow. Each architecture must implement this interface.
*/
class IArchString : public IInterface
{
public:
IArchString() = default;
IArchString(const IArchString &) = delete;
IArchString(IArchString &&) = delete;
virtual ~IArchString();
IArchString &operator=(const IArchString &) = delete;
IArchString &operator=(IArchString &&) = delete;
//! Wide character encodings
/*!
The known wide character encodings
*/
enum EWideCharEncoding
{
kUCS2, //!< The UCS-2 encoding
kUCS4, //!< The UCS-4 encoding
kUTF16, //!< The UTF-16 encoding
kUTF32, //!< The UTF-32 encoding
kPlatformDetermined
};
//! @name manipulators
//@{
//! printf() to limited size buffer with va_list
/*!
This method is equivalent to vsprintf() except it will not write
more than \c n bytes to the buffer, returning -1 if the output
was truncated and the number of bytes written not including the
trailing NUL otherwise.
*/
virtual int vsnprintf(char *str, int size, const char *fmt, va_list ap);
//! Convert multibyte string to wide character string
virtual int convStringMBToWC(wchar_t *, const char *, UInt32 n, bool *errors);
//! Convert wide character string to multibyte string
virtual int convStringWCToMB(char *, const wchar_t *, UInt32 n, bool *errors);
//! Return the architecture's native wide character encoding
virtual EWideCharEncoding getWideCharEncoding() = 0;
//@}
};
| 2,392
|
C++
|
.h
| 65
| 34.138462
| 80
| 0.743413
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,840
|
IArchMultithread.h
|
deskflow_deskflow/src/lib/arch/IArchMultithread.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "common/IInterface.h"
/*!
\class ArchCondImpl
\brief Internal condition variable data.
An architecture dependent type holding the necessary data for a
condition variable.
*/
class ArchCondImpl;
/*!
\var ArchCond
\brief Opaque condition variable type.
An opaque type representing a condition variable.
*/
typedef ArchCondImpl *ArchCond;
/*!
\class ArchMutexImpl
\brief Internal mutex data.
An architecture dependent type holding the necessary data for a mutex.
*/
class ArchMutexImpl;
/*!
\var ArchMutex
\brief Opaque mutex type.
An opaque type representing a mutex.
*/
typedef ArchMutexImpl *ArchMutex;
/*!
\class ArchThreadImpl
\brief Internal thread data.
An architecture dependent type holding the necessary data for a thread.
*/
class ArchThreadImpl;
/*!
\var ArchThread
\brief Opaque thread type.
An opaque type representing a thread.
*/
typedef ArchThreadImpl *ArchThread;
//! Interface for architecture dependent multithreading
/*!
This interface defines the multithreading operations required by
deskflow. Each architecture must implement this interface.
*/
class IArchMultithread : public IInterface
{
public:
//! Type of thread entry point
typedef void *(*ThreadFunc)(void *);
//! Type of thread identifier
typedef unsigned int ThreadID;
//! Types of signals
/*!
Not all platforms support all signals. Unsupported signals are
ignored.
*/
enum ESignal
{
kINTERRUPT, //!< Interrupt (e.g. Ctrl+C)
kTERMINATE, //!< Terminate (e.g. Ctrl+Break)
kHANGUP, //!< Hangup (SIGHUP)
kUSER, //!< User (SIGUSR2)
kNUM_SIGNALS
};
//! Type of signal handler function
typedef void (*SignalFunc)(ESignal, void *userData);
//! @name manipulators
//@{
//
// condition variable methods
//
//! Create a condition variable
/*!
The condition variable is an opaque data type.
*/
virtual ArchCond newCondVar() = 0;
//! Destroy a condition variable
virtual void closeCondVar(ArchCond) = 0;
//! Signal a condition variable
/*!
Signalling a condition variable releases one waiting thread.
*/
virtual void signalCondVar(ArchCond) = 0;
//! Broadcast a condition variable
/*!
Broadcasting a condition variable releases all waiting threads.
*/
virtual void broadcastCondVar(ArchCond) = 0;
//! Wait on a condition variable
/*!
Wait on a conditation variable for up to \c timeout seconds.
If \c timeout is < 0 then there is no timeout. The mutex must
be locked when this method is called. The mutex is unlocked
during the wait and locked again before returning. Returns
true if the condition variable was signalled and false on
timeout.
(Cancellation point)
*/
virtual bool waitCondVar(ArchCond, ArchMutex, double timeout) = 0;
//
// mutex methods
//
//! Create a recursive mutex
/*!
Creates a recursive mutex. A thread may lock a recursive mutex
when it already holds a lock on that mutex. The mutex is an
opaque data type.
*/
virtual ArchMutex newMutex() = 0;
//! Destroy a mutex
virtual void closeMutex(ArchMutex) = 0;
//! Lock a mutex
virtual void lockMutex(ArchMutex) = 0;
//! Unlock a mutex
virtual void unlockMutex(ArchMutex) = 0;
//
// thread methods
//
//! Start a new thread
/*!
Creates and starts a new thread, using \c func as the entry point
and passing it \c userData. The thread is an opaque data type.
*/
virtual ArchThread newThread(ThreadFunc func, void *userData) = 0;
//! Get a reference to the calling thread
/*!
Returns a thread representing the current (i.e. calling) thread.
*/
virtual ArchThread newCurrentThread() = 0;
//! Copy a thread object
/*!
Returns a reference to to thread referred to by \c thread.
*/
virtual ArchThread copyThread(ArchThread thread) = 0;
//! Release a thread reference
/*!
Deletes the given thread object. This does not destroy the thread
the object referred to, even if there are no remaining references.
Use cancelThread() and waitThread() to stop a thread and wait for
it to exit.
*/
virtual void closeThread(ArchThread) = 0;
//! Force a thread to exit
/*!
Causes \c thread to exit when it next calls a cancellation point.
A thread avoids cancellation as long as it nevers calls a
cancellation point. Once it begins the cancellation process it
must always let cancellation go to completion but may take as
long as necessary to clean up.
*/
virtual void cancelThread(ArchThread thread) = 0;
//! Change thread priority
/*!
Changes the priority of \c thread by \c n. If \c n is positive
the thread has a lower priority and if negative a higher priority.
Some architectures may not support either or both directions.
*/
virtual void setPriorityOfThread(ArchThread, int n) = 0;
//! Cancellation point
/*!
This method does nothing but is a cancellation point. Clients
can make their own functions cancellation points by calling this
method at appropriate times.
(Cancellation point)
*/
virtual void testCancelThread() = 0;
//! Wait for a thread to exit
/*!
Waits for up to \c timeout seconds for \c thread to exit (normally
or by cancellation). Waits forever if \c timeout < 0. Returns
true if the thread exited, false otherwise. Waiting on the current
thread returns immediately with false.
(Cancellation point)
*/
virtual bool wait(ArchThread thread, double timeout) = 0;
//! Compare threads
/*!
Returns true iff two thread objects refer to the same thread.
Note that comparing thread objects directly is meaningless.
*/
virtual bool isSameThread(ArchThread, ArchThread) = 0;
//! Test if thread exited
/*!
Returns true iff \c thread has exited.
*/
virtual bool isExitedThread(ArchThread thread) = 0;
//! Returns the exit code of a thread
/*!
Waits indefinitely for \c thread to exit (if it hasn't yet) then
returns the thread's exit code.
(Cancellation point)
*/
virtual void *getResultOfThread(ArchThread thread) = 0;
//! Returns an ID for a thread
/*!
Returns some ID number for \c thread. This is for logging purposes.
All thread objects referring to the same thread return the same ID.
However, clients should us isSameThread() to compare thread objects
instead of comparing IDs.
*/
virtual ThreadID getIDOfThread(ArchThread thread) = 0;
//! Set the interrupt handler
/*!
Sets the function to call on receipt of an external interrupt.
By default and when \p func is NULL, the main thread is cancelled.
*/
virtual void setSignalHandler(ESignal, SignalFunc func, void *userData) = 0;
//! Invoke the signal handler
/*!
Invokes the signal handler for \p signal, if any. If no handler
cancels the main thread for \c kINTERRUPT and \c kTERMINATE and
ignores the call otherwise.
*/
virtual void raiseSignal(ESignal signal) = 0;
//@}
};
| 7,620
|
C++
|
.h
| 233
| 29.974249
| 78
| 0.743262
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,841
|
ArchConsoleStd.h
|
deskflow_deskflow/src/lib/arch/ArchConsoleStd.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "arch/IArchConsole.h"
//! Cross platform implementation of IArchConsole
class ArchConsoleStd : public IArchConsole
{
public:
ArchConsoleStd()
{
}
virtual ~ArchConsoleStd()
{
}
// IArchConsole overrides
virtual void openConsole(const char *title)
{
}
virtual void closeConsole()
{
}
virtual void showConsole(bool)
{
}
virtual void writeConsole(ELevel level, const char *);
};
| 1,165
|
C++
|
.h
| 41
| 26.097561
| 72
| 0.753571
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| true
| true
| false
| false
| false
| false
| false
| false
|
13,842
|
ArchSleepWindows.h
|
deskflow_deskflow/src/lib/arch/win32/ArchSleepWindows.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "arch/IArchSleep.h"
#define ARCH_SLEEP ArchSleepWindows
//! Win32 implementation of IArchSleep
class ArchSleepWindows : public IArchSleep
{
public:
ArchSleepWindows();
virtual ~ArchSleepWindows();
// IArchSleep overrides
virtual void sleep(double timeout);
};
| 1,025
|
C++
|
.h
| 29
| 33.344828
| 72
| 0.772957
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| true
| true
| false
| false
| false
| false
| false
| false
|
13,843
|
ArchMultithreadWindows.h
|
deskflow_deskflow/src/lib/arch/win32/ArchMultithreadWindows.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "arch/IArchMultithread.h"
#include "common/stdlist.h"
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#define ARCH_MULTITHREAD ArchMultithreadWindows
class ArchCondImpl
{
public:
enum
{
kSignal = 0,
kBroadcast
};
HANDLE m_events[2];
mutable int m_waitCount;
ArchMutex m_waitCountMutex;
};
class ArchMutexImpl
{
public:
CRITICAL_SECTION m_mutex;
};
//! Win32 implementation of IArchMultithread
class ArchMultithreadWindows : public IArchMultithread
{
public:
ArchMultithreadWindows();
virtual ~ArchMultithreadWindows();
//! @name manipulators
//@{
void setNetworkDataForCurrentThread(void *);
//@}
//! @name accessors
//@{
HANDLE getCancelEventForCurrentThread();
void *getNetworkDataForThread(ArchThread);
static ArchMultithreadWindows *getInstance();
//@}
// IArchMultithread overrides
virtual ArchCond newCondVar();
virtual void closeCondVar(ArchCond);
virtual void signalCondVar(ArchCond);
virtual void broadcastCondVar(ArchCond);
virtual bool waitCondVar(ArchCond, ArchMutex, double timeout);
virtual ArchMutex newMutex();
virtual void closeMutex(ArchMutex);
virtual void lockMutex(ArchMutex);
virtual void unlockMutex(ArchMutex);
virtual ArchThread newThread(ThreadFunc, void *);
virtual ArchThread newCurrentThread();
virtual ArchThread copyThread(ArchThread);
virtual void closeThread(ArchThread);
virtual void cancelThread(ArchThread);
virtual void setPriorityOfThread(ArchThread, int n);
virtual void testCancelThread();
virtual bool wait(ArchThread, double timeout);
virtual bool isSameThread(ArchThread, ArchThread);
virtual bool isExitedThread(ArchThread);
virtual void *getResultOfThread(ArchThread);
virtual ThreadID getIDOfThread(ArchThread);
virtual void setSignalHandler(ESignal, SignalFunc, void *);
virtual void raiseSignal(ESignal);
private:
ArchThreadImpl *find(DWORD id);
ArchThreadImpl *findNoRef(DWORD id);
ArchThreadImpl *findNoRefOrCreate(DWORD id);
void insert(ArchThreadImpl *thread);
void erase(ArchThreadImpl *thread);
void refThread(ArchThreadImpl *rep);
void testCancelThreadImpl(ArchThreadImpl *rep);
void doThreadFunc(ArchThread thread);
static unsigned int __stdcall threadFunc(void *vrep);
private:
typedef std::list<ArchThread> ThreadList;
static ArchMultithreadWindows *s_instance;
ArchMutex m_threadMutex;
ThreadList m_threadList;
ArchThread m_mainThread;
SignalFunc m_signalFunc[kNUM_SIGNALS];
void *m_signalUserData[kNUM_SIGNALS];
};
| 3,278
|
C++
|
.h
| 99
| 30.434343
| 72
| 0.788273
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| true
| false
| false
| false
| false
| false
| false
|
13,844
|
ArchMiscWindows.h
|
deskflow_deskflow/src/lib/arch/win32/ArchMiscWindows.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "base/String.h"
#include "common/stdset.h"
#include "common/stdstring.h"
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <Tlhelp32.h>
//! Miscellaneous win32 functions.
class ArchMiscWindows
{
public:
enum EValueType
{
kUNKNOWN,
kNO_VALUE,
kUINT,
kSTRING,
kBINARY
};
enum EBusyModes
{
kIDLE = 0x0000,
kSYSTEM = 0x0001,
kDISPLAY = 0x0002
};
typedef int (*RunFunc)(void);
//! Initialize
static void init();
//! Delete memory
static void cleanup();
//! Set the application icons
/*!
Set the application icons.
*/
static void setIcons(HICON largeIcon, HICON smallIcon);
//! Get the application icons
/*!
Get the application icons.
*/
static void getIcons(HICON &largeIcon, HICON &smallIcon);
//! Run the daemon
/*!
Delegates to ArchDaemonWindows.
*/
static int runDaemon(RunFunc runFunc);
//! Indicate daemon is in main loop
/*!
Delegates to ArchDaemonWindows.
*/
static void daemonRunning(bool running);
//! Indicate failure of running daemon
/*!
Delegates to ArchDaemonWindows.
*/
static void daemonFailed(int result);
//! Get daemon quit message
/*!
Delegates to ArchDaemonWindows.
*/
static UINT getDaemonQuitMessage();
//! Open and return a registry key, closing the parent key
static HKEY openKey(HKEY parent, const TCHAR *child);
//! Open and return a registry key, closing the parent key
static HKEY openKey(HKEY parent, const TCHAR *const *keyPath);
//! Open/create and return a registry key, closing the parent key
static HKEY addKey(HKEY parent, const TCHAR *child);
//! Open/create and return a registry key, closing the parent key
static HKEY addKey(HKEY parent, const TCHAR *const *keyPath);
//! Close a key
static void closeKey(HKEY);
//! Delete a key (which should have no subkeys)
static void deleteKey(HKEY parent, const TCHAR *name);
//! Delete a value
static void deleteValue(HKEY parent, const TCHAR *name);
//! Test if a value exists
static bool hasValue(HKEY key, const TCHAR *name);
//! Get type of value
static EValueType typeOfValue(HKEY key, const TCHAR *name);
//! Set a string value in the registry
static void setValue(HKEY key, const TCHAR *name, const std::string &value);
//! Set a DWORD value in the registry
static void setValue(HKEY key, const TCHAR *name, DWORD value);
//! Set a BINARY value in the registry
/*!
Sets the \p name value of \p key to \p value.data().
*/
static void setValueBinary(HKEY key, const TCHAR *name, const std::string &value);
//! Read a string value from the registry
static std::string readValueString(HKEY, const TCHAR *name);
//! Read a DWORD value from the registry
static DWORD readValueInt(HKEY, const TCHAR *name);
//! Read a BINARY value from the registry
static std::string readValueBinary(HKEY, const TCHAR *name);
//! Add a dialog
static void addDialog(HWND);
//! Remove a dialog
static void removeDialog(HWND);
//! Process dialog message
/*!
Checks if the message is destined for a dialog. If so the message
is passed to the dialog and returns true, otherwise returns false.
*/
static bool processDialog(MSG *);
//! Disable power saving
static void addBusyState(DWORD busyModes);
//! Enable power saving
static void removeBusyState(DWORD busyModes);
//! Briefly interrupt power saving
static void wakeupDisplay();
//! Returns true if this process was launched via NT service host.
static bool wasLaunchedAsService();
//! Returns true if we got the parent process name.
static bool getParentProcessName(String &name);
static HINSTANCE instanceWin32();
static void setInstanceWin32(HINSTANCE instance);
static BOOL WINAPI getProcessEntry(PROCESSENTRY32 &entry, DWORD processID);
static BOOL WINAPI getSelfProcessEntry(PROCESSENTRY32 &entry);
static BOOL WINAPI getParentProcessEntry(PROCESSENTRY32 &entry);
private:
//! Open and return a registry key, closing the parent key
static HKEY openKey(HKEY parent, const TCHAR *child, bool create);
//! Open and return a registry key, closing the parent key
static HKEY openKey(HKEY parent, const TCHAR *const *keyPath, bool create);
//! Read a string value from the registry
static std::string readBinaryOrString(HKEY, const TCHAR *name, DWORD type);
//! Set thread busy state
static void setThreadExecutionState(DWORD);
static DWORD WINAPI dummySetThreadExecutionState(DWORD);
private:
typedef std::set<HWND> Dialogs;
typedef DWORD(WINAPI *STES_t)(DWORD);
static Dialogs *s_dialogs;
static DWORD s_busyState;
static STES_t s_stes;
static HICON s_largeIcon;
static HICON s_smallIcon;
static HINSTANCE s_instanceWin32;
};
| 5,508
|
C++
|
.h
| 155
| 32.425806
| 84
| 0.74444
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,845
|
ArchTaskBarWindows.h
|
deskflow_deskflow/src/lib/arch/win32/ArchTaskBarWindows.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2003 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "arch/IArchMultithread.h"
#include "arch/IArchTaskBar.h"
#include "common/stdmap.h"
#include "common/stdvector.h"
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#define ARCH_TASKBAR ArchTaskBarWindows
//! Win32 implementation of IArchTaskBar
class ArchTaskBarWindows : public IArchTaskBar
{
public:
ArchTaskBarWindows();
virtual ~ArchTaskBarWindows();
virtual void init();
//! Add a dialog window
/*!
Tell the task bar event loop about a dialog. Win32 annoyingly
requires messages destined for modeless dialog boxes to be
dispatched differently than other messages.
*/
static void addDialog(HWND);
//! Remove a dialog window
/*!
Remove a dialog window added via \c addDialog().
*/
static void removeDialog(HWND);
// IArchTaskBar overrides
virtual void addReceiver(IArchTaskBarReceiver *);
virtual void removeReceiver(IArchTaskBarReceiver *);
virtual void updateReceiver(IArchTaskBarReceiver *);
private:
class ReceiverInfo
{
public:
UINT m_id;
};
typedef std::map<IArchTaskBarReceiver *, ReceiverInfo> ReceiverToInfoMap;
typedef std::map<UINT, ReceiverToInfoMap::iterator> CIDToReceiverMap;
typedef std::vector<UINT> CIDStack;
typedef std::map<HWND, bool> Dialogs;
UINT getNextID();
void recycleID(UINT);
void addIcon(UINT);
void removeIcon(UINT);
void updateIcon(UINT);
void addAllIcons();
void removeAllIcons();
void modifyIconNoLock(ReceiverToInfoMap::const_iterator, DWORD taskBarMessage);
void removeIconNoLock(UINT id);
void handleIconMessage(IArchTaskBarReceiver *, LPARAM);
bool processDialogs(MSG *);
LRESULT wndProc(HWND, UINT, WPARAM, LPARAM);
static LRESULT CALLBACK staticWndProc(HWND, UINT, WPARAM, LPARAM);
void threadMainLoop();
static void *threadEntry(void *);
HINSTANCE instanceWin32();
private:
static ArchTaskBarWindows *s_instance;
// multithread data
ArchMutex m_mutex;
ArchCond m_condVar;
bool m_ready;
int m_result;
ArchThread m_thread;
// child thread data
HWND m_hwnd;
UINT m_taskBarRestart;
// shared data
ReceiverToInfoMap m_receivers;
CIDToReceiverMap m_idTable;
CIDStack m_oldIDs;
UINT m_nextID;
// dialogs
Dialogs m_dialogs;
Dialogs m_addedDialogs;
};
| 2,985
|
C++
|
.h
| 94
| 29.031915
| 81
| 0.768722
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,846
|
ArchNetworkWinsock.h
|
deskflow_deskflow/src/lib/arch/win32/ArchNetworkWinsock.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include <ws2tcpip.h>
// declare no functions in winsock2
#ifndef INCL_WINSOCK_API_PROTOTYPES
#define INCL_WINSOCK_API_PROTOTYPES 0
#endif
#define INCL_WINSOCK_API_TYPEDEFS 0
#include "arch/IArchMultithread.h"
#include "arch/IArchNetwork.h"
#include <WinSock2.h>
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <list>
#pragma comment(lib, "ws2_32.lib")
#define ARCH_NETWORK ArchNetworkWinsock
class ArchSocketImpl
{
public:
SOCKET m_socket;
int m_refCount;
WSAEVENT m_event;
bool m_pollWrite;
};
class ArchNetAddressImpl
{
public:
static ArchNetAddressImpl *alloc(size_t);
public:
int m_len;
struct sockaddr_storage m_addr;
};
#define ADDR_HDR_SIZE offsetof(ArchNetAddressImpl, m_addr)
#define TYPED_ADDR(type_, addr_) (reinterpret_cast<type_ *>(&addr_->m_addr))
//! Win32 implementation of IArchNetwork
class ArchNetworkWinsock : public IArchNetwork
{
public:
ArchNetworkWinsock();
virtual ~ArchNetworkWinsock();
virtual void init();
// IArchNetwork overrides
virtual ArchSocket newSocket(EAddressFamily, ESocketType);
virtual ArchSocket copySocket(ArchSocket s);
virtual void closeSocket(ArchSocket s);
virtual void closeSocketForRead(ArchSocket s);
virtual void closeSocketForWrite(ArchSocket s);
virtual void bindSocket(ArchSocket s, ArchNetAddress addr);
virtual void listenOnSocket(ArchSocket s);
virtual ArchSocket acceptSocket(ArchSocket s, ArchNetAddress *addr);
virtual bool connectSocket(ArchSocket s, ArchNetAddress name);
virtual int pollSocket(PollEntry[], int num, double timeout);
virtual void unblockPollSocket(ArchThread thread);
virtual size_t readSocket(ArchSocket s, void *buf, size_t len);
virtual size_t writeSocket(ArchSocket s, const void *buf, size_t len);
virtual void throwErrorOnSocket(ArchSocket);
virtual bool setNoDelayOnSocket(ArchSocket, bool noDelay);
virtual bool setReuseAddrOnSocket(ArchSocket, bool reuse);
virtual std::string getHostName();
virtual ArchNetAddress newAnyAddr(EAddressFamily);
virtual ArchNetAddress copyAddr(ArchNetAddress);
virtual std::vector<ArchNetAddress> nameToAddr(const std::string &);
virtual void closeAddr(ArchNetAddress);
virtual std::string addrToName(ArchNetAddress);
virtual std::string addrToString(ArchNetAddress);
virtual EAddressFamily getAddrFamily(ArchNetAddress);
virtual void setAddrPort(ArchNetAddress, int port);
virtual int getAddrPort(ArchNetAddress);
virtual bool isAnyAddr(ArchNetAddress);
virtual bool isEqualAddr(ArchNetAddress, ArchNetAddress);
private:
void initModule(HMODULE);
void setBlockingOnSocket(SOCKET, bool blocking);
void throwError(int);
void throwNameError(int);
private:
typedef std::list<WSAEVENT> EventList;
ArchMutex m_mutex;
EventList m_unblockEvents;
};
| 3,524
|
C++
|
.h
| 96
| 34.40625
| 76
| 0.795954
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,847
|
ArchFileWindows.h
|
deskflow_deskflow/src/lib/arch/win32/ArchFileWindows.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "arch/IArchFile.h"
#define ARCH_FILE ArchFileWindows
//! Win32 implementation of IArchFile
class ArchFileWindows : public IArchFile
{
public:
ArchFileWindows();
virtual ~ArchFileWindows();
// IArchFile overrides
virtual const char *getBasename(const char *pathname);
virtual std::string getUserDirectory();
virtual std::string getSystemDirectory();
virtual std::string getInstalledDirectory();
virtual std::string getLogDirectory();
virtual std::string getPluginDirectory();
virtual std::string getProfileDirectory();
virtual std::string concatPath(const std::string &prefix, const std::string &suffix);
virtual void setProfileDirectory(const String &s);
virtual void setPluginDirectory(const String &s);
private:
String m_profileDirectory;
String m_pluginDirectory;
};
| 1,558
|
C++
|
.h
| 41
| 35.731707
| 87
| 0.778293
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,848
|
ArchDaemonWindows.h
|
deskflow_deskflow/src/lib/arch/win32/ArchDaemonWindows.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "arch/IArchDaemon.h"
#include "arch/IArchMultithread.h"
#include "common/constants.h"
#include "common/stdstring.h"
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <tchar.h>
#define ARCH_DAEMON ArchDaemonWindows
//! Win32 implementation of IArchDaemon
class ArchDaemonWindows : public IArchDaemon
{
public:
typedef int (*RunFunc)(void);
ArchDaemonWindows();
virtual ~ArchDaemonWindows();
//! Run the daemon
/*!
When the client calls \c daemonize(), the \c DaemonFunc should call this
function after initialization and argument parsing to perform the
daemon processing. The \c runFunc should perform the daemon's
main loop, calling \c daemonRunning(true) when it enters the main loop
(i.e. after initialization) and \c daemonRunning(false) when it leaves
the main loop. The \c runFunc is called in a new thread and when the
daemon must exit the main loop due to some external control the
getDaemonQuitMessage() is posted to the thread. This function returns
what \c runFunc returns. \c runFunc should call \c daemonFailed() if
the daemon fails.
*/
static int runDaemon(RunFunc runFunc);
//! Indicate daemon is in main loop
/*!
The \c runFunc passed to \c runDaemon() should call this function
to indicate when it has entered (\c running is \c true) or exited
(\c running is \c false) the main loop.
*/
static void daemonRunning(bool running);
//! Indicate failure of running daemon
/*!
The \c runFunc passed to \c runDaemon() should call this function
to indicate failure. \c result is returned by \c daemonize().
*/
static void daemonFailed(int result);
//! Get daemon quit message
/*!
The windows NT daemon tells daemon thread to exit by posting this
message to it. The thread must, of course, have a message queue
for this to work.
*/
static UINT getDaemonQuitMessage();
// IArchDaemon overrides
virtual void installDaemon(
const char *name, const char *description, const char *pathname, const char *commandLine, const char *dependencies
);
virtual void uninstallDaemon(const char *name);
virtual void installDaemon();
virtual void uninstallDaemon();
virtual int daemonize(const char *name, DaemonFunc func);
virtual bool canInstallDaemon(const char *name);
virtual bool isDaemonInstalled(const char *name);
std::string commandLine() const
{
return m_commandLine;
}
private:
static HKEY openNTServicesKey();
int doRunDaemon(RunFunc runFunc);
void doDaemonRunning(bool running);
UINT doGetDaemonQuitMessage();
static void setStatus(DWORD state);
static void setStatus(DWORD state, DWORD step, DWORD waitHint);
static void setStatusError(DWORD error);
static bool isRunState(DWORD state);
void serviceMain(DWORD, LPTSTR *);
static void WINAPI serviceMainEntry(DWORD, LPTSTR *);
void serviceHandler(DWORD ctrl);
static void WINAPI serviceHandlerEntry(DWORD ctrl);
void start(const char *name);
void stop(const char *name);
private:
class XArchDaemonRunFailed
{
public:
XArchDaemonRunFailed(int result) : m_result(result)
{
}
public:
int m_result;
};
private:
static ArchDaemonWindows *s_daemon;
ArchMutex m_serviceMutex;
ArchCond m_serviceCondVar;
DWORD m_serviceState;
bool m_serviceHandlerWaiting;
bool m_serviceRunning;
DWORD m_daemonThreadID;
DaemonFunc m_daemonFunc;
int m_daemonResult;
SERVICE_STATUS_HANDLE m_statusHandle;
UINT m_quitMessage;
std::string m_commandLine;
};
#define DEFAULT_DAEMON_NAME _T(kAppName)
#define DEFAULT_DAEMON_INFO _T("Manages the Deskflow foreground processes.")
#define LEGACY_SERVER_DAEMON_NAME _T("Deskflow Server")
#define LEGACY_CLIENT_DAEMON_NAME _T("Deskflow Client")
| 4,492
|
C++
|
.h
| 124
| 33.370968
| 120
| 0.763364
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| true
| false
| false
| false
| false
| false
| false
|
13,849
|
XArchWindows.h
|
deskflow_deskflow/src/lib/arch/win32/XArchWindows.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "arch/XArch.h"
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
//! Lazy error message string evaluation for windows
class XArchEvalWindows : public XArchEval
{
public:
XArchEvalWindows() : m_error(GetLastError())
{
}
XArchEvalWindows(DWORD error) : m_error(error)
{
}
virtual ~XArchEvalWindows()
{
}
virtual std::string eval() const throw();
private:
DWORD m_error;
};
//! Lazy error message string evaluation for winsock
class XArchEvalWinsock : public XArchEval
{
public:
XArchEvalWinsock(int error) : m_error(error)
{
}
virtual ~XArchEvalWinsock()
{
}
virtual std::string eval() const throw();
private:
int m_error;
};
| 1,422
|
C++
|
.h
| 52
| 25.134615
| 72
| 0.749449
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,850
|
ArchConsoleWindows.h
|
deskflow_deskflow/src/lib/arch/win32/ArchConsoleWindows.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "arch/ArchConsoleStd.h"
#define ARCH_CONSOLE ArchConsoleWindows
class ArchConsoleWindows : public ArchConsoleStd
{
public:
ArchConsoleWindows();
virtual ~ArchConsoleWindows();
};
| 939
|
C++
|
.h
| 26
| 34.192308
| 72
| 0.775578
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,851
|
ArchTimeWindows.h
|
deskflow_deskflow/src/lib/arch/win32/ArchTimeWindows.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "arch/IArchTime.h"
#define ARCH_TIME ArchTimeWindows
//! Win32 implementation of IArchTime
class ArchTimeWindows : public IArchTime
{
public:
ArchTimeWindows();
virtual ~ArchTimeWindows();
// IArchTime overrides
virtual double time();
};
| 1,003
|
C++
|
.h
| 29
| 32.586207
| 72
| 0.768834
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| true
| true
| false
| false
| false
| false
| false
| false
|
13,852
|
ArchStringWindows.h
|
deskflow_deskflow/src/lib/arch/win32/ArchStringWindows.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "arch/IArchString.h"
#define ARCH_STRING ArchStringWindows
//! Win32 implementation of IArchString
class ArchStringWindows : public IArchString
{
public:
ArchStringWindows();
virtual ~ArchStringWindows();
// IArchString overrides
virtual EWideCharEncoding getWideCharEncoding();
};
| 1,047
|
C++
|
.h
| 29
| 34.103448
| 72
| 0.778875
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| true
| true
| false
| false
| false
| false
| false
| false
|
13,853
|
ArchSystemWindows.h
|
deskflow_deskflow/src/lib/arch/win32/ArchSystemWindows.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "arch/IArchSystem.h"
#define ARCH_SYSTEM ArchSystemWindows
//! Win32 implementation of IArchString
class ArchSystemWindows : public IArchSystem
{
public:
ArchSystemWindows();
virtual ~ArchSystemWindows();
// IArchSystem overrides
virtual std::string getOSName() const;
virtual std::string getPlatformName() const;
virtual std::string setting(const std::string &valueName) const;
virtual void setting(const std::string &valueName, const std::string &valueString) const;
bool isWOW64() const;
};
| 1,268
|
C++
|
.h
| 33
| 36.272727
| 91
| 0.772986
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,854
|
ArchLogWindows.h
|
deskflow_deskflow/src/lib/arch/win32/ArchLogWindows.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "arch/IArchLog.h"
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#define ARCH_LOG ArchLogWindows
//! Win32 implementation of IArchLog
class ArchLogWindows : public IArchLog
{
public:
ArchLogWindows();
virtual ~ArchLogWindows();
// IArchLog overrides
virtual void openLog(const char *name);
virtual void closeLog();
virtual void showLog(bool showIfEmpty);
virtual void writeLog(ELevel, const char *);
private:
HANDLE m_eventLog;
};
| 1,208
|
C++
|
.h
| 36
| 31.472222
| 72
| 0.76824
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| true
| true
| false
| false
| false
| false
| false
| false
|
13,855
|
ArchStringUnix.h
|
deskflow_deskflow/src/lib/arch/unix/ArchStringUnix.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "arch/IArchString.h"
#define ARCH_STRING ArchStringUnix
//! Unix implementation of IArchString
class ArchStringUnix : public IArchString
{
public:
ArchStringUnix();
virtual ~ArchStringUnix();
// IArchString overrides
virtual EWideCharEncoding getWideCharEncoding();
};
| 1,034
|
C++
|
.h
| 29
| 33.655172
| 72
| 0.776
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| true
| false
| false
| false
| false
| false
| false
|
13,856
|
ArchTimeUnix.h
|
deskflow_deskflow/src/lib/arch/unix/ArchTimeUnix.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "arch/IArchTime.h"
#define ARCH_TIME ArchTimeUnix
//! Generic Unix implementation of IArchTime
class ArchTimeUnix : public IArchTime
{
public:
ArchTimeUnix();
virtual ~ArchTimeUnix();
// IArchTime overrides
virtual double time();
};
| 998
|
C++
|
.h
| 29
| 32.413793
| 72
| 0.766598
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,857
|
ArchNetworkBSD.h
|
deskflow_deskflow/src/lib/arch/unix/ArchNetworkBSD.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "arch/IArchMultithread.h"
#include "arch/IArchNetwork.h"
#include <memory>
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#else
struct sockaddr_storage
{
unsigned char ss_len; /* address length */
unsigned char ss_family; /* [XSI] address family */
char __ss_pad1[_SS_PAD1SIZE];
long long __ss_align; /* force structure storage alignment */
char __ss_pad2[_SS_PAD2SIZE];
};
#endif
#if !HAVE_SOCKLEN_T
typedef int socklen_t;
#endif
#include <poll.h>
#define ARCH_NETWORK ArchNetworkBSD
#define TYPED_ADDR(type_, addr_) (reinterpret_cast<type_ *>(&addr_->m_addr))
// old systems may use char* for [gs]etsockopt()'s optval argument.
// this should be void on modern systems but char is forwards
// compatible so we always use it.
typedef char optval_t;
class ArchSocketImpl
{
public:
int m_fd;
int m_refCount;
};
class ArchNetAddressImpl
{
public:
ArchNetAddressImpl() : m_len(sizeof(m_addr))
{
}
public:
struct sockaddr_storage m_addr;
socklen_t m_len;
};
//! Berkeley (BSD) sockets implementation of IArchNetwork
class ArchNetworkBSD : public IArchNetwork
{
public:
struct Deps
{
virtual ~Deps() = default;
virtual void sleep(double);
virtual int poll(struct pollfd *, nfds_t, int);
virtual std::shared_ptr<struct pollfd[]> makePollFD(nfds_t);
virtual ssize_t read(int, void *, size_t);
virtual void testCancelThread();
};
explicit ArchNetworkBSD(std::shared_ptr<Deps> deps = std::make_shared<Deps>()) : m_pDeps(deps)
{
}
ArchNetworkBSD(ArchNetworkBSD const &) = delete;
ArchNetworkBSD(ArchNetworkBSD &&) = delete;
~ArchNetworkBSD() override;
ArchNetworkBSD &operator=(ArchNetworkBSD const &) = delete;
ArchNetworkBSD &operator=(ArchNetworkBSD &&) = delete;
void init() override;
// IArchNetwork overrides
ArchSocket newSocket(EAddressFamily, ESocketType) override;
ArchSocket copySocket(ArchSocket s) override;
void closeSocket(ArchSocket s) override;
void closeSocketForRead(ArchSocket s) override;
void closeSocketForWrite(ArchSocket s) override;
void bindSocket(ArchSocket s, ArchNetAddress addr) override;
void listenOnSocket(ArchSocket s) override;
ArchSocket acceptSocket(ArchSocket s, ArchNetAddress *addr) override;
bool connectSocket(ArchSocket s, ArchNetAddress name) override;
int pollSocket(PollEntry[], int num, double timeout) override;
void unblockPollSocket(ArchThread thread) override;
size_t readSocket(ArchSocket s, void *buf, size_t len) override;
size_t writeSocket(ArchSocket s, const void *buf, size_t len) override;
void throwErrorOnSocket(ArchSocket) override;
bool setNoDelayOnSocket(ArchSocket, bool noDelay) override;
bool setReuseAddrOnSocket(ArchSocket, bool reuse) override;
std::string getHostName() override;
ArchNetAddress newAnyAddr(EAddressFamily) override;
ArchNetAddress copyAddr(ArchNetAddress) override;
std::vector<ArchNetAddress> nameToAddr(const std::string &) override;
void closeAddr(ArchNetAddress) override;
std::string addrToName(ArchNetAddress) override;
std::string addrToString(ArchNetAddress) override;
EAddressFamily getAddrFamily(ArchNetAddress) override;
void setAddrPort(ArchNetAddress, int port) override;
int getAddrPort(ArchNetAddress) override;
bool isAnyAddr(ArchNetAddress) override;
bool isEqualAddr(ArchNetAddress, ArchNetAddress) override;
private:
const int *getUnblockPipe();
const int *getUnblockPipeForThread(ArchThread);
void setBlockingOnSocket(int fd, bool blocking);
void throwError(int);
void throwNameError(int);
private:
std::shared_ptr<Deps> m_pDeps;
ArchMutex m_mutex{};
};
| 4,421
|
C++
|
.h
| 123
| 33.479675
| 96
| 0.771388
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,858
|
ArchSystemUnix.h
|
deskflow_deskflow/src/lib/arch/unix/ArchSystemUnix.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "arch/IArchSystem.h"
#define ARCH_SYSTEM ArchSystemUnix
//! Unix implementation of IArchString
class ArchSystemUnix : public IArchSystem
{
public:
ArchSystemUnix();
virtual ~ArchSystemUnix();
// IArchSystem overrides
virtual std::string getOSName() const;
virtual std::string getPlatformName() const;
virtual std::string setting(const std::string &) const;
virtual void setting(const std::string &, const std::string &) const;
virtual std::string getLibsUsed(void) const;
#ifndef __APPLE__
enum class InhibitScreenServices
{
kScreenSaver,
kSessionManager
};
static bool DBusInhibitScreenCall(InhibitScreenServices serviceID, bool state, std::string &error);
#endif
};
| 1,458
|
C++
|
.h
| 41
| 33.243902
| 101
| 0.768958
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,859
|
ArchLogUnix.h
|
deskflow_deskflow/src/lib/arch/unix/ArchLogUnix.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "arch/IArchLog.h"
#define ARCH_LOG ArchLogUnix
//! Unix implementation of IArchLog
class ArchLogUnix : public IArchLog
{
public:
ArchLogUnix();
virtual ~ArchLogUnix();
// IArchLog overrides
virtual void openLog(const char *name);
virtual void closeLog();
virtual void showLog(bool);
virtual void writeLog(ELevel, const char *);
};
| 1,102
|
C++
|
.h
| 32
| 32.34375
| 72
| 0.762441
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,860
|
ArchDaemonUnix.h
|
deskflow_deskflow/src/lib/arch/unix/ArchDaemonUnix.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "arch/ArchDaemonNone.h"
#undef ARCH_DAEMON
#define ARCH_DAEMON ArchDaemonUnix
//! Unix implementation of IArchDaemon
class ArchDaemonUnix : public ArchDaemonNone
{
public:
ArchDaemonUnix();
virtual ~ArchDaemonUnix();
// IArchDaemon overrides
virtual int daemonize(const char *name, DaemonFunc func);
};
| 1,068
|
C++
|
.h
| 30
| 33.633333
| 72
| 0.774443
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,861
|
ArchConsoleUnix.h
|
deskflow_deskflow/src/lib/arch/unix/ArchConsoleUnix.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "arch/ArchConsoleStd.h"
#define ARCH_CONSOLE ArchConsoleUnix
class ArchConsoleUnix : public ArchConsoleStd
{
public:
ArchConsoleUnix();
virtual ~ArchConsoleUnix();
};
| 927
|
C++
|
.h
| 26
| 33.730769
| 72
| 0.772575
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,862
|
ArchMultithreadPosix.h
|
deskflow_deskflow/src/lib/arch/unix/ArchMultithreadPosix.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "arch/IArchMultithread.h"
#include "common/stdlist.h"
#include <pthread.h>
#define ARCH_MULTITHREAD ArchMultithreadPosix
class ArchCondImpl
{
public:
pthread_cond_t m_cond;
};
class ArchMutexImpl
{
public:
pthread_mutex_t m_mutex;
};
//! Posix implementation of IArchMultithread
class ArchMultithreadPosix : public IArchMultithread
{
public:
ArchMultithreadPosix();
ArchMultithreadPosix(ArchMultithreadPosix const &) = delete;
ArchMultithreadPosix(ArchMultithreadPosix &&) = delete;
virtual ~ArchMultithreadPosix();
ArchMultithreadPosix &operator=(ArchMultithreadPosix const &) = delete;
ArchMultithreadPosix &operator=(ArchMultithreadPosix &&) = delete;
//! @name manipulators
//@{
void setNetworkDataForCurrentThread(void *);
//@}
//! @name accessors
//@{
void *getNetworkDataForThread(ArchThread);
static ArchMultithreadPosix *getInstance();
//@}
// IArchMultithread overrides
virtual ArchCond newCondVar();
virtual void closeCondVar(ArchCond);
virtual void signalCondVar(ArchCond);
virtual void broadcastCondVar(ArchCond);
virtual bool waitCondVar(ArchCond, ArchMutex, double timeout);
virtual ArchMutex newMutex();
virtual void closeMutex(ArchMutex);
virtual void lockMutex(ArchMutex);
virtual void unlockMutex(ArchMutex);
virtual ArchThread newThread(ThreadFunc, void *);
virtual ArchThread newCurrentThread();
virtual ArchThread copyThread(ArchThread);
virtual void closeThread(ArchThread);
virtual void cancelThread(ArchThread);
virtual void setPriorityOfThread(ArchThread, int n);
virtual void testCancelThread();
virtual bool wait(ArchThread, double timeout);
virtual bool isSameThread(ArchThread, ArchThread);
virtual bool isExitedThread(ArchThread);
virtual void *getResultOfThread(ArchThread);
virtual ThreadID getIDOfThread(ArchThread);
virtual void setSignalHandler(ESignal, SignalFunc, void *);
virtual void raiseSignal(ESignal);
private:
void startSignalHandler();
ArchThreadImpl *find(pthread_t thread);
ArchThreadImpl *findNoRef(pthread_t thread);
void insert(ArchThreadImpl *thread);
void erase(ArchThreadImpl *thread);
void refThread(ArchThreadImpl *rep);
void testCancelThreadImpl(ArchThreadImpl *rep);
void doThreadFunc(ArchThread thread);
static void *threadFunc(void *vrep);
static void threadCancel(int);
static void *threadSignalHandler(void *vrep);
private:
typedef std::list<ArchThread> ThreadList;
static ArchMultithreadPosix *s_instance;
bool m_newThreadCalled;
ArchMutex m_threadMutex;
ArchThread m_mainThread;
ThreadList m_threadList;
ThreadID m_nextID;
pthread_t m_signalThread;
SignalFunc m_signalFunc[kNUM_SIGNALS];
void *m_signalUserData[kNUM_SIGNALS];
};
| 3,493
|
C++
|
.h
| 99
| 32.626263
| 73
| 0.790504
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| true
| false
| false
| false
| false
| false
| false
|
13,863
|
ArchFileUnix.h
|
deskflow_deskflow/src/lib/arch/unix/ArchFileUnix.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "arch/IArchFile.h"
#define ARCH_FILE ArchFileUnix
//! Unix implementation of IArchFile
class ArchFileUnix : public IArchFile
{
public:
ArchFileUnix();
virtual ~ArchFileUnix();
// IArchFile overrides
virtual const char *getBasename(const char *pathname);
virtual std::string getUserDirectory();
virtual std::string getSystemDirectory();
virtual std::string getInstalledDirectory();
virtual std::string getLogDirectory();
virtual std::string getPluginDirectory();
virtual std::string getProfileDirectory();
virtual std::string concatPath(const std::string &prefix, const std::string &suffix);
virtual void setProfileDirectory(const String &s);
virtual void setPluginDirectory(const String &s);
private:
String m_profileDirectory;
String m_pluginDirectory;
};
| 1,545
|
C++
|
.h
| 41
| 35.414634
| 87
| 0.776368
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,864
|
ArchTaskBarXWindows.h
|
deskflow_deskflow/src/lib/arch/unix/ArchTaskBarXWindows.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2003 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "arch/IArchTaskBar.h"
#define ARCH_TASKBAR ArchTaskBarXWindows
//! X11 implementation of IArchTaskBar
class ArchTaskBarXWindows : public IArchTaskBar
{
public:
ArchTaskBarXWindows();
virtual ~ArchTaskBarXWindows();
// IArchTaskBar overrides
virtual void addReceiver(IArchTaskBarReceiver *);
virtual void removeReceiver(IArchTaskBarReceiver *);
virtual void updateReceiver(IArchTaskBarReceiver *);
};
| 1,169
|
C++
|
.h
| 31
| 35.645161
| 72
| 0.784643
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,865
|
ArchSleepUnix.h
|
deskflow_deskflow/src/lib/arch/unix/ArchSleepUnix.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "arch/IArchSleep.h"
#define ARCH_SLEEP ArchSleepUnix
//! Unix implementation of IArchSleep
class ArchSleepUnix : public IArchSleep
{
public:
ArchSleepUnix();
virtual ~ArchSleepUnix();
// IArchSleep overrides
virtual void sleep(double timeout);
};
| 1,012
|
C++
|
.h
| 29
| 32.896552
| 72
| 0.769939
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| true
| true
| false
| false
| false
| false
| false
| false
|
13,866
|
XArchUnix.h
|
deskflow_deskflow/src/lib/arch/unix/XArchUnix.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "arch/XArch.h"
//! Lazy error message string evaluation for unix
class XArchEvalUnix : public XArchEval
{
public:
XArchEvalUnix(int error) : m_error(error)
{
}
virtual ~XArchEvalUnix() _NOEXCEPT
{
}
virtual std::string eval() const;
private:
int m_error;
};
| 1,031
|
C++
|
.h
| 33
| 29.121212
| 72
| 0.753273
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,867
|
version.h
|
deskflow_deskflow/src/lib/common/version.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2024 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/>.
*/
#pragma once
#include "constants.h"
#include <string>
namespace deskflow {
inline std::string version()
{
std::string result = kVersion;
std::string gitSha = kVersionGitSha;
if (!gitSha.empty()) {
result.append(" (");
result.append(gitSha);
result.append(")");
}
return result;
}
} // namespace deskflow
| 1,018
|
C++
|
.h
| 32
| 29.46875
| 72
| 0.738776
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,870
|
stdset.h
|
deskflow_deskflow/src/lib/common/stdset.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "common/stdpre.h"
#include <set>
#include "common/stdpost.h"
| 816
|
C++
|
.h
| 21
| 36.952381
| 72
| 0.761364
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,871
|
stdstring.h
|
deskflow_deskflow/src/lib/common/stdstring.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "common/stdpre.h"
#include <string>
#include "common/stdpost.h"
| 819
|
C++
|
.h
| 21
| 37.095238
| 72
| 0.762264
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| true
| false
| false
| false
| false
| false
| false
|
13,872
|
stdexcept.h
|
deskflow_deskflow/src/lib/common/stdexcept.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2014-2016 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/>.
*/
#pragma once
#include <stdexcept>
// apple declares _NOEXCEPT
#ifndef _NOEXCEPT
#define _NOEXCEPT throw()
#endif
| 807
|
C++
|
.h
| 22
| 34.863636
| 72
| 0.764706
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,873
|
stddeque.h
|
deskflow_deskflow/src/lib/common/stddeque.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "common/stdpre.h"
#include <deque>
#include "common/stdpost.h"
| 818
|
C++
|
.h
| 21
| 37.047619
| 72
| 0.761965
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,874
|
stdmap.h
|
deskflow_deskflow/src/lib/common/stdmap.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "common/stdpre.h"
#include <map>
#include "common/stdpost.h"
| 816
|
C++
|
.h
| 21
| 36.952381
| 72
| 0.761364
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,875
|
copyright.h
|
deskflow_deskflow/src/lib/common/copyright.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2024 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/>.
*/
#pragma once
namespace deskflow {
const auto kCopyright = //
"Copyright (C) 2024 Deskflow Developers\n"
"Copyright (C) 2012-2024 Symless Ltd.\n"
"Copyright (C) 2009-2012 Nick Bolton\n"
"Copyright (C) 2002-2009 Chris Schoeneman";
} // namespace deskflow
| 958
|
C++
|
.h
| 24
| 37.5
| 72
| 0.747583
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,876
|
stdfstream.h
|
deskflow_deskflow/src/lib/common/stdfstream.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "common/stdpre.h"
#include "common/stdistream.h"
#include <fstream>
#include "common/stdpost.h"
| 851
|
C++
|
.h
| 22
| 36.818182
| 72
| 0.763923
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,877
|
stdostream.h
|
deskflow_deskflow/src/lib/common/stdostream.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "common/stdpre.h"
#if HAVE_OSTREAM
#include <ostream>
#else
#include <iostream>
#endif
#include "common/stdpost.h"
| 870
|
C++
|
.h
| 25
| 33.04
| 72
| 0.764846
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| true
| false
| false
| false
| false
| false
| false
|
13,878
|
stdlist.h
|
deskflow_deskflow/src/lib/common/stdlist.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "common/stdpre.h"
#include <list>
#include "common/stdpost.h"
| 817
|
C++
|
.h
| 21
| 37
| 72
| 0.761665
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,879
|
ipc.h
|
deskflow_deskflow/src/lib/common/ipc.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012 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/>.
*/
#pragma once
#include "common/basic_types.h"
enum class IpcMessageType : UInt8
{
Hello,
HelloBack,
LogLine,
Command,
Shutdown,
Setting
};
enum class IpcClientType
{
Unknown,
GUI,
Node
};
const auto kIpcHost = "127.0.0.1";
const auto kIpcPort = 24801;
// handshake: node/gui -> daemon
// $1 = type, the client identifies it's self as gui or core (server/client).
const auto kIpcMsgHello = "IHEL%1i";
// handshake: daemon -> node/gui
// the daemon responds to the handshake.
const auto kIpcMsgHelloBack = "IHEL";
// log line: daemon -> gui
// $1 = aggregate log lines collected from core (server/client) or the daemon
// itself.
const auto kIpcMsgLogLine = "ILOG%s";
// command: gui -> daemon
// $1 = command; the command for the daemon to launch, typically the full
// path to core (server/client). $2 = true when process must be elevated on ms
// windows.
const auto kIpcMsgCommand = "ICMD%s%1i";
// shutdown: daemon -> node
// the daemon tells core (server/client) to shut down gracefully.
const auto kIpcMsgShutdown = "ISDN";
// set setting: gui -> daemon
// $1 = setting name
// $2 = setting value
const auto kIpcMsgSetting = "SSET%s%s";
| 1,856
|
C++
|
.h
| 57
| 30.789474
| 78
| 0.738255
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,880
|
IInterface.h
|
deskflow_deskflow/src/lib/common/IInterface.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "common/common.h"
//! Base class of interfaces
/*!
This is the base class of all interface classes. An interface class has
only pure virtual methods.
*/
class IInterface
{
public:
//! Interface destructor does nothing
virtual ~IInterface()
{
}
};
| 1,011
|
C++
|
.h
| 32
| 29.75
| 72
| 0.759221
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| true
| true
| false
| false
| false
| false
| false
| false
|
13,881
|
MacOSXPrecomp.h
|
deskflow_deskflow/src/lib/common/MacOSXPrecomp.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
//
// Prefix header for all source files of the 'deleteme' target in the 'deleteme'
// project.
//
#pragma once
#include <Carbon/Carbon.h>
| 870
|
C++
|
.h
| 23
| 36.086957
| 80
| 0.756501
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,882
|
stdbitset.h
|
deskflow_deskflow/src/lib/common/stdbitset.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "common/stdpre.h"
#include <bitset>
#include "common/stdpost.h"
| 819
|
C++
|
.h
| 21
| 37.095238
| 72
| 0.762264
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| true
| false
| false
| false
| false
| false
| false
|
13,883
|
stdistream.h
|
deskflow_deskflow/src/lib/common/stdistream.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "common/stdpre.h"
#if HAVE_ISTREAM
#include <istream>
#else
#include <iostream>
#endif
#include "common/stdpost.h"
#if defined(_MSC_VER) && _MSC_VER <= 1200
// VC++6 istream has no overloads for __int* types, .NET does
inline std::istream &operator>>(std::istream &s, SInt8 &i)
{
return s >> (signed char &)i;
}
inline std::istream &operator>>(std::istream &s, SInt16 &i)
{
return s >> (short &)i;
}
inline std::istream &operator>>(std::istream &s, SInt32 &i)
{
return s >> (int &)i;
}
inline std::istream &operator>>(std::istream &s, UInt8 &i)
{
return s >> (unsigned char &)i;
}
inline std::istream &operator>>(std::istream &s, UInt16 &i)
{
return s >> (unsigned short &)i;
}
inline std::istream &operator>>(std::istream &s, UInt32 &i)
{
return s >> (unsigned int &)i;
}
#endif
| 1,548
|
C++
|
.h
| 52
| 28.153846
| 72
| 0.715818
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,885
|
common.h
|
deskflow_deskflow/src/lib/common/common.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#if defined(_WIN32)
#define SYSAPI_WIN32 1
#define WINAPI_MSWINDOWS 1
#elif HAVE_CONFIG_H
#include "config.h"
#else
#error "config.h missing"
#endif
// define NULL
#include <stddef.h>
// make assert available since we use it a lot
#include <assert.h>
#include <stdlib.h>
#include <string.h>
enum
{
kExitSuccess = 0, // successful completion
kExitFailed = 1, // general failure
kExitTerminated = 2, // killed by signal
kExitArgs = 3, // bad arguments
kExitConfig = 4, // cannot read configuration
kExitSubscription = 5 // subscription error
};
| 1,325
|
C++
|
.h
| 41
| 30.512195
| 72
| 0.741986
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,886
|
constants.h
|
deskflow_deskflow/src/lib/common/constants.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#if !defined(DESKFLOW_VERSION)
#error version was not passed to the compiler
#endif
const auto kAppName = "Deskflow";
const auto kAppId = "deskflow";
const auto kAppDescription = "Mouse and keyboard sharing utility";
const auto kVersion = DESKFLOW_VERSION;
#ifdef GIT_SHA_SHORT
const auto kVersionGitSha = GIT_SHA_SHORT;
#else
const auto kVersionGitSha = "";
#endif
#ifndef NDEBUG
const auto kDebugBuild = true;
#else
const auto kDebugBuild = false;
#endif
| 1,200
|
C++
|
.h
| 35
| 32.685714
| 72
| 0.775862
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,887
|
basic_types.h
|
deskflow_deskflow/src/lib/common/basic_types.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#include "common/common.h"
// VC++ has built-in sized types
// moved from common.h (why was it there?)
#if defined(_MSC_VER)
#include <wchar.h>
#define TYPE_OF_SIZE_1 __int8
#define TYPE_OF_SIZE_2 __int16
#define TYPE_OF_SIZE_4 __int32
#endif
//
// pick types of particular sizes
//
#if !defined(TYPE_OF_SIZE_1)
#if SIZEOF_CHAR == 1
#define TYPE_OF_SIZE_1 char
#endif
#endif
#if !defined(TYPE_OF_SIZE_2)
#if SIZEOF_INT == 2
#define TYPE_OF_SIZE_2 int
#else
#define TYPE_OF_SIZE_2 short
#endif
#endif
#if !defined(TYPE_OF_SIZE_4)
// Carbon defines SInt32 and UInt32 in terms of long
#if SIZEOF_INT == 4 && !defined(__APPLE__)
#define TYPE_OF_SIZE_4 int
#else
#define TYPE_OF_SIZE_4 long
#endif
#endif
//
// verify existence of required types
//
#if !defined(TYPE_OF_SIZE_1)
#error No 1 byte integer type
#endif
#if !defined(TYPE_OF_SIZE_2)
#error No 2 byte integer type
#endif
#if !defined(TYPE_OF_SIZE_4)
#error No 4 byte integer type
#endif
//
// make typedefs
//
// except for SInt8 and UInt8 these types are only guaranteed to be
// at least as big as indicated (in bits). that is, they may be
// larger than indicated.
//
// Added this because it doesn't compile on OS X 10.6 because they are already
// defined in Carbon
#if !defined(__MACTYPES__)
#if defined(__APPLE__)
#include <CoreServices/CoreServices.h>
#else
typedef signed TYPE_OF_SIZE_1 SInt8;
typedef signed TYPE_OF_SIZE_2 SInt16;
typedef signed TYPE_OF_SIZE_4 SInt32;
typedef unsigned TYPE_OF_SIZE_1 UInt8;
typedef unsigned TYPE_OF_SIZE_2 UInt16;
typedef unsigned TYPE_OF_SIZE_4 UInt32;
#endif
#endif
//
// clean up
//
#undef TYPE_OF_SIZE_1
#undef TYPE_OF_SIZE_2
#undef TYPE_OF_SIZE_4
| 2,407
|
C++
|
.h
| 89
| 25.730337
| 78
| 0.751084
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
13,888
|
stdpre.h
|
deskflow_deskflow/src/lib/common/stdpre.h
|
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* 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/>.
*/
#pragma once
#if defined(_MSC_VER)
#pragma warning(disable : 4786) // identifier truncated
#pragma warning(disable : 4514) // unreferenced inline
#pragma warning(disable : 4710) // not inlined
#pragma warning(disable : 4663) // C++ change, template specialization
#pragma warning(disable : 4503) // decorated name length too long
#pragma warning(push, 3)
#pragma warning(disable : 4018) // signed/unsigned mismatch
#pragma warning(disable : 4284)
#pragma warning(disable : 4146) // unary minus on unsigned value
#pragma warning(disable : 4127) // conditional expression is constant
#pragma warning(disable : 4701) // variable possibly used uninitialized
#endif
| 1,392
|
C++
|
.h
| 31
| 43.354839
| 72
| 0.766912
|
deskflow/deskflow
| 10,364
| 3,653
| 93
|
GPL-2.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.