2008-10-31 18:09:20 +00:00
|
|
|
/* -*- mode: js2; js2-basic-offset: 4; -*- */
|
|
|
|
|
2008-10-31 04:22:44 +00:00
|
|
|
const Shell = imports.gi.Shell;
|
|
|
|
const Clutter = imports.gi.Clutter;
|
|
|
|
|
2008-10-31 18:09:20 +00:00
|
|
|
const Panel = imports.ui.panel;
|
2008-10-31 23:09:46 +00:00
|
|
|
const Overlay = imports.ui.overlay;
|
2008-10-31 18:09:20 +00:00
|
|
|
|
2008-10-31 18:29:42 +00:00
|
|
|
const DEFAULT_BACKGROUND_COLOR = new Clutter.Color();
|
|
|
|
DEFAULT_BACKGROUND_COLOR.from_pixel(0x2266bbff);
|
|
|
|
|
2008-10-31 18:09:20 +00:00
|
|
|
let panel = null;
|
2008-10-31 23:09:46 +00:00
|
|
|
let overlay = null;
|
2008-10-31 18:09:20 +00:00
|
|
|
|
2008-10-31 04:22:44 +00:00
|
|
|
function start() {
|
2008-10-31 18:29:42 +00:00
|
|
|
let global = Shell.global_get();
|
|
|
|
|
|
|
|
// The background color really only matters if there is no desktop
|
|
|
|
// window (say, nautilus) running. We set it mostly so things look good
|
|
|
|
// when we are running inside Xephyr.
|
|
|
|
global.stage.color = DEFAULT_BACKGROUND_COLOR;
|
|
|
|
|
|
|
|
// Mutter currently hardcodes putting "Yessir. The compositor is running""
|
|
|
|
// in the overlay. Clear that out.
|
2008-10-31 23:09:46 +00:00
|
|
|
let children = global.overlay_group.get_children();
|
2008-10-31 18:29:42 +00:00
|
|
|
for (let i = 0; i < children.length; i++)
|
|
|
|
children[i].destroy();
|
|
|
|
|
2008-10-31 18:09:20 +00:00
|
|
|
panel = new Panel.Panel();
|
2008-10-31 23:09:46 +00:00
|
|
|
overlay = new Overlay.Overlay();
|
|
|
|
global.set_stage_input_area(0, 0, global.screen_width, Panel.PANEL_HEIGHT);
|
|
|
|
}
|
|
|
|
|
|
|
|
function show_overlay() {
|
|
|
|
let global = Shell.global_get();
|
|
|
|
|
|
|
|
overlay.show();
|
|
|
|
global.set_stage_input_area(0, 0, global.screen_width, global.screen_height);
|
|
|
|
}
|
|
|
|
|
|
|
|
function hide_overlay() {
|
|
|
|
let global = Shell.global_get();
|
|
|
|
|
|
|
|
overlay.hide();
|
|
|
|
global.set_stage_input_area(0, 0, global.screen_width, Panel.PANEL_HEIGHT);
|
2008-10-31 04:22:44 +00:00
|
|
|
}
|