1 /*
2  * synergy -- mouse and keyboard sharing utility
3  * Copyright (C) 2012-2016 Symless Ltd.
4  * Copyright (C) 2002 Chris Schoeneman
5  *
6  * This package is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * found in the file LICENSE that should have accompanied this file.
9  *
10  * This package is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #pragma once
20 
21 #include "base/EventTypes.h"
22 #include "common/stdvector.h"
23 
24 //! Option ID
25 /*!
26 Type to hold an option identifier.
27 */
28 typedef UInt32            OptionID;
29 
30 //! Option Value
31 /*!
32 Type to hold an option value.
33 */
34 typedef SInt32            OptionValue;
35 
36 // for now, options are just pairs of integers
37 typedef std::vector<UInt32> OptionsList;
38 
39 // macro for packing 4 character strings into 4 byte integers
40 #define OPTION_CODE(_s)                                             \
41     (static_cast<UInt32>(static_cast<unsigned char>(_s[0]) << 24) |    \
42      static_cast<UInt32>(static_cast<unsigned char>(_s[1]) << 16) |    \
43      static_cast<UInt32>(static_cast<unsigned char>(_s[2]) <<  8) |    \
44      static_cast<UInt32>(static_cast<unsigned char>(_s[3])      ))
45 
46 //! @name Option identifiers
47 //@{
48 static const OptionID    kOptionHalfDuplexCapsLock        = OPTION_CODE("HDCL");
49 static const OptionID    kOptionHalfDuplexNumLock        = OPTION_CODE("HDNL");
50 static const OptionID    kOptionHalfDuplexScrollLock        = OPTION_CODE("HDSL");
51 static const OptionID    kOptionModifierMapForShift        = OPTION_CODE("MMFS");
52 static const OptionID    kOptionModifierMapForControl    = OPTION_CODE("MMFC");
53 static const OptionID    kOptionModifierMapForAlt        = OPTION_CODE("MMFA");
54 static const OptionID    kOptionModifierMapForAltGr        = OPTION_CODE("MMFG");
55 static const OptionID    kOptionModifierMapForMeta        = OPTION_CODE("MMFM");
56 static const OptionID    kOptionModifierMapForSuper        = OPTION_CODE("MMFR");
57 static const OptionID    kOptionHeartbeat                = OPTION_CODE("HART");
58 static const OptionID    kOptionScreenSwitchCorners        = OPTION_CODE("SSCM");
59 static const OptionID    kOptionScreenSwitchCornerSize    = OPTION_CODE("SSCS");
60 static const OptionID    kOptionScreenSwitchDelay        = OPTION_CODE("SSWT");
61 static const OptionID    kOptionScreenSwitchTwoTap        = OPTION_CODE("SSTT");
62 static const OptionID    kOptionScreenSwitchNeedsShift   = OPTION_CODE("SSNS");
63 static const OptionID    kOptionScreenSwitchNeedsControl = OPTION_CODE("SSNC");
64 static const OptionID    kOptionScreenSwitchNeedsAlt     = OPTION_CODE("SSNA");
65 static const OptionID    kOptionScreenSaverSync            = OPTION_CODE("SSVR");
66 static const OptionID    kOptionXTestXineramaUnaware        = OPTION_CODE("XTXU");
67 static const OptionID    kOptionScreenPreserveFocus        = OPTION_CODE("SFOC");
68 static const OptionID    kOptionRelativeMouseMoves        = OPTION_CODE("MDLT");
69 static const OptionID    kOptionWin32KeepForeground        = OPTION_CODE("_KFW");
70 static const OptionID    kOptionDisableLockToScreen    = OPTION_CODE("DLTS");
71 static const OptionID    kOptionClipboardSharing            = OPTION_CODE("CLPS");
72 static const OptionID   kOptionClipboardSharingSize     = OPTION_CODE("CLSZ");
73 //@}
74 
75 //! @name Screen switch corner enumeration
76 //@{
77 enum EScreenSwitchCorners {
78     kNoCorner,
79     kTopLeft,
80     kTopRight,
81     kBottomLeft,
82     kBottomRight,
83     kFirstCorner = kTopLeft,
84     kLastCorner  = kBottomRight
85 };
86 //@}
87 
88 //! @name Screen switch corner masks
89 //@{
90 enum EScreenSwitchCornerMasks {
91     kNoCornerMask    = 0,
92     kTopLeftMask     = 1 << (kTopLeft - kFirstCorner),
93     kTopRightMask    = 1 << (kTopRight - kFirstCorner),
94     kBottomLeftMask  = 1 << (kBottomLeft - kFirstCorner),
95     kBottomRightMask = 1 << (kBottomRight - kFirstCorner),
96     kAllCornersMask  = kTopLeftMask | kTopRightMask |
97                         kBottomLeftMask | kBottomRightMask
98 };
99 //@}
100 
101 #undef OPTION_CODE
102