From cd84317346c7eea04b195be9c669bd9fa1eb2544 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Thu, 13 Jun 2013 18:01:17 -0700 Subject: [PATCH] compositor: add support for unminimize compositor effects https://bugzilla.gnome.org/show_bug.cgi?id=733789 --- doc/reference/meta-sections.txt | 1 + src/compositor/meta-plugin-manager.c | 9 +++++++++ src/compositor/meta-plugin-manager.h | 1 + src/compositor/meta-plugin.c | 7 +++++++ src/compositor/meta-window-actor.c | 17 +++++++++++++++-- src/meta/meta-plugin.h | 13 +++++++++++++ 6 files changed, 46 insertions(+), 2 deletions(-) diff --git a/doc/reference/meta-sections.txt b/doc/reference/meta-sections.txt index 5952f0aac..66fb44646 100644 --- a/doc/reference/meta-sections.txt +++ b/doc/reference/meta-sections.txt @@ -300,6 +300,7 @@ MetaPluginVersion META_PLUGIN_DECLARE meta_plugin_switch_workspace_completed meta_plugin_minimize_completed +meta_plugin_unminimize_completed meta_plugin_maximize_completed meta_plugin_unmaximize_completed meta_plugin_map_completed diff --git a/src/compositor/meta-plugin-manager.c b/src/compositor/meta-plugin-manager.c index d36c289f8..eb684971b 100644 --- a/src/compositor/meta-plugin-manager.c +++ b/src/compositor/meta-plugin-manager.c @@ -170,6 +170,15 @@ meta_plugin_manager_event_simple (MetaPluginManager *plugin_mgr, klass->minimize (plugin, actor); } break; + case META_PLUGIN_UNMINIMIZE: + if (klass->unminimize) + { + retval = TRUE; + meta_plugin_manager_kill_window_effects (plugin_mgr, + actor); + klass->unminimize (plugin, actor); + } + break; case META_PLUGIN_MAP: if (klass->map) { diff --git a/src/compositor/meta-plugin-manager.h b/src/compositor/meta-plugin-manager.h index c425d827e..3baa0a8a0 100644 --- a/src/compositor/meta-plugin-manager.h +++ b/src/compositor/meta-plugin-manager.h @@ -35,6 +35,7 @@ #define META_PLUGIN_MAP (1<<3) #define META_PLUGIN_DESTROY (1<<4) #define META_PLUGIN_SWITCH_WORKSPACE (1<<5) +#define META_PLUGIN_UNMINIMIZE (1<<6) #define META_PLUGIN_ALL_EFFECTS (~0) diff --git a/src/compositor/meta-plugin.c b/src/compositor/meta-plugin.c index 8d71e6939..170fa691c 100644 --- a/src/compositor/meta-plugin.c +++ b/src/compositor/meta-plugin.c @@ -110,6 +110,13 @@ meta_plugin_minimize_completed (MetaPlugin *plugin, meta_plugin_window_effect_completed (plugin, actor, META_PLUGIN_MINIMIZE); } +void +meta_plugin_unminimize_completed (MetaPlugin *plugin, + MetaWindowActor *actor) +{ + meta_plugin_window_effect_completed (plugin, actor, META_PLUGIN_UNMINIMIZE); +} + void meta_plugin_maximize_completed (MetaPlugin *plugin, MetaWindowActor *actor) diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c index 4f1e23885..b30faf700 100644 --- a/src/compositor/meta-window-actor.c +++ b/src/compositor/meta-window-actor.c @@ -84,6 +84,7 @@ struct _MetaWindowActorPrivate * might be dubious, but we have to at least handle it correctly. */ gint minimize_in_progress; + gint unminimize_in_progress; gint maximize_in_progress; gint unmaximize_in_progress; gint map_in_progress; @@ -1008,6 +1009,9 @@ start_simple_effect (MetaWindowActor *self, case META_PLUGIN_MINIMIZE: counter = &priv->minimize_in_progress; break; + case META_PLUGIN_UNMINIMIZE: + counter = &priv->unminimize_in_progress; + break; case META_PLUGIN_MAP: counter = &priv->map_in_progress; break; @@ -1078,6 +1082,16 @@ meta_window_actor_effect_completed (MetaWindowActor *self, } } break; + case META_PLUGIN_UNMINIMIZE: + { + priv->unminimize_in_progress--; + if (priv->unminimize_in_progress < 0) + { + g_warning ("Error in unminimize accounting."); + priv->unminimize_in_progress = 0; + } + } + break; case META_PLUGIN_MAP: /* * Make sure that the actor is at the correct place in case @@ -1243,8 +1257,7 @@ meta_window_actor_show (MetaWindowActor *self, event = META_PLUGIN_MAP; break; case META_COMP_EFFECT_UNMINIMIZE: - /* FIXME: should have META_PLUGIN_UNMINIMIZE */ - event = META_PLUGIN_MAP; + event = META_PLUGIN_UNMINIMIZE; break; case META_COMP_EFFECT_NONE: break; diff --git a/src/meta/meta-plugin.h b/src/meta/meta-plugin.h index 55887b463..3e840d7fc 100644 --- a/src/meta/meta-plugin.h +++ b/src/meta/meta-plugin.h @@ -94,6 +94,15 @@ struct _MetaPluginClass void (*minimize) (MetaPlugin *plugin, MetaWindowActor *actor); + /** + * MetaPluginClass::unminimize: + * @actor: a #MetaWindowActor + * + * Virtual function called when the window represented by @actor is unminimized. + */ + void (*unminimize) (MetaPlugin *plugin, + MetaWindowActor *actor); + /** * MetaPluginClass::maximize: * @actor: a #MetaWindowActor @@ -372,6 +381,10 @@ void meta_plugin_minimize_completed (MetaPlugin *plugin, MetaWindowActor *actor); +void +meta_plugin_unminimize_completed (MetaPlugin *plugin, + MetaWindowActor *actor); + void meta_plugin_maximize_completed (MetaPlugin *plugin, MetaWindowActor *actor);