windowManager: Add unminimize effect
The effect was added to mutter a while ago, but never implemented in the shell. Just do the reverse of the minimize animation ... https://bugzilla.gnome.org/show_bug.cgi?id=702662
This commit is contained in:
parent
86c6716786
commit
c9bcb411fc
@ -616,6 +616,7 @@ const WindowManager = new Lang.Class({
|
|||||||
this._shellwm = global.window_manager;
|
this._shellwm = global.window_manager;
|
||||||
|
|
||||||
this._minimizing = [];
|
this._minimizing = [];
|
||||||
|
this._unminimizing = [];
|
||||||
this._maximizing = [];
|
this._maximizing = [];
|
||||||
this._unmaximizing = [];
|
this._unmaximizing = [];
|
||||||
this._mapping = [];
|
this._mapping = [];
|
||||||
@ -641,6 +642,7 @@ const WindowManager = new Lang.Class({
|
|||||||
this._shellwm.connect('hide-tile-preview', Lang.bind(this, this._hideTilePreview));
|
this._shellwm.connect('hide-tile-preview', Lang.bind(this, this._hideTilePreview));
|
||||||
this._shellwm.connect('show-window-menu', Lang.bind(this, this._showWindowMenu));
|
this._shellwm.connect('show-window-menu', Lang.bind(this, this._showWindowMenu));
|
||||||
this._shellwm.connect('minimize', Lang.bind(this, this._minimizeWindow));
|
this._shellwm.connect('minimize', Lang.bind(this, this._minimizeWindow));
|
||||||
|
this._shellwm.connect('unminimize', Lang.bind(this, this._unminimizeWindow));
|
||||||
this._shellwm.connect('maximize', Lang.bind(this, this._maximizeWindow));
|
this._shellwm.connect('maximize', Lang.bind(this, this._maximizeWindow));
|
||||||
this._shellwm.connect('unmaximize', Lang.bind(this, this._unmaximizeWindow));
|
this._shellwm.connect('unmaximize', Lang.bind(this, this._unmaximizeWindow));
|
||||||
this._shellwm.connect('map', Lang.bind(this, this._mapWindow));
|
this._shellwm.connect('map', Lang.bind(this, this._mapWindow));
|
||||||
@ -1072,6 +1074,84 @@ const WindowManager = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_unminimizeWindow : function(shellwm, actor) {
|
||||||
|
let types = [Meta.WindowType.NORMAL,
|
||||||
|
Meta.WindowType.MODAL_DIALOG,
|
||||||
|
Meta.WindowType.DIALOG];
|
||||||
|
if (!this._shouldAnimateActor(actor, types)) {
|
||||||
|
shellwm.completed_unminimize(actor);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._unminimizing.push(actor);
|
||||||
|
|
||||||
|
if (actor.meta_window.is_monitor_sized()) {
|
||||||
|
actor.opacity = 0;
|
||||||
|
actor.set_scale(1.0, 1.0);
|
||||||
|
Tweener.addTween(actor,
|
||||||
|
{ opacity: 255,
|
||||||
|
time: MINIMIZE_WINDOW_ANIMATION_TIME,
|
||||||
|
transition: 'easeOutQuad',
|
||||||
|
onComplete: this._unminimizeWindowDone,
|
||||||
|
onCompleteScope: this,
|
||||||
|
onCompleteParams: [shellwm, actor],
|
||||||
|
onOverwrite: this._unminimizeWindowOverwritten,
|
||||||
|
onOverwriteScope: this,
|
||||||
|
onOverwriteParams: [shellwm, actor]
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
let [success, geom] = actor.meta_window.get_icon_geometry();
|
||||||
|
if (success) {
|
||||||
|
actor.set_position(geom.x, geom.y);
|
||||||
|
actor.set_scale(geom.width / actor.width,
|
||||||
|
geom.height / actor.height);
|
||||||
|
} else {
|
||||||
|
let monitor = Main.layoutManager.monitors[actor.meta_window.get_monitor()];
|
||||||
|
actor.set_position(monitor.x, monitor.y);
|
||||||
|
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
|
||||||
|
actor.x += monitor.width;
|
||||||
|
actor.set_scale(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
let rect = actor.meta_window.get_frame_rect();
|
||||||
|
let [xDest, yDest] = [rect.x, rect.y];
|
||||||
|
|
||||||
|
actor.show();
|
||||||
|
Tweener.addTween(actor,
|
||||||
|
{ scale_x: 1.0,
|
||||||
|
scale_y: 1.0,
|
||||||
|
x: xDest,
|
||||||
|
y: yDest,
|
||||||
|
time: MINIMIZE_WINDOW_ANIMATION_TIME,
|
||||||
|
transition: 'easeInExpo',
|
||||||
|
onComplete: this._unminimizeWindowDone,
|
||||||
|
onCompleteScope: this,
|
||||||
|
onCompleteParams: [shellwm, actor],
|
||||||
|
onOverwrite: this._unminimizeWindowOverwritten,
|
||||||
|
onOverwriteScope: this,
|
||||||
|
onOverwriteParams: [shellwm, actor]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
_unminimizeWindowDone : function(shellwm, actor) {
|
||||||
|
if (this._removeEffect(this._unminimizing, actor)) {
|
||||||
|
Tweener.removeTweens(actor);
|
||||||
|
actor.set_scale(1.0, 1.0);
|
||||||
|
actor.set_opacity(255);
|
||||||
|
actor.set_pivot_point(0, 0);
|
||||||
|
|
||||||
|
shellwm.completed_unminimize(actor);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
_unminimizeWindowOverwritten : function(shellwm, actor) {
|
||||||
|
if (this._removeEffect(this._unminimizing, actor)) {
|
||||||
|
shellwm.completed_unminimize(actor);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
_maximizeWindow : function(shellwm, actor, targetX, targetY, targetWidth, targetHeight) {
|
_maximizeWindow : function(shellwm, actor, targetX, targetY, targetWidth, targetHeight) {
|
||||||
shellwm.completed_maximize(actor);
|
shellwm.completed_maximize(actor);
|
||||||
},
|
},
|
||||||
|
@ -40,6 +40,8 @@
|
|||||||
static void gnome_shell_plugin_start (MetaPlugin *plugin);
|
static void gnome_shell_plugin_start (MetaPlugin *plugin);
|
||||||
static void gnome_shell_plugin_minimize (MetaPlugin *plugin,
|
static void gnome_shell_plugin_minimize (MetaPlugin *plugin,
|
||||||
MetaWindowActor *actor);
|
MetaWindowActor *actor);
|
||||||
|
static void gnome_shell_plugin_unminimize (MetaPlugin *plugin,
|
||||||
|
MetaWindowActor *actor);
|
||||||
static void gnome_shell_plugin_maximize (MetaPlugin *plugin,
|
static void gnome_shell_plugin_maximize (MetaPlugin *plugin,
|
||||||
MetaWindowActor *actor,
|
MetaWindowActor *actor,
|
||||||
gint x,
|
gint x,
|
||||||
@ -131,6 +133,7 @@ gnome_shell_plugin_class_init (GnomeShellPluginClass *klass)
|
|||||||
plugin_class->start = gnome_shell_plugin_start;
|
plugin_class->start = gnome_shell_plugin_start;
|
||||||
plugin_class->map = gnome_shell_plugin_map;
|
plugin_class->map = gnome_shell_plugin_map;
|
||||||
plugin_class->minimize = gnome_shell_plugin_minimize;
|
plugin_class->minimize = gnome_shell_plugin_minimize;
|
||||||
|
plugin_class->unminimize = gnome_shell_plugin_unminimize;
|
||||||
plugin_class->maximize = gnome_shell_plugin_maximize;
|
plugin_class->maximize = gnome_shell_plugin_maximize;
|
||||||
plugin_class->unmaximize = gnome_shell_plugin_unmaximize;
|
plugin_class->unmaximize = gnome_shell_plugin_unmaximize;
|
||||||
plugin_class->destroy = gnome_shell_plugin_destroy;
|
plugin_class->destroy = gnome_shell_plugin_destroy;
|
||||||
@ -268,6 +271,15 @@ gnome_shell_plugin_minimize (MetaPlugin *plugin,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gnome_shell_plugin_unminimize (MetaPlugin *plugin,
|
||||||
|
MetaWindowActor *actor)
|
||||||
|
{
|
||||||
|
_shell_wm_unminimize (get_shell_wm (),
|
||||||
|
actor);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnome_shell_plugin_maximize (MetaPlugin *plugin,
|
gnome_shell_plugin_maximize (MetaPlugin *plugin,
|
||||||
MetaWindowActor *actor,
|
MetaWindowActor *actor,
|
||||||
|
@ -10,6 +10,8 @@ G_BEGIN_DECLS
|
|||||||
|
|
||||||
void _shell_wm_minimize (ShellWM *wm,
|
void _shell_wm_minimize (ShellWM *wm,
|
||||||
MetaWindowActor *actor);
|
MetaWindowActor *actor);
|
||||||
|
void _shell_wm_unminimize (ShellWM *wm,
|
||||||
|
MetaWindowActor *actor);
|
||||||
void _shell_wm_maximize (ShellWM *wm,
|
void _shell_wm_maximize (ShellWM *wm,
|
||||||
MetaWindowActor *actor,
|
MetaWindowActor *actor,
|
||||||
gint x,
|
gint x,
|
||||||
|
@ -19,6 +19,7 @@ struct _ShellWM {
|
|||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
MINIMIZE,
|
MINIMIZE,
|
||||||
|
UNMINIMIZE,
|
||||||
MAXIMIZE,
|
MAXIMIZE,
|
||||||
UNMAXIMIZE,
|
UNMAXIMIZE,
|
||||||
MAP,
|
MAP,
|
||||||
@ -65,6 +66,14 @@ shell_wm_class_init (ShellWMClass *klass)
|
|||||||
NULL, NULL, NULL,
|
NULL, NULL, NULL,
|
||||||
G_TYPE_NONE, 1,
|
G_TYPE_NONE, 1,
|
||||||
META_TYPE_WINDOW_ACTOR);
|
META_TYPE_WINDOW_ACTOR);
|
||||||
|
shell_wm_signals[UNMINIMIZE] =
|
||||||
|
g_signal_new ("unminimize",
|
||||||
|
G_TYPE_FROM_CLASS (klass),
|
||||||
|
G_SIGNAL_RUN_LAST,
|
||||||
|
0,
|
||||||
|
NULL, NULL, NULL,
|
||||||
|
G_TYPE_NONE, 1,
|
||||||
|
META_TYPE_WINDOW_ACTOR);
|
||||||
shell_wm_signals[MAXIMIZE] =
|
shell_wm_signals[MAXIMIZE] =
|
||||||
g_signal_new ("maximize",
|
g_signal_new ("maximize",
|
||||||
G_TYPE_FROM_CLASS (klass),
|
G_TYPE_FROM_CLASS (klass),
|
||||||
@ -197,6 +206,20 @@ shell_wm_completed_minimize (ShellWM *wm,
|
|||||||
meta_plugin_minimize_completed (wm->plugin, actor);
|
meta_plugin_minimize_completed (wm->plugin, actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* shell_wm_completed_unminimize:
|
||||||
|
* @wm: the ShellWM
|
||||||
|
* @actor: the MetaWindowActor actor
|
||||||
|
*
|
||||||
|
* The plugin must call this when it has completed a window unminimize effect.
|
||||||
|
**/
|
||||||
|
void
|
||||||
|
shell_wm_completed_unminimize (ShellWM *wm,
|
||||||
|
MetaWindowActor *actor)
|
||||||
|
{
|
||||||
|
meta_plugin_unminimize_completed (wm->plugin, actor);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* shell_wm_completed_maximize:
|
* shell_wm_completed_maximize:
|
||||||
* @wm: the ShellWM
|
* @wm: the ShellWM
|
||||||
@ -328,6 +351,13 @@ _shell_wm_minimize (ShellWM *wm,
|
|||||||
g_signal_emit (wm, shell_wm_signals[MINIMIZE], 0, actor);
|
g_signal_emit (wm, shell_wm_signals[MINIMIZE], 0, actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_shell_wm_unminimize (ShellWM *wm,
|
||||||
|
MetaWindowActor *actor)
|
||||||
|
{
|
||||||
|
g_signal_emit (wm, shell_wm_signals[UNMINIMIZE], 0, actor);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_shell_wm_maximize (ShellWM *wm,
|
_shell_wm_maximize (ShellWM *wm,
|
||||||
MetaWindowActor *actor,
|
MetaWindowActor *actor,
|
||||||
|
@ -29,6 +29,8 @@ ShellWM *shell_wm_new (MetaPlugin *plugin);
|
|||||||
|
|
||||||
void shell_wm_completed_minimize (ShellWM *wm,
|
void shell_wm_completed_minimize (ShellWM *wm,
|
||||||
MetaWindowActor *actor);
|
MetaWindowActor *actor);
|
||||||
|
void shell_wm_completed_unminimize (ShellWM *wm,
|
||||||
|
MetaWindowActor *actor);
|
||||||
void shell_wm_completed_maximize (ShellWM *wm,
|
void shell_wm_completed_maximize (ShellWM *wm,
|
||||||
MetaWindowActor *actor);
|
MetaWindowActor *actor);
|
||||||
void shell_wm_completed_unmaximize (ShellWM *wm,
|
void shell_wm_completed_unmaximize (ShellWM *wm,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user