Accessors for plugins to obtain stage and overlay_group actors.

This commit is contained in:
Tomas Frydrych 2008-10-09 13:22:32 +01:00
parent 0e6fba083f
commit 1a8e5872d1
7 changed files with 72 additions and 21 deletions

View File

@ -205,7 +205,9 @@ switch_workspace (const GList **actors, gint from, gint to)
gint n_workspaces;
ClutterActor *group1 = clutter_group_new ();
ClutterActor *group2 = clutter_group_new ();
ClutterActor *stage = plugin->stage;
ClutterActor *stage;
stage = meta_comp_clutter_plugin_get_stage (plugin);
#if 1
clutter_actor_set_anchor_point (group2,

View File

@ -205,7 +205,9 @@ switch_workspace (const GList **actors, gint from, gint to)
gint n_workspaces;
ClutterActor *group1 = clutter_group_new ();
ClutterActor *group2 = clutter_group_new ();
ClutterActor *stage = plugin->stage;
ClutterActor *stage;
stage = meta_comp_clutter_plugin_get_stage (plugin);
#if 1
clutter_actor_set_anchor_point (group2,

View File

@ -35,7 +35,6 @@ static gboolean meta_compositor_clutter_plugin_manager_reload (MetaCompositorClu
struct MetaCompositorClutterPluginManager
{
MetaScreen *screen;
ClutterActor *stage;
GList *plugins; /* TODO -- maybe use hash table */
GList *unload; /* Plugins that are disabled and pending unload */
@ -47,7 +46,8 @@ typedef struct MetaCompositorClutterPluginPrivate MetaCompositorClutterPluginPri
struct MetaCompositorClutterPluginPrivate
{
GModule *module;
MetaCompositorClutterPluginManager *self;
GModule *module;
gboolean disabled : 1;
};
@ -127,10 +127,9 @@ update_plugin_workspaces (MetaScreen *screen,
* struct.
*/
static MetaCompositorClutterPlugin *
meta_compositor_clutter_plugin_load (MetaScreen *screen,
ClutterActor *stage,
GModule *module,
const gchar *params)
meta_compositor_clutter_plugin_load (MetaCompositorClutterPluginManager *mgr,
GModule *module,
const gchar *params)
{
MetaCompositorClutterPlugin *plg;
@ -146,14 +145,14 @@ meta_compositor_clutter_plugin_load (MetaScreen *screen,
priv = g_new0 (MetaCompositorClutterPluginPrivate, 1);
plg->params = g_strdup (params);
plg->completed = meta_compositor_clutter_effect_completed;
plg->stage = stage;
plg->manager_private = priv;
priv->module = module;
priv->self = mgr;
meta_screen_get_size (screen,
meta_screen_get_size (mgr->screen,
&plg->screen_width, &plg->screen_height);
update_plugin_workspaces (screen, plg);
update_plugin_workspaces (mgr->screen, plg);
/*
* Check for and run the plugin init function.
@ -342,8 +341,7 @@ meta_compositor_clutter_plugin_manager_load (MetaCompositorClutterPluginManager
{
MetaCompositorClutterPlugin *p;
if ((p = meta_compositor_clutter_plugin_load (mgr->screen,
mgr->stage,
if ((p = meta_compositor_clutter_plugin_load (mgr,
plg, params)))
mgr->plugins = g_list_prepend (mgr->plugins, p);
else
@ -437,15 +435,13 @@ meta_compositor_clutter_plugin_manager_update_workspaces (MetaCompositorClutterP
}
MetaCompositorClutterPluginManager *
meta_compositor_clutter_plugin_manager_new (MetaScreen *screen,
ClutterActor *stage)
meta_compositor_clutter_plugin_manager_new (MetaScreen *screen)
{
MetaCompositorClutterPluginManager *mgr;
mgr = g_new0 (MetaCompositorClutterPluginManager, 1);
mgr->screen = screen;
mgr->stage = stage;
mgr->screen = screen;
if (!meta_compositor_clutter_plugin_manager_init (mgr))
{
@ -682,3 +678,24 @@ meta_compositor_clutter_plugin_manager_xevent_filter
return FALSE;
}
/*
* Public accessors for plugins, exposed from compositor-clutter-plugin.h
*/
ClutterActor *
meta_comp_clutter_plugin_get_overlay_group (MetaCompositorClutterPlugin *plugin)
{
MetaCompositorClutterPluginPrivate *priv = plugin->manager_private;
MetaCompositorClutterPluginManager *mgr = priv->self;
return meta_compositor_clutter_get_overlay_group_for_screen (mgr->screen);
}
ClutterActor *
meta_comp_clutter_plugin_get_stage (MetaCompositorClutterPlugin *plugin)
{
MetaCompositorClutterPluginPrivate *priv = plugin->manager_private;
MetaCompositorClutterPluginManager *mgr = priv->self;
return meta_compositor_clutter_get_stage_for_screen (mgr->screen);
}

View File

@ -30,7 +30,7 @@
typedef struct MetaCompositorClutterPluginManager MetaCompositorClutterPluginManager;
MetaCompositorClutterPluginManager * meta_compositor_clutter_plugin_manager_new (MetaScreen *screen, ClutterActor *stage);
MetaCompositorClutterPluginManager * meta_compositor_clutter_plugin_manager_new (MetaScreen *screen);
gboolean meta_compositor_clutter_plugin_manager_event_simple (MetaCompositorClutterPluginManager *mgr,
MetaCompWindow *actor,
unsigned long event);
@ -53,4 +53,5 @@ gboolean meta_compositor_clutter_plugin_manager_switch_workspace (MetaCompositor
gboolean meta_compositor_clutter_plugin_manager_xevent_filter (MetaCompositorClutterPluginManager *mgr,
XEvent *xev);
#endif

View File

@ -1673,6 +1673,29 @@ get_output_window (MetaScreen *screen)
return output;
}
ClutterActor *
meta_compositor_clutter_get_stage_for_screen (MetaScreen *screen)
{
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
if (!info)
return NULL;
return info->stage;
}
ClutterActor *
meta_compositor_clutter_get_overlay_group_for_screen (MetaScreen *screen)
{
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
if (!info)
return NULL;
return info->overlay_group;
}
static void
clutter_cmp_manage_screen (MetaCompositor *compositor,
MetaScreen *screen)
@ -1745,7 +1768,7 @@ clutter_cmp_manage_screen (MetaCompositor *compositor,
info->plugin_mgr =
meta_compositor_clutter_plugin_manager_new (screen, info->stage);
meta_compositor_clutter_plugin_manager_new (screen);
clutter_actor_show_all (info->stage);
clutter_actor_show_all (info->overlay_group);

View File

@ -212,8 +212,6 @@ struct MetaCompositorClutterPlugin
* switch-workspace
*/
ClutterActor *stage;
gint screen_width;
gint screen_height;
@ -264,3 +262,9 @@ meta_comp_clutter_plugin_effect_completed (MetaCompositorClutterPlugin *plugin,
#endif
#endif
ClutterActor *
meta_comp_clutter_plugin_get_overlay_group (MetaCompositorClutterPlugin *plugin);
ClutterActor *
meta_comp_clutter_plugin_get_stage (MetaCompositorClutterPlugin *plugin);

View File

@ -67,5 +67,7 @@ MetaCompositor *meta_compositor_clutter_new (MetaDisplay *display);
void meta_compositor_clutter_window_effect_completed (MetaCompWindow *actor, gulong event);
ClutterActor * meta_compositor_clutter_get_stage_for_screen (MetaScreen *screen);
ClutterActor * meta_compositor_clutter_get_overlay_group_for_screen (MetaScreen *screen);
#endif