summaryrefslogtreecommitdiffstats
path: root/server/Mac/mf_event.h
blob: 197cfd7910e5fdfb6eccdcc64281ec10ca3234bb (plain)
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
/**
 * FreeRDP: A Remote Desktop Protocol Implementation
 * OS X Server Event Handling
 *
 * Copyright 2012 Corey Clayton <can.of.tuna@gmail.com>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef FREERDP_SERVER_MAC_EVENT_H
#define FREERDP_SERVER_MAC_EVENT_H

typedef struct mf_event mfEvent;
typedef struct mf_event_queue mfEventQueue;
typedef struct mf_event_region mfEventRegion;

#include <pthread.h>
#include "mfreerdp.h"

//#include "mf_peer.h"

enum mf_event_type
{
	FREERDP_SERVER_MAC_EVENT_TYPE_REGION,
	FREERDP_SERVER_MAC_EVENT_TYPE_FRAME_TICK
};

struct mf_event
{
	int type;
};

struct mf_event_queue
{
	int size;
	int count;
	int pipe_fd[2];
	mfEvent** events;
	pthread_mutex_t mutex;
};

struct mf_event_region
{
	int type;

	int x;
	int y;
	int width;
	int height;
};

void mf_event_push(mfEventQueue* event_queue, mfEvent* event);
mfEvent* mf_event_peek(mfEventQueue* event_queue);
mfEvent* mf_event_pop(mfEventQueue* event_queue);

mfEventRegion* mf_event_region_new(int x, int y, int width, int height);
void mf_event_region_free(mfEventRegion* event_region);

mfEvent* mf_event_new(int type);
void mf_event_free(mfEvent* event);

mfEventQueue* mf_event_queue_new(void);
void mf_event_queue_free(mfEventQueue* event_queue);

#endif /* FREERDP_SERVER_MAC_EVENT_H */