mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
clutter: StageWindow: Use G_DECLARE_INTERFACE()
It cuts away a bit of the GObject boilerplate, gives us support for `g_autoptr`, and removes the typedef hack inside clutter-stage-window.c. https://gitlab.gnome.org/GNOME/mutter/merge_requests/380
This commit is contained in:
parent
f9e33a89fd
commit
b67394dcd1
@ -14,10 +14,6 @@
|
||||
* #ClutterStage actor, abstracting away the specifics of the windowing system.
|
||||
*/
|
||||
|
||||
#define clutter_stage_window_get_type _clutter_stage_window_get_type
|
||||
|
||||
typedef ClutterStageWindowIface ClutterStageWindowInterface;
|
||||
|
||||
G_DEFINE_INTERFACE (ClutterStageWindow, clutter_stage_window, G_TYPE_OBJECT);
|
||||
|
||||
static void
|
||||
@ -60,7 +56,7 @@ void
|
||||
_clutter_stage_window_set_title (ClutterStageWindow *window,
|
||||
const gchar *title)
|
||||
{
|
||||
ClutterStageWindowIface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
||||
ClutterStageWindowInterface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
||||
|
||||
if (iface->set_title)
|
||||
iface->set_title (window, title);
|
||||
@ -70,7 +66,7 @@ void
|
||||
_clutter_stage_window_set_fullscreen (ClutterStageWindow *window,
|
||||
gboolean is_fullscreen)
|
||||
{
|
||||
ClutterStageWindowIface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
||||
ClutterStageWindowInterface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
||||
|
||||
if (iface->set_fullscreen)
|
||||
iface->set_fullscreen (window, is_fullscreen);
|
||||
@ -80,7 +76,7 @@ void
|
||||
_clutter_stage_window_set_cursor_visible (ClutterStageWindow *window,
|
||||
gboolean is_visible)
|
||||
{
|
||||
ClutterStageWindowIface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
||||
ClutterStageWindowInterface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
||||
|
||||
if (iface->set_cursor_visible)
|
||||
iface->set_cursor_visible (window, is_visible);
|
||||
@ -138,7 +134,7 @@ void
|
||||
_clutter_stage_window_schedule_update (ClutterStageWindow *window,
|
||||
int sync_delay)
|
||||
{
|
||||
ClutterStageWindowIface *iface;
|
||||
ClutterStageWindowInterface *iface;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_STAGE_WINDOW (window));
|
||||
|
||||
@ -163,7 +159,7 @@ _clutter_stage_window_schedule_update (ClutterStageWindow *window,
|
||||
gint64
|
||||
_clutter_stage_window_get_update_time (ClutterStageWindow *window)
|
||||
{
|
||||
ClutterStageWindowIface *iface;
|
||||
ClutterStageWindowInterface *iface;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), 0);
|
||||
|
||||
@ -186,7 +182,7 @@ _clutter_stage_window_get_update_time (ClutterStageWindow *window)
|
||||
void
|
||||
_clutter_stage_window_clear_update_time (ClutterStageWindow *window)
|
||||
{
|
||||
ClutterStageWindowIface *iface;
|
||||
ClutterStageWindowInterface *iface;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_STAGE_WINDOW (window));
|
||||
|
||||
@ -204,7 +200,7 @@ void
|
||||
_clutter_stage_window_add_redraw_clip (ClutterStageWindow *window,
|
||||
cairo_rectangle_int_t *stage_clip)
|
||||
{
|
||||
ClutterStageWindowIface *iface;
|
||||
ClutterStageWindowInterface *iface;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_STAGE_WINDOW (window));
|
||||
|
||||
@ -224,7 +220,7 @@ _clutter_stage_window_add_redraw_clip (ClutterStageWindow *window,
|
||||
gboolean
|
||||
_clutter_stage_window_has_redraw_clips (ClutterStageWindow *window)
|
||||
{
|
||||
ClutterStageWindowIface *iface;
|
||||
ClutterStageWindowInterface *iface;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), FALSE);
|
||||
|
||||
@ -246,7 +242,7 @@ _clutter_stage_window_has_redraw_clips (ClutterStageWindow *window)
|
||||
gboolean
|
||||
_clutter_stage_window_ignoring_redraw_clips (ClutterStageWindow *window)
|
||||
{
|
||||
ClutterStageWindowIface *iface;
|
||||
ClutterStageWindowInterface *iface;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), FALSE);
|
||||
|
||||
@ -261,7 +257,7 @@ gboolean
|
||||
_clutter_stage_window_get_redraw_clip_bounds (ClutterStageWindow *window,
|
||||
cairo_rectangle_int_t *stage_clip)
|
||||
{
|
||||
ClutterStageWindowIface *iface;
|
||||
ClutterStageWindowInterface *iface;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), FALSE);
|
||||
|
||||
@ -276,7 +272,7 @@ void
|
||||
_clutter_stage_window_set_accept_focus (ClutterStageWindow *window,
|
||||
gboolean accept_focus)
|
||||
{
|
||||
ClutterStageWindowIface *iface;
|
||||
ClutterStageWindowInterface *iface;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_STAGE_WINDOW (window));
|
||||
|
||||
@ -288,7 +284,7 @@ _clutter_stage_window_set_accept_focus (ClutterStageWindow *window,
|
||||
void
|
||||
_clutter_stage_window_redraw (ClutterStageWindow *window)
|
||||
{
|
||||
ClutterStageWindowIface *iface;
|
||||
ClutterStageWindowInterface *iface;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_STAGE_WINDOW (window));
|
||||
|
||||
@ -303,7 +299,7 @@ _clutter_stage_window_get_dirty_pixel (ClutterStageWindow *window,
|
||||
ClutterStageView *view,
|
||||
int *x, int *y)
|
||||
{
|
||||
ClutterStageWindowIface *iface;
|
||||
ClutterStageWindowInterface *iface;
|
||||
|
||||
*x = 0;
|
||||
*y = 0;
|
||||
@ -318,7 +314,7 @@ _clutter_stage_window_get_dirty_pixel (ClutterStageWindow *window,
|
||||
gboolean
|
||||
_clutter_stage_window_can_clip_redraws (ClutterStageWindow *window)
|
||||
{
|
||||
ClutterStageWindowIface *iface;
|
||||
ClutterStageWindowInterface *iface;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), FALSE);
|
||||
|
||||
@ -332,7 +328,7 @@ _clutter_stage_window_can_clip_redraws (ClutterStageWindow *window)
|
||||
GList *
|
||||
_clutter_stage_window_get_views (ClutterStageWindow *window)
|
||||
{
|
||||
ClutterStageWindowIface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
||||
ClutterStageWindowInterface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
||||
|
||||
return iface->get_views (window);
|
||||
}
|
||||
@ -340,7 +336,7 @@ _clutter_stage_window_get_views (ClutterStageWindow *window)
|
||||
void
|
||||
_clutter_stage_window_finish_frame (ClutterStageWindow *window)
|
||||
{
|
||||
ClutterStageWindowIface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
||||
ClutterStageWindowInterface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
||||
|
||||
if (iface->finish_frame)
|
||||
iface->finish_frame (window);
|
||||
@ -349,7 +345,7 @@ _clutter_stage_window_finish_frame (ClutterStageWindow *window)
|
||||
int64_t
|
||||
_clutter_stage_window_get_frame_counter (ClutterStageWindow *window)
|
||||
{
|
||||
ClutterStageWindowIface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
||||
ClutterStageWindowInterface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
||||
|
||||
if (iface->get_frame_counter)
|
||||
return iface->get_frame_counter (window);
|
||||
|
@ -7,30 +7,21 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_STAGE_WINDOW (_clutter_stage_window_get_type ())
|
||||
#define CLUTTER_STAGE_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_STAGE_WINDOW, ClutterStageWindow))
|
||||
#define CLUTTER_IS_STAGE_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_STAGE_WINDOW))
|
||||
#define CLUTTER_STAGE_WINDOW_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CLUTTER_TYPE_STAGE_WINDOW, ClutterStageWindowIface))
|
||||
#define CLUTTER_TYPE_STAGE_WINDOW (clutter_stage_window_get_type ())
|
||||
|
||||
CLUTTER_EXPORT
|
||||
G_DECLARE_INTERFACE (ClutterStageWindow, clutter_stage_window,
|
||||
CLUTTER, STAGE_WINDOW,
|
||||
GObject)
|
||||
|
||||
/*
|
||||
* ClutterStageWindow: (skip)
|
||||
*
|
||||
* #ClutterStageWindow is an opaque structure
|
||||
* whose members should not be accessed directly
|
||||
*
|
||||
* Since: 0.8
|
||||
*/
|
||||
typedef struct _ClutterStageWindow ClutterStageWindow; /* dummy */
|
||||
typedef struct _ClutterStageWindowIface ClutterStageWindowIface;
|
||||
|
||||
/*
|
||||
* ClutterStageWindowIface: (skip)
|
||||
* ClutterStageWindowInterface: (skip)
|
||||
*
|
||||
* The interface implemented by backends for stage windows
|
||||
*
|
||||
* Since: 0.8
|
||||
*/
|
||||
struct _ClutterStageWindowIface
|
||||
struct _ClutterStageWindowInterface
|
||||
{
|
||||
/*< private >*/
|
||||
GTypeInterface parent_iface;
|
||||
@ -88,9 +79,6 @@ struct _ClutterStageWindowIface
|
||||
void (* finish_frame) (ClutterStageWindow *stage_window);
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType _clutter_stage_window_get_type (void) G_GNUC_CONST;
|
||||
|
||||
ClutterActor * _clutter_stage_window_get_wrapper (ClutterStageWindow *window);
|
||||
|
||||
void _clutter_stage_window_set_title (ClutterStageWindow *window,
|
||||
|
@ -2742,7 +2742,7 @@ clutter_stage_set_fullscreen (ClutterStage *stage,
|
||||
if (priv->is_fullscreen != fullscreen)
|
||||
{
|
||||
ClutterStageWindow *impl = CLUTTER_STAGE_WINDOW (priv->impl);
|
||||
ClutterStageWindowIface *iface;
|
||||
ClutterStageWindowInterface *iface;
|
||||
|
||||
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (impl);
|
||||
|
||||
@ -2807,7 +2807,7 @@ clutter_stage_set_user_resizable (ClutterStage *stage,
|
||||
&& priv->is_user_resizable != resizable)
|
||||
{
|
||||
ClutterStageWindow *impl = CLUTTER_STAGE_WINDOW (priv->impl);
|
||||
ClutterStageWindowIface *iface;
|
||||
ClutterStageWindowInterface *iface;
|
||||
|
||||
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (impl);
|
||||
if (iface->set_user_resizable)
|
||||
@ -2856,7 +2856,7 @@ clutter_stage_show_cursor (ClutterStage *stage)
|
||||
if (!priv->is_cursor_visible)
|
||||
{
|
||||
ClutterStageWindow *impl = CLUTTER_STAGE_WINDOW (priv->impl);
|
||||
ClutterStageWindowIface *iface;
|
||||
ClutterStageWindowInterface *iface;
|
||||
|
||||
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (impl);
|
||||
if (iface->set_cursor_visible)
|
||||
@ -2889,7 +2889,7 @@ clutter_stage_hide_cursor (ClutterStage *stage)
|
||||
if (priv->is_cursor_visible)
|
||||
{
|
||||
ClutterStageWindow *impl = CLUTTER_STAGE_WINDOW (priv->impl);
|
||||
ClutterStageWindowIface *iface;
|
||||
ClutterStageWindowInterface *iface;
|
||||
|
||||
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (impl);
|
||||
if (iface->set_cursor_visible)
|
||||
|
@ -60,7 +60,8 @@ typedef struct _ClutterStageViewCoglPrivate
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ClutterStageViewCogl, clutter_stage_view_cogl,
|
||||
CLUTTER_TYPE_STAGE_VIEW)
|
||||
|
||||
static void clutter_stage_window_iface_init (ClutterStageWindowIface *iface);
|
||||
static void
|
||||
clutter_stage_window_iface_init (ClutterStageWindowInterface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (ClutterStageCogl,
|
||||
_clutter_stage_cogl,
|
||||
@ -994,7 +995,7 @@ clutter_stage_cogl_get_dirty_pixel (ClutterStageWindow *stage_window,
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_window_iface_init (ClutterStageWindowIface *iface)
|
||||
clutter_stage_window_iface_init (ClutterStageWindowInterface *iface)
|
||||
{
|
||||
iface->realize = clutter_stage_cogl_realize;
|
||||
iface->unrealize = clutter_stage_cogl_unrealize;
|
||||
|
@ -49,10 +49,12 @@
|
||||
|
||||
#define STAGE_X11_IS_MAPPED(s) ((((ClutterStageX11 *) (s))->wm_state & STAGE_X11_WITHDRAWN) == 0)
|
||||
|
||||
static ClutterStageWindowIface *clutter_stage_window_parent_iface = NULL;
|
||||
static ClutterStageWindowInterface *clutter_stage_window_parent_iface = NULL;
|
||||
|
||||
static void clutter_stage_window_iface_init (ClutterStageWindowIface *iface);
|
||||
static void clutter_event_translator_iface_init (ClutterEventTranslatorIface *iface);
|
||||
static void
|
||||
clutter_stage_window_iface_init (ClutterStageWindowInterface *iface);
|
||||
static void
|
||||
clutter_event_translator_iface_init (ClutterEventTranslatorIface *iface);
|
||||
|
||||
static ClutterStageCogl *clutter_x11_get_stage_window_from_window (Window win);
|
||||
|
||||
@ -972,7 +974,7 @@ clutter_stage_x11_init (ClutterStageX11 *stage)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_window_iface_init (ClutterStageWindowIface *iface)
|
||||
clutter_stage_window_iface_init (ClutterStageWindowInterface *iface)
|
||||
{
|
||||
clutter_stage_window_parent_iface = g_type_interface_peek_parent (iface);
|
||||
|
||||
|
@ -45,7 +45,7 @@ struct _MetaStageNative
|
||||
};
|
||||
|
||||
static void
|
||||
clutter_stage_window_iface_init (ClutterStageWindowIface *iface);
|
||||
clutter_stage_window_iface_init (ClutterStageWindowInterface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (MetaStageNative, meta_stage_native,
|
||||
CLUTTER_TYPE_STAGE_COGL,
|
||||
@ -219,7 +219,7 @@ meta_stage_native_class_init (MetaStageNativeClass *klass)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_window_iface_init (ClutterStageWindowIface *iface)
|
||||
clutter_stage_window_iface_init (ClutterStageWindowInterface *iface)
|
||||
{
|
||||
iface->can_clip_redraws = meta_stage_native_can_clip_redraws;
|
||||
iface->get_geometry = meta_stage_native_get_geometry;
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "backends/x11/nested/meta-renderer-x11-nested.h"
|
||||
#include "clutter/clutter-mutter.h"
|
||||
|
||||
static ClutterStageWindowIface *clutter_stage_window_parent_iface = NULL;
|
||||
static ClutterStageWindowInterface *clutter_stage_window_parent_iface = NULL;
|
||||
|
||||
struct _MetaStageX11Nested
|
||||
{
|
||||
@ -45,7 +45,7 @@ struct _MetaStageX11Nested
|
||||
};
|
||||
|
||||
static void
|
||||
clutter_stage_window_iface_init (ClutterStageWindowIface *iface);
|
||||
clutter_stage_window_iface_init (ClutterStageWindowInterface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (MetaStageX11Nested, meta_stage_x11_nested,
|
||||
CLUTTER_TYPE_STAGE_X11,
|
||||
@ -350,7 +350,7 @@ meta_stage_x11_nested_class_init (MetaStageX11NestedClass *klass)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_window_iface_init (ClutterStageWindowIface *iface)
|
||||
clutter_stage_window_iface_init (ClutterStageWindowInterface *iface)
|
||||
{
|
||||
clutter_stage_window_parent_iface = g_type_interface_peek_parent (iface);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user