mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 15:40:41 -05:00
meta/plugin: Use G_DECLARE_DERIVABLE_TYPE
It cuts out some of the GObject boilerplate, and gives us g_autoptr() support for free. Since this changes the ABI, we also need to bump the libmutter API version.
This commit is contained in:
parent
e11ee44236
commit
ca7c5c1223
@ -9,7 +9,7 @@ m4_define([mutter_version],
|
||||
|
||||
m4_define([mutter_plugin_api_version], [3])
|
||||
|
||||
m4_define([libmutter_api_version], [3])
|
||||
m4_define([libmutter_api_version], [4])
|
||||
|
||||
AC_INIT([mutter], [mutter_version],
|
||||
[http://bugzilla.gnome.org/enter_bug.cgi?product=mutter])
|
||||
|
@ -6,7 +6,7 @@ project('mutter', 'c',
|
||||
|
||||
mutter_plugin_api_version = '3'
|
||||
|
||||
libmutter_api_version = '3'
|
||||
libmutter_api_version = '4'
|
||||
|
||||
# generic version requirements
|
||||
glib_req = '>= 2.53.2'
|
||||
|
@ -43,16 +43,14 @@
|
||||
#include "meta/display.h"
|
||||
#include "meta/util.h"
|
||||
|
||||
struct _MetaPluginPrivate
|
||||
|
||||
typedef struct _MetaPluginPrivate
|
||||
{
|
||||
MetaCompositor *compositor;
|
||||
};
|
||||
} MetaPluginPrivate;
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (MetaPlugin, meta_plugin, G_TYPE_OBJECT);
|
||||
|
||||
#define META_PLUGIN_GET_PRIVATE(obj) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), META_TYPE_PLUGIN, MetaPluginPrivate))
|
||||
|
||||
static void
|
||||
meta_plugin_class_init (MetaPluginClass *klass)
|
||||
{
|
||||
@ -61,7 +59,6 @@ meta_plugin_class_init (MetaPluginClass *klass)
|
||||
static void
|
||||
meta_plugin_init (MetaPlugin *self)
|
||||
{
|
||||
self->priv = META_PLUGIN_GET_PRIVATE (self);
|
||||
}
|
||||
|
||||
const MetaPluginInfo *
|
||||
@ -90,7 +87,7 @@ _meta_plugin_xevent_filter (MetaPlugin *plugin,
|
||||
void
|
||||
meta_plugin_switch_workspace_completed (MetaPlugin *plugin)
|
||||
{
|
||||
MetaPluginPrivate *priv = META_PLUGIN (plugin)->priv;
|
||||
MetaPluginPrivate *priv = meta_plugin_get_instance_private (plugin);
|
||||
|
||||
meta_switch_workspace_completed (priv->compositor);
|
||||
}
|
||||
@ -164,7 +161,7 @@ meta_plugin_begin_modal (MetaPlugin *plugin,
|
||||
MetaModalOptions options,
|
||||
guint32 timestamp)
|
||||
{
|
||||
MetaPluginPrivate *priv = META_PLUGIN (plugin)->priv;
|
||||
MetaPluginPrivate *priv = meta_plugin_get_instance_private (plugin);
|
||||
|
||||
return meta_begin_modal_for_plugin (priv->compositor, plugin,
|
||||
options, timestamp);
|
||||
@ -185,7 +182,7 @@ void
|
||||
meta_plugin_end_modal (MetaPlugin *plugin,
|
||||
guint32 timestamp)
|
||||
{
|
||||
MetaPluginPrivate *priv = META_PLUGIN (plugin)->priv;
|
||||
MetaPluginPrivate *priv = meta_plugin_get_instance_private (plugin);
|
||||
|
||||
meta_end_modal_for_plugin (priv->compositor, plugin, timestamp);
|
||||
}
|
||||
@ -201,7 +198,7 @@ meta_plugin_end_modal (MetaPlugin *plugin,
|
||||
MetaDisplay *
|
||||
meta_plugin_get_display (MetaPlugin *plugin)
|
||||
{
|
||||
MetaPluginPrivate *priv = META_PLUGIN (plugin)->priv;
|
||||
MetaPluginPrivate *priv = meta_plugin_get_instance_private (plugin);
|
||||
|
||||
return priv->compositor->display;
|
||||
}
|
||||
@ -209,7 +206,7 @@ meta_plugin_get_display (MetaPlugin *plugin)
|
||||
void
|
||||
_meta_plugin_set_compositor (MetaPlugin *plugin, MetaCompositor *compositor)
|
||||
{
|
||||
MetaPluginPrivate *priv = META_PLUGIN (plugin)->priv;
|
||||
MetaPluginPrivate *priv = meta_plugin_get_instance_private (plugin);
|
||||
|
||||
priv->compositor = compositor;
|
||||
}
|
||||
|
@ -33,25 +33,11 @@
|
||||
#include "meta/meta-version.h"
|
||||
#include "meta/types.h"
|
||||
|
||||
#define META_TYPE_PLUGIN (meta_plugin_get_type ())
|
||||
#define META_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_PLUGIN, MetaPlugin))
|
||||
#define META_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_PLUGIN, MetaPluginClass))
|
||||
#define META_IS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_PLUGIN))
|
||||
#define META_IS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_PLUGIN))
|
||||
#define META_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_PLUGIN, MetaPluginClass))
|
||||
#define META_TYPE_PLUGIN (meta_plugin_get_type ())
|
||||
G_DECLARE_DERIVABLE_TYPE (MetaPlugin, meta_plugin, META, PLUGIN, GObject)
|
||||
|
||||
typedef struct _MetaPlugin MetaPlugin;
|
||||
typedef struct _MetaPluginClass MetaPluginClass;
|
||||
typedef struct _MetaPluginVersion MetaPluginVersion;
|
||||
typedef struct _MetaPluginInfo MetaPluginInfo;
|
||||
typedef struct _MetaPluginPrivate MetaPluginPrivate;
|
||||
|
||||
struct _MetaPlugin
|
||||
{
|
||||
GObject parent;
|
||||
|
||||
MetaPluginPrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* MetaPluginClass:
|
||||
@ -270,8 +256,6 @@ struct _MetaPluginInfo
|
||||
const gchar *description;
|
||||
};
|
||||
|
||||
GType meta_plugin_get_type (void);
|
||||
|
||||
const MetaPluginInfo * meta_plugin_get_info (MetaPlugin *plugin);
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user