aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/barrier/IPrimaryScreen.cpp
blob: 2220212e9ebdac54fc0929e5cab16845244f961c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
 * barrier -- 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/>.
 */

#include "barrier/IPrimaryScreen.h"
#include "base/EventQueue.h"

#include <cstdlib>

//
// IPrimaryScreen::ButtonInfo
//

IPrimaryScreen::ButtonInfo*
IPrimaryScreen::ButtonInfo::alloc(ButtonID id, KeyModifierMask mask)
{
    ButtonInfo* info = (ButtonInfo*)malloc(sizeof(ButtonInfo));
    info->m_button = id;
    info->m_mask   = mask;
    return info;
}

IPrimaryScreen::ButtonInfo*
IPrimaryScreen::ButtonInfo::alloc(const ButtonInfo& x)
{
    ButtonInfo* info = (ButtonInfo*)malloc(sizeof(ButtonInfo));
    info->m_button = x.m_button;
    info->m_mask   = x.m_mask;
    return info;
}

bool
IPrimaryScreen::ButtonInfo::equal(const ButtonInfo* a, const ButtonInfo* b)
{
    return (a->m_button == b->m_button && a->m_mask == b->m_mask);
}


//
// IPrimaryScreen::MotionInfo
//

IPrimaryScreen::MotionInfo*
IPrimaryScreen::MotionInfo::alloc(SInt32 x, SInt32 y)
{
    MotionInfo* info = (MotionInfo*)malloc(sizeof(MotionInfo));
    info->m_x = x;
    info->m_y = y;
    return info;
}


//
// IPrimaryScreen::WheelInfo
//

IPrimaryScreen::WheelInfo*
IPrimaryScreen::WheelInfo::alloc(SInt32 xDelta, SInt32 yDelta)
{
    WheelInfo* info = (WheelInfo*)malloc(sizeof(WheelInfo));
    info->m_xDelta = xDelta;
    info->m_yDelta = yDelta;
    return info;
}


//
// IPrimaryScreen::HotKeyInfo
//

IPrimaryScreen::HotKeyInfo*
IPrimaryScreen::HotKeyInfo::alloc(UInt32 id)
{
    HotKeyInfo* info = (HotKeyInfo*)malloc(sizeof(HotKeyInfo));
    info->m_id = id;
    return info;
}