From 1a8e5872d16104289d9ee921e9dd9f101c441bfc Mon Sep 17 00:00:00 2001 From: Tomas Frydrych Date: Thu, 9 Oct 2008 13:22:32 +0100 Subject: [PATCH] Accessors for plugins to obtain stage and overlay_group actors. --- .../clutter/clutter-plugins/default.c | 4 +- .../clutter/clutter-plugins/moblin.c | 4 +- .../compositor-clutter-plugin-manager.c | 47 +++++++++++++------ .../compositor-clutter-plugin-manager.h | 3 +- src/compositor/clutter/compositor-clutter.c | 25 +++++++++- src/include/compositor-clutter-plugin.h | 8 +++- src/include/compositor-clutter.h | 2 + 7 files changed, 72 insertions(+), 21 deletions(-) diff --git a/src/compositor/clutter/clutter-plugins/default.c b/src/compositor/clutter/clutter-plugins/default.c index b1d1f96e5..88d3ea73c 100644 --- a/src/compositor/clutter/clutter-plugins/default.c +++ b/src/compositor/clutter/clutter-plugins/default.c @@ -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, diff --git a/src/compositor/clutter/clutter-plugins/moblin.c b/src/compositor/clutter/clutter-plugins/moblin.c index 83171b56a..6cb2d89c3 100644 --- a/src/compositor/clutter/clutter-plugins/moblin.c +++ b/src/compositor/clutter/clutter-plugins/moblin.c @@ -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, diff --git a/src/compositor/clutter/compositor-clutter-plugin-manager.c b/src/compositor/clutter/compositor-clutter-plugin-manager.c index 1707b0ee2..1e07c5424 100644 --- a/src/compositor/clutter/compositor-clutter-plugin-manager.c +++ b/src/compositor/clutter/compositor-clutter-plugin-manager.c @@ -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); +} diff --git a/src/compositor/clutter/compositor-clutter-plugin-manager.h b/src/compositor/clutter/compositor-clutter-plugin-manager.h index a2ca52168..e2b5dde81 100644 --- a/src/compositor/clutter/compositor-clutter-plugin-manager.h +++ b/src/compositor/clutter/compositor-clutter-plugin-manager.h @@ -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 diff --git a/src/compositor/clutter/compositor-clutter.c b/src/compositor/clutter/compositor-clutter.c index f23de1d79..9b5e0bfff 100644 --- a/src/compositor/clutter/compositor-clutter.c +++ b/src/compositor/clutter/compositor-clutter.c @@ -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); diff --git a/src/include/compositor-clutter-plugin.h b/src/include/compositor-clutter-plugin.h index 7d32547cf..6f03c1c9b 100644 --- a/src/include/compositor-clutter-plugin.h +++ b/src/include/compositor-clutter-plugin.h @@ -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); diff --git a/src/include/compositor-clutter.h b/src/include/compositor-clutter.h index 6eab55fde..0663ef9de 100644 --- a/src/include/compositor-clutter.h +++ b/src/include/compositor-clutter.h @@ -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