-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDataTypes.cpp
executable file
·73 lines (64 loc) · 1.79 KB
/
DataTypes.cpp
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
#include "DataTypes.h"
#include <string.h>
#include <iostream>
using namespace std;
HotkeyInfo::HotkeyInfo(){
ucpHotkeySequence = NULL;
args = NULL;
}
HotkeyInfo::~HotkeyInfo(){ //overriden for now. Need CC and operator= to work properly.
//if(ucpHotkeySequence != NULL)
// delete ucpHotkeySequence;
//if(args != NULL)
// delete args;
}
BorderlessInfo::BorderlessInfo(){
leftNeigh = -1;
rightNeigh = -1;
topNeigh = -1;
bottomNeigh = -1;
}
void BorderlessInfo::Print() const{
printf(" BORDERS: l:(%+05d,%+05d) r:(%+05d,%+05d) u:(%+05d,%+05d) d:(%+05d,%+05d)\n", leftBorder, leftNeigh, rightBorder, rightNeigh, topBorder, topNeigh, bottomBorder, bottomNeigh);
}
void HandlerProperties::Print() const{
printf("DEV_ID:%-3d DEV_NAM:%-7s PORT:%-5d IP:%-15s WIDTH:%-4d HEIGTH:%-4d\n", DEVICE_ID, DEVICE_NAME, PORT, IP_ADDR, width, heigth);
//std::cout<<"DEV_ID:"<<DEVICE_ID<<"\tDEV_NAM:"<<DEVICE_NAME<<"\tPORT:"<<PORT<<"IP_ADDR:"<<IP_ADDR<<"WIDTH:"<<width<<"HEIGTH:"<<heigth<<std::endl;
itsBorders.Print();
}
void HotkeyInfo::setTypeAndArgs(HotkeyType typeToSet, const char* argsToSet){
type = typeToSet;
switch(type){
case SET_ACTIVE_SCREEN:
args = new int[1];
*((int*)args) = (int)strtol(argsToSet, NULL, 0);
break;
case TOGGLE_BORDERLESS_MODE:
args = NULL;
break;
case EXECUTE_CMD:
args = new char[strlen(argsToSet) + 1];
strcpy((char*)args, argsToSet);
break;
default:
break;
}
}
void HotkeyInfo::Print() const{
cout<<"KEYS ";
for(int i = 0; i < ucHotkeyLength; ++i)
cout<<(int)ucpHotkeySequence[i]<<' ';
switch(type){
case SET_ACTIVE_SCREEN:
cout<<"SET_ACTIVE_SCREEN "<<*((int*)args)<<endl;
break;
case TOGGLE_BORDERLESS_MODE:
cout<<"TOGGLE_BORDERLESS_MODE"<<endl;
break;
case EXECUTE_CMD:
cout<<"EXECUTE_CMD "<<(char*)args<<endl;
break;
default:
break;
}
}