Re: window / workspace switcher
- From: Milan Bouchet-Valat <nalimilan club fr>
- To: Stanisław Pitucha <viraptor gmail com>
- Cc: gnome-shell-list gnome org
- Subject: Re: window / workspace switcher
- Date: Fri, 27 Mar 2009 12:13:09 +0100
I wrote a little patch some time ago that I'll need at some point. It's
not been committed into metacity-clutter, but I think it can easily go
there if you need it now.
The relevant code is in src/core/worspace.c. There are three events :
WINDOW_ADDED
WINDOW_REMOVED
WORKSPACE_SWITCHED
So you'd only need to connect you JS code to these GObject events.
Maybe you can use libwnck else, I guess that's how the old applet works.
diff --git a/src/core/workspace.c b/src/core/workspace.c
index f324c6e..4abf23b 100644
--- a/src/core/workspace.c
+++ b/src/core/workspace.c
@@ -50,6 +50,7 @@ enum
{
WINDOW_ADDED,
WINDOW_REMOVED,
+ WORKSPACE_SWITCHED,
LAST_SIGNAL
};
@@ -85,6 +86,15 @@ meta_workspace_class_init (MetaWorkspaceClass *klass)
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
META_TYPE_WINDOW);
+ signals[WORKSPACE_SWITCHED] = g_signal_new ("workspace-switched",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__UINT,
+ G_TYPE_NONE,
+ 1,
+ G_TYPE_UINT);
}
static void
@@ -525,6 +535,8 @@ meta_workspace_activate_with_focus (MetaWorkspace *workspace,
meta_compositor_switch_workspace (comp, screen, old, workspace, direction);
}
#endif
+
+ g_signal_emit (workspace, signals[WORKSPACE_SWITCHED], 0, timestamp);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]