wayland: Add accessor API to permit access to underlying Wayland structures

* clutter_wayland_input_device_get_wl_input_device for the input device
* clutter_wayland_stage_get_wl_surface for the Wayland surface
* clutter_wayland_stage_get_wl_shell_surface for the shell surface
This commit is contained in:
Rob Bradford 2012-02-10 16:46:45 +00:00
parent 84362a8257
commit cf735b54df
4 changed files with 139 additions and 0 deletions

View File

@ -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)

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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 <http://www.gnu.org/licenses/>.
*
*
*/
/**
* 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 <glib.h>
#include <wayland-client.h>
#include <clutter/clutter.h>
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__ */