Added convenience function meta_comp_clutter_plugin_effect_completed()

This commit is contained in:
Tomas Frydrych 2008-10-08 16:01:04 +01:00
parent 976635a22b
commit f061a6d793
5 changed files with 108 additions and 50 deletions

View File

@ -110,6 +110,7 @@ metacity_SOURCES += \
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

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,35 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright (c) 2008 Intel Corp.
*
* Author: Tomas Frydrych <tf@linux.intel.com>
*
* 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);
}

View File

@ -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