return buffer;
}
+/**
+ * Increase reference count of the given buffer
+ *
+ * @param buffer buffer object
+ *
+ * @see pepper_buffer_unreference()
+ */
PEPPER_API void
pepper_buffer_reference(pepper_buffer_t *buffer)
{
buffer->ref_count++;
}
+/**
+ * Decrease reference count of the given buffer
+ *
+ * @param buffer buffer object
+ *
+ * If the reference count drops to 0, wl_buffer.release is sent to the client but the buffer is not
+ * destroyed. Buffer is destroyed only for the wl_buffer.destroy request.
+ */
PEPPER_API void
pepper_buffer_unreference(pepper_buffer_t *buffer)
{
}
}
+/**
+ * Get the wl_resource of the given buffer
+ *
+ * @param buffer buffer object
+ *
+ * @return wl_resource of the buffer
+ */
PEPPER_API struct wl_resource *
pepper_buffer_get_resource(pepper_buffer_t *buffer)
{
return buffer->resource;
}
+/**
+ * Get the size of the given buffer
+ *
+ * @param buffer buffer object
+ * @param w pointer to receive width
+ * @param h pointer to receive height
+ *
+ * @return PEPPER_TRUE on success, PEPPER_FALSE otherwise
+ *
+ * Buffer size is unknown until it is actually attached to the output backend. So, querying the size
+ * of a buffer might fail and never forget that.
+ */
PEPPER_API pepper_bool_t
pepper_buffer_get_size(pepper_buffer_t *buffer, int *w, int *h)
{
#include "pepper-internal.h"
-/* compositor interface */
static void
compositor_create_surface(struct wl_client *client,
struct wl_resource *resource,
pepper_output_schedule_repaint(output);
}
+/**
+ * Create a compositor with the given fd and socket name
+ *
+ * @param socket_name socket name, if NULL, automatically determined internally
+ * @param fd file descriptor to the socket, if -1, socket is created internally
+ *
+ * @return created compositor object
+ *
+ * On tizen, there're some security issues so that creating a socket is not allowed to applications.
+ * In that situation, creating a compositor from already existing socket fd is required. The fd is
+ * acquired by requesting to some kind of system service rather than creating directly by the
+ * application.
+ *
+ * @see pepper_compositor_create()
+ */
PEPPER_API pepper_compositor_t *
pepper_compositor_create_fd(const char *socket_name, int fd)
{
return NULL;
}
+
+/**
+ * Create a compositor with the given socket name
+ *
+ * @param socket_name socket name, if NULL, automatically determined internally
+ *
+ * @return created compositor object
+ *
+ * After creating a compositor, clients can connect to the socket.
+ * wl_compositor global is internally created.
+ *
+ * @see pepper_compositor_destroy()
+ */
PEPPER_API pepper_compositor_t *
pepper_compositor_create(const char *socket_name)
{
return pepper_compositor_create_fd(socket_name, -1);
}
+/**
+ * Destroy the given compositor
+ *
+ * @param compositor compositor object
+ *
+ * @see pepper_compositor_create()
+ * @see pepper_compositor_create_fd()
+ */
PEPPER_API void
pepper_compositor_destroy(pepper_compositor_t *compositor)
{
pepper_surface_t *surface, *next_surface;
pepper_region_t *region, *next_region;
- /* TODO: Data device manager fini. */
-
pepper_list_for_each_safe(surface, next_surface, &compositor->surface_list, link)
pepper_surface_destroy(surface);
free(compositor);
}
+/**
+ * Get the wl_display of the given compositor
+ *
+ * @param compositor compositor object
+ *
+ * @return wl_display of the compositor
+ *
+ * Exposing wl_display of a compositor is useful, as user can construct their own main loop and
+ * install desired globals to provide extension protocols.
+ */
PEPPER_API struct wl_display *
pepper_compositor_get_display(pepper_compositor_t *compositor)
{
return compositor->display;
}
+/**
+ * Get the list of bound wl_resource of the given compositor
+ *
+ * @param compositor compositor object
+ *
+ * @return list of the bound wl_resource
+ */
PEPPER_API struct wl_list *
pepper_compositor_get_resource_list(pepper_compositor_t *compositor)
{
return &compositor->resource_list;
}
+/**
+ * Get the socket name of the given compositor
+ *
+ * @param compositor compositor object
+ *
+ * @return null terminating string of the socket name
+ */
PEPPER_API const char *
pepper_compositor_get_socket_name(pepper_compositor_t *compositor)
{
return compositor->socket_name;
}
+/**
+ * Get the list of outputs of the given compositor
+ *
+ * @param compositor compositor object
+ *
+ * @return list of outputs
+ */
PEPPER_API const pepper_list_t *
pepper_compositor_get_output_list(pepper_compositor_t *compositor)
{
return &compositor->output_list;
}
+/**
+ * Get the list of surfaces of the given compositor
+ *
+ * @param compositor compositor object
+ *
+ * @return list of surfaces
+ */
PEPPER_API const pepper_list_t *
pepper_compositor_get_surface_list(pepper_compositor_t *compositor)
{
return &compositor->surface_list;
}
+/**
+ * Get the list of views of the given compositor
+ *
+ * @param compositor compositor object
+ *
+ * @return list of views sorted in z-order (front to back)
+ */
PEPPER_API const pepper_list_t *
pepper_compositor_get_view_list(pepper_compositor_t *compositor)
{
return &compositor->view_list;
}
+/**
+ * Get the list of seats of the given compositor
+ *
+ * @param compositor compositor object
+ *
+ * @return list of seats
+ */
PEPPER_API const pepper_list_t *
pepper_compositor_get_seat_list(pepper_compositor_t *compositor)
{
return &compositor->seat_list;
}
+/**
+ * Get the list of input devices of the given compositor
+ *
+ * @param compositor compositor object
+ *
+ * @return list of input devices
+ */
PEPPER_API const pepper_list_t *
pepper_compositor_get_input_device_list(pepper_compositor_t *compositor)
{
return &compositor->input_device_list;
}
+/**
+ * Pick a view for given position in the compositor
+ *
+ * @param compositor compositor object
+ * @param x x coordinate in global space
+ * @param y y coordinate in global space
+ * @param vx pointer to receive x coordinate in view space
+ * @param vx pointer to receive y coordinate in view space
+ *
+ * @return picked view if there's any, NULL otherwise
+ *
+ * Pepper picks a view which is located topmost for the given position. If input region is set for
+ * the surface of the view, the region should contain the position.
+ */
PEPPER_API pepper_view_t *
pepper_compositor_pick_view(pepper_compositor_t *compositor,
double x, double y, double *vx, double *vy)
return NULL;
}
+/**
+ * Set clock id for clock_gettime() function of the given pepper_compositor_t
+ *
+ * @param compositor compositor object
+ * @param id clock id
+ *
+ * @return PEPPER_TRUE on success, otherwise PEPPER_FALSE
+ *
+ * It is recommended to use the same clock id with output backend. If multiple output backends use
+ * different timer, you should not use pepper_compositor_get_time(). Also, be aware that changing
+ * clock id might cause the timer base changes.
+ */
PEPPER_API pepper_bool_t
pepper_compositor_set_clock_id(pepper_compositor_t *compositor, clockid_t id)
{
return PEPPER_TRUE;
}
+/**
+ * Get current time of the given compositor with undefined base
+ *
+ * @param compositor compositor object
+ * @param ts pointer to receive the current time
+ *
+ * @return PEPPER_TRUE on success, otherwise PEPPER_FALSE
+ */
PEPPER_API pepper_bool_t
pepper_compositor_get_time(pepper_compositor_t *compositor, struct timespec *ts)
{
wl_seat_send_name(resource, seat->name);
}
+/**
+ * Create and add a seat to the given compositor
+ *
+ * @param compositor compositor object
+ * @param seat_name name of the seat to be added
+ *
+ * @return added seat
+ *
+ * Global for the wl_seat is created internally, thus broadcasted to all clients via registry.
+ */
PEPPER_API pepper_seat_t *
pepper_compositor_add_seat(pepper_compositor_t *compositor, const char *seat_name)
{
return NULL;
}
+/**
+ * Destroy the given seat
+ *
+ * @param seat seat object
+ */
PEPPER_API void
pepper_seat_destroy(pepper_seat_t *seat)
{
wl_resource_destroy(resource);
}
+/**
+ * Get the list of wl_resource of the given seat
+ *
+ * @param seat seat object
+ *
+ * @return list of seat resource
+ */
PEPPER_API struct wl_list *
pepper_seat_get_resource_list(pepper_seat_t *seat)
{
return &seat->resource_list;
}
+/**
+ * Get the compositor of the given seat
+ *
+ * @param seat seat object
+ *
+ * @return compositor of the seat
+ */
PEPPER_API pepper_compositor_t *
pepper_seat_get_compositor(pepper_seat_t *seat)
{
return seat->compositor;
}
+/**
+ * Get the pointer of the given seat
+ *
+ * @param seat seat object
+ *
+ * @return pointer if exist, NULL otherwise
+ *
+ * When the seat doesn't have pointer capability, NULL would be returned.
+ */
PEPPER_API pepper_pointer_t *
pepper_seat_get_pointer(pepper_seat_t *seat)
{
return seat->pointer;
}
+/**
+ * Get the keyboard of the given seat
+ *
+ * @param seat keyboard object
+ *
+ * @return keyboard to the keyboard object if exist, NULL otherwise
+ *
+ * When the seat doesn't have keyboard capability, NULL would be returned.
+ */
PEPPER_API pepper_keyboard_t *
pepper_seat_get_keyboard(pepper_seat_t *seat)
{
return seat->keyboard;
}
+/**
+ * Get the touch of the given seat
+ *
+ * @param seat touch object
+ *
+ * @return touch to the touch object if exist, NULL otherwise
+ *
+ * When the seat doesn't have touch capability, NULL would be returned.
+ */
PEPPER_API pepper_touch_t *
pepper_seat_get_touch(pepper_seat_t *seat)
{
return seat->touch;
}
+/**
+ * Get the name of the given seat
+ *
+ * @param seat seat object
+ *
+ * @return pointer the null terminating string of the seat name
+ */
PEPPER_API const char *
pepper_seat_get_name(pepper_seat_t *seat)
{
}
}
+/**
+ * Add the input device to the given seat
+ *
+ * @param seat seat object
+ * @param device input device object
+ *
+ * Seat's capabilities will be updated according to the device's capabilities and the change is
+ * broadcasted to all resources. The seat installs an event listener on the device and dispatches
+ * input events to proper destination which is one of pepper_pointer/keyboard/touch_t of the seat.
+ * Device add events are emitted to the seat according to the device's capabilities like
+ * PEPPER_EVENT_SEAT_POINTER_DEVICE_ADD. If any of pepper_pointer/keyboard/touch_t has been created
+ * by adding the input device, event is emitted to the seat like PEPPER_EVENT_SEAT_POINTER_ADD.
+ */
PEPPER_API void
pepper_seat_add_input_device(pepper_seat_t *seat, pepper_input_device_t *device)
{
seat_handle_device_event, entry);
}
+/**
+ * Remove an input device from the given seat
+ *
+ * @param seat seat to remove the input device
+ * @param device input device to be removed
+ *
+ * If the device is not added to the seat, this function has no effect. Removing the device causes
+ * the capabilities of the seat to change resulting wayland events and pepper events. Refer to the
+ * events described in pepper_seat_add_input_device().
+ */
PEPPER_API void
pepper_seat_remove_input_device(pepper_seat_t *seat, pepper_input_device_t *device)
{
}
}
+/**
+ * Create an input device.
+ *
+ * @param compositor compositor to add the device
+ * @param caps capabilities of the device
+ * @param backend pointer to an input device backend function table
+ * @param data backend data
+ *
+ * @returns #pepper_input_device_t
+ *
+ * PEPPER_EVENT_COMPOSITOR_INPUT_DEVICE_ADD event is emitted.
+ */
PEPPER_API pepper_input_device_t *
pepper_input_device_create(pepper_compositor_t *compositor, uint32_t caps,
const pepper_input_device_backend_t *backend, void *data)
return device;
}
+/**
+ * Destroy the given input device.
+ *
+ * @param device input device to destroy
+ *
+ * PEPPER_EVENT_COMPOSITOR_INPUT_DEVICE_REMOVE event is emitted.
+ */
PEPPER_API void
pepper_input_device_destroy(pepper_input_device_t *device)
{
free(device);
}
+/**
+ * Get the #pepper_compositor_t of the given #pepper_input_device_t
+ *
+ * @param device input device to get the compositor
+ *
+ * @return compositor
+ */
PEPPER_API pepper_compositor_t *
pepper_input_device_get_compositor(pepper_input_device_t *device)
{
return device->compositor;
}
+/**
+ * Get property of the given #pepper_input_device_t for the given key
+ *
+ * @param device input device to get the property
+ * @param key key for the property
+ *
+ * @return null terminating string of the property if exist, NULL otherwise
+ *
+ * Available keys for the properties are different between input backends.
+ */
PEPPER_API const char *
pepper_input_device_get_property(pepper_input_device_t *device, const char *key)
{
return device->backend->get_property(device->data, key);
}
+/**
+ * Get capabilities value of the given input device.
+ *
+ * @param device device to get capabilities
+ *
+ * @returns capabilities of the device
+ *
+ * @see wl_seat_capability
+ */
PEPPER_API uint32_t
pepper_input_device_get_caps(pepper_input_device_t *device)
{
}
}
+/**
+ * Get the list of wl_resource of the given keyboard
+ *
+ * @param keyboard keyboard object
+ *
+ * @return list of the keyboard resources
+ */
PEPPER_API struct wl_list *
pepper_keyboard_get_resource_list(pepper_keyboard_t *keyboard)
{
return &keyboard->resource_list;
}
+/**
+ * Get the compositor of the given keyboard
+ *
+ * @param keyboard keyboard object
+ *
+ * @return compositor
+ */
PEPPER_API pepper_compositor_t *
pepper_keyboard_get_compositor(pepper_keyboard_t *keyboard)
{
return keyboard->seat->compositor;
}
+/**
+ * Get the seat of the given keyboard
+ *
+ * @param keyboard keyboard object
+ *
+ * @return seat
+ */
PEPPER_API pepper_seat_t *
pepper_keyboard_get_seat(pepper_keyboard_t *keyboard)
{
return keyboard->seat;
}
+/**
+ * Set the focus view of the given keyboard
+ *
+ * @param keyboard keyboard object
+ * @param focus focus view
+ *
+ * @see pepper_keyboard_send_enter()
+ * @see pepper_keyboard_send_leave()
+ * @see pepper_keyboard_get_focus()
+ */
PEPPER_API void
pepper_keyboard_set_focus(pepper_keyboard_t *keyboard, pepper_view_t *focus)
{
}
}
+/**
+ * Get the focus view of the given keyboard
+ *
+ * @param keyboard keyboard object
+ *
+ * @return focus view
+ *
+ * @see pepper_keyboard_set_focus()
+ */
PEPPER_API pepper_view_t *
pepper_keyboard_get_focus(pepper_keyboard_t *keyboard)
{
return keyboard->focus;
}
+/**
+ * Send wl_keyboard.leave event to the client
+ *
+ * @param keyboard keyboard object
+ * @param view view object having the target surface for the leave event
+ */
PEPPER_API void
pepper_keyboard_send_leave(pepper_keyboard_t *keyboard, pepper_view_t *view)
{
}
}
+/**
+ * Send wl_keyboard.enter event to the client
+ *
+ * @param keyboard keyboard object
+ * @param view view object having the target surface for the enter event
+ */
PEPPER_API void
pepper_keyboard_send_enter(pepper_keyboard_t *keyboard, pepper_view_t *view)
{
}
}
+/**
+ * Send wl_keyboard.key event to the client
+ *
+ * @param keyboard keyboard object
+ * @param view view object having the target surface for the enter event
+ * @param time time in mili-second with undefined base
+ * @param key key code
+ * @param state state flag (ex. WL_KEYBOARD_KEY_STATE_PRESSED)
+ */
PEPPER_API void
pepper_keyboard_send_key(pepper_keyboard_t *keyboard, pepper_view_t *view,
uint32_t time, uint32_t key, uint32_t state)
pepper_object_emit_event(&view->base, PEPPER_EVENT_KEYBOARD_KEY, &event);
}
+/**
+ * Send wl_keyboard.key event to the client
+ *
+ * @param keyboard keyboard object
+ * @param view view object having the target surface for the enter event
+ * @param depressed (none)
+ * @param latched (none)
+ * @param locked (none)
+ * @param group (none)
+ */
PEPPER_API void
pepper_keyboard_send_modifiers(pepper_keyboard_t *keyboard, pepper_view_t *view,
uint32_t depressed, uint32_t latched,
}
}
+/**
+ * Install keyboard grab
+ *
+ * @param keyboard keyboard object
+ * @param grab grab handler
+ * @param data user data to be passed to grab functions
+ */
PEPPER_API void
pepper_keyboard_set_grab(pepper_keyboard_t *keyboard, const pepper_keyboard_grab_t *grab, void *data)
{
keyboard->data = data;
}
+/**
+ * Get the current keyboard grab
+ *
+ * @param keyboard keyboard object
+ *
+ * @return grab handler which is most recently installed
+ *
+ * @see pepper_keyboard_set_grab()
+ * @see pepper_keyboard_get_grab_data()
+ */
PEPPER_API const pepper_keyboard_grab_t *
pepper_keyboard_get_grab(pepper_keyboard_t *keyboard)
{
return keyboard->grab;
}
+/**
+ * Get the current keyboard grab data
+ *
+ * @param keyboard keyboard object
+ *
+ * @return grab data which is most recently installed
+ *
+ * @see pepper_keyboard_set_grab()
+ * @see pepper_keyboard_get_grab()
+ */
PEPPER_API void *
pepper_keyboard_get_grab_data(pepper_keyboard_t *keyboard)
{
return keyboard->data;
}
+/**
+ * Set xkb keymap for the given keyboard
+ *
+ * @param keyboard keyboard object
+ * @param keymap xkb keymap
+ *
+ * This function might send wl_pointer.keymap and wl_pointer.modifers events internally
+ */
PEPPER_API void
pepper_keyboard_set_keymap(pepper_keyboard_t *keyboard, struct xkb_keymap *keymap)
{
#include "pepper-internal.h"
+/**
+ * Transforms a pixman region from global space to output local space
+ *
+ * @param region pixman region
+ * @param output output object
+ */
PEPPER_API void
pepper_pixman_region_global_to_output(pixman_region32_t *region, pepper_output_t *output)
{
}
}
+/**
+ * Transforms coordinates from surface local to buffer local space
+ *
+ * @param surface surface object
+ * @param sx x coordinate in surface local space
+ * @param sy y coordinate in surface local space
+ * @param bx pointer to receive x coordinate in buffer local space
+ * @param by pointer to receive y coordinate in buffer local space
+ */
PEPPER_API void
pepper_coordinates_surface_to_buffer(pepper_surface_t *surface,
double sx, double sy, double *bx, double *by)
pepper_event_listener_remove(listener);
}
+/**
+ * Get the type of the given object
+ *
+ * @param object (none)
+ *
+ * @return type of the object
+ */
PEPPER_API pepper_object_type_t
pepper_object_get_type(pepper_object_t *object)
{
return object->type;
}
+/**
+ * Set user data to the given object with the given key
+ *
+ * @param object (none)
+ * @param key (none)
+ * @param data (none)
+ * @param free_func function to free the user data when the object is destroyed
+ *
+ * Only a single user data can be set for a key simultaneously. Be aware not to overwrite previous
+ * user data by checking existing user data with #pepper_object_get_user_data() before write.
+ *
+ * @see pepper_object_get_user_data()
+ */
PEPPER_API void
pepper_object_set_user_data(pepper_object_t *object, const void *key, void *data,
pepper_free_func_t free_func)
pepper_map_set(&object->user_data_map, key, data, free_func);
}
+/**
+ * Get the user data of the given object for the given key
+ *
+ * @param object (none)
+ * @param key (none)
+ *
+ * @return the user data which has been set for the given key
+ *
+ * @see pepper_object_set_user_data()
+ */
PEPPER_API void *
pepper_object_get_user_data(pepper_object_t *object, const void *key)
{
pepper_list_insert(object->event_listener_list.prev, &listener->link);
}
+/**
+ * Add an event listener to the given object
+ *
+ * @param object (none)
+ * @param id event id
+ * @param priority priority (higher priority called earlier)
+ * @param callback callback to be called when the event is emitted
+ * @param data data passed to the callback when the event is emitted
+ *
+ * @return added event listener object
+ *
+ * @see pepper_event_listener_remove()
+ * @see pepper_event_listener_set_priority()
+ */
PEPPER_API pepper_event_listener_t *
pepper_object_add_event_listener(pepper_object_t *object, uint32_t id, int priority,
pepper_event_callback_t callback, void *data)
return listener;
}
+/**
+ * Remove an event listener from the belonging object
+ *
+ * @param listener event listener
+ *
+ * @see pepper_object_add_event_listener()
+ */
PEPPER_API void
pepper_event_listener_remove(pepper_event_listener_t *listener)
{
free(listener);
}
+/**
+ * Set priority of the given event listener
+ *
+ * @param listener event listener
+ * @param priority priority (higher priority called earlier)
+ */
PEPPER_API void
pepper_event_listener_set_priority(pepper_event_listener_t *listener, int priority)
{
insert_listener(listener->object, listener);
}
+/**
+ * Emit an event to the given object
+ *
+ * @param object (none)
+ * @param id event id
+ * @param info event info passed to the listeners
+ *
+ * Emitting an event to an object causes registered listeners are called. Higher priority listeners
+ * will get called ealier than lower priority listeners. The type of the info is dependent on the
+ * event type. Event info for the built-in events are defined in #pepper_built_in_events. Emitting
+ * #PEPPER_EVENT_ALL has no effect. Some event ids are reserved by pepper which is defined in
+ * #pepper_built_in_event.
+ *
+ * @see pepper_object_add_event_listener()
+ * @see pepper_built_in_event
+ */
PEPPER_API void
pepper_object_emit_event(pepper_object_t *object, uint32_t id, void *info)
{
pepper_event_listener_t *listener, *tmp;
+ PEPPER_CHECK(id != PEPPER_EVENT_ALL, return, "Cannot emit the PEPPER_EVENT_ALL event");
+
pepper_list_for_each_safe(listener, tmp, &object->event_listener_list, link)
{
if (listener->id == PEPPER_EVENT_ALL || listener->id == id)
wl_event_loop_add_idle(loop, idle_repaint, output);
}
+/**
+ * Add damage region to all planes in the given output.
+ *
+ * @param output output object
+ * @param region damage region
+ *
+ * If the damage region is NULL, entire output area is marked as damaged.
+ */
PEPPER_API void
pepper_output_add_damage_region(pepper_output_t *output, pixman_region32_t *region)
{
pepper_plane_add_damage_region(plane, region);
}
+/**
+ * Finish the currently pending frame of the given output.
+ *
+ * @param output output object
+ * @param ts current time
+ *
+ * Output backend should call this function when they are ready to draw a new frame in response to
+ * the requests from pepper library.
+ */
PEPPER_API void
pepper_output_finish_frame(pepper_output_t *output, struct timespec *ts)
{
output_repaint(output);
}
-PEPPER_API void
-pepper_output_remove(pepper_output_t *output)
-{
- pepper_output_destroy(output);
-}
-
+/**
+ * Update mode of the given output.
+ *
+ * @param output output object
+ *
+ * Backend should call this function after changing output mode.
+ */
PEPPER_API void
pepper_output_update_mode(pepper_output_t *output)
{
pepper_object_emit_event(&output->base, PEPPER_EVENT_OUTPUT_MODE_CHANGE, NULL);
}
+/**
+ * Create an output and add it to the given compositor
+ *
+ * @param compositor compositor object
+ * @param backend output backend function table
+ * @param name output name
+ * @param data backend private data
+ * @param transform output transform (ex. WL_OUTPUT_TRANSFORM_NORMAL)
+ * @param scale output scale
+ *
+ * @returns the created output object
+ */
PEPPER_API pepper_output_t *
pepper_compositor_add_output(pepper_compositor_t *compositor,
const pepper_output_backend_t *backend, const char *name, void *data,
return output;
}
+/**
+ * Get the compositor of the given output
+ *
+ * @param output output object
+ *
+ * @return compositor of the output
+ */
PEPPER_API pepper_compositor_t *
pepper_output_get_compositor(pepper_output_t *output)
{
return output->compositor;
}
+/**
+ * Destroy the given output
+ *
+ * @param output output object
+ *
+ * Destroying an output will emit PEPPER_EVENT_COMPOSITOR_OUTPUT_REMOVE event to the compositor.
+ */
PEPPER_API void
pepper_output_destroy(pepper_output_t *output)
{
free(output);
}
+/**
+ * Get the list of wl_resource of the given output
+ *
+ * @param output output object
+ *
+ * @return list of output resources
+ */
PEPPER_API struct wl_list *
pepper_output_get_resource_list(pepper_output_t *output)
{
return &output->resource_list;
}
+/**
+ * Move origin of the given output to the given position in global space
+ *
+ * @param output output object
+ * @param x x coordinate of the new origin in global space
+ * @param y y coordinate of the new origin in global space
+ *
+ * Repaint is scheduled for the output if the origin of the output changes.
+ */
PEPPER_API void
pepper_output_move(pepper_output_t *output, int32_t x, int32_t y)
{
}
}
+/**
+ * Get the geometry of the given output
+ *
+ * @param output output object
+ *
+ * @return pointer to the structure of the output geometry
+ */
PEPPER_API const pepper_output_geometry_t *
pepper_output_get_geometry(pepper_output_t *output)
{
return &output->geometry;
}
+/**
+ * Get the scale value of the given output
+ *
+ * @param output output object
+ *
+ * @return output scale
+ */
PEPPER_API int32_t
pepper_output_get_scale(pepper_output_t *output)
{
return output->scale;
}
+/**
+ * Get the number of available modes of the given output
+ *
+ * @param output output object
+ *
+ * @return the number of available modes
+ */
PEPPER_API int
pepper_output_get_mode_count(pepper_output_t *output)
{
return output->backend->get_mode_count(output->data);
}
+/**
+ * Get the mode for the given mode index of the given output
+ *
+ * @param output output object
+ * @param index index of the mode
+ * @param mode pointer to receive the mode info
+ */
PEPPER_API void
pepper_output_get_mode(pepper_output_t *output, int index, pepper_output_mode_t *mode)
{
return output->backend->get_mode(output->data, index, mode);
}
+/**
+ * Get the current mode of the given output
+ *
+ * @param output output object
+ *
+ * @return pointer to the current mode info
+ */
PEPPER_API const pepper_output_mode_t *
pepper_output_get_current_mode(pepper_output_t *output)
{
return &output->current_mode;
}
+/**
+ * Set display mode of the given output
+ *
+ * @param output output object
+ * @param mode mode info
+ *
+ * @return PEPPER_TRUE on sucess, PEPPER_FALSE otherwise
+ *
+ * Mode setting might succeed even if the mode count is zero. There might be infinite available
+ * modes for some output backends like x11 and wayland backend.
+ */
PEPPER_API pepper_bool_t
pepper_output_set_mode(pepper_output_t *output, const pepper_output_mode_t *mode)
{
return PEPPER_FALSE;
}
+/**
+ * Get the name of the given output
+ *
+ * @param output output to get the name
+ *
+ * @return null terminating string of the output name
+ */
PEPPER_API const char *
pepper_output_get_name(pepper_output_t *output)
{
return output->name;
}
+/**
+ * Find the output for the given name in the given compositor
+ *
+ * @param compositor compositor to find the output
+ * @param name name of the output to be found
+ *
+ * @return output with the given name if exist, NULL otherwise
+ */
PEPPER_API pepper_output_t *
pepper_compositor_find_output(pepper_compositor_t *compositor, const char *name)
{
const char * (*get_property)(void *device, const char *key);
};
-/**
- * Create #pepper_input_device_t. Emit PEPPER_EVENT_COMPOSITOR_INPUT_DEVICE_ADD event.
- *
- * @param compositor compositor to add the device
- * @param caps capabilities of the device
- * @param backend pointer to an input device backend function table
- * @param data backend data
- *
- * @returns #pepper_input_device_t
- */
PEPPER_API pepper_input_device_t *
pepper_input_device_create(pepper_compositor_t *compositor, uint32_t caps,
const pepper_input_device_backend_t *backend, void *data);
-/**
- * Destroy #pepper_input_device_t. Emit PEPPER_EVENT_COMPOSITOR_INPUT_DEVICE_REMOVE event.
- *
- * @param device input device to destroy
- */
PEPPER_API void
pepper_input_device_destroy(pepper_input_device_t *device);
-/**
- * Get capabilities value of a device. Capabilities value is a bitmap of available input devices.
- *
- * @param device device to get capabilities
- *
- * @returns capabilities of the device
- *
- * @see wl_seat_capability
- * WL_SEAT_CAPABILITY_POINTER, WL_SEAT_CAPABILITY_KEYBOARD, WL_SEAT_CAPABILITY_TOUCH
- *
- */
PEPPER_API uint32_t
pepper_input_device_get_caps(pepper_input_device_t *device);
pepper_bool_t *keep_buffer);
};
-/**
- * Create and add #pepper_output_t to compositor.
- *
- * @param compositor compositor to add the output
- * @param backend pointer to an output backend function table
- * @param name name of the output to add
- * @param data backend data
- * @param transform transform of the output to add
- * @param scale scale of the output to add
- *
- * @returns #pepper_output_t
- */
PEPPER_API pepper_output_t *
pepper_compositor_add_output(pepper_compositor_t *compositor,
const pepper_output_backend_t *backend, const char *name, void *data,
pixman_region32_t visible_region; /**< visible region of the view */
};
-/**
- * Create and add #pepper_plane_t to the output.
- *
- * @param output output to add the plane
- * @param above_plane added plane will be placed above above_plane
- *
- * @returns #pepper_plane_t
- */
PEPPER_API pepper_plane_t *
pepper_output_add_plane(pepper_output_t *output, pepper_plane_t *above_plane);
-/**
- * Destroy the plane.
- *
- * @param plane plane to destroy
- */
PEPPER_API void
pepper_plane_destroy(pepper_plane_t *plane);
-/**
- * Get the region that has been changed. Not necessarily the damage region should be visible.
- *
- * @param plane plane to get the damage region
- *
- * @returns #pixman_region32_t
- */
PEPPER_API pixman_region32_t *
pepper_plane_get_damage_region(pepper_plane_t *plane);
-/**
- * Get the region that is obscured by other planes in front of the plane. Visible damage region
- * should be (DAMAGE - CLIP)
- *
- * @param plane plane to get the clip region
- *
- * @returns #pixman_region32_t
- */
PEPPER_API pixman_region32_t *
pepper_plane_get_clip_region(pepper_plane_t *plane);
-/**
- * Get list of #pepper_render_item_t.
- *
- * @param plane plane to get the list
- *
- * @returns #pepper_list_t
- */
PEPPER_API const pepper_list_t *
pepper_plane_get_render_list(pepper_plane_t *plane);
-/**
- * Subtract given region from the damage region of a plane. Called to partially update the
- * damage region of a plane.
- *
- * @param plane plane
- * @param damage region to subtract
- */
PEPPER_API void
pepper_plane_subtract_damage_region(pepper_plane_t *plane, pixman_region32_t *damage);
-/**
- * Clear the damage region of a plane. Called when the output backend has processed the damage
- * region. Or if you partially updated the damage region use pepper_plane_subtract_damage_region.
- *
- * @param plane plane to clear the damage region
- */
PEPPER_API void
pepper_plane_clear_damage_region(pepper_plane_t *plane);
-/**
- * Assign a view to a plane.
- *
- * @param view view to assign
- * @param output output of the plane
- * @param plane plane to assign a view
- */
PEPPER_API void
pepper_view_assign_plane(pepper_view_t *view, pepper_output_t *output, pepper_plane_t *plane);
-/**
- * Add damage region to planes in the output. if damage region is empty, whole area is set to
- * damage region.
- *
- * @param output output to add damage
- * @param region damage region
- */
PEPPER_API void
pepper_output_add_damage_region(pepper_output_t *output, pixman_region32_t *region);
-/**
- * Notifying that the pending frame has been finished. Output backend should call this function
- * when they are ready to draw a new frame in response to the requests from the pepper library.
- *
- * @param output output to finish frame
- * @param ts time of finishing frame
- */
PEPPER_API void
pepper_output_finish_frame(pepper_output_t *output, struct timespec *ts);
-/**
- * Destroy output and backend internal resources.
- *
- * @param output output to destroy
- */
-PEPPER_API void
-pepper_output_remove(pepper_output_t *output);
-
-/**
- * Update output mode. Backend should call this function after change output mode.
- *
- * @param output output to update mode
- */
PEPPER_API void
pepper_output_update_mode(pepper_output_t *output);
double value; /**< pointer axis value. */
};
-/* Generic object functions. */
PEPPER_API pepper_object_type_t
pepper_object_get_type(pepper_object_t *object);
PEPPER_API void
pepper_object_emit_event(pepper_object_t *object, uint32_t id, void *info);
-/* Compositor functions. */
PEPPER_API pepper_compositor_t *
pepper_compositor_create(const char *socket_name);
PEPPER_API pepper_bool_t
pepper_compositor_get_time(pepper_compositor_t *compositor, struct timespec *ts);
-/* Output. */
PEPPER_API void
pepper_output_destroy(pepper_output_t *output);
PEPPER_API pepper_output_t *
pepper_compositor_find_output(pepper_compositor_t *compositor, const char *name);
-/* Seat & Input Device. */
PEPPER_API pepper_seat_t *
pepper_compositor_add_seat(pepper_compositor_t *compositor, const char *seat_name);
PEPPER_API pepper_compositor_t *
pepper_input_device_get_compositor(pepper_input_device_t *device);
-/* Pointer. */
struct pepper_pointer_grab
{
+ /**
+ * Handler for pointer motion event
+ *
+ * @param pointer pointer object
+ * @param data data registered for the grab (@see pepper_pointer_set_grab)
+ * @param time time in mili-second with undefined base
+ * @param x movement in x direction on global space
+ * @param x movement in y direction on global space
+ **/
void (*motion)(pepper_pointer_t *pointer, void *data, uint32_t time, double x, double y);
+
+ /**
+ * Handler for pointer button event
+ *
+ * @param pointer pointer object
+ * @param data data registered for the grab (@see pepper_pointer_set_grab)
+ * @param time time in mili-second with undefined base
+ * @param button button id
+ * @param state button state (@see pepper_button_state)
+ **/
void (*button)(pepper_pointer_t *pointer, void *data, uint32_t time, uint32_t button,
uint32_t state);
+
+ /**
+ * Handler for pointer axis event
+ *
+ * @param pointer pointer object
+ * @param data data registered for the grab (@see pepper_pointer_set_grab)
+ * @param time time in mili-second with undefined base
+ * @param axis axis id
+ * @param value amount of axis movement
+ **/
void (*axis)(pepper_pointer_t *pointer, void *data, uint32_t time, uint32_t axis, double value);
+
+ /**
+ * Handler for the grab cancel
+ *
+ * @param pointer pointer object
+ * @param data data registered for the grab (@see pepper_pointer_set_grab)
+ *
+ * Notifying that the grab is canceled and removed. Place to release resources or clean up grab
+ * states.
+ **/
void (*cancel)(pepper_pointer_t *pointer, void *data);
};
/* Keyboard. */
struct pepper_keyboard_grab
{
+ /**
+ * Handler for keyboard key event
+ *
+ * @param keyboard keyboard object
+ * @param data data registered for the grab (@see pepper_keyboard_set_grab)
+ * @param time time in mili-second with undefined base
+ * @param key key code
+ * @param state state flag (ex. WL_KEYBOARD_KEY_STATE_PRESSED)
+ **/
void (*key)(pepper_keyboard_t *keyboard, void *data, uint32_t time, uint32_t key,
uint32_t state);
+
+ /**
+ * Handler for keyboard modifier event
+ *
+ * @param keyboard keyboard object
+ * @param data data registered for the grab (@see pepper_keyboard_set_grab)
+ * @param mods_depressed depressed mods
+ * @param mods_latched latched mods
+ * @param mods_locked locked mods
+ * @param group (none)
+ **/
void (*modifiers)(pepper_keyboard_t *keyboard, void *data, uint32_t mods_depressed,
uint32_t mods_latched, uint32_t mods_locked, uint32_t group);
+
+ /**
+ * Handler for grab cancel
+ *
+ * @param keyboard keyboard object
+ * @param data data registered for the grab (@see pepper_keyboard_set_grab)
+ **/
void (*cancel)(pepper_keyboard_t *keyboard, void *data);
};
pixman_region32_fini(&plane_clip);
}
+/**
+ * Create and add #pepper_plane_t to the output.
+ *
+ * @param output output to add the plane
+ * @param above_plane added plane will be placed above above_plane
+ *
+ * @returns #pepper_plane_t
+ */
PEPPER_API pepper_plane_t *
pepper_output_add_plane(pepper_output_t *output, pepper_plane_t *above)
{
return plane;
}
+/**
+ * Destroy the plane.
+ *
+ * @param plane plane to destroy
+ */
PEPPER_API void
pepper_plane_destroy(pepper_plane_t *plane)
{
}
}
+/**
+ * Get the region that has been changed. Not necessarily the damage region should be visible.
+ *
+ * @param plane plane to get the damage region
+ *
+ * @returns #pixman_region32_t
+ */
PEPPER_API pixman_region32_t *
pepper_plane_get_damage_region(pepper_plane_t *plane)
{
return &plane->damage_region;
}
+/**
+ * Get the region that is obscured by other planes in front of the plane. Visible damage region
+ * should be (DAMAGE - CLIP)
+ *
+ * @param plane plane to get the clip region
+ *
+ * @returns #pixman_region32_t
+ */
PEPPER_API pixman_region32_t *
pepper_plane_get_clip_region(pepper_plane_t *plane)
{
return &plane->clip_region;
}
+/**
+ * Get list of #pepper_render_item_t.
+ *
+ * @param plane plane to get the list
+ *
+ * @returns #pepper_list_t
+ */
PEPPER_API const pepper_list_t *
pepper_plane_get_render_list(pepper_plane_t *plane)
{
return &plane->entry_list;
}
+/**
+ * Subtract given region from the damage region of a plane. Called to partially update the
+ * damage region of a plane.
+ *
+ * @param plane plane
+ * @param damage region to subtract
+ */
PEPPER_API void
pepper_plane_subtract_damage_region(pepper_plane_t *plane, pixman_region32_t *damage)
{
pixman_region32_subtract(&plane->damage_region, &plane->damage_region, damage);
}
+/**
+ * Clear the damage region of a plane. Called when the output backend has processed the damage
+ * region. Or if you partially updated the damage region use pepper_plane_subtract_damage_region.
+ *
+ * @param plane plane to clear the damage region
+ */
PEPPER_API void
pepper_plane_clear_damage_region(pepper_plane_t *plane)
{
}
}
+/**
+ * Get the list of wl_resource of the given pointer
+ *
+ * @param pointer pointer object
+ *
+ * @return list of the pointer resources
+ */
PEPPER_API struct wl_list *
pepper_pointer_get_resource_list(pepper_pointer_t *pointer)
{
return &pointer->resource_list;
}
+/**
+ * Get the compositor of the given pointer
+ *
+ * @param pointer pointer object
+ *
+ * @return compositor
+ */
PEPPER_API pepper_compositor_t *
pepper_pointer_get_compositor(pepper_pointer_t *pointer)
{
return pointer->seat->compositor;
}
+/**
+ * Get the seat of the given pointer
+ *
+ * @param pointer pointer object
+ *
+ * @return seat
+ */
PEPPER_API pepper_seat_t *
pepper_pointer_get_seat(pepper_pointer_t *pointer)
{
return pointer->seat;
}
+/**
+ * Set the clamp area of the given pointer
+ *
+ * @param pointer pointer object
+ * @param x0 x coordinate of top left corner of the clamp area
+ * @param y0 y coordinate of top left corner of the clamp area
+ * @param x1 x coordinate of bottom right corner of the clamp area
+ * @param y1 y coordinate of bottom right corner of the clamp area
+ *
+ * @return PEPPER_TRUE on success, PEPPER_FALSE otherwise
+ *
+ * Clamp area is a rectangular boundary that a pointer's cursor can never go out of it. Changing the
+ * clamp area might cause the pointer cursor to be moved (to be located inside of the area)
+ * resulting motion events.
+ */
PEPPER_API pepper_bool_t
pepper_pointer_set_clamp(pepper_pointer_t *pointer, double x0, double y0, double x1, double y1)
{
return PEPPER_TRUE;
}
+/**
+ * Get the clamp area of the given pointer
+ *
+ * @param pointer pointer object
+ * @param x0 pointer to receive x coordinate of top left corner of the clamp area
+ * @param y0 pointer to receive y coordinate of top left corner of the clamp area
+ * @param x1 pointer to receive x coordinate of bottom right corner of the clamp area
+ * @param y1 pointer to receive y coordinate of bottom right corner of the clamp area
+ */
PEPPER_API void
pepper_pointer_get_clamp(pepper_pointer_t *pointer, double *x0, double *y0, double *x1, double *y1)
{
*y1 = pointer->clamp.y1;
}
+/**
+ * Set the velocity of the given pointer
+ *
+ * @param pointer pointer object
+ * @param vx velocity in x direction
+ * @param vy velocity in y direction
+ *
+ * Pointer cursor movement is calculated as follows.
+ *
+ * dx = x_velocity * motion.x
+ * dy = y_velocity * motion.x
+ *
+ * Default value is (1.0, 1.0).
+ */
PEPPER_API void
pepper_pointer_set_velocity(pepper_pointer_t *pointer, double vx, double vy)
{
pointer->y_velocity = vy;
}
+/**
+ * Get the velocity of the given pointer
+ *
+ * @param pointer pointer object
+ * @param vx pointer to receive velocity in x direction
+ * @param vx pointer to receive velocity in y direction
+ *
+ * @see pepper_pointer_set_velocity()
+ */
PEPPER_API void
pepper_pointer_get_velocity(pepper_pointer_t *pointer, double *vx, double *vy)
{
*vy = pointer->y_velocity;
}
+/**
+ * Get the current cursor position of the given pointer
+ *
+ * @param pointer pointer object
+ * @param x pointer to receive x coordinate of the cursor in global space
+ * @param x pointer to receive y coordinate of the cursor in global space
+ */
PEPPER_API void
pepper_pointer_get_position(pepper_pointer_t *pointer, double *x, double *y)
{
*y = pointer->y;
}
+/**
+ * Set the focus view of the given pointer
+ *
+ * @param pointer pointer object
+ * @param focus focus view
+ *
+ * @see pepper_pointer_send_enter()
+ * @see pepper_pointer_send_leave()
+ * @see pepper_pointer_get_focus()
+ */
PEPPER_API void
pepper_pointer_set_focus(pepper_pointer_t *pointer, pepper_view_t *focus)
{
}
}
+/**
+ * Get the focus view of the given pointer
+ *
+ * @param pointer pointer object
+ *
+ * @return focus view
+ *
+ * @see pepper_pointer_set_focus()
+ */
PEPPER_API pepper_view_t *
pepper_pointer_get_focus(pepper_pointer_t *pointer)
{
return pointer->focus;
}
+/**
+ * Send wl_pointer.leave event to the client
+ *
+ * @param pointer pointer object
+ * @param view view object having the target surface for the leave event
+ */
PEPPER_API void
pepper_pointer_send_leave(pepper_pointer_t *pointer, pepper_view_t *view)
{
}
}
+/**
+ * Send wl_pointer.enter event to the client
+ *
+ * @param pointer pointer object
+ * @param view view object having the target surface for the enter event
+ */
PEPPER_API void
pepper_pointer_send_enter(pepper_pointer_t *pointer, pepper_view_t *view, double x, double y)
{
}
}
+/**
+ * Send wl_pointer.motion event to the client
+ *
+ * @param pointer pointer object
+ * @param view view object having the target surface for the motion event
+ * @param time time in mili-second with undefined base
+ * @param x movement in x direction in global space
+ * @param y movement in y direction in global space
+ */
PEPPER_API void
pepper_pointer_send_motion(pepper_pointer_t *pointer, pepper_view_t *view,
uint32_t time, double x, double y)
pepper_object_emit_event(&view->base, PEPPER_EVENT_POINTER_MOTION, &event);
}
+/**
+ * Send wl_pointer.button event to the client
+ *
+ * @param pointer pointer object
+ * @param view view object having the target surface for the button event
+ * @param time time in mili-second with undefined base
+ * @param button button flag (ex. BTN_LEFT)
+ * @param state state flag (ex. WL_POINTER_BUTTON_STATE_PRESSED)
+ */
PEPPER_API void
pepper_pointer_send_button(pepper_pointer_t *pointer, pepper_view_t *view,
uint32_t time, uint32_t button, uint32_t state)
pepper_object_emit_event(&view->base, PEPPER_EVENT_POINTER_BUTTON, &event);
}
+/**
+ * Send wl_pointer.axis event to the client
+ *
+ * @param pointer pointer object
+ * @param view view object having the target surface for the axis event
+ * @param time time in mili-second with undefined base
+ * @param axis axis flag (ex. WL_POINTER_AXIS_VERTICAL_SCROLL)
+ * @param value amount of the scrolling
+ */
PEPPER_API void
pepper_pointer_send_axis(pepper_pointer_t *pointer, pepper_view_t *view,
uint32_t time, uint32_t axis, double value)
pepper_object_emit_event(&view->base, PEPPER_EVENT_POINTER_AXIS, &event);
}
+/**
+ * Install pointer grab
+ *
+ * @param pointer pointer object
+ * @param grab grab handler
+ * @param data user data to be passed to grab functions
+ */
PEPPER_API void
pepper_pointer_set_grab(pepper_pointer_t *pointer, const pepper_pointer_grab_t *grab, void *data)
{
pointer->data = data;
}
+/**
+ * Get the current pointer grab
+ *
+ * @param pointer pointer object
+ *
+ * @return grab handler which is most recently installed
+ *
+ * @see pepper_pointer_set_grab()
+ * @see pepper_pointer_get_grab_data()
+ */
PEPPER_API const pepper_pointer_grab_t *
pepper_pointer_get_grab(pepper_pointer_t *pointer)
{
return pointer->grab;
}
+/**
+ * Get the current pointer grab data
+ *
+ * @param pointer pointer object
+ *
+ * @return grab data which is most recently installed
+ *
+ * @see pepper_pointer_set_grab()
+ * @see pepper_pointer_get_grab()
+ */
PEPPER_API void *
pepper_pointer_get_grab_data(pepper_pointer_t *pointer)
{
}
}
+/**
+ * Get the wl_resource of the given surface
+ *
+ * @param surface surface object
+ *
+ * @return wl_resource of the given surface
+ */
PEPPER_API struct wl_resource *
pepper_surface_get_resource(pepper_surface_t *surface)
{
return surface->resource;
}
+/**
+ * Get the compositor of the given surface
+ *
+ * @param surface surface object
+ *
+ * @return compositor of the given surface
+ */
PEPPER_API pepper_compositor_t *
pepper_surface_get_compositor(pepper_surface_t *surface)
{
return surface->compositor;
}
+/**
+ * Get the role name of the given surface
+ *
+ * @param surface surface object
+ *
+ * @return role name of the given surface
+ */
PEPPER_API const char *
pepper_surface_get_role(pepper_surface_t *surface)
{
return surface->role;
}
+/**
+ * Set role name of the given surface
+ *
+ * @param surface surface object
+ * @param role role name
+ *
+ * @return PEPPER_TRUE on sucess, PEPPER_FALSE otherwise
+ *
+ * If the given surface already has a role, the function will fail. NULL role name make the surface
+ * having no role.
+ */
PEPPER_API pepper_bool_t
pepper_surface_set_role(pepper_surface_t *surface, const char *role)
{
return PEPPER_TRUE;
}
+/**
+ * Get the buffer of the surface which is most recently committed
+ *
+ * @param surface surface object
+ *
+ * @return the most recently committed buffer
+ *
+ * The surface might not have a reference to the buffer depending on the output backend.
+ */
PEPPER_API pepper_buffer_t *
pepper_surface_get_buffer(pepper_surface_t *surface)
{
return surface->buffer.buffer;
}
+/**
+ * Get the buffer offset of the given surface
+ *
+ * @param surface surface object
+ * @param x pointer to receive x coordinate of the offset
+ * @param y pointer to receive y coordinate of the offset
+ */
PEPPER_API void
pepper_surface_get_buffer_offset(pepper_surface_t *surface, int32_t *x, int32_t *y)
{
*y = surface->buffer.y;
}
+/**
+ * Get the buffer scale of the given surface
+ *
+ * @param surface surface object
+ *
+ * @return buffer scale value
+ */
PEPPER_API int32_t
pepper_surface_get_buffer_scale(pepper_surface_t *surface)
{
return surface->buffer.scale;
}
+/**
+ * Get the buffer transform of the given surface
+ *
+ * @param surface surface object
+ *
+ * @return buffer transform value
+ */
PEPPER_API int32_t
pepper_surface_get_buffer_transform(pepper_surface_t *surface)
{
return surface->buffer.transform;
}
+/**
+ * Get the damage region of the given surface (wl_surface.damage)
+ *
+ * @param surface surface object
+ *
+ * @return the damage region
+ *
+ * The damage region is the current state of the surface which is updated on wl_surface.commit.
+ */
PEPPER_API pixman_region32_t *
pepper_surface_get_damage_region(pepper_surface_t *surface)
{
return &surface->damage_region;
}
+
+/**
+ * Get the opaque region of the given surface (wl_surface.set_opaque_region)
+ *
+ * @param surface surface object
+ *
+ * @return the damage region
+ *
+ * The opaque region is the current state of the surface which is updated on wl_surface.commit.
+ */
PEPPER_API pixman_region32_t *
pepper_surface_get_opaque_region(pepper_surface_t *surface)
{
return &surface->opaque_region;
}
+/**
+ * Get the input region of the given surface (wl_surface.input)
+ *
+ * @param surface surface object
+ *
+ * @return the input region
+ *
+ * The input region is the current state of the surface which is updated on wl_surface.commit.
+ */
PEPPER_API pixman_region32_t *
pepper_surface_get_input_region(pepper_surface_t *surface)
{
return &surface->input_region;
}
+/**
+ * Get the size of the given surface
+ *
+ * @param surface surface object
+ * @param w pointer to receive width
+ * @param h pointer to receive height
+ *
+ * The size of a surface is determined by applying buffer transform and buffer scale to the size of
+ * the attached buffer. First buffer size is divided by the buffer scale, then width and height is
+ * swapped when the transform is a kind of 90 or 270 degree rotation.
+ */
PEPPER_API void
pepper_surface_get_size(pepper_surface_t *surface, int *w, int *h)
{
*h = surface->h;
}
+/**
+ * Send wl_surface.enter to the client
+ *
+ * @param surface surface object
+ * @param output output object
+ */
PEPPER_API void
pepper_surface_send_enter(pepper_surface_t *surface, pepper_output_t *output)
{
}
}
+/**
+ * Send wl_surface.leave to the client
+ *
+ * @param surface surface object
+ * @param output output object
+ */
PEPPER_API void
pepper_surface_send_leave(pepper_surface_t *surface, pepper_output_t *output)
{
/* TODO: Send down for newly bound resources. */
}
+/**
+ * Get the list of wl_resource of the given touch
+ *
+ * @param touch touch object
+ *
+ * @return list of the touch resources
+ */
PEPPER_API struct wl_list *
pepper_touch_get_resource_list(pepper_touch_t *touch)
{
return &touch->resource_list;
}
+/**
+ * Get the compositor of the given touch
+ *
+ * @param touch touch object
+ *
+ * @return compositor
+ */
PEPPER_API pepper_compositor_t *
pepper_touch_get_compositor(pepper_touch_t *touch)
{
return touch->seat->compositor;
}
+/**
+ * Get the seat of the given touch
+ *
+ * @param touch touch object
+ *
+ * @return seat
+ */
PEPPER_API pepper_seat_t *
pepper_touch_get_seat(pepper_touch_t *touch)
{
return touch->seat;
}
+/**
+ * Add a touch pointer to the given touch
+ *
+ * @param touch touch object
+ * @param id touch point id
+ * @param x x coordinate in global space
+ * @param y y coordinate in global space
+ */
PEPPER_API void
pepper_touch_add_point(pepper_touch_t *touch, uint32_t id, double x, double y)
{
pepper_list_insert(touch->point_list.prev, &point->link);
}
+/**
+ * Remove a touch point from the given touch
+ *
+ * @param touch touch object
+ * @param id touch point id
+ */
PEPPER_API void
pepper_touch_remove_point(pepper_touch_t *touch, uint32_t id)
{
free(point);
}
+/**
+ * Set the focus view of the given touch
+ *
+ * @param touch touch object
+ * @param focus focus view
+ *
+ * @see pepper_touch_send_enter()
+ * @see pepper_touch_send_leave()
+ * @see pepper_touch_get_focus()
+ */
PEPPER_API void
pepper_touch_set_focus(pepper_touch_t *touch, uint32_t id, pepper_view_t *focus)
{
}
}
+/**
+ * Get the focus view of the given touch
+ *
+ * @param touch touch object
+ *
+ * @return focus view
+ *
+ * @see pepper_touch_set_focus()
+ */
PEPPER_API pepper_view_t *
pepper_touch_get_focus(pepper_touch_t *touch, uint32_t id)
{
return point->focus;
}
+/**
+ * Get the position of the given touch point
+ *
+ * @param touch touch object
+ * @param id touch point id
+ * @param x pointer to receive x coordinate in global space
+ * @param y pointer to receive y coordinate in global space
+ *
+ * @return PEPPER_TRUE on success, PEPPER_FALSE otherwise
+ */
PEPPER_API pepper_bool_t
pepper_touch_get_position(pepper_touch_t *touch, uint32_t id, double *x, double *y)
{
return PEPPER_TRUE;
}
+/**
+ * Set the position of the given touch point
+ *
+ * @param touch touch object
+ * @param id touch point id
+ * @param x x coordinate in global space
+ * @param y y coordinate in global space
+ *
+ * @return PEPPER_TRUE on success, PEPPER_FALSE otherwise
+ */
PEPPER_API pepper_bool_t
pepper_touch_set_position(pepper_touch_t *touch, uint32_t id, double x, double y)
{
return PEPPER_TRUE;
}
+/**
+ * Send wl_touch.down event to the client
+ *
+ * @param touch touch object
+ * @param view target view
+ * @param time time in mili-second with undefined base
+ * @param id touch point id
+ * @param x x coordinate in global space
+ * @param y y coordinate in global space
+ */
PEPPER_API void
pepper_touch_send_down(pepper_touch_t *touch, pepper_view_t *view,
uint32_t time, uint32_t id, double x, double y)
pepper_object_emit_event(&view->base, PEPPER_EVENT_TOUCH_DOWN, &event);
}
+/**
+ * Send wl_touch.up event to the client
+ *
+ * @param touch touch object
+ * @param view target view
+ * @param time time in mili-second with undefined base
+ * @param id touch point id
+ */
PEPPER_API void
pepper_touch_send_up(pepper_touch_t *touch, pepper_view_t *view, uint32_t time, uint32_t id)
{
pepper_object_emit_event(&view->base, PEPPER_EVENT_TOUCH_UP, &event);
}
+/**
+ * Send wl_touch.motion event to the client
+ *
+ * @param touch touch object
+ * @param view target view
+ * @param time time in mili-second with undefined base
+ * @param id touch point id
+ * @param x x coordinate in global space
+ * @param y y coordinate in global space
+ */
PEPPER_API void
pepper_touch_send_motion(pepper_touch_t *touch, pepper_view_t *view, uint32_t time, uint32_t id, double x, double y)
{
pepper_object_emit_event(&view->base, PEPPER_EVENT_TOUCH_MOTION, &event);
}
+/**
+ * Send wl_touch.frame event to the client
+ *
+ * @param touch touch object
+ * @param view target view
+ */
PEPPER_API void
pepper_touch_send_frame(pepper_touch_t *touch, pepper_view_t *view)
{
pepper_object_emit_event(&view->base, PEPPER_EVENT_TOUCH_FRAME, NULL);
}
+/**
+ * Send wl_touch.cancel event to the client
+ *
+ * @param touch touch object
+ * @param view target view
+ */
PEPPER_API void
pepper_touch_send_cancel(pepper_touch_t *touch, pepper_view_t *view)
{
pepper_object_emit_event(&view->base, PEPPER_EVENT_TOUCH_CANCEL, NULL);
}
+/**
+ * Install touch grab
+ *
+ * @param touch touch object
+ * @param grab grab handler
+ * @param data user data to be passed to grab functions
+ */
PEPPER_API void
pepper_touch_set_grab(pepper_touch_t *touch, const pepper_touch_grab_t *grab, void *data)
{
touch->data = data;
}
+/**
+ * Get the current touch grab
+ *
+ * @param touch touch object
+ *
+ * @return grab handler which is most recently installed
+ *
+ * @see pepper_touch_set_grab()
+ * @see pepper_touch_get_grab_data()
+ */
PEPPER_API const pepper_touch_grab_t *
pepper_touch_get_grab(pepper_touch_t *touch)
{
return touch->grab;
}
+/**
+ * Get the current touch grab data
+ *
+ * @param touch touch object
+ *
+ * @return grab data which is most recently installed
+ *
+ * @see pepper_touch_set_grab()
+ * @see pepper_touch_get_grab()
+ */
PEPPER_API void *
pepper_touch_get_grab_data(pepper_touch_t *touch)
{
}
}
-void
+/**
+ * Assign a view to a plane.
+ *
+ * @param view view to assign
+ * @param output output of the plane
+ * @param plane plane to assign a view
+ */
+PEPPER_API void
pepper_view_assign_plane(pepper_view_t *view, pepper_output_t *output, pepper_plane_t *plane)
{
PEPPER_CHECK(!plane || plane->output == output, return, "Plane output mismatch.\n");
}
}
+/**
+ * Create and add a view to the given compositor
+ *
+ * @param compositor compositor object
+ *
+ * @return the created view
+ */
PEPPER_API pepper_view_t *
pepper_compositor_add_view(pepper_compositor_t *compositor)
{
subsurface_create_children_views(view->surface->sub, view);
}
+/**
+ * Set a surface to the given view as its content
+ *
+ * @param view view object
+ * @param surface surface object
+ *
+ * @return PEPPER_TRUE on success, PEPPER_FALSE otherwise
+ *
+ * View is just a container which can be located on the compositor space. Its content come from
+ * other resources like wl_surface. This function sets the content of the given view with the given
+ * surface.
+ */
PEPPER_API pepper_bool_t
pepper_view_set_surface(pepper_view_t *view, pepper_surface_t *surface)
{
return PEPPER_TRUE;
}
+/**
+ * Destroy the given view
+ *
+ * @param view view object
+ */
PEPPER_API void
pepper_view_destroy(pepper_view_t *view)
{
free(view);
}
+/**
+ * Get the compositor of the given view
+ *
+ * @param view view object
+ *
+ * @return compositor of the view
+ */
PEPPER_API pepper_compositor_t *
pepper_view_get_compositor(pepper_view_t *view)
{
return view->compositor;
}
+/**
+ * Get the surface of the given view
+ *
+ * @param view view object
+ *
+ * @return surface of the view
+ *
+ * @see pepper_view_set_surface()
+ */
PEPPER_API pepper_surface_t *
pepper_view_get_surface(pepper_view_t *view)
{
return view->surface;
}
+/**
+ * Set the parent of the given view
+ *
+ * @param view view object
+ * @param parent parent view object
+ *
+ * Views can inherit some of the properties from their parent. Changing the parent of a view might
+ * result repaint.
+ *
+ * @see pepper_view_set_transform_inherit()
+ * @see pepper_view_get_parent()
+ * @see pepper_view_get_children_list()
+ * @see pepper_view_stack_above()
+ * @see pepper_view_stack_below()
+ * @see pepper_view_stack_top()
+ * @see pepper_view_stack_bottom()
+ */
PEPPER_API void
pepper_view_set_parent(pepper_view_t *view, pepper_view_t *parent)
{
pepper_view_mark_dirty(view, PEPPER_VIEW_ACTIVE_DIRTY | PEPPER_VIEW_GEOMETRY_DIRTY);
}
+/**
+ * Get the parent of the given view
+ *
+ * @param view view object
+ *
+ * @return the parent view
+ *
+ * @see pepper_view_set_parent()
+ */
PEPPER_API pepper_view_t *
pepper_view_get_parent(pepper_view_t *view)
{
return view->parent;
}
+/**
+ * Set the transform inheritance flag of the given view
+ *
+ * @param view view object
+ * @param inherit boolean value to enable inherit or not
+ *
+ * If the inherit is set to PEPPER_TRUE, view position and transform is interpreted as
+ * relative to its parent. If it is not, position and transform is relative to the global frame.
+ *
+ * @see pepper_view_set_parent()
+ * @see pepper_view_get_transform_inherit()
+ */
PEPPER_API void
pepper_view_set_transform_inherit(pepper_view_t *view, pepper_bool_t inherit)
{
view->inherit_transform = inherit;
}
+/**
+ * Get the transform inheritance flag of the given view
+ *
+ * @param view view object
+ *
+ * @return transform inheritance flag
+ *
+ * @see pepper_view_set_transform_inherit()
+ */
PEPPER_API pepper_bool_t
pepper_view_get_transform_inherit(pepper_view_t *view)
{
return view->inherit_transform;
}
+/**
+ * Stack the given view above the target view
+ *
+ * @param view view object
+ * @param below target view to stack the given view above it
+ * @param subtree flag for stacking entire subtree or not
+ *
+ * @return PEPPER_TRUE on success, PEPPER_FALSE otherwise
+ *
+ * If the subtree is PEPPER_TRUE, entire subtree is taken from the tack, and inserted above the
+ * target view. Child views are stacked above their parents. Z-order between siblings is determined
+ * by the order in the list.
+ *
+ * @see pepper_view_stack_below()
+ * @see pepper_view_stack_top()
+ * @see pepper_view_stack_bottom()
+ */
PEPPER_API pepper_bool_t
pepper_view_stack_above(pepper_view_t *view, pepper_view_t *below, pepper_bool_t subtree)
{
return PEPPER_TRUE;
}
+/**
+ * Stack the given view below the target view
+ *
+ * @param view view object
+ * @param above target view to stack the given view below it
+ * @param subtree flag for stacking entire subtree or not
+ *
+ * @return PEPPER_TRUE on success, PEPPER_FALSE otherwise
+ *
+ * @see pepper_view_stack_above()
+ * @see pepper_view_stack_top()
+ * @see pepper_view_stack_bottom()
+ */
PEPPER_API pepper_bool_t
pepper_view_stack_below(pepper_view_t *view, pepper_view_t *above, pepper_bool_t subtree)
{
return PEPPER_TRUE;
}
+/**
+ * Stack the given view at the top
+ *
+ * @param view view object
+ * @param subtree flag for stacking entire subtree or not
+ *
+ * @see pepper_view_stack_above()
+ * @see pepper_view_stack_below()
+ * @see pepper_view_stack_bottom()
+ */
PEPPER_API void
pepper_view_stack_top(pepper_view_t *view, pepper_bool_t subtree)
{
view_insert(view, &view->compositor->view_list, subtree);
}
+/**
+ * Stack the given view at the bottom
+ *
+ * @param view view object
+ * @param subtree flag for stacking entire subtree or not
+ *
+ * @see pepper_view_stack_above()
+ * @see pepper_view_stack_below()
+ * @see pepper_view_stack_top()
+ */
PEPPER_API void
pepper_view_stack_bottom(pepper_view_t *view, pepper_bool_t subtree)
{
view_insert(view, view->compositor->view_list.prev, subtree);
}
+/**
+ * Get the view right above the given view
+ *
+ * @param view view object
+ *
+ * @return the view right above the given view
+ *
+ * @see pepper_view_get_below()
+ */
PEPPER_API pepper_view_t *
pepper_view_get_above(pepper_view_t *view)
{
return view->compositor_link.next->item;
}
+/**
+ * Get the view right below the given view
+ *
+ * @param view view object
+ *
+ * @return the view right below the given view
+ *
+ * @see pepper_view_get_below()
+ */
PEPPER_API pepper_view_t *
pepper_view_get_below(pepper_view_t *view)
{
return view->compositor_link.prev->item;
}
+/**
+ * Get the list of children of the given view
+ *
+ * @param view view object
+ *
+ * @return the children list
+ *
+ * @see pepper_view_set_parent()
+ */
PEPPER_API const pepper_list_t *
pepper_view_get_children_list(pepper_view_t *view)
{
return &view->children_list;
}
+/**
+ * Resize the given view (Don't use this function)
+ *
+ * @param view view object
+ * @param w width of the new size
+ * @param h height of the new size
+ *
+ * Never use this function. The view size is automatically determined by the surface.
+ */
PEPPER_API void
pepper_view_resize(pepper_view_t *view, int w, int h)
{
pepper_view_mark_dirty(view, PEPPER_VIEW_GEOMETRY_DIRTY);
}
+/**
+ * Get the size of the given view
+ *
+ * @param view view object
+ * @param w pointer to receive width
+ * @param h pointer to receive height
+ */
PEPPER_API void
pepper_view_get_size(pepper_view_t *view, int *w, int *h)
{
*h = view->h;
}
+/**
+ * Set the position of the given view
+ *
+ * @param view view object
+ * @param x x coordinate of the new position
+ * @param y y coordinate of the new position
+ *
+ * The position can be interpreted differently according to the transform inheritance flag of the
+ * view.
+ *
+ * @see pepper_view_set_transform_inherit()
+ * @see pepper_view_get_position()
+ */
PEPPER_API void
pepper_view_set_position(pepper_view_t *view, double x, double y)
{
pepper_view_mark_dirty(view, PEPPER_VIEW_GEOMETRY_DIRTY);
}
+/**
+ * Get the position of the given view
+ *
+ * @param view view object
+ * @param x pointer to receive x coordinate
+ * @param y pointer to receive y coordinate
+ *
+ * @see pepper_view_set_position()
+ */
PEPPER_API void
pepper_view_get_position(pepper_view_t *view, double *x, double *y)
{
*y = view->y;
}
+/**
+ * Set the transform matrix of the given view
+ *
+ * @param view view object
+ * @param matrix 4x4 transform matrix
+ *
+ * The transform might be relative to its parent or global frame.
+ *
+ * @see pepper_view_set_transform_inherit()
+ */
PEPPER_API void
pepper_view_set_transform(pepper_view_t *view, const pepper_mat4_t *matrix)
{
pepper_view_mark_dirty(view, PEPPER_VIEW_GEOMETRY_DIRTY);
}
+/**
+ * Get the transform matrix of the given view
+ *
+ * @param view view object
+ *
+ * @return the transform matrix
+ */
PEPPER_API const pepper_mat4_t *
pepper_view_get_transform(pepper_view_t *view)
{
return &view->transform;
}
+/**
+ * Map the given view
+ *
+ * @param view view object
+ *
+ * View is visible if it is mapped and its parent is visible.
+ *
+ * @see pepper_view_unmap()
+ */
PEPPER_API void
pepper_view_map(pepper_view_t *view)
{
pepper_view_mark_dirty(view, PEPPER_VIEW_ACTIVE_DIRTY);
}
+/**
+ * Unmap the given view
+ *
+ * @param view view object
+ *
+ * @see pepper_view_map()
+ */
PEPPER_API void
pepper_view_unmap(pepper_view_t *view)
{
pepper_view_mark_dirty(view, PEPPER_VIEW_ACTIVE_DIRTY);
}
+/**
+ * Check if the view is mapped
+ *
+ * @param view view object
+ *
+ * @return PEPPER_TRUE if the view is mapped, PEPPER_FALSE otherwise
+ *
+ * @see pepper_view_map()
+ * @see pepper_view_unmap()
+ * @see pepper_view_is_visible()
+ */
PEPPER_API pepper_bool_t
pepper_view_is_mapped(pepper_view_t *view)
{
return view->mapped;
}
+/**
+ * Check if the view is visible
+ *
+ * @param view view object
+ *
+ * @return PEPPER_TRUE if the view is visible, PEPPER_FALSE otherwise
+ *
+ * Here, visible means that all its parent and direct ancestors are mapped. The visility is not
+ * affected by the views obscuring the given view.
+ *
+ * @see pepper_view_map()
+ * @see pepper_view_unmap()
+ * @see pepper_view_is_mapped()
+ */
PEPPER_API pepper_bool_t
pepper_view_is_visible(pepper_view_t *view)
{
return view->mapped;
}
+/**
+ * Check if the view is opaque
+ *
+ * @param view view object
+ *
+ * @return PEPPER_TRUE if the view is opaque, PEPPER_FALSE otherwise
+ *
+ * If the content is opaque or opaque region of the surface covers entire region, the view is
+ * opaque.
+ */
PEPPER_API pepper_bool_t
pepper_view_is_opaque(pepper_view_t *view)
{
return PEPPER_FALSE;
}
+/**
+ * Get the view local coordinates for the given global coordinates
+ *
+ * @param view view object
+ * @param gx x coordinate in global space
+ * @param gy y coordinate in global space
+ * @param lx pointer to receive x coordinate in view local space
+ * @param ly pointer to receive y coordinate in view local space
+ */
PEPPER_API void
pepper_view_get_local_coordinate(pepper_view_t *view, double gx, double gy, double *lx, double *ly)
{
*ly = pos.y / pos.w;
}
+/**
+ * Get the global coodinates for the given local coordinates
+ *
+ * @param view view object
+ * @param lx x coordinate in view local space
+ * @param ly y coordinate in view local space
+ * @param gx pointer to receive x coordinate in global space
+ * @param gy pointer to receive y coordinate in global space
+ */
PEPPER_API void
pepper_view_get_global_coordinate(pepper_view_t *view, double lx, double ly, double *gx, double *gy)
{