Adapt to new size-change API

We don't implement any maximize transitions (yet??), but we still have
the skeleton there. Let's keep it up to date.
This commit is contained in:
Jasper St. Pierre 2015-07-05 21:16:33 -07:00
parent 9ac55a98f1
commit 7305466765
5 changed files with 33 additions and 127 deletions

View File

@ -19,8 +19,6 @@ const Tweener = imports.ui.tweener;
const WindowMenu = imports.ui.windowMenu;
const SHELL_KEYBINDINGS_SCHEMA = 'org.gnome.shell.keybindings';
const MAXIMIZE_WINDOW_ANIMATION_TIME = 0.15;
const UNMAXIMIZE_WINDOW_ANIMATION_TIME = 0.15;
const MINIMIZE_WINDOW_ANIMATION_TIME = 0.2;
const SHOW_WINDOW_ANIMATION_TIME = 0.15;
const DIALOG_SHOW_WINDOW_ANIMATION_TIME = 0.1;
@ -624,8 +622,6 @@ const WindowManager = new Lang.Class({
this._minimizing = [];
this._unminimizing = [];
this._maximizing = [];
this._unmaximizing = [];
this._mapping = [];
this._destroying = [];
this._movingWindow = null;
@ -640,8 +636,6 @@ const WindowManager = new Lang.Class({
this._shellwm.connect('kill-switch-workspace', Lang.bind(this, this._switchWorkspaceDone));
this._shellwm.connect('kill-window-effects', Lang.bind(this, function (shellwm, actor) {
this._minimizeWindowDone(shellwm, actor);
this._maximizeWindowDone(shellwm, actor);
this._unmaximizeWindowDone(shellwm, actor);
this._mapWindowDone(shellwm, actor);
this._destroyWindowDone(shellwm, actor);
}));
@ -652,8 +646,6 @@ const WindowManager = new Lang.Class({
this._shellwm.connect('show-window-menu', Lang.bind(this, this._showWindowMenu));
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('unmaximize', Lang.bind(this, this._unmaximizeWindow));
this._shellwm.connect('map', Lang.bind(this, this._mapWindow));
this._shellwm.connect('destroy', Lang.bind(this, this._destroyWindow));
this._shellwm.connect('filter-keybinding', Lang.bind(this, this._filterKeybinding));
@ -1163,22 +1155,8 @@ const WindowManager = new Lang.Class({
}
},
_maximizeWindow : function(shellwm, actor, targetX, targetY, targetWidth, targetHeight) {
shellwm.completed_maximize(actor);
},
_maximizeWindowDone : function(shellwm, actor) {
},
_maximizeWindowOverwrite : function(shellwm, actor) {
},
_unmaximizeWindow : function(shellwm, actor, targetX, targetY, targetWidth, targetHeight) {
shellwm.completed_unmaximize(actor);
},
_unmaximizeWindowDone : function(shellwm, actor) {
_sizeChangeWindow : function(shellwm, actor, whichChange, oldFrameRect, oldBufferRect) {
shellwm.completed_size_change(actor);
},
_hasAttachedDialogs: function(window, ignoreWindow) {

View File

@ -42,18 +42,11 @@ static void gnome_shell_plugin_minimize (MetaPlugin *plugin,
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_size_change (MetaPlugin *plugin,
MetaWindowActor *actor,
gint x,
gint y,
gint width,
gint height);
static void gnome_shell_plugin_unmaximize (MetaPlugin *plugin,
MetaWindowActor *actor,
gint x,
gint y,
gint width,
gint height);
MetaSizeChange which_change,
MetaRectangle *old_rect,
MetaRectangle *new_rect);
static void gnome_shell_plugin_map (MetaPlugin *plugin,
MetaWindowActor *actor);
static void gnome_shell_plugin_destroy (MetaPlugin *plugin,
@ -134,8 +127,7 @@ gnome_shell_plugin_class_init (GnomeShellPluginClass *klass)
plugin_class->map = gnome_shell_plugin_map;
plugin_class->minimize = gnome_shell_plugin_minimize;
plugin_class->unminimize = gnome_shell_plugin_unminimize;
plugin_class->maximize = gnome_shell_plugin_maximize;
plugin_class->unmaximize = gnome_shell_plugin_unmaximize;
plugin_class->size_change = gnome_shell_plugin_size_change;
plugin_class->destroy = gnome_shell_plugin_destroy;
plugin_class->switch_workspace = gnome_shell_plugin_switch_workspace;
@ -281,27 +273,13 @@ gnome_shell_plugin_unminimize (MetaPlugin *plugin,
}
static void
gnome_shell_plugin_maximize (MetaPlugin *plugin,
MetaWindowActor *actor,
gint x,
gint y,
gint width,
gint height)
gnome_shell_plugin_size_change (MetaPlugin *plugin,
MetaWindowActor *actor,
MetaSizeChange which_change,
MetaRectangle *old_frame_rect,
MetaRectangle *old_buffer_rect)
{
_shell_wm_maximize (get_shell_wm (),
actor, x, y, width, height);
}
static void
gnome_shell_plugin_unmaximize (MetaPlugin *plugin,
MetaWindowActor *actor,
gint x,
gint y,
gint width,
gint height)
{
_shell_wm_unmaximize (get_shell_wm (),
actor, x, y, width, height);
_shell_wm_size_change (get_shell_wm (), actor, which_change, old_frame_rect, old_buffer_rect);
}
static void

View File

@ -12,18 +12,11 @@ void _shell_wm_minimize (ShellWM *wm,
MetaWindowActor *actor);
void _shell_wm_unminimize (ShellWM *wm,
MetaWindowActor *actor);
void _shell_wm_maximize (ShellWM *wm,
void _shell_wm_size_change(ShellWM *wm,
MetaWindowActor *actor,
gint x,
gint y,
gint width,
gint height);
void _shell_wm_unmaximize (ShellWM *wm,
MetaWindowActor *actor,
gint x,
gint y,
gint width,
gint height);
MetaSizeChange which_change,
MetaRectangle *old_rect,
MetaRectangle *new_rect);
void _shell_wm_map (ShellWM *wm,
MetaWindowActor *actor);
void _shell_wm_destroy (ShellWM *wm,

View File

@ -4,6 +4,7 @@
#include <string.h>
#include <meta/meta-enum-types.h>
#include <meta/keybindings.h>
#include "shell-wm-private.h"
@ -20,8 +21,7 @@ enum
{
MINIMIZE,
UNMINIMIZE,
MAXIMIZE,
UNMAXIMIZE,
SIZE_CHANGE,
MAP,
DESTROY,
SWITCH_WORKSPACE,
@ -74,22 +74,14 @@ shell_wm_class_init (ShellWMClass *klass)
NULL, NULL, NULL,
G_TYPE_NONE, 1,
META_TYPE_WINDOW_ACTOR);
shell_wm_signals[MAXIMIZE] =
g_signal_new ("maximize",
shell_wm_signals[SIZE_CHANGE] =
g_signal_new ("size-change",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 5,
META_TYPE_WINDOW_ACTOR, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT);
shell_wm_signals[UNMAXIMIZE] =
g_signal_new ("unmaximize",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 5,
META_TYPE_WINDOW_ACTOR, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT);
G_TYPE_NONE, 4,
META_TYPE_WINDOW_ACTOR, META_TYPE_SIZE_CHANGE, META_TYPE_RECTANGLE, META_TYPE_RECTANGLE);
shell_wm_signals[MAP] =
g_signal_new ("map",
G_TYPE_FROM_CLASS (klass),
@ -220,32 +212,11 @@ shell_wm_completed_unminimize (ShellWM *wm,
meta_plugin_unminimize_completed (wm->plugin, actor);
}
/**
* shell_wm_completed_maximize:
* @wm: the ShellWM
* @actor: the MetaWindowActor actor
*
* The plugin must call this when it has completed a window maximize effect.
**/
void
shell_wm_completed_maximize (ShellWM *wm,
MetaWindowActor *actor)
shell_wm_completed_size_change (ShellWM *wm,
MetaWindowActor *actor)
{
meta_plugin_maximize_completed (wm->plugin, actor);
}
/**
* shell_wm_completed_unmaximize:
* @wm: the ShellWM
* @actor: the MetaWindowActor actor
*
* The plugin must call this when it has completed a window unmaximize effect.
**/
void
shell_wm_completed_unmaximize (ShellWM *wm,
MetaWindowActor *actor)
{
meta_plugin_unmaximize_completed (wm->plugin, actor);
meta_plugin_size_change_completed (wm->plugin, actor);
}
/**
@ -359,25 +330,13 @@ _shell_wm_unminimize (ShellWM *wm,
}
void
_shell_wm_maximize (ShellWM *wm,
MetaWindowActor *actor,
int target_x,
int target_y,
int target_width,
int target_height)
_shell_wm_size_change (ShellWM *wm,
MetaWindowActor *actor,
MetaSizeChange which_change,
MetaRectangle *old_frame_rect,
MetaRectangle *old_buffer_rect)
{
g_signal_emit (wm, shell_wm_signals[MAXIMIZE], 0, actor, target_x, target_y, target_width, target_height);
}
void
_shell_wm_unmaximize (ShellWM *wm,
MetaWindowActor *actor,
int target_x,
int target_y,
int target_width,
int target_height)
{
g_signal_emit (wm, shell_wm_signals[UNMAXIMIZE], 0, actor, target_x, target_y, target_width, target_height);
g_signal_emit (wm, shell_wm_signals[SIZE_CHANGE], 0, actor, which_change, old_frame_rect, old_buffer_rect);
}
void

View File

@ -31,9 +31,7 @@ void shell_wm_completed_minimize (ShellWM *wm,
MetaWindowActor *actor);
void shell_wm_completed_unminimize (ShellWM *wm,
MetaWindowActor *actor);
void shell_wm_completed_maximize (ShellWM *wm,
MetaWindowActor *actor);
void shell_wm_completed_unmaximize (ShellWM *wm,
void shell_wm_completed_size_change (ShellWM *wm,
MetaWindowActor *actor);
void shell_wm_completed_map (ShellWM *wm,
MetaWindowActor *actor);