2008-10-31 14:09:20 -04:00
|
|
|
/* -*- mode: js2; js2-basic-offset: 4; -*- */
|
|
|
|
|
2008-10-31 00:22:44 -04:00
|
|
|
const Shell = imports.gi.Shell;
|
|
|
|
const Clutter = imports.gi.Clutter;
|
|
|
|
|
2008-10-31 14:09:20 -04:00
|
|
|
const Panel = imports.ui.panel;
|
2008-10-31 19:09:46 -04:00
|
|
|
const Overlay = imports.ui.overlay;
|
2008-11-19 18:21:42 -05:00
|
|
|
const RunDialog = imports.ui.run_dialog;
|
2008-11-21 09:02:09 -05:00
|
|
|
const WindowManager = imports.ui.windowmanager;
|
2008-10-31 14:09:20 -04:00
|
|
|
|
2008-10-31 14:29:42 -04:00
|
|
|
const DEFAULT_BACKGROUND_COLOR = new Clutter.Color();
|
|
|
|
DEFAULT_BACKGROUND_COLOR.from_pixel(0x2266bbff);
|
|
|
|
|
2008-10-31 14:09:20 -04:00
|
|
|
let panel = null;
|
2008-10-31 19:09:46 -04:00
|
|
|
let overlay = null;
|
2008-11-19 18:21:42 -05:00
|
|
|
let run_dialog = null;
|
2008-11-21 09:02:09 -05:00
|
|
|
let wm = null;
|
2008-10-31 14:09:20 -04:00
|
|
|
|
2008-10-31 00:22:44 -04:00
|
|
|
function start() {
|
2008-10-31 14:29:42 -04: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 19:09:46 -04:00
|
|
|
let children = global.overlay_group.get_children();
|
2008-10-31 14:29:42 -04:00
|
|
|
for (let i = 0; i < children.length; i++)
|
|
|
|
children[i].destroy();
|
|
|
|
|
2008-11-19 18:21:42 -05:00
|
|
|
global.connect('panel-run-dialog', function(panel) {
|
|
|
|
// Make sure not more than one run dialog is shown.
|
|
|
|
if (!run_dialog) {
|
|
|
|
run_dialog = new RunDialog.RunDialog();
|
2008-11-20 10:47:13 -05:00
|
|
|
let handler = function() {
|
2008-11-19 18:21:42 -05:00
|
|
|
run_dialog.destroy();
|
|
|
|
run_dialog = null;
|
|
|
|
};
|
2008-11-20 10:47:13 -05:00
|
|
|
run_dialog.connect('run', handler);
|
|
|
|
run_dialog.connect('cancel', handler);
|
2008-11-19 18:21:42 -05:00
|
|
|
run_dialog.show();
|
|
|
|
}
|
2008-11-07 13:42:23 -05:00
|
|
|
});
|
|
|
|
|
2008-10-31 14:09:20 -04:00
|
|
|
panel = new Panel.Panel();
|
2008-10-31 19:09:46 -04:00
|
|
|
global.set_stage_input_area(0, 0, global.screen_width, Panel.PANEL_HEIGHT);
|
2008-11-21 09:02:09 -05:00
|
|
|
|
|
|
|
overlay = new Overlay.Overlay();
|
|
|
|
wm = new WindowManager.WindowManager();
|
2008-10-31 19:09:46 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
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();
|
2008-11-14 19:44:11 -05:00
|
|
|
panel.overlayHidden();
|
2008-10-31 19:09:46 -04:00
|
|
|
global.set_stage_input_area(0, 0, global.screen_width, Panel.PANEL_HEIGHT);
|
2008-10-31 00:22:44 -04:00
|
|
|
}
|