diff --git a/clutter/Makefile.am b/clutter/Makefile.am index 0d94fddbd..6a523196d 100644 --- a/clutter/Makefile.am +++ b/clutter/Makefile.am @@ -603,6 +603,10 @@ backend_source_c += \ $(srcdir)/wayland/clutter-input-device-wayland.c \ $(srcdir)/wayland/clutter-device-manager-wayland.c + +clutterwayland_includedir = $(clutter_includedir)/wayland +clutterwayland_include_HEADERS = $(srcdir)/wayland/clutter-wayland.h + clutter-wayland-$(CLUTTER_API_VERSION).pc: clutter-$(CLUTTER_API_VERSION).pc $(QUIET_GEN)cp -f $< $(@F) diff --git a/clutter/wayland/clutter-input-device-wayland.c b/clutter/wayland/clutter-input-device-wayland.c index af5aed286..2210b5fa9 100644 --- a/clutter/wayland/clutter-input-device-wayland.c +++ b/clutter/wayland/clutter-input-device-wayland.c @@ -256,3 +256,32 @@ static void clutter_input_device_wayland_init (ClutterInputDeviceWayland *self) { } + +/** + * clutter_wayland_input_device_get_wl_input_device: (skip) + * + * @device: a #ClutterInputDevice + * + * Access the underlying data structure representing the Wayland device that is + * backing this #ClutterInputDevice. + * + * Note: this function can only be called when running on the Wayland platform. + * Calling this function at any other time will return %NULL. + * + * Returns: (transfer none): the Wayland input device associated with the + * @device + * + * Since: 1.10 + */ +struct wl_input_device * +clutter_wayland_input_device_get_wl_input_device (ClutterInputDevice *device) +{ + ClutterInputDeviceWayland *wayland_device; + + if (!CLUTTER_INPUT_DEVICE_WAYLAND (device)) + return NULL; + + wayland_device = CLUTTER_INPUT_DEVICE_WAYLAND (device); + + return wayland_device->input_device; +} diff --git a/clutter/wayland/clutter-stage-wayland.c b/clutter/wayland/clutter-stage-wayland.c index 583c47240..6b7a0671f 100644 --- a/clutter/wayland/clutter-stage-wayland.c +++ b/clutter/wayland/clutter-stage-wayland.c @@ -183,3 +183,61 @@ static void clutter_stage_wayland_class_init (ClutterStageWaylandClass *klass) { } + +/** + * clutter_wayland_stage_get_wl_shell_surface: (skip) + * + * @stage: a #ClutterStage + * + * Access the underlying data structure representing the shell surface that is + * backing the #ClutterStage + * + * Note: this function can only be called when running on the Wayland + * platform. Calling this function at any other time will return %NULL. + * + * Returns: (transfer non): the Wayland shell surface associated with + * @stage + * + * Since: 1.10 + */ +struct wl_shell_surface * +clutter_wayland_stage_get_wl_shell_surface (ClutterStage *stage) +{ + ClutterStageWindow *stage_window = _clutter_stage_get_window (stage); + ClutterStageWayland *stage_wayland; + + if (!CLUTTER_IS_STAGE_WAYLAND (stage_window)) + return NULL; + + stage_wayland = CLUTTER_STAGE_WAYLAND (stage_window); + + return stage_wayland->wayland_shell_surface; +} + +/** + * clutter_wayland_stage_get_wl_surface: (skip) + * + * @stage: a #ClutterStage + * + * Access the underlying data structure representing the surface that is + * backing the #ClutterStage + * + * Note: this function can only be called when running on the Wayland + * platform. Calling this function at any other time will return %NULL. + * + * Returns: (transfer none): the Wayland surface associated with @stage + */ +struct wl_surface * +clutter_wayland_stage_get_wl_surface (ClutterStage *stage) +{ + ClutterStageWindow *stage_window = _clutter_stage_get_window (stage); + ClutterStageWayland *stage_wayland; + + if (!CLUTTER_IS_STAGE_WAYLAND (stage_window)) + return NULL; + + stage_wayland = CLUTTER_STAGE_WAYLAND (stage_window); + + return stage_wayland->wayland_surface; + +} diff --git a/clutter/wayland/clutter-wayland.h b/clutter/wayland/clutter-wayland.h new file mode 100644 index 000000000..55b874876 --- /dev/null +++ b/clutter/wayland/clutter-wayland.h @@ -0,0 +1,48 @@ +/* + * Clutter. + * + * An OpenGL based 'interactive canvas' library. + * + * Copyright (C) 2012 Intel Corporation + * + * 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, see . + * + * + */ + +/** + * SECTION:clutter-wayland + * @short_description: Wayland specific API + * + * The Wayland backend for Clutter provides some specific API, allowing + * integration with the Wayland client API for acessing the underlying data + * structures + * + * The Clutter Wayland API is available since Clutter 1.10 + */ + +#ifndef __CLUTTER_WAYLAND_H__ +#define __CLUTTER_WAYLAND_H__ + +#include +#include +#include +G_BEGIN_DECLS + +struct wl_input_device *clutter_wayland_input_device_get_wl_input_device (ClutterInputDevice *device); +struct wl_shell_surface *clutter_wayland_stage_get_wl_shell_surface (ClutterStage *stage); +struct wl_surface *clutter_wayland_stage_get_wl_surface (ClutterStage *stage); +G_END_DECLS + +#endif /* __CLUTTER_WAYLAND_H__ */