Clean up MutterPlugin effect interface
The current effect API passes an unnecessary list of windows to switch_workspace() and forces a window to be passed in when killing the switch_workspace() effect. We can simplify the interface to correspond more closely to how it is actually used and fix these problems: Remove the actors parameter to plugin->switch_workspace Remove the events parameter to plugin->kill_effect and rename it to kill_window_effects Add plugin->kill_switch_workspace Remove mutter_plugin_manager_kill_effect Add mutter_plugin_manager_kill_window_effects Add mutter_plugin_manager_kill_switch_workspace Remove mutter_plugin_effect_completed Add mutter_plugin_[minimize/map/destroy/maximize/unmaximize]_completed https://bugzilla.gnome.org/show_bug.cgi?id=621082
This commit is contained in:
parent
ff5a73de49
commit
13ad103823
@ -790,7 +790,6 @@ meta_compositor_switch_workspace (MetaCompositor *compositor,
|
|||||||
|
|
||||||
if (!info->plugin_mgr ||
|
if (!info->plugin_mgr ||
|
||||||
!mutter_plugin_manager_switch_workspace (info->plugin_mgr,
|
!mutter_plugin_manager_switch_workspace (info->plugin_mgr,
|
||||||
(const GList **)&info->windows,
|
|
||||||
from_indx,
|
from_indx,
|
||||||
to_indx,
|
to_indx,
|
||||||
direction))
|
direction))
|
||||||
|
@ -402,9 +402,8 @@ mutter_plugin_manager_get (MetaScreen *screen)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mutter_plugin_manager_kill_effect (MutterPluginManager *plugin_mgr,
|
mutter_plugin_manager_kill_window_effects (MutterPluginManager *plugin_mgr,
|
||||||
MutterWindow *actor,
|
MutterWindow *actor)
|
||||||
unsigned long events)
|
|
||||||
{
|
{
|
||||||
GList *l = plugin_mgr->plugins;
|
GList *l = plugin_mgr->plugins;
|
||||||
|
|
||||||
@ -414,17 +413,32 @@ mutter_plugin_manager_kill_effect (MutterPluginManager *plugin_mgr,
|
|||||||
MutterPluginClass *klass = MUTTER_PLUGIN_GET_CLASS (plugin);
|
MutterPluginClass *klass = MUTTER_PLUGIN_GET_CLASS (plugin);
|
||||||
|
|
||||||
if (!mutter_plugin_disabled (plugin)
|
if (!mutter_plugin_disabled (plugin)
|
||||||
&& (mutter_plugin_features (plugin) & events)
|
&& klass->kill_window_effects)
|
||||||
&& klass->kill_effect)
|
klass->kill_window_effects (plugin, actor);
|
||||||
klass->kill_effect (plugin, actor, events);
|
|
||||||
|
l = l->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
mutter_plugin_manager_kill_switch_workspace (MutterPluginManager *plugin_mgr)
|
||||||
|
{
|
||||||
|
GList *l = plugin_mgr->plugins;
|
||||||
|
|
||||||
|
while (l)
|
||||||
|
{
|
||||||
|
MutterPlugin *plugin = l->data;
|
||||||
|
MutterPluginClass *klass = MUTTER_PLUGIN_GET_CLASS (plugin);
|
||||||
|
|
||||||
|
if (!mutter_plugin_disabled (plugin)
|
||||||
|
&& (mutter_plugin_features (plugin) & MUTTER_PLUGIN_SWITCH_WORKSPACE)
|
||||||
|
&& klass->kill_switch_workspace)
|
||||||
|
klass->kill_switch_workspace (plugin);
|
||||||
|
|
||||||
l = l->next;
|
l = l->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ALL_BUT_SWITCH \
|
|
||||||
MUTTER_PLUGIN_ALL_EFFECTS & \
|
|
||||||
~MUTTER_PLUGIN_SWITCH_WORKSPACE
|
|
||||||
/*
|
/*
|
||||||
* Public method that the compositor hooks into for events that require
|
* Public method that the compositor hooks into for events that require
|
||||||
* no additional parameters.
|
* no additional parameters.
|
||||||
@ -461,10 +475,9 @@ mutter_plugin_manager_event_simple (MutterPluginManager *plugin_mgr,
|
|||||||
case MUTTER_PLUGIN_MINIMIZE:
|
case MUTTER_PLUGIN_MINIMIZE:
|
||||||
if (klass->minimize)
|
if (klass->minimize)
|
||||||
{
|
{
|
||||||
mutter_plugin_manager_kill_effect (
|
mutter_plugin_manager_kill_window_effects (
|
||||||
plugin_mgr,
|
plugin_mgr,
|
||||||
actor,
|
actor);
|
||||||
ALL_BUT_SWITCH);
|
|
||||||
|
|
||||||
_mutter_plugin_effect_started (plugin);
|
_mutter_plugin_effect_started (plugin);
|
||||||
klass->minimize (plugin, actor);
|
klass->minimize (plugin, actor);
|
||||||
@ -473,10 +486,9 @@ mutter_plugin_manager_event_simple (MutterPluginManager *plugin_mgr,
|
|||||||
case MUTTER_PLUGIN_MAP:
|
case MUTTER_PLUGIN_MAP:
|
||||||
if (klass->map)
|
if (klass->map)
|
||||||
{
|
{
|
||||||
mutter_plugin_manager_kill_effect (
|
mutter_plugin_manager_kill_window_effects (
|
||||||
plugin_mgr,
|
plugin_mgr,
|
||||||
actor,
|
actor);
|
||||||
ALL_BUT_SWITCH);
|
|
||||||
|
|
||||||
_mutter_plugin_effect_started (plugin);
|
_mutter_plugin_effect_started (plugin);
|
||||||
klass->map (plugin, actor);
|
klass->map (plugin, actor);
|
||||||
@ -540,10 +552,9 @@ mutter_plugin_manager_event_maximize (MutterPluginManager *plugin_mgr,
|
|||||||
case MUTTER_PLUGIN_MAXIMIZE:
|
case MUTTER_PLUGIN_MAXIMIZE:
|
||||||
if (klass->maximize)
|
if (klass->maximize)
|
||||||
{
|
{
|
||||||
mutter_plugin_manager_kill_effect (
|
mutter_plugin_manager_kill_window_effects (
|
||||||
plugin_mgr,
|
plugin_mgr,
|
||||||
actor,
|
actor);
|
||||||
ALL_BUT_SWITCH);
|
|
||||||
|
|
||||||
_mutter_plugin_effect_started (plugin);
|
_mutter_plugin_effect_started (plugin);
|
||||||
klass->maximize (plugin, actor,
|
klass->maximize (plugin, actor,
|
||||||
@ -554,10 +565,9 @@ mutter_plugin_manager_event_maximize (MutterPluginManager *plugin_mgr,
|
|||||||
case MUTTER_PLUGIN_UNMAXIMIZE:
|
case MUTTER_PLUGIN_UNMAXIMIZE:
|
||||||
if (klass->unmaximize)
|
if (klass->unmaximize)
|
||||||
{
|
{
|
||||||
mutter_plugin_manager_kill_effect (
|
mutter_plugin_manager_kill_window_effects (
|
||||||
plugin_mgr,
|
plugin_mgr,
|
||||||
actor,
|
actor);
|
||||||
ALL_BUT_SWITCH);
|
|
||||||
|
|
||||||
_mutter_plugin_effect_started (plugin);
|
_mutter_plugin_effect_started (plugin);
|
||||||
klass->unmaximize (plugin, actor,
|
klass->unmaximize (plugin, actor,
|
||||||
@ -586,7 +596,6 @@ mutter_plugin_manager_event_maximize (MutterPluginManager *plugin_mgr,
|
|||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
mutter_plugin_manager_switch_workspace (MutterPluginManager *plugin_mgr,
|
mutter_plugin_manager_switch_workspace (MutterPluginManager *plugin_mgr,
|
||||||
const GList **actors,
|
|
||||||
gint from,
|
gint from,
|
||||||
gint to,
|
gint to,
|
||||||
MetaMotionDirection direction)
|
MetaMotionDirection direction)
|
||||||
@ -604,19 +613,15 @@ mutter_plugin_manager_switch_workspace (MutterPluginManager *plugin_mgr,
|
|||||||
MutterPluginClass *klass = MUTTER_PLUGIN_GET_CLASS (plugin);
|
MutterPluginClass *klass = MUTTER_PLUGIN_GET_CLASS (plugin);
|
||||||
|
|
||||||
if (!mutter_plugin_disabled (plugin) &&
|
if (!mutter_plugin_disabled (plugin) &&
|
||||||
(mutter_plugin_features (plugin) & MUTTER_PLUGIN_SWITCH_WORKSPACE) &&
|
(mutter_plugin_features (plugin) & MUTTER_PLUGIN_SWITCH_WORKSPACE))
|
||||||
(actors && *actors))
|
|
||||||
{
|
{
|
||||||
if (klass->switch_workspace)
|
if (klass->switch_workspace)
|
||||||
{
|
{
|
||||||
retval = TRUE;
|
retval = TRUE;
|
||||||
mutter_plugin_manager_kill_effect (
|
mutter_plugin_manager_kill_switch_workspace (plugin_mgr);
|
||||||
plugin_mgr,
|
|
||||||
MUTTER_WINDOW ((*actors)->data),
|
|
||||||
MUTTER_PLUGIN_SWITCH_WORKSPACE);
|
|
||||||
|
|
||||||
_mutter_plugin_effect_started (plugin);
|
_mutter_plugin_effect_started (plugin);
|
||||||
klass->switch_workspace (plugin, actors, from, to, direction);
|
klass->switch_workspace (plugin, from, to, direction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +31,15 @@
|
|||||||
#include "mutter-plugin.h"
|
#include "mutter-plugin.h"
|
||||||
#undef MUTTER_PLUGIN_FROM_MANAGER_
|
#undef MUTTER_PLUGIN_FROM_MANAGER_
|
||||||
|
|
||||||
|
#define MUTTER_PLUGIN_MINIMIZE (1<<0)
|
||||||
|
#define MUTTER_PLUGIN_MAXIMIZE (1<<1)
|
||||||
|
#define MUTTER_PLUGIN_UNMAXIMIZE (1<<2)
|
||||||
|
#define MUTTER_PLUGIN_MAP (1<<3)
|
||||||
|
#define MUTTER_PLUGIN_DESTROY (1<<4)
|
||||||
|
#define MUTTER_PLUGIN_SWITCH_WORKSPACE (1<<5)
|
||||||
|
|
||||||
|
#define MUTTER_PLUGIN_ALL_EFFECTS (~0)
|
||||||
|
|
||||||
typedef struct MutterPluginManager MutterPluginManager;
|
typedef struct MutterPluginManager MutterPluginManager;
|
||||||
|
|
||||||
MutterPluginManager * mutter_plugin_manager_get (MetaScreen *screen);
|
MutterPluginManager * mutter_plugin_manager_get (MetaScreen *screen);
|
||||||
@ -54,7 +63,6 @@ void mutter_plugin_manager_update_workspaces (MutterPluginManager *mgr);
|
|||||||
void mutter_plugin_manager_update_workspace (MutterPluginManager *mgr, MetaWorkspace *w);
|
void mutter_plugin_manager_update_workspace (MutterPluginManager *mgr, MetaWorkspace *w);
|
||||||
|
|
||||||
gboolean mutter_plugin_manager_switch_workspace (MutterPluginManager *mgr,
|
gboolean mutter_plugin_manager_switch_workspace (MutterPluginManager *mgr,
|
||||||
const GList **actors,
|
|
||||||
gint from,
|
gint from,
|
||||||
gint to,
|
gint to,
|
||||||
MetaMotionDirection direction);
|
MetaMotionDirection direction);
|
||||||
|
@ -367,7 +367,23 @@ _mutter_plugin_effect_started (MutterPlugin *plugin)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
mutter_plugin_effect_completed (MutterPlugin *plugin,
|
mutter_plugin_switch_workspace_completed (MutterPlugin *plugin)
|
||||||
|
{
|
||||||
|
MutterPluginPrivate *priv = MUTTER_PLUGIN (plugin)->priv;
|
||||||
|
|
||||||
|
MetaScreen *screen = mutter_plugin_get_screen (plugin);
|
||||||
|
|
||||||
|
if (priv->running-- < 0)
|
||||||
|
{
|
||||||
|
g_warning ("Error in running effect accounting, adjusting.");
|
||||||
|
priv->running = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
mutter_switch_workspace_completed (screen);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
mutter_plugin_window_effect_completed (MutterPlugin *plugin,
|
||||||
MutterWindow *actor,
|
MutterWindow *actor,
|
||||||
unsigned long event)
|
unsigned long event)
|
||||||
{
|
{
|
||||||
@ -391,17 +407,42 @@ mutter_plugin_effect_completed (MutterPlugin *plugin,
|
|||||||
name ? name : "unknown");
|
name ? name : "unknown");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event == MUTTER_PLUGIN_SWITCH_WORKSPACE)
|
|
||||||
{
|
|
||||||
/* The window is just used to identify the screen */
|
|
||||||
MetaWindow *window = mutter_window_get_meta_window (actor);
|
|
||||||
MetaScreen *screen = meta_window_get_screen (window);
|
|
||||||
mutter_switch_workspace_completed (screen);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mutter_window_effect_completed (actor, event);
|
mutter_window_effect_completed (actor, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
mutter_plugin_minimize_completed (MutterPlugin *plugin,
|
||||||
|
MutterWindow *actor)
|
||||||
|
{
|
||||||
|
mutter_plugin_window_effect_completed (plugin, actor, MUTTER_PLUGIN_MINIMIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
mutter_plugin_maximize_completed (MutterPlugin *plugin,
|
||||||
|
MutterWindow *actor)
|
||||||
|
{
|
||||||
|
mutter_plugin_window_effect_completed (plugin, actor, MUTTER_PLUGIN_MAXIMIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
mutter_plugin_unmaximize_completed (MutterPlugin *plugin,
|
||||||
|
MutterWindow *actor)
|
||||||
|
{
|
||||||
|
mutter_plugin_window_effect_completed (plugin, actor, MUTTER_PLUGIN_UNMAXIMIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
mutter_plugin_map_completed (MutterPlugin *plugin,
|
||||||
|
MutterWindow *actor)
|
||||||
|
{
|
||||||
|
mutter_plugin_window_effect_completed (plugin, actor, MUTTER_PLUGIN_MAP);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
mutter_plugin_destroy_completed (MutterPlugin *plugin,
|
||||||
|
MutterWindow *actor)
|
||||||
|
{
|
||||||
|
mutter_plugin_window_effect_completed (plugin, actor, MUTTER_PLUGIN_DESTROY);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -81,11 +81,12 @@ static void unmaximize (MutterPlugin *plugin,
|
|||||||
gint x, gint y, gint width, gint height);
|
gint x, gint y, gint width, gint height);
|
||||||
|
|
||||||
static void switch_workspace (MutterPlugin *plugin,
|
static void switch_workspace (MutterPlugin *plugin,
|
||||||
const GList **actors, gint from, gint to,
|
gint from, gint to,
|
||||||
MetaMotionDirection direction);
|
MetaMotionDirection direction);
|
||||||
|
|
||||||
static void kill_effect (MutterPlugin *plugin,
|
static void kill_window_effects (MutterPlugin *plugin,
|
||||||
MutterWindow *actor, gulong event);
|
MutterWindow *actor);
|
||||||
|
static void kill_switch_workspace (MutterPlugin *plugin);
|
||||||
|
|
||||||
static const MutterPluginInfo * plugin_info (MutterPlugin *plugin);
|
static const MutterPluginInfo * plugin_info (MutterPlugin *plugin);
|
||||||
|
|
||||||
@ -99,7 +100,6 @@ struct _MutterDefaultPluginPrivate
|
|||||||
/* Valid only when switch_workspace effect is in progress */
|
/* Valid only when switch_workspace effect is in progress */
|
||||||
ClutterTimeline *tml_switch_workspace1;
|
ClutterTimeline *tml_switch_workspace1;
|
||||||
ClutterTimeline *tml_switch_workspace2;
|
ClutterTimeline *tml_switch_workspace2;
|
||||||
GList **actors;
|
|
||||||
ClutterActor *desktop1;
|
ClutterActor *desktop1;
|
||||||
ClutterActor *desktop2;
|
ClutterActor *desktop2;
|
||||||
|
|
||||||
@ -220,8 +220,9 @@ mutter_default_plugin_class_init (MutterDefaultPluginClass *klass)
|
|||||||
plugin_class->unmaximize = unmaximize;
|
plugin_class->unmaximize = unmaximize;
|
||||||
plugin_class->destroy = destroy;
|
plugin_class->destroy = destroy;
|
||||||
plugin_class->switch_workspace = switch_workspace;
|
plugin_class->switch_workspace = switch_workspace;
|
||||||
plugin_class->kill_effect = kill_effect;
|
|
||||||
plugin_class->plugin_info = plugin_info;
|
plugin_class->plugin_info = plugin_info;
|
||||||
|
plugin_class->kill_window_effects = kill_window_effects;
|
||||||
|
plugin_class->kill_switch_workspace = kill_switch_workspace;
|
||||||
|
|
||||||
g_type_class_add_private (gobject_class, sizeof (MutterDefaultPluginPrivate));
|
g_type_class_add_private (gobject_class, sizeof (MutterDefaultPluginPrivate));
|
||||||
}
|
}
|
||||||
@ -270,20 +271,12 @@ get_actor_private (MutterWindow *actor)
|
|||||||
return priv;
|
return priv;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct SwitchWorkspaceData
|
|
||||||
{
|
|
||||||
MutterPlugin *plugin;
|
|
||||||
const GList **actors;
|
|
||||||
} SwitchWorkspaceData;
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_switch_workspace_effect_complete (ClutterTimeline *timeline, gpointer data)
|
on_switch_workspace_effect_complete (ClutterTimeline *timeline, gpointer data)
|
||||||
{
|
{
|
||||||
SwitchWorkspaceData *sw_data = data;
|
MutterPlugin *plugin = MUTTER_PLUGIN (data);
|
||||||
MutterPlugin *plugin = sw_data->plugin;
|
|
||||||
MutterDefaultPluginPrivate *priv = MUTTER_DEFAULT_PLUGIN (plugin)->priv;
|
MutterDefaultPluginPrivate *priv = MUTTER_DEFAULT_PLUGIN (plugin)->priv;
|
||||||
GList *l = *((GList**)sw_data->actors);
|
GList *l = mutter_plugin_get_windows (plugin);
|
||||||
MutterWindow *actor_for_cb = l->data;
|
|
||||||
|
|
||||||
while (l)
|
while (l)
|
||||||
{
|
{
|
||||||
@ -303,21 +296,17 @@ on_switch_workspace_effect_complete (ClutterTimeline *timeline, gpointer data)
|
|||||||
clutter_actor_destroy (priv->desktop1);
|
clutter_actor_destroy (priv->desktop1);
|
||||||
clutter_actor_destroy (priv->desktop2);
|
clutter_actor_destroy (priv->desktop2);
|
||||||
|
|
||||||
priv->actors = NULL;
|
|
||||||
priv->tml_switch_workspace1 = NULL;
|
priv->tml_switch_workspace1 = NULL;
|
||||||
priv->tml_switch_workspace2 = NULL;
|
priv->tml_switch_workspace2 = NULL;
|
||||||
priv->desktop1 = NULL;
|
priv->desktop1 = NULL;
|
||||||
priv->desktop2 = NULL;
|
priv->desktop2 = NULL;
|
||||||
|
|
||||||
g_free (data);
|
mutter_plugin_switch_workspace_completed (plugin);
|
||||||
|
|
||||||
mutter_plugin_effect_completed (plugin, actor_for_cb,
|
|
||||||
MUTTER_PLUGIN_SWITCH_WORKSPACE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
switch_workspace (MutterPlugin *plugin,
|
switch_workspace (MutterPlugin *plugin,
|
||||||
const GList **actors, gint from, gint to,
|
gint from, gint to,
|
||||||
MetaMotionDirection direction)
|
MetaMotionDirection direction)
|
||||||
{
|
{
|
||||||
MutterDefaultPluginPrivate *priv = MUTTER_DEFAULT_PLUGIN (plugin)->priv;
|
MutterDefaultPluginPrivate *priv = MUTTER_DEFAULT_PLUGIN (plugin)->priv;
|
||||||
@ -328,12 +317,8 @@ switch_workspace (MutterPlugin *plugin,
|
|||||||
ClutterActor *stage;
|
ClutterActor *stage;
|
||||||
int screen_width, screen_height;
|
int screen_width, screen_height;
|
||||||
MetaScreen *screen = mutter_plugin_get_screen (plugin);
|
MetaScreen *screen = mutter_plugin_get_screen (plugin);
|
||||||
SwitchWorkspaceData *sw_data = g_new (SwitchWorkspaceData, 1);
|
|
||||||
ClutterAnimation *animation;
|
ClutterAnimation *animation;
|
||||||
|
|
||||||
sw_data->plugin = plugin;
|
|
||||||
sw_data->actors = actors;
|
|
||||||
|
|
||||||
stage = mutter_plugin_get_stage (plugin);
|
stage = mutter_plugin_get_stage (plugin);
|
||||||
|
|
||||||
mutter_plugin_query_screen_size (plugin,
|
mutter_plugin_query_screen_size (plugin,
|
||||||
@ -353,14 +338,13 @@ switch_workspace (MutterPlugin *plugin,
|
|||||||
|
|
||||||
if (from == to)
|
if (from == to)
|
||||||
{
|
{
|
||||||
mutter_plugin_effect_completed (plugin, NULL,
|
mutter_plugin_switch_workspace_completed (plugin);
|
||||||
MUTTER_PLUGIN_SWITCH_WORKSPACE);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
n_workspaces = meta_screen_get_n_workspaces (screen);
|
n_workspaces = meta_screen_get_n_workspaces (screen);
|
||||||
|
|
||||||
l = g_list_last (*((GList**) actors));
|
l = g_list_last (mutter_plugin_get_windows (plugin));
|
||||||
|
|
||||||
while (l)
|
while (l)
|
||||||
{
|
{
|
||||||
@ -395,7 +379,6 @@ switch_workspace (MutterPlugin *plugin,
|
|||||||
l = l->prev;
|
l = l->prev;
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->actors = (GList **)actors;
|
|
||||||
priv->desktop1 = workspace0;
|
priv->desktop1 = workspace0;
|
||||||
priv->desktop2 = workspace1;
|
priv->desktop2 = workspace1;
|
||||||
|
|
||||||
@ -408,7 +391,7 @@ switch_workspace (MutterPlugin *plugin,
|
|||||||
g_signal_connect (priv->tml_switch_workspace1,
|
g_signal_connect (priv->tml_switch_workspace1,
|
||||||
"completed",
|
"completed",
|
||||||
G_CALLBACK (on_switch_workspace_effect_complete),
|
G_CALLBACK (on_switch_workspace_effect_complete),
|
||||||
sw_data);
|
plugin);
|
||||||
|
|
||||||
animation = clutter_actor_animate (workspace1, CLUTTER_EASE_IN_SINE,
|
animation = clutter_actor_animate (workspace1, CLUTTER_EASE_IN_SINE,
|
||||||
SWITCH_TIMEOUT,
|
SWITCH_TIMEOUT,
|
||||||
@ -446,8 +429,7 @@ on_minimize_effect_complete (ClutterTimeline *timeline, EffectCompleteData *data
|
|||||||
CLUTTER_GRAVITY_NORTH_WEST);
|
CLUTTER_GRAVITY_NORTH_WEST);
|
||||||
|
|
||||||
/* Now notify the manager that we are done with this effect */
|
/* Now notify the manager that we are done with this effect */
|
||||||
mutter_plugin_effect_completed (plugin, mc_window,
|
mutter_plugin_minimize_completed (plugin, mc_window);
|
||||||
MUTTER_PLUGIN_MINIMIZE);
|
|
||||||
|
|
||||||
g_free (data);
|
g_free (data);
|
||||||
}
|
}
|
||||||
@ -490,8 +472,7 @@ minimize (MutterPlugin *plugin, MutterWindow *mc_window)
|
|||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
mutter_plugin_effect_completed (plugin, mc_window,
|
mutter_plugin_minimize_completed (plugin, mc_window);
|
||||||
MUTTER_PLUGIN_MINIMIZE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -516,8 +497,7 @@ on_maximize_effect_complete (ClutterTimeline *timeline, EffectCompleteData *data
|
|||||||
CLUTTER_GRAVITY_NORTH_WEST);
|
CLUTTER_GRAVITY_NORTH_WEST);
|
||||||
|
|
||||||
/* Now notify the manager that we are done with this effect */
|
/* Now notify the manager that we are done with this effect */
|
||||||
mutter_plugin_effect_completed (plugin, mc_window,
|
mutter_plugin_maximize_completed (plugin, mc_window);
|
||||||
MUTTER_PLUGIN_MAXIMIZE);
|
|
||||||
|
|
||||||
g_free (data);
|
g_free (data);
|
||||||
}
|
}
|
||||||
@ -587,8 +567,7 @@ maximize (MutterPlugin *plugin,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mutter_plugin_effect_completed (plugin, mc_window,
|
mutter_plugin_maximize_completed (plugin, mc_window);
|
||||||
MUTTER_PLUGIN_MAXIMIZE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -611,8 +590,7 @@ unmaximize (MutterPlugin *plugin,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Do this conditionally, if the effect requires completion callback. */
|
/* Do this conditionally, if the effect requires completion callback. */
|
||||||
mutter_plugin_effect_completed (plugin, mc_window,
|
mutter_plugin_unmaximize_completed (plugin, mc_window);
|
||||||
MUTTER_PLUGIN_UNMAXIMIZE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -631,7 +609,7 @@ on_map_effect_complete (ClutterTimeline *timeline, EffectCompleteData *data)
|
|||||||
CLUTTER_GRAVITY_NORTH_WEST);
|
CLUTTER_GRAVITY_NORTH_WEST);
|
||||||
|
|
||||||
/* Now notify the manager that we are done with this effect */
|
/* Now notify the manager that we are done with this effect */
|
||||||
mutter_plugin_effect_completed (plugin, mc_window, MUTTER_PLUGIN_MAP);
|
mutter_plugin_map_completed (plugin, mc_window);
|
||||||
|
|
||||||
g_free (data);
|
g_free (data);
|
||||||
}
|
}
|
||||||
@ -677,8 +655,7 @@ map (MutterPlugin *plugin, MutterWindow *mc_window)
|
|||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
mutter_plugin_effect_completed (plugin, mc_window,
|
mutter_plugin_map_completed (plugin, mc_window);
|
||||||
MUTTER_PLUGIN_MAP);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -694,8 +671,7 @@ on_destroy_effect_complete (ClutterTimeline *timeline, EffectCompleteData *data)
|
|||||||
|
|
||||||
apriv->tml_destroy = NULL;
|
apriv->tml_destroy = NULL;
|
||||||
|
|
||||||
mutter_plugin_effect_completed (plugin, mc_window,
|
mutter_plugin_destroy_completed (plugin, mc_window);
|
||||||
MUTTER_PLUGIN_DESTROY);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -732,17 +708,12 @@ destroy (MutterPlugin *plugin, MutterWindow *mc_window)
|
|||||||
data);
|
data);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
mutter_plugin_effect_completed (plugin, mc_window,
|
mutter_plugin_destroy_completed (plugin, mc_window);
|
||||||
MUTTER_PLUGIN_DESTROY);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
kill_effect (MutterPlugin *plugin, MutterWindow *mc_window, gulong event)
|
kill_switch_workspace (MutterPlugin *plugin)
|
||||||
{
|
{
|
||||||
ActorPrivate *apriv;
|
|
||||||
|
|
||||||
if (event & MUTTER_PLUGIN_SWITCH_WORKSPACE)
|
|
||||||
{
|
|
||||||
MutterDefaultPluginPrivate *priv = MUTTER_DEFAULT_PLUGIN (plugin)->priv;
|
MutterDefaultPluginPrivate *priv = MUTTER_DEFAULT_PLUGIN (plugin)->priv;
|
||||||
|
|
||||||
if (priv->tml_switch_workspace1)
|
if (priv->tml_switch_workspace1)
|
||||||
@ -751,35 +722,34 @@ kill_effect (MutterPlugin *plugin, MutterWindow *mc_window, gulong event)
|
|||||||
clutter_timeline_stop (priv->tml_switch_workspace2);
|
clutter_timeline_stop (priv->tml_switch_workspace2);
|
||||||
g_signal_emit_by_name (priv->tml_switch_workspace1, "completed", NULL);
|
g_signal_emit_by_name (priv->tml_switch_workspace1, "completed", NULL);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!(event & ~MUTTER_PLUGIN_SWITCH_WORKSPACE))
|
static void
|
||||||
{
|
kill_window_effects (MutterPlugin *plugin, MutterWindow *mc_window)
|
||||||
/* Workspace switch only, nothing more to do */
|
{
|
||||||
return;
|
ActorPrivate *apriv;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
apriv = get_actor_private (mc_window);
|
apriv = get_actor_private (mc_window);
|
||||||
|
|
||||||
if ((event & MUTTER_PLUGIN_MINIMIZE) && apriv->tml_minimize)
|
if (apriv->tml_minimize)
|
||||||
{
|
{
|
||||||
clutter_timeline_stop (apriv->tml_minimize);
|
clutter_timeline_stop (apriv->tml_minimize);
|
||||||
g_signal_emit_by_name (apriv->tml_minimize, "completed", NULL);
|
g_signal_emit_by_name (apriv->tml_minimize, "completed", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((event & MUTTER_PLUGIN_MAXIMIZE) && apriv->tml_maximize)
|
if (apriv->tml_maximize)
|
||||||
{
|
{
|
||||||
clutter_timeline_stop (apriv->tml_maximize);
|
clutter_timeline_stop (apriv->tml_maximize);
|
||||||
g_signal_emit_by_name (apriv->tml_maximize, "completed", NULL);
|
g_signal_emit_by_name (apriv->tml_maximize, "completed", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((event & MUTTER_PLUGIN_MAP) && apriv->tml_map)
|
if (apriv->tml_map)
|
||||||
{
|
{
|
||||||
clutter_timeline_stop (apriv->tml_map);
|
clutter_timeline_stop (apriv->tml_map);
|
||||||
g_signal_emit_by_name (apriv->tml_map, "completed", NULL);
|
g_signal_emit_by_name (apriv->tml_map, "completed", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((event & MUTTER_PLUGIN_DESTROY) && apriv->tml_destroy)
|
if (apriv->tml_destroy)
|
||||||
{
|
{
|
||||||
clutter_timeline_stop (apriv->tml_destroy);
|
clutter_timeline_stop (apriv->tml_destroy);
|
||||||
g_signal_emit_by_name (apriv->tml_destroy, "completed", NULL);
|
g_signal_emit_by_name (apriv->tml_destroy, "completed", NULL);
|
||||||
|
@ -32,19 +32,6 @@
|
|||||||
#include <X11/extensions/Xfixes.h>
|
#include <X11/extensions/Xfixes.h>
|
||||||
#include <gmodule.h>
|
#include <gmodule.h>
|
||||||
|
|
||||||
/*
|
|
||||||
* FIXME -- move these to a private include
|
|
||||||
* Required by plugin manager.
|
|
||||||
*/
|
|
||||||
#define MUTTER_PLUGIN_MINIMIZE (1<<0)
|
|
||||||
#define MUTTER_PLUGIN_MAXIMIZE (1<<1)
|
|
||||||
#define MUTTER_PLUGIN_UNMAXIMIZE (1<<2)
|
|
||||||
#define MUTTER_PLUGIN_MAP (1<<3)
|
|
||||||
#define MUTTER_PLUGIN_DESTROY (1<<4)
|
|
||||||
#define MUTTER_PLUGIN_SWITCH_WORKSPACE (1<<5)
|
|
||||||
|
|
||||||
#define MUTTER_PLUGIN_ALL_EFFECTS (~0)
|
|
||||||
|
|
||||||
#define MUTTER_TYPE_PLUGIN (mutter_plugin_get_type ())
|
#define MUTTER_TYPE_PLUGIN (mutter_plugin_get_type ())
|
||||||
#define MUTTER_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MUTTER_TYPE_PLUGIN, MutterPlugin))
|
#define MUTTER_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MUTTER_TYPE_PLUGIN, MutterPlugin))
|
||||||
#define MUTTER_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MUTTER_TYPE_PLUGIN, MutterPluginClass))
|
#define MUTTER_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MUTTER_TYPE_PLUGIN, MutterPluginClass))
|
||||||
@ -95,20 +82,18 @@ struct _MutterPluginClass
|
|||||||
MutterWindow *actor);
|
MutterWindow *actor);
|
||||||
|
|
||||||
void (*switch_workspace) (MutterPlugin *plugin,
|
void (*switch_workspace) (MutterPlugin *plugin,
|
||||||
const GList **actors,
|
|
||||||
gint from,
|
gint from,
|
||||||
gint to,
|
gint to,
|
||||||
MetaMotionDirection direction);
|
MetaMotionDirection direction);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Called if an effect should be killed prematurely; the plugin must
|
* Called if an effects should be killed prematurely; the plugin must
|
||||||
* call the completed() callback as if the effect terminated naturally.
|
* call the completed() callback as if the effect terminated naturally.
|
||||||
* The events parameter is a bitmask indicating which effects are to be
|
|
||||||
* killed.
|
|
||||||
*/
|
*/
|
||||||
void (*kill_effect) (MutterPlugin *plugin,
|
void (*kill_window_effects) (MutterPlugin *plugin,
|
||||||
MutterWindow *actor,
|
MutterWindow *actor);
|
||||||
gulong events);
|
|
||||||
|
void (*kill_switch_workspace) (MutterPlugin *plugin);
|
||||||
|
|
||||||
/* General XEvent filter. This is fired *before* mutter itself handles
|
/* General XEvent filter. This is fired *before* mutter itself handles
|
||||||
* an event. Return TRUE to block any further processing.
|
* an event. Return TRUE to block any further processing.
|
||||||
@ -227,9 +212,27 @@ struct _MutterPluginVersion
|
|||||||
} \
|
} \
|
||||||
|
|
||||||
void
|
void
|
||||||
mutter_plugin_effect_completed (MutterPlugin *plugin,
|
mutter_plugin_switch_workspace_completed (MutterPlugin *plugin);
|
||||||
MutterWindow *actor,
|
|
||||||
unsigned long event);
|
void
|
||||||
|
mutter_plugin_minimize_completed (MutterPlugin *plugin,
|
||||||
|
MutterWindow *actor);
|
||||||
|
|
||||||
|
void
|
||||||
|
mutter_plugin_maximize_completed (MutterPlugin *plugin,
|
||||||
|
MutterWindow *actor);
|
||||||
|
|
||||||
|
void
|
||||||
|
mutter_plugin_unmaximize_completed (MutterPlugin *plugin,
|
||||||
|
MutterWindow *actor);
|
||||||
|
|
||||||
|
void
|
||||||
|
mutter_plugin_map_completed (MutterPlugin *plugin,
|
||||||
|
MutterWindow *actor);
|
||||||
|
|
||||||
|
void
|
||||||
|
mutter_plugin_destroy_completed (MutterPlugin *plugin,
|
||||||
|
MutterWindow *actor);
|
||||||
|
|
||||||
ClutterActor *
|
ClutterActor *
|
||||||
mutter_plugin_get_overlay_group (MutterPlugin *plugin);
|
mutter_plugin_get_overlay_group (MutterPlugin *plugin);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user