First stab at showing windows in the overlay
shell-global.[ch]: Add shell_global_get_windows() to get the list of all MutterWindow for the screen Makefile.am: Include the metacity typelib so that we can reference the MutterWindow type js/ui/overlay.js: Cascade the open windows, scaled down in the overlay svn path=/trunk/; revision=24
This commit is contained in:
parent
1ce78680b1
commit
e624b2a241
@ -29,11 +29,58 @@ Overlay.prototype = {
|
|||||||
|
|
||||||
this._group.hide();
|
this._group.hide();
|
||||||
global.overlay_group.add_actor(this._group);
|
global.overlay_group.add_actor(this._group);
|
||||||
|
|
||||||
|
this._window_clones = []
|
||||||
},
|
},
|
||||||
|
|
||||||
show : function() {
|
show : function() {
|
||||||
if (!this.visible) {
|
if (!this.visible) {
|
||||||
this.visible = true;
|
this.visible = true;
|
||||||
|
|
||||||
|
// Very simple version of a window overview ... when we show the
|
||||||
|
// overlay, display all the user's windows in the overlay scaled
|
||||||
|
// down.
|
||||||
|
//
|
||||||
|
// We show the window using "clones" of the texture .. separate
|
||||||
|
// actors that mirror the original actors for the window. For
|
||||||
|
// animation purposes, it may be better to actually move the
|
||||||
|
// original actors about instead.
|
||||||
|
|
||||||
|
let global = Shell.global_get();
|
||||||
|
let windows = global.get_windows();
|
||||||
|
|
||||||
|
let screen_width = global.screen_width
|
||||||
|
let screen_height = global.screen_height
|
||||||
|
|
||||||
|
let x = screen_width / 4
|
||||||
|
let y = screen_height / 4
|
||||||
|
|
||||||
|
for (let i = 0; i < windows.length; i++)
|
||||||
|
if (!windows[i].is_override_redirect()) {
|
||||||
|
let clone = new Clutter.CloneTexture({ parent_texture: windows[i].get_texture(),
|
||||||
|
x: x,
|
||||||
|
y: y });
|
||||||
|
|
||||||
|
// We scale each window down so that it is at most 300x300, but we
|
||||||
|
// never want to scale a window up.
|
||||||
|
let size = clone.width;
|
||||||
|
if (clone.height > size)
|
||||||
|
size = clone.height;
|
||||||
|
|
||||||
|
let scale = 300 / size;
|
||||||
|
if (scale > 1)
|
||||||
|
scale = 1;
|
||||||
|
|
||||||
|
clone.set_scale(scale, scale);
|
||||||
|
this._group.add_actor(clone);
|
||||||
|
this._window_clones.push(clone);
|
||||||
|
|
||||||
|
// Windows are overlapped diagonally. If there are too many, they'll
|
||||||
|
// end up off the screen
|
||||||
|
x += 50;
|
||||||
|
y += 50;
|
||||||
|
}
|
||||||
|
|
||||||
this._group.show();
|
this._group.show();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -42,6 +89,12 @@ Overlay.prototype = {
|
|||||||
if (this.visible) {
|
if (this.visible) {
|
||||||
this.visible = false;
|
this.visible = false;
|
||||||
this._group.hide();
|
this._group.hide();
|
||||||
|
|
||||||
|
for (let i = 0; i < this._window_clones.length; i++) {
|
||||||
|
this._window_clones[i].destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
this._window_clones = [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -38,6 +38,7 @@ Shell-0.1.gir: libgnome-shell-introspect.la $(libgnome_shell_la_SOURCES)
|
|||||||
--nsversion=0.1 \
|
--nsversion=0.1 \
|
||||||
--include=GObject-2.0 \
|
--include=GObject-2.0 \
|
||||||
--include=Clutter-0.8 \
|
--include=Clutter-0.8 \
|
||||||
|
--include=Meta-2.25 \
|
||||||
--library=gnome-shell-introspect \
|
--library=gnome-shell-introspect \
|
||||||
$(libgnome_shell_la_SOURCES) \
|
$(libgnome_shell_la_SOURCES) \
|
||||||
$(INCLUDES) \
|
$(INCLUDES) \
|
||||||
|
@ -14,6 +14,11 @@ mutter_plugin_get_stage (MutterPlugin *plugin)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GList *
|
||||||
|
mutter_plugin_get_windows (MutterPlugin *plugin)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
mutter_plugin_query_screen_size (MutterPlugin *plugin,
|
mutter_plugin_query_screen_size (MutterPlugin *plugin,
|
||||||
int *width,
|
int *width,
|
||||||
|
@ -159,6 +159,21 @@ shell_global_set_stage_input_area (ShellGlobal *global,
|
|||||||
mutter_plugin_set_stage_input_area (global->plugin, x, y, width, height);
|
mutter_plugin_set_stage_input_area (global->plugin, x, y, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* shell_global_get_windows:
|
||||||
|
*
|
||||||
|
* Gets the list of MutterWindows for the plugin's screen
|
||||||
|
*
|
||||||
|
* Return value: (element-type MutterWindow) (transfer none): the list of windows
|
||||||
|
*/
|
||||||
|
GList *
|
||||||
|
shell_global_get_windows (ShellGlobal *global)
|
||||||
|
{
|
||||||
|
g_return_if_fail (SHELL_IS_GLOBAL (global));
|
||||||
|
|
||||||
|
return mutter_plugin_get_windows (global->plugin);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_shell_global_set_plugin (ShellGlobal *global,
|
_shell_global_set_plugin (ShellGlobal *global,
|
||||||
MutterPlugin *plugin)
|
MutterPlugin *plugin)
|
||||||
|
@ -21,12 +21,13 @@ GType shell_global_get_type (void) G_GNUC_CONST;
|
|||||||
|
|
||||||
ShellGlobal *shell_global_get (void);
|
ShellGlobal *shell_global_get (void);
|
||||||
|
|
||||||
void
|
void shell_global_set_stage_input_area (ShellGlobal *global,
|
||||||
shell_global_set_stage_input_area (ShellGlobal *global,
|
int x,
|
||||||
int x,
|
int y,
|
||||||
int y,
|
int width,
|
||||||
int width,
|
int height);
|
||||||
int height);
|
|
||||||
|
GList *shell_global_get_windows (ShellGlobal *global);
|
||||||
|
|
||||||
void _shell_global_set_plugin (ShellGlobal *global,
|
void _shell_global_set_plugin (ShellGlobal *global,
|
||||||
MutterPlugin *plugin);
|
MutterPlugin *plugin);
|
||||||
|
Loading…
Reference in New Issue
Block a user