dnd: Centralize drag actor positioning code, use shellWorkspaceLaunch for workspaces

We had multiple copies of the code to position a drag actor given a particular
source.  Instead, just put it inside dnd.js.

Second, rather than test for GenericDisplay/WellDisplayItem etc.,
in various places, add a new method on each source "shellWorkspaceLaunch"
which both marks the item as being droppable on a workspace, and is
called by the workspaces code to launch the item.
This commit is contained in:
Colin Walters
2009-08-17 20:29:54 -04:00
parent 9563515e97
commit dd1a309cb6
5 changed files with 33 additions and 37 deletions

View File

@ -11,9 +11,7 @@ const Pango = imports.gi.Pango;
const Shell = imports.gi.Shell;
const Signals = imports.signals;
const AppDisplay = imports.ui.appDisplay;
const DND = imports.ui.dnd;
const GenericDisplay = imports.ui.genericDisplay;
const Main = imports.ui.main;
const Overview = imports.ui.overview;
const Panel = imports.ui.panel;
@ -855,9 +853,9 @@ Workspace.prototype = {
false, // don't create workspace
time);
return true;
} else if (source instanceof GenericDisplay.GenericDisplayItem || source instanceof AppDisplay.WellDisplayItem) {
} else if (source.shellWorkspaceLaunch) {
this._metaWorkspace.activate(time);
source.launch();
source.shellWorkspaceLaunch();
return true;
}