From f061a6d79387103b4a00e0d7ebb52fc4267c11cd Mon Sep 17 00:00:00 2001 From: Tomas Frydrych Date: Wed, 8 Oct 2008 16:01:04 +0100 Subject: [PATCH] Added convenience function meta_comp_clutter_plugin_effect_completed() --- src/Makefile.am | 17 +++---- .../clutter/clutter-plugins/default.c | 44 ++++++++++--------- .../clutter/clutter-plugins/moblin.c | 44 ++++++++++--------- .../clutter/compositor-clutter-plugin.c | 35 +++++++++++++++ src/include/compositor-clutter-plugin.h | 18 ++++++++ 5 files changed, 108 insertions(+), 50 deletions(-) create mode 100644 src/compositor/clutter/compositor-clutter-plugin.c diff --git a/src/Makefile.am b/src/Makefile.am index cfb3943b4..1c1a07ad0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -103,14 +103,15 @@ metacity_SOURCES= \ ui/ui.c if WITH_CLUTTER -metacity_SOURCES += \ - compositor/clutter/compositor-clutter.c \ - compositor/clutter/compositor-clutter.h \ - compositor/clutter/tidy-texture-frame.c \ - compositor/clutter/tidy-texture-frame.h \ - compositor/clutter/shaped-texture.c \ - compositor/clutter/shaped-texture.h \ - include/compositor-clutter-plugin.h \ +metacity_SOURCES += \ + compositor/clutter/compositor-clutter.c \ + compositor/clutter/compositor-clutter.h \ + compositor/clutter/tidy-texture-frame.c \ + compositor/clutter/tidy-texture-frame.h \ + compositor/clutter/shaped-texture.c \ + compositor/clutter/shaped-texture.h \ + compositor/clutter/compositor-clutter-plugin.c \ + include/compositor-clutter-plugin.h \ compositor/clutter/compositor-clutter-plugin-manager.c \ compositor/clutter/compositor-clutter-plugin-manager.h endif diff --git a/src/compositor/clutter/clutter-plugins/default.c b/src/compositor/clutter/clutter-plugins/default.c index 935fe2436..919f5bdb8 100644 --- a/src/compositor/clutter/clutter-plugins/default.c +++ b/src/compositor/clutter/clutter-plugins/default.c @@ -187,8 +187,7 @@ on_switch_workspace_effect_complete (ClutterActor *group, gpointer data) ppriv->desktop1 = NULL; ppriv->desktop2 = NULL; - if (plugin->completed) - plugin->completed (plugin, actor_for_cb, + meta_comp_clutter_plugin_effect_completed (plugin, actor_for_cb, META_COMPOSITOR_CLUTTER_PLUGIN_SWITCH_WORKSPACE); } @@ -219,8 +218,7 @@ switch_workspace (const GList **actors, gint from, gint to) if (from == to) { - if (plugin->completed) - plugin->completed (plugin, NULL, + meta_comp_clutter_plugin_effect_completed (plugin, NULL, META_COMPOSITOR_CLUTTER_PLUGIN_SWITCH_WORKSPACE); return; } @@ -314,8 +312,8 @@ on_minimize_effect_complete (ClutterActor *actor, gpointer data) plugin->running--; /* Now notify the manager that we are done with this effect */ - if (plugin->completed) - plugin->completed (plugin, mcw, META_COMPOSITOR_CLUTTER_PLUGIN_MINIMIZE); + meta_comp_clutter_plugin_effect_completed (plugin, mcw, + META_COMPOSITOR_CLUTTER_PLUGIN_MINIMIZE); } /* @@ -352,8 +350,9 @@ minimize (MetaCompWindow *mcw) on_minimize_effect_complete, NULL); } - else if (plugin->completed) - plugin->completed (plugin, mcw, META_COMPOSITOR_CLUTTER_PLUGIN_MINIMIZE); + else + meta_comp_clutter_plugin_effect_completed (plugin, mcw, + META_COMPOSITOR_CLUTTER_PLUGIN_MINIMIZE); } /* @@ -380,8 +379,8 @@ on_maximize_effect_complete (ClutterActor *actor, gpointer data) plugin->running--; /* Now notify the manager that we are done with this effect */ - if (plugin->completed) - plugin->completed (plugin, mcw, META_COMPOSITOR_CLUTTER_PLUGIN_MAXIMIZE); + meta_comp_clutter_plugin_effect_completed (plugin, mcw, + META_COMPOSITOR_CLUTTER_PLUGIN_MAXIMIZE); } /* @@ -444,8 +443,8 @@ maximize (MetaCompWindow *mcw, return; } - if (plugin->completed) - plugin->completed (plugin, mcw, META_COMPOSITOR_CLUTTER_PLUGIN_MAXIMIZE); + meta_comp_clutter_plugin_effect_completed (plugin, mcw, + META_COMPOSITOR_CLUTTER_PLUGIN_MAXIMIZE); } /* @@ -470,7 +469,8 @@ unmaximize (MetaCompWindow *mcw, } /* Do this conditionally, if the effect requires completion callback. */ - plugin->completed (plugin, mcw, META_COMPOSITOR_CLUTTER_PLUGIN_UNMAXIMIZE); + meta_comp_clutter_plugin_effect_completed (plugin, mcw, + META_COMPOSITOR_CLUTTER_PLUGIN_UNMAXIMIZE); } static void @@ -492,8 +492,8 @@ on_map_effect_complete (ClutterActor *actor, gpointer data) plugin->running--; /* Now notify the manager that we are done with this effect */ - if (plugin->completed) - plugin->completed (plugin, mcw, META_COMPOSITOR_CLUTTER_PLUGIN_MAP); + meta_comp_clutter_plugin_effect_completed (plugin, mcw, + META_COMPOSITOR_CLUTTER_PLUGIN_MAP); } /* @@ -533,8 +533,9 @@ map (MetaCompWindow *mcw) apriv->is_minimized = FALSE; } - else if (plugin->completed) - plugin->completed (plugin, mcw, META_COMPOSITOR_CLUTTER_PLUGIN_MAP); + else + meta_comp_clutter_plugin_effect_completed (plugin, mcw, + META_COMPOSITOR_CLUTTER_PLUGIN_MAP); } /* @@ -553,8 +554,8 @@ on_destroy_effect_complete (ClutterActor *actor, gpointer data) plugin->running--; - if (plugin->completed) - plugin->completed (plugin, mcw, META_COMPOSITOR_CLUTTER_PLUGIN_DESTROY); + meta_comp_clutter_plugin_effect_completed (plugin, mcw, + META_COMPOSITOR_CLUTTER_PLUGIN_DESTROY); } /* @@ -587,8 +588,9 @@ destroy (MetaCompWindow *mcw) on_destroy_effect_complete, NULL); } - else if (plugin->completed) - plugin->completed (plugin, mcw, META_COMPOSITOR_CLUTTER_PLUGIN_DESTROY); + else + meta_comp_clutter_plugin_effect_completed (plugin, mcw, + META_COMPOSITOR_CLUTTER_PLUGIN_DESTROY); } static void diff --git a/src/compositor/clutter/clutter-plugins/moblin.c b/src/compositor/clutter/clutter-plugins/moblin.c index e14b43981..4fad21e42 100644 --- a/src/compositor/clutter/clutter-plugins/moblin.c +++ b/src/compositor/clutter/clutter-plugins/moblin.c @@ -187,8 +187,7 @@ on_switch_workspace_effect_complete (ClutterActor *group, gpointer data) ppriv->desktop1 = NULL; ppriv->desktop2 = NULL; - if (plugin->completed) - plugin->completed (plugin, actor_for_cb, + meta_comp_clutter_plugin_effect_completed (plugin, actor_for_cb, META_COMPOSITOR_CLUTTER_PLUGIN_SWITCH_WORKSPACE); } @@ -219,8 +218,7 @@ switch_workspace (const GList **actors, gint from, gint to) if (from == to) { - if (plugin->completed) - plugin->completed (plugin, NULL, + meta_comp_clutter_plugin_effect_completed (plugin, NULL, META_COMPOSITOR_CLUTTER_PLUGIN_SWITCH_WORKSPACE); return; } @@ -314,8 +312,8 @@ on_minimize_effect_complete (ClutterActor *actor, gpointer data) plugin->running--; /* Now notify the manager that we are done with this effect */ - if (plugin->completed) - plugin->completed (plugin, mcw, META_COMPOSITOR_CLUTTER_PLUGIN_MINIMIZE); + meta_comp_clutter_plugin_effect_completed (plugin, mcw, + META_COMPOSITOR_CLUTTER_PLUGIN_MINIMIZE); } /* @@ -352,8 +350,9 @@ minimize (MetaCompWindow *mcw) on_minimize_effect_complete, NULL); } - else if (plugin->completed) - plugin->completed (plugin, mcw, META_COMPOSITOR_CLUTTER_PLUGIN_MINIMIZE); + else + meta_comp_clutter_plugin_effect_completed (plugin, mcw, + META_COMPOSITOR_CLUTTER_PLUGIN_MINIMIZE); } /* @@ -380,8 +379,8 @@ on_maximize_effect_complete (ClutterActor *actor, gpointer data) plugin->running--; /* Now notify the manager that we are done with this effect */ - if (plugin->completed) - plugin->completed (plugin, mcw, META_COMPOSITOR_CLUTTER_PLUGIN_MAXIMIZE); + meta_comp_clutter_plugin_effect_completed (plugin, mcw, + META_COMPOSITOR_CLUTTER_PLUGIN_MAXIMIZE); } /* @@ -444,8 +443,8 @@ maximize (MetaCompWindow *mcw, return; } - if (plugin->completed) - plugin->completed (plugin, mcw, META_COMPOSITOR_CLUTTER_PLUGIN_MAXIMIZE); + meta_comp_clutter_plugin_effect_completed (plugin, mcw, + META_COMPOSITOR_CLUTTER_PLUGIN_MAXIMIZE); } /* @@ -470,7 +469,8 @@ unmaximize (MetaCompWindow *mcw, } /* Do this conditionally, if the effect requires completion callback. */ - plugin->completed (plugin, mcw, META_COMPOSITOR_CLUTTER_PLUGIN_UNMAXIMIZE); + meta_comp_clutter_plugin_effect_completed (plugin, mcw, + META_COMPOSITOR_CLUTTER_PLUGIN_UNMAXIMIZE); } static void @@ -492,8 +492,8 @@ on_map_effect_complete (ClutterActor *actor, gpointer data) plugin->running--; /* Now notify the manager that we are done with this effect */ - if (plugin->completed) - plugin->completed (plugin, mcw, META_COMPOSITOR_CLUTTER_PLUGIN_MAP); + meta_comp_clutter_plugin_effect_completed (plugin, mcw, + META_COMPOSITOR_CLUTTER_PLUGIN_MAP); } /* @@ -533,8 +533,9 @@ map (MetaCompWindow *mcw) apriv->is_minimized = FALSE; } - else if (plugin->completed) - plugin->completed (plugin, mcw, META_COMPOSITOR_CLUTTER_PLUGIN_MAP); + else + meta_comp_clutter_plugin_effect_completed (plugin, mcw, + META_COMPOSITOR_CLUTTER_PLUGIN_MAP); } /* @@ -553,8 +554,8 @@ on_destroy_effect_complete (ClutterActor *actor, gpointer data) plugin->running--; - if (plugin->completed) - plugin->completed (plugin, mcw, META_COMPOSITOR_CLUTTER_PLUGIN_DESTROY); + meta_comp_clutter_plugin_effect_completed (plugin, mcw, + META_COMPOSITOR_CLUTTER_PLUGIN_DESTROY); } /* @@ -587,8 +588,9 @@ destroy (MetaCompWindow *mcw) on_destroy_effect_complete, NULL); } - else if (plugin->completed) - plugin->completed (plugin, mcw, META_COMPOSITOR_CLUTTER_PLUGIN_DESTROY); + else + meta_comp_clutter_plugin_effect_completed (plugin, mcw, + META_COMPOSITOR_CLUTTER_PLUGIN_DESTROY); } static void diff --git a/src/compositor/clutter/compositor-clutter-plugin.c b/src/compositor/clutter/compositor-clutter-plugin.c new file mode 100644 index 000000000..d7f2771c4 --- /dev/null +++ b/src/compositor/clutter/compositor-clutter-plugin.c @@ -0,0 +1,35 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ + +/* + * Copyright (c) 2008 Intel Corp. + * + * Author: Tomas Frydrych + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program 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 + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#define G_IMPLEMENT_INLINES + +#include "compositor-clutter-plugin.h" + +void +meta_comp_clutter_plugin_effect_completed (MetaCompositorClutterPlugin *plugin, + MetaCompWindow *actor, + unsigned long event) +{ + if (plugin->completed) + plugin->completed (plugin, actor, event); +} diff --git a/src/include/compositor-clutter-plugin.h b/src/include/compositor-clutter-plugin.h index 34464030a..7d32547cf 100644 --- a/src/include/compositor-clutter-plugin.h +++ b/src/include/compositor-clutter-plugin.h @@ -245,4 +245,22 @@ struct MetaCompositorClutterPlugin void *manager_private; }; +G_INLINE_FUNC +void +meta_comp_clutter_plugin_effect_completed (MetaCompositorClutterPlugin *plugin, + MetaCompWindow *actor, + unsigned long event); + +#if defined (G_CAN_INLINE) +G_INLINE_FUNC +void +meta_comp_clutter_plugin_effect_completed (MetaCompositorClutterPlugin *plugin, + MetaCompWindow *actor, + unsigned long event) +{ + if (plugin->completed) + plugin->completed (plugin, actor, event); +} +#endif + #endif