[gnome-shell] Update GnomeShellPlugin according to recent changes in MutterPlugin
- From: Maxim Ermilov <mermilov src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] Update GnomeShellPlugin according to recent changes in MutterPlugin
- Date: Wed, 16 Jun 2010 21:46:44 +0000 (UTC)
commit 4800a80c3a0b0d18702dda7e26a95d55ba396d84
Author: Maxim Ermilov <zaspire rambler ru>
Date: Thu Jun 17 01:28:57 2010 +0400
Update GnomeShellPlugin according to recent changes in MutterPlugin
https://bugzilla.gnome.org/show_bug.cgi?id=621083
js/ui/windowManager.js | 17 +++--
src/gnome-shell-plugin.c | 30 +++++----
src/shell-wm.c | 159 +++++++--------------------------------------
src/shell-wm.h | 7 +-
4 files changed, 55 insertions(+), 158 deletions(-)
---
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index 7232fc9..86e1ea3 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -30,18 +30,21 @@ WindowManager.prototype = {
this._destroying = [];
this._switchData = null;
- this._shellwm.connect('switch-workspace', Lang.bind(this, this._switchWorkspace));
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);
+ }));
+
+ this._shellwm.connect('switch-workspace', Lang.bind(this, this._switchWorkspace));
this._shellwm.connect('minimize', Lang.bind(this, this._minimizeWindow));
- this._shellwm.connect('kill-minimize', Lang.bind(this, this._minimizeWindowDone));
this._shellwm.connect('maximize', Lang.bind(this, this._maximizeWindow));
- this._shellwm.connect('kill-maximize', Lang.bind(this, this._maximizeWindowDone));
this._shellwm.connect('unmaximize', Lang.bind(this, this._unmaximizeWindow));
- this._shellwm.connect('kill-unmaximize', Lang.bind(this, this._unmaximizeWindowDone));
this._shellwm.connect('map', Lang.bind(this, this._mapWindow));
- this._shellwm.connect('kill-map', Lang.bind(this, this._mapWindowDone));
this._shellwm.connect('destroy', Lang.bind(this, this._destroyWindow));
- this._shellwm.connect('kill-destroy', Lang.bind(this, this._destroyWindowDone));
this._workspaceSwitcherPopup = null;
this.setKeybindingHandler('switch_to_workspace_left', Lang.bind(this, this._showWorkspaceSwitcher));
@@ -197,7 +200,7 @@ WindowManager.prototype = {
return;
}
- let windows = shellwm.get_switch_workspace_actors();
+ let windows = global.get_windows();
/* @direction is the direction that the "camera" moves, so the
* screen contents have to move one screen's worth in the
diff --git a/src/gnome-shell-plugin.c b/src/gnome-shell-plugin.c
index 8358a35..4b2b71a 100644
--- a/src/gnome-shell-plugin.c
+++ b/src/gnome-shell-plugin.c
@@ -78,13 +78,13 @@ static void gnome_shell_plugin_destroy (MutterPlugin *plugi
MutterWindow *actor);
static void gnome_shell_plugin_switch_workspace (MutterPlugin *plugin,
- const GList **actors,
gint from,
gint to,
MetaMotionDirection direction);
-static void gnome_shell_plugin_kill_effect (MutterPlugin *plugin,
- MutterWindow *actor,
- gulong events);
+
+static void gnome_shell_plugin_kill_window_effects (MutterPlugin *plugin,
+ MutterWindow *actor);
+static void gnome_shell_plugin_kill_switch_workspace (MutterPlugin *plugin);
static gboolean gnome_shell_plugin_xevent_filter (MutterPlugin *plugin,
XEvent *event);
@@ -142,7 +142,9 @@ gnome_shell_plugin_class_init (GnomeShellPluginClass *klass)
plugin_class->destroy = gnome_shell_plugin_destroy;
plugin_class->switch_workspace = gnome_shell_plugin_switch_workspace;
- plugin_class->kill_effect = gnome_shell_plugin_kill_effect;
+
+ plugin_class->kill_window_effects = gnome_shell_plugin_kill_window_effects;
+ plugin_class->kill_switch_workspace = gnome_shell_plugin_kill_switch_workspace;
plugin_class->xevent_filter = gnome_shell_plugin_xevent_filter;
plugin_class->plugin_info = gnome_shell_plugin_plugin_info;
@@ -458,22 +460,24 @@ gnome_shell_plugin_destroy (MutterPlugin *plugin,
static void
gnome_shell_plugin_switch_workspace (MutterPlugin *plugin,
- const GList **actors,
gint from,
gint to,
MetaMotionDirection direction)
{
- _shell_wm_switch_workspace (get_shell_wm(),
- actors, from, to, direction);
+ _shell_wm_switch_workspace (get_shell_wm(), from, to, direction);
+}
+
+static void
+gnome_shell_plugin_kill_window_effects (MutterPlugin *plugin,
+ MutterWindow *actor)
+{
+ _shell_wm_kill_window_effects (get_shell_wm(), actor);
}
static void
-gnome_shell_plugin_kill_effect (MutterPlugin *plugin,
- MutterWindow *actor,
- gulong events)
+gnome_shell_plugin_kill_switch_workspace (MutterPlugin *plugin)
{
- _shell_wm_kill_effect (get_shell_wm(),
- actor, events);
+ _shell_wm_kill_switch_workspace (get_shell_wm());
}
static gboolean
diff --git a/src/shell-wm.c b/src/shell-wm.c
index 6ddd655..f6e687f 100644
--- a/src/shell-wm.c
+++ b/src/shell-wm.c
@@ -14,24 +14,19 @@ struct _ShellWM {
GObject parent;
MutterPlugin *plugin;
- GList *switch_workspace_actors;
};
/* Signals */
enum
{
MINIMIZE,
- KILL_MINIMIZE,
MAXIMIZE,
- KILL_MAXIMIZE,
UNMAXIMIZE,
- KILL_UNMAXIMIZE,
MAP,
- KILL_MAP,
DESTROY,
- KILL_DESTROY,
SWITCH_WORKSPACE,
KILL_SWITCH_WORKSPACE,
+ KILL_WINDOW_EFFECTS,
KEYBINDING,
@@ -40,9 +35,6 @@ enum
G_DEFINE_TYPE(ShellWM, shell_wm, G_TYPE_OBJECT);
-static void shell_wm_set_switch_workspace_actors (ShellWM *wm,
- GList *actors);
-
static guint shell_wm_signals [LAST_SIGNAL] = { 0 };
static void
@@ -53,10 +45,6 @@ shell_wm_init (ShellWM *wm)
static void
shell_wm_finalize (GObject *object)
{
- ShellWM *wm = SHELL_WM (object);
-
- shell_wm_set_switch_workspace_actors (wm, NULL);
-
G_OBJECT_CLASS (shell_wm_parent_class)->finalize (object);
}
@@ -76,15 +64,6 @@ shell_wm_class_init (ShellWMClass *klass)
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
MUTTER_TYPE_COMP_WINDOW);
- shell_wm_signals[KILL_MINIMIZE] =
- g_signal_new ("kill-minimize",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE, 1,
- MUTTER_TYPE_COMP_WINDOW);
shell_wm_signals[MAXIMIZE] =
g_signal_new ("maximize",
G_TYPE_FROM_CLASS (klass),
@@ -94,15 +73,6 @@ shell_wm_class_init (ShellWMClass *klass)
_shell_marshal_VOID__OBJECT_INT_INT_INT_INT,
G_TYPE_NONE, 5,
MUTTER_TYPE_COMP_WINDOW, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT);
- shell_wm_signals[KILL_MAXIMIZE] =
- g_signal_new ("kill-maximize",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE, 1,
- MUTTER_TYPE_COMP_WINDOW);
shell_wm_signals[UNMAXIMIZE] =
g_signal_new ("unmaximize",
G_TYPE_FROM_CLASS (klass),
@@ -112,15 +82,6 @@ shell_wm_class_init (ShellWMClass *klass)
_shell_marshal_VOID__OBJECT_INT_INT_INT_INT,
G_TYPE_NONE, 1,
MUTTER_TYPE_COMP_WINDOW, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT);
- shell_wm_signals[KILL_UNMAXIMIZE] =
- g_signal_new ("kill-unmaximize",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE, 1,
- MUTTER_TYPE_COMP_WINDOW);
shell_wm_signals[MAP] =
g_signal_new ("map",
G_TYPE_FROM_CLASS (klass),
@@ -130,15 +91,6 @@ shell_wm_class_init (ShellWMClass *klass)
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
MUTTER_TYPE_COMP_WINDOW);
- shell_wm_signals[KILL_MAP] =
- g_signal_new ("kill-map",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE, 1,
- MUTTER_TYPE_COMP_WINDOW);
shell_wm_signals[DESTROY] =
g_signal_new ("destroy",
G_TYPE_FROM_CLASS (klass),
@@ -148,15 +100,6 @@ shell_wm_class_init (ShellWMClass *klass)
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
MUTTER_TYPE_COMP_WINDOW);
- shell_wm_signals[KILL_DESTROY] =
- g_signal_new ("kill-destroy",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE, 1,
- MUTTER_TYPE_COMP_WINDOW);
shell_wm_signals[SWITCH_WORKSPACE] =
g_signal_new ("switch-workspace",
G_TYPE_FROM_CLASS (klass),
@@ -174,6 +117,15 @@ shell_wm_class_init (ShellWMClass *klass)
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
+ shell_wm_signals[KILL_WINDOW_EFFECTS] =
+ g_signal_new ("kill-window-effects",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ MUTTER_TYPE_COMP_WINDOW);
/**
* ShellWM::keybinding:
@@ -204,52 +156,15 @@ shell_wm_class_init (ShellWMClass *klass)
void
_shell_wm_switch_workspace (ShellWM *wm,
- const GList **actors,
gint from,
gint to,
MetaMotionDirection direction)
{
- shell_wm_set_switch_workspace_actors (wm, (GList *)*actors);
g_signal_emit (wm, shell_wm_signals[SWITCH_WORKSPACE], 0,
from, to, direction);
}
/**
- * shell_wm_get_switch_workspace_actors:
- * @wm: the #ShellWM
- *
- * A workaround for a missing feature in gobject-introspection. Returns
- * the list of windows involved in a switch-workspace operation (which
- * cannot be passed directly to the signal handler because there's no
- * way to annotate the element-type of a signal parameter.)
- *
- * Return value: (element-type MutterWindow) (transfer full): the list
- * of windows
- **/
-GList *
-shell_wm_get_switch_workspace_actors (ShellWM *wm)
-{
- GList *l;
-
- for (l = wm->switch_workspace_actors; l; l = l->next)
- g_object_ref (l->data);
- return g_list_copy (wm->switch_workspace_actors);
-}
-
-static void
-shell_wm_set_switch_workspace_actors (ShellWM *wm, GList *actors)
-{
- const GList *l;
-
- for (l = wm->switch_workspace_actors; l; l = l->next)
- g_object_unref (l->data);
- g_list_free (wm->switch_workspace_actors);
- wm->switch_workspace_actors = g_list_copy (actors);
- for (l = wm->switch_workspace_actors; l; l = l->next)
- g_object_ref (l->data);
-}
-
-/**
* shell_wm_completed_switch_workspace:
* @wm: the ShellWM
*
@@ -259,15 +174,7 @@ shell_wm_set_switch_workspace_actors (ShellWM *wm, GList *actors)
void
shell_wm_completed_switch_workspace (ShellWM *wm)
{
- g_return_if_fail (wm->switch_workspace_actors != NULL);
-
- /* mutter_plugin_effect_completed() requires us to pass a window,
- * though it doesn't matter *which* window in this case.
- */
- mutter_plugin_effect_completed (wm->plugin,
- wm->switch_workspace_actors->data,
- MUTTER_PLUGIN_SWITCH_WORKSPACE);
- shell_wm_set_switch_workspace_actors (wm, NULL);
+ mutter_plugin_switch_workspace_completed (wm->plugin);
}
/**
@@ -281,9 +188,7 @@ void
shell_wm_completed_minimize (ShellWM *wm,
MutterWindow *actor)
{
- mutter_plugin_effect_completed (wm->plugin,
- actor,
- MUTTER_PLUGIN_MINIMIZE);
+ mutter_plugin_minimize_completed (wm->plugin, actor);
}
/**
@@ -297,9 +202,7 @@ void
shell_wm_completed_maximize (ShellWM *wm,
MutterWindow *actor)
{
- mutter_plugin_effect_completed (wm->plugin,
- actor,
- MUTTER_PLUGIN_MAXIMIZE);
+ mutter_plugin_maximize_completed (wm->plugin, actor);
}
/**
@@ -313,9 +216,7 @@ void
shell_wm_completed_unmaximize (ShellWM *wm,
MutterWindow *actor)
{
- mutter_plugin_effect_completed (wm->plugin,
- actor,
- MUTTER_PLUGIN_UNMAXIMIZE);
+ mutter_plugin_unmaximize_completed (wm->plugin, actor);
}
/**
@@ -329,9 +230,7 @@ void
shell_wm_completed_map (ShellWM *wm,
MutterWindow *actor)
{
- mutter_plugin_effect_completed (wm->plugin,
- actor,
- MUTTER_PLUGIN_MAP);
+ mutter_plugin_map_completed (wm->plugin, actor);
}
/**
@@ -345,28 +244,20 @@ void
shell_wm_completed_destroy (ShellWM *wm,
MutterWindow *actor)
{
- mutter_plugin_effect_completed (wm->plugin,
- actor,
- MUTTER_PLUGIN_DESTROY);
+ mutter_plugin_destroy_completed (wm->plugin, actor);
+}
+
+void
+_shell_wm_kill_switch_workspace (ShellWM *wm)
+{
+ g_signal_emit (wm, shell_wm_signals[KILL_SWITCH_WORKSPACE], 0);
}
void
-_shell_wm_kill_effect (ShellWM *wm,
- MutterWindow *actor,
- gulong events)
+_shell_wm_kill_window_effects (ShellWM *wm,
+ MutterWindow *actor)
{
- if (events & MUTTER_PLUGIN_MINIMIZE)
- g_signal_emit (wm, shell_wm_signals[KILL_MINIMIZE], 0, actor);
- if (events & MUTTER_PLUGIN_MAXIMIZE)
- g_signal_emit (wm, shell_wm_signals[KILL_MAXIMIZE], 0, actor);
- if (events & MUTTER_PLUGIN_UNMAXIMIZE)
- g_signal_emit (wm, shell_wm_signals[KILL_UNMAXIMIZE], 0, actor);
- if (events & MUTTER_PLUGIN_MAP)
- g_signal_emit (wm, shell_wm_signals[KILL_MAP], 0, actor);
- if (events & MUTTER_PLUGIN_DESTROY)
- g_signal_emit (wm, shell_wm_signals[KILL_DESTROY], 0, actor);
- if (events & MUTTER_PLUGIN_SWITCH_WORKSPACE)
- g_signal_emit (wm, shell_wm_signals[KILL_SWITCH_WORKSPACE], 0);
+ g_signal_emit (wm, shell_wm_signals[KILL_WINDOW_EFFECTS], 0, actor);
}
diff --git a/src/shell-wm.h b/src/shell-wm.h
index 30eb193..fccfe66 100644
--- a/src/shell-wm.h
+++ b/src/shell-wm.h
@@ -64,13 +64,12 @@ void _shell_wm_destroy (ShellWM *wm,
MutterWindow *actor);
void _shell_wm_switch_workspace (ShellWM *wm,
- const GList **actors,
gint from,
gint to,
MetaMotionDirection direction);
-void _shell_wm_kill_effect (ShellWM *wm,
- MutterWindow *actor,
- gulong events);
+void _shell_wm_kill_window_effects (ShellWM *wm,
+ MutterWindow *actor);
+void _shell_wm_kill_switch_workspace (ShellWM *wm);
/* Keybinding stuff */
void shell_wm_takeover_keybinding (ShellWM *wm,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]