~ubuntu-branches/ubuntu/utopic/wayland/utopic-proposed

« back to all changes in this revision

Viewing changes to src/wayland-server.h

  • Committer: Package Import Robot
  • Author(s): Hector Oron, Timo Aaltonen, Hector Oron
  • Date: 2013-10-11 11:23:38 UTC
  • mfrom: (1.1.7)
  • Revision ID: package-import@ubuntu.com-20131011112338-tjsp43i3jwguenpb
Tags: 1.3.0-1
[ Timo Aaltonen ]
* control: Bump the libwayland0 C/R to (<< 1.1.0) so that it covers
  the ubuntu version too, and add it to -cursor.

[ Hector Oron ]
* New upstream stable release (1.3.0).
* Add myself to Uploaders.
* Switch to Debian source format 3.0 quilt.
* d/libwayland-dev.install:
  - install wayland documentation

Show diffs side-by-side

added added

removed removed

Lines of Context:
129
129
void
130
130
wl_client_post_no_memory(struct wl_client *client);
131
131
 
 
132
/** \class wl_listener
 
133
 *
 
134
 * \brief A single listener for Wayland signals
 
135
 *
 
136
 * wl_listener provides the means to listen for wl_signal notifications. Many
 
137
 * Wayland objects use wl_listener for notification of significant events like
 
138
 * object destruction.
 
139
 *
 
140
 * Clients should create wl_listener objects manually and can register them as
 
141
 * listeners to signals using #wl_signal_add, assuming the signal is
 
142
 * directly accessible. For opaque structs like wl_event_loop, adding a
 
143
 * listener should be done through provided accessor methods. A listener can
 
144
 * only listen to one signal at a time.
 
145
 *
 
146
 * ~~~
 
147
 * struct wl_listener your_listener;
 
148
 *
 
149
 * your_listener.notify = your_callback_method;
 
150
 *
 
151
 * \comment{Direct access}
 
152
 * wl_signal_add(&some_object->destroy_signal, &your_listener);
 
153
 *
 
154
 * \comment{Accessor access}
 
155
 * wl_event_loop *loop = ...;
 
156
 * wl_event_loop_add_destroy_listener(loop, &your_listener);
 
157
 * ~~~
 
158
 *
 
159
 * If the listener is part of a larger struct, #wl_container_of can be used
 
160
 * to retrieve a pointer to it:
 
161
 *
 
162
 * \code
 
163
 * void your_listener(struct wl_listener *listener, void *data)
 
164
 * {
 
165
 *      struct your_data *data = NULL;
 
166
 *
 
167
 *      your_data = wl_container_of(listener, data, your_member_name);
 
168
 * }
 
169
 * \endcode
 
170
 *
 
171
 * If you need to remove a listener from a signal, use #wl_list_remove.
 
172
 *
 
173
 * \code
 
174
 * wl_list_remove(&your_listener.link);
 
175
 * \endcode
 
176
 *
 
177
 * \sa wl_signal
 
178
 */
132
179
struct wl_listener {
133
180
        struct wl_list link;
134
181
        wl_notify_func_t notify;
135
182
};
136
183
 
 
184
/** \class wl_signal
 
185
 *
 
186
 * \brief A source of a type of observable event
 
187
 *
 
188
 * Signals are recognized points where significant events can be observed.
 
189
 * Compositors as well as the server can provide signals. Observers are
 
190
 * wl_listener's that are added through #wl_signal_add. Signals are emitted
 
191
 * using #wl_signal_emit, which will invoke all listeners until that
 
192
 * listener is removed by #wl_list_remove (or whenever the signal is
 
193
 * destroyed).
 
194
 *
 
195
 * \sa wl_listener for more information on using wl_signal
 
196
 */
137
197
struct wl_signal {
138
198
        struct wl_list listener_list;
139
199
};
140
200
 
 
201
/** Initialize a new \ref wl_signal for use.
 
202
 *
 
203
 * \param signal The signal that will be initialized
 
204
 *
 
205
 * \memberof wl_signal
 
206
 */
141
207
static inline void
142
208
wl_signal_init(struct wl_signal *signal)
143
209
{
144
210
        wl_list_init(&signal->listener_list);
145
211
}
146
212
 
 
213
/** Add the specified listener to this signal.
 
214
 *
 
215
 * \param signal The signal that will emit events to the listener
 
216
 * \param listener The listener to add
 
217
 *
 
218
 * \memberof wl_signal
 
219
 */
147
220
static inline void
148
221
wl_signal_add(struct wl_signal *signal, struct wl_listener *listener)
149
222
{
150
223
        wl_list_insert(signal->listener_list.prev, &listener->link);
151
224
}
152
225
 
 
226
/** Gets the listener struct for the specified callback.
 
227
 *
 
228
 * \param signal The signal that contains the specified listener
 
229
 * \param notify The listener that is the target of this search
 
230
 * \return the list item that corresponds to the specified listener, or NULL
 
231
 * if none was found
 
232
 *
 
233
 * \memberof wl_signal
 
234
 */
153
235
static inline struct wl_listener *
154
236
wl_signal_get(struct wl_signal *signal, wl_notify_func_t notify)
155
237
{
162
244
        return NULL;
163
245
}
164
246
 
 
247
/** Emits this signal, notifying all registered listeners.
 
248
 *
 
249
 * \param signal The signal object that will emit the signal
 
250
 * \param data The data that will be emitted with the signal
 
251
 *
 
252
 * \memberof wl_signal
 
253
 */
165
254
static inline void
166
255
wl_signal_emit(struct wl_signal *signal, void *data)
167
256
{
241
330
 */
242
331
void wl_resource_post_event(struct wl_resource *resource,
243
332
                            uint32_t opcode, ...);
 
333
void wl_resource_post_event_array(struct wl_resource *resource,
 
334
                                  uint32_t opcode, union wl_argument *args);
244
335
void wl_resource_queue_event(struct wl_resource *resource,
245
336
                             uint32_t opcode, ...);
 
337
void wl_resource_queue_event_array(struct wl_resource *resource,
 
338
                                   uint32_t opcode, union wl_argument *args);
246
339
 
247
340
/* msg is a printf format string, variable args are its args. */
248
341
void wl_resource_post_error(struct wl_resource *resource,
264
357
                               const void *implementation,
265
358
                               void *data,
266
359
                               wl_resource_destroy_func_t destroy);
 
360
void
 
361
wl_resource_set_dispatcher(struct wl_resource *resource,
 
362
                           wl_dispatcher_func_t dispatcher,
 
363
                           const void *implementation,
 
364
                           void *data,
 
365
                           wl_resource_destroy_func_t destroy);
267
366
 
268
367
void
269
368
wl_resource_destroy(struct wl_resource *resource);
298
397
wl_resource_get_destroy_listener(struct wl_resource *resource,
299
398
                                 wl_notify_func_t notify);
300
399
 
 
400
#define wl_resource_for_each(resource, list)                                    \
 
401
        for (resource = 0, resource = wl_resource_from_link((list)->next);      \
 
402
             wl_resource_get_link(resource) != (list);                          \
 
403
             resource = wl_resource_from_link(wl_resource_get_link(resource)->next))
 
404
 
 
405
#define wl_resource_for_each_safe(resource, tmp, list)                                  \
 
406
        for (resource = 0, tmp = 0,                                                     \
 
407
             resource = wl_resource_from_link((list)->next),    \
 
408
             tmp = wl_resource_from_link((list)->next->next);   \
 
409
             wl_resource_get_link(resource) != (list);                          \
 
410
             resource = tmp,                                                    \
 
411
             tmp = wl_resource_from_link(wl_resource_get_link(resource)->next))
 
412
 
301
413
struct wl_shm_buffer;
302
414
 
303
415
struct wl_shm_buffer *
321
433
int
322
434
wl_display_init_shm(struct wl_display *display);
323
435
 
 
436
void
 
437
wl_display_add_shm_format(struct wl_display *display, uint32_t format);
 
438
 
324
439
struct wl_shm_buffer *
325
440
wl_shm_buffer_create(struct wl_client *client,
326
441
                     uint32_t id, int32_t width, int32_t height,