summaryrefslogtreecommitdiff
path: root/Source/DirectFB/src/core/wm_module.h
blob: b470ebdfb0cc4714ebf20cb3f18b658b0d3ad67d (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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
/*
   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
   (c) Copyright 2000-2004  Convergence (integrated media) GmbH

   All rights reserved.

   Written by Denis Oliver Kropp <dok@directfb.org>,
              Andreas Hundt <andi@fischlustig.de>,
              Sven Neumann <neo@directfb.org>,
              Ville Syrjälä <syrjala@sci.fi> and
              Claudio Ciccani <klan@users.sf.net>.

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   This library 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
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with this library; if not, write to the
   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   Boston, MA 02111-1307, USA.
*/

#ifndef __DFB__CORE__WM_MODULE_H__
#define __DFB__CORE__WM_MODULE_H__

#include <core/wm.h>


/** Module **/

static void      wm_get_info       ( CoreWMInfo             *info );

static DFBResult wm_initialize     ( CoreDFB                *core,
                                     void                   *wm_data,
                                     void                   *shared_data );

static DFBResult wm_join           ( CoreDFB                *core,
                                     void                   *wm_data,
                                     void                   *shared_data );

static DFBResult wm_shutdown       ( bool                    emergency,
                                     void                   *wm_data,
                                     void                   *shared_data );

static DFBResult wm_leave          ( bool                    emergency,
                                     void                   *wm_data,
                                     void                   *shared_data );

static DFBResult wm_suspend        ( void                   *wm_data,
                                     void                   *shared_data );

static DFBResult wm_resume         ( void                   *wm_data,
                                     void                   *shared_data );

static DFBResult wm_post_init      ( void                   *wm_data,
                                     void                   *shared_data );


/** Stack **/

static DFBResult wm_init_stack     ( CoreWindowStack        *stack,
                                     void                   *wm_data,
                                     void                   *stack_data );

static DFBResult wm_close_stack    ( CoreWindowStack        *stack,
                                     void                   *wm_data,
                                     void                   *stack_data );

static DFBResult wm_set_active     ( CoreWindowStack        *stack,
                                     void                   *wm_data,
                                     void                   *stack_data,
                                     bool                    active );

static DFBResult wm_resize_stack   ( CoreWindowStack        *stack,
                                     void                   *wm_data,
                                     void                   *stack_data,
                                     int                     width,
                                     int                     height );

static DFBResult wm_process_input  ( CoreWindowStack        *stack,
                                     void                   *wm_data,
                                     void                   *stack_data,
                                     const DFBInputEvent    *event );

static DFBResult wm_flush_keys     ( CoreWindowStack        *stack,
                                     void                   *wm_data,
                                     void                   *stack_data );

static DFBResult wm_window_at      ( CoreWindowStack        *stack,
                                     void                   *wm_data,
                                     void                   *stack_data,
                                     int                     x,
                                     int                     y,
                                     CoreWindow            **ret_window );

static DFBResult wm_window_lookup  ( CoreWindowStack        *stack,
                                     void                   *wm_data,
                                     void                   *stack_data,
                                     DFBWindowID             window_id,
                                     CoreWindow            **ret_window );

static DFBResult wm_enum_windows   ( CoreWindowStack        *stack,
                                     void                   *wm_data,
                                     void                   *stack_data,
                                     CoreWMWindowCallback    callback,
                                     void                   *callback_ctx );

/** Window **/
static DFBResult wm_get_insets     ( CoreWindowStack        *stack,
                                     CoreWindow             *window,
                                     DFBInsets              *insets );

static DFBResult wm_preconfigure_window     ( CoreWindowStack        *stack,
                                     void                   *wm_data,
                                     void                   *stack_data,
                                     CoreWindow             *window,
                                     void                   *window_data );

static DFBResult wm_set_window_property( CoreWindowStack        *stack,
                                         void                   *wm_data,
                                         void                   *stack_data,
                                         CoreWindow             *window,
                                         void                   *window_data,
                                         const char             *key,
                                         void                   *value, 
                                         void                  **ret_old_value );

static DFBResult wm_get_window_property( CoreWindowStack        *stack,
                                         void                   *wm_data,
                                         void                   *stack_data,
                                         CoreWindow             *window,
                                         void                   *window_data,
                                         const char             *key,
                                         void                  **ret_value );

static DFBResult wm_remove_window_property( CoreWindowStack        *stack,
                                            void                   *wm_data,
                                            void                   *stack_data,
                                            CoreWindow             *window,
                                            void                   *window_data,
                                            const char             *key,
                                            void                  **ret_value );

static DFBResult wm_add_window     ( CoreWindowStack        *stack,
                                     void                   *wm_data,
                                     void                   *stack_data,
                                     CoreWindow             *window,
                                     void                   *window_data );

static DFBResult wm_remove_window  ( CoreWindowStack        *stack,
                                     void                   *wm_data,
                                     void                   *stack_data,
                                     CoreWindow             *window,
                                     void                   *window_data );

static DFBResult wm_set_window_config( CoreWindow             *window,
                                       void                   *wm_data,
                                       void                   *window_data,
                                       const CoreWindowConfig *config,
                                       CoreWindowConfigFlags   flags );

static DFBResult wm_restack_window ( CoreWindow             *window,
                                     void                   *wm_data,
                                     void                   *window_data,
                                     CoreWindow             *relative,
                                     void                   *relative_data,
                                     int                     relation );

static DFBResult wm_grab           ( CoreWindow             *window,
                                     void                   *wm_data,
                                     void                   *window_data,
                                     CoreWMGrab             *grab );

static DFBResult wm_ungrab         ( CoreWindow             *window,
                                     void                   *wm_data,
                                     void                   *window_data,
                                     CoreWMGrab             *grab );

static DFBResult wm_request_focus  ( CoreWindow             *window,
                                     void                   *wm_data,
                                     void                   *window_data );

static DFBResult wm_begin_updates  ( CoreWindow             *window,
                                     void                   *wm_data,
                                     void                   *window_data,
                                     const DFBRegion        *update );

static DFBResult wm_set_cursor_position( CoreWindow             *window,
                                         void                   *wm_data,
                                         void                   *window_data,
                                         int                     x,
                                         int                     y );

/** Updates **/

static DFBResult wm_update_stack   ( CoreWindowStack        *stack,
                                     void                   *wm_data,
                                     void                   *stack_data,
                                     const DFBRegion        *region,
                                     DFBSurfaceFlipFlags     flags );

static DFBResult wm_update_window  ( CoreWindow             *window,
                                     void                   *wm_data,
                                     void                   *window_data,
                                     const DFBRegion        *region,
                                     DFBSurfaceFlipFlags     flags );

static DFBResult wm_update_cursor  ( CoreWindowStack        *stack,
                                     void                   *wm_data,
                                     void                   *stack_data,
                                     CoreCursorUpdateFlags   flags );


static CoreWMFuncs wm_funcs = {
     .GetWMInfo            = wm_get_info,

     .Initialize           = wm_initialize,
     .Join                 = wm_join,
     .Shutdown             = wm_shutdown,
     .Leave                = wm_leave,
     .Suspend              = wm_suspend,
     .Resume               = wm_resume,
     .PostInit             = wm_post_init,

     .InitStack            = wm_init_stack,
     .CloseStack           = wm_close_stack,
     .SetActive            = wm_set_active,
     .ResizeStack          = wm_resize_stack,
     .ProcessInput         = wm_process_input,
     .FlushKeys            = wm_flush_keys,
     .WindowAt             = wm_window_at,
     .WindowLookup         = wm_window_lookup,
     .EnumWindows          = wm_enum_windows,

     .GetInsets            = wm_get_insets,
     .PreConfigureWindow   = wm_preconfigure_window,
     .SetWindowProperty    = wm_set_window_property,
     .GetWindowProperty    = wm_get_window_property,
     .RemoveWindowProperty = wm_remove_window_property,
     .AddWindow            = wm_add_window,
     .RemoveWindow         = wm_remove_window,
     .SetWindowConfig      = wm_set_window_config,
     .RestackWindow        = wm_restack_window,
     .Grab                 = wm_grab,
     .Ungrab               = wm_ungrab,
     .RequestFocus         = wm_request_focus,
     .BeginUpdates         = wm_begin_updates,
     .SetCursorPosition    = wm_set_cursor_position,

     .UpdateStack          = wm_update_stack,
     .UpdateWindow         = wm_update_window,
     .UpdateCursor         = wm_update_cursor
};


#define DFB_WINDOW_MANAGER(shortname)                             \
__attribute__((constructor)) void directfbwm_##shortname( void ); \
                                                                  \
void                                                              \
directfbwm_##shortname( void )                                    \
{                                                                 \
     direct_modules_register( &dfb_core_wm_modules,               \
                              DFB_CORE_WM_ABI_VERSION,            \
                              #shortname, &wm_funcs );            \
}

#endif