aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/ecore/src/lib/ecore_directfb/Ecore_DirectFB.h
blob: 1f6fc639aa255fe0d30ee485d12ec14f9c62885c (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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
#ifndef _ECORE_DIRECTFB_H
#define _ECORE_DIRECTFB_H

#include <directfb.h>

#include <Eina.h>

#ifdef EAPI
# undef EAPI
#endif /* ifdef EAPI */

#ifdef __GNUC__
# if __GNUC__ >= 4
#  define EAPI __attribute__ ((visibility("default")))
# else /* if __GNUC__ >= 4 */
#  define EAPI
# endif /* if __GNUC__ >= 4 */
#else /* ifdef __GNUC__ */
# define EAPI
#endif /* ifdef __GNUC__ */

#ifdef __cplusplus
extern "C" {
#endif /* ifdef __cplusplus */

EAPI extern int ECORE_DIRECTFB_EVENT_POSITION;
EAPI extern int ECORE_DIRECTFB_EVENT_SIZE;
EAPI extern int ECORE_DIRECTFB_EVENT_CLOSE;
EAPI extern int ECORE_DIRECTFB_EVENT_DESTROYED;
EAPI extern int ECORE_DIRECTFB_EVENT_GOT_FOCUS;
EAPI extern int ECORE_DIRECTFB_EVENT_LOST_FOCUS;
EAPI extern int ECORE_DIRECTFB_EVENT_KEY_DOWN;
EAPI extern int ECORE_DIRECTFB_EVENT_KEY_UP;
EAPI extern int ECORE_DIRECTFB_EVENT_BUTTON_DOWN;
EAPI extern int ECORE_DIRECTFB_EVENT_BUTTON_UP;
EAPI extern int ECORE_DIRECTFB_EVENT_MOTION;
EAPI extern int ECORE_DIRECTFB_EVENT_ENTER;
EAPI extern int ECORE_DIRECTFB_EVENT_LEAVE;
EAPI extern int ECORE_DIRECTFB_EVENT_WHEEL;

#ifndef _ECORE_DIRECTFB_WINDOW_PREDEF
typedef struct _Ecore_DirectFB_Window              Ecore_DirectFB_Window;
#endif /* ifndef _ECORE_DIRECTFB_WINDOW_PREDEF */
typedef struct _Ecore_DirectFB_Cursor              Ecore_DirectFB_Cursor;

typedef struct _Ecore_DirectFB_Event_Key_Down      Ecore_DirectFB_Event_Key_Down;
typedef struct _Ecore_DirectFB_Event_Key_Up        Ecore_DirectFB_Event_Key_Up;
typedef struct _Ecore_DirectFB_Event_Button_Down   Ecore_DirectFB_Event_Button_Down;
typedef struct _Ecore_DirectFB_Event_Button_Up     Ecore_DirectFB_Event_Button_Up;
typedef struct _Ecore_DirectFB_Event_Motion        Ecore_DirectFB_Event_Motion;
typedef struct _Ecore_DirectFB_Event_Enter         Ecore_DirectFB_Event_Enter;
typedef struct _Ecore_DirectFB_Event_Leave         Ecore_DirectFB_Event_Leave;
typedef struct _Ecore_DirectFB_Event_Wheel         Ecore_DirectFB_Event_Wheel;
typedef struct _Ecore_DirectFB_Event_Got_Focus     Ecore_DirectFB_Event_Got_Focus;
typedef struct _Ecore_DirectFB_Event_Lost_Focus    Ecore_DirectFB_Event_Lost_Focus;

/* this struct is to keep windows data (id, window itself and surface) in memory as every call
 * to DirectFB for this values (e.g window->GetSurface(window,&surface)) will increment the
 * reference count, then we will have to release N times the data, so better we just ask for
   them once */
struct _Ecore_DirectFB_Window
{
   DFBWindowID            id;
   IDirectFBWindow       *window;
   IDirectFBSurface      *surface;
   Ecore_DirectFB_Cursor *cursor;
};

struct _Ecore_DirectFB_Cursor
{
   IDirectFBSurface *surface;
   int               hot_x;
   int               hot_y;
};

struct _Ecore_DirectFB_Event_Key_Down /** DirectFB Key Down event */
{
   char        *name; /**< The name of the key that was released */
   char        *string; /**< The logical symbol of the key that was pressed */
   char        *key_compose; /**< The UTF-8 string conversion if any */
   unsigned int time;
   DFBWindowID  win;
};

struct _Ecore_DirectFB_Event_Key_Up /** DirectFB Key Up event */
{
   char        *name; /**< The name of the key that was released */
   char        *string; /**< The logical symbol of the key that was pressed */
   char        *key_compose; /**< The UTF-8 string conversion if any */
   unsigned int time;
   DFBWindowID  win;
};

struct _Ecore_DirectFB_Event_Button_Down
{
   int          button;
   int          modifiers;
   int          x, y;
   unsigned int time;
   int          double_click : 1;
   int          triple_click : 1;
   DFBWindowID  win;
};
struct _Ecore_DirectFB_Event_Button_Up
{
   int          button;
   int          modifiers;
   int          x, y;
   unsigned int time;
   DFBWindowID  win;
   int          double_click : 1;
   int          triple_click : 1;
};
struct _Ecore_DirectFB_Event_Motion
{
   int          modifiers;
   int          x, y;
   unsigned int time;
   DFBWindowID  win;
};

struct _Ecore_DirectFB_Event_Enter
{
   int          modifiers;
   int          x, y;
   unsigned int time;
   DFBWindowID  win;
};

struct _Ecore_DirectFB_Event_Leave
{
   int          modifiers;
   int          x, y;
   unsigned int time;
   DFBWindowID  win;
};

struct _Ecore_DirectFB_Event_Wheel
{
   int          direction;
   int          z;
   int          modifiers;
   unsigned int time;
   DFBWindowID  win;
};

struct _Ecore_DirectFB_Event_Got_Focus
{
   unsigned int time;
   DFBWindowID  win;
};

struct _Ecore_DirectFB_Event_Lost_Focus
{
   unsigned int time;
   DFBWindowID  win;
};

/* main functions */
EAPI int                    ecore_directfb_init(const char *name);
EAPI int                    ecore_directfb_shutdown(void);
EAPI IDirectFB *            ecore_directfb_interface_get(void);

/* window operations */
EAPI Ecore_DirectFB_Window *ecore_directfb_window_new(int x, int y, int w, int h);
EAPI void                   ecore_directfb_window_free(Ecore_DirectFB_Window *window);
EAPI void                   ecore_directfb_window_move(Ecore_DirectFB_Window *window, int x, int y);
EAPI void                   ecore_directfb_window_resize(Ecore_DirectFB_Window *window, int w, int h);
EAPI void                   ecore_directfb_window_focus(Ecore_DirectFB_Window *window);
EAPI void                   ecore_directfb_window_show(Ecore_DirectFB_Window *window);
EAPI void                   ecore_directfb_window_hide(Ecore_DirectFB_Window *window);
EAPI void                   ecore_directfb_window_shaped_set(Ecore_DirectFB_Window *window, Eina_Bool set);
EAPI void                   ecore_directfb_window_fullscreen_set(Ecore_DirectFB_Window *window, Eina_Bool set);
EAPI void                   ecore_directfb_window_size_get(Ecore_DirectFB_Window *window, int *w, int *h);
EAPI void                   ecore_directfb_window_cursor_show(Ecore_DirectFB_Window *window, Eina_Bool show);

#ifdef __cplusplus
}
#endif /* ifdef __cplusplus */

#endif /* ifndef _ECORE_DIRECTFB_H */