1 /*
2 * synergy -- mouse and keyboard sharing utility
3 * Copyright (C) 2012-2016 Symless Ltd.
4 * Copyright (C) 2004 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 #include "synergy/IPrimaryScreen.h"
20 #include "base/EventQueue.h"
21
22 #include <cstdlib>
23
24 //
25 // IPrimaryScreen::ButtonInfo
26 //
27
28 IPrimaryScreen::ButtonInfo*
alloc(ButtonID id,KeyModifierMask mask)29 IPrimaryScreen::ButtonInfo::alloc(ButtonID id, KeyModifierMask mask)
30 {
31 ButtonInfo* info = (ButtonInfo*)malloc(sizeof(ButtonInfo));
32 info->m_button = id;
33 info->m_mask = mask;
34 return info;
35 }
36
37 IPrimaryScreen::ButtonInfo*
alloc(const ButtonInfo & x)38 IPrimaryScreen::ButtonInfo::alloc(const ButtonInfo& x)
39 {
40 ButtonInfo* info = (ButtonInfo*)malloc(sizeof(ButtonInfo));
41 info->m_button = x.m_button;
42 info->m_mask = x.m_mask;
43 return info;
44 }
45
46 bool
equal(const ButtonInfo * a,const ButtonInfo * b)47 IPrimaryScreen::ButtonInfo::equal(const ButtonInfo* a, const ButtonInfo* b)
48 {
49 return (a->m_button == b->m_button && a->m_mask == b->m_mask);
50 }
51
52
53 //
54 // IPrimaryScreen::MotionInfo
55 //
56
57 IPrimaryScreen::MotionInfo*
alloc(SInt32 x,SInt32 y)58 IPrimaryScreen::MotionInfo::alloc(SInt32 x, SInt32 y)
59 {
60 MotionInfo* info = (MotionInfo*)malloc(sizeof(MotionInfo));
61 info->m_x = x;
62 info->m_y = y;
63 return info;
64 }
65
66
67 //
68 // IPrimaryScreen::WheelInfo
69 //
70
71 IPrimaryScreen::WheelInfo*
alloc(SInt32 xDelta,SInt32 yDelta)72 IPrimaryScreen::WheelInfo::alloc(SInt32 xDelta, SInt32 yDelta)
73 {
74 WheelInfo* info = (WheelInfo*)malloc(sizeof(WheelInfo));
75 info->m_xDelta = xDelta;
76 info->m_yDelta = yDelta;
77 return info;
78 }
79
80
81 //
82 // IPrimaryScreen::HotKeyInfo
83 //
84
85 IPrimaryScreen::HotKeyInfo*
alloc(UInt32 id)86 IPrimaryScreen::HotKeyInfo::alloc(UInt32 id)
87 {
88 HotKeyInfo* info = (HotKeyInfo*)malloc(sizeof(HotKeyInfo));
89 info->m_id = id;
90 return info;
91 }
92