[overview] Fix dnd on mulit screen setups

Currently we don't get any drop events for dual screen modes with a screen
at the right, and behave weird by hardcoding the screen size and 0 as drag
edges.

Fix that by spawning the drop group over the whole stage and take the primary monitors position and size into account in _handleDragOver.

https://bugzilla.gnome.org/show_bug.cgi?id=620378
This commit is contained in:
Adel Gadllah 2010-06-02 18:38:31 +02:00
parent cc163237cc
commit fe91f7fe9e

View File

@ -665,10 +665,10 @@ SingleView.prototype = {
this._animatingScroll = false; // programatically move the scroll bar this._animatingScroll = false; // programatically move the scroll bar
this._inDrag = false; // dragging a window this._inDrag = false; // dragging a window
this._lastMotionTime = -1; // used to track "stopping" while dragging workspaces this._lastMotionTime = -1; // used to track "stopping" while dragging workspaces
let primary = global.get_primary_monitor();
this._dropGroup = new Clutter.Group({ x: 0, y: 0, this._dropGroup = new Clutter.Group({ x: 0, y: 0,
width: primary.width, width: global.screen_width,
height: primary.height }); height: global.screen_height });
this._dropGroup._delegate = this; this._dropGroup._delegate = this;
global.stage.add_actor(this._dropGroup); global.stage.add_actor(this._dropGroup);
this._dropGroup.lower_bottom(); this._dropGroup.lower_bottom();
@ -1195,19 +1195,20 @@ SingleView.prototype = {
handleDragOver: function(self, actor, x, y) { handleDragOver: function(self, actor, x, y) {
let onPanel = false; let onPanel = false;
let primary = global.get_primary_monitor();
let activeWorkspaceIndex = global.screen.get_active_workspace_index(); let activeWorkspaceIndex = global.screen.get_active_workspace_index();
if (x == 0 && activeWorkspaceIndex > 0 && this._dragOverLastX !== 0) {
if (x <= primary.x && activeWorkspaceIndex > 0 && this._dragOverLastX !== primary.x) {
this._workspaces[activeWorkspaceIndex - 1].metaWorkspace.activate(global.get_current_time()); this._workspaces[activeWorkspaceIndex - 1].metaWorkspace.activate(global.get_current_time());
this._workspaces[activeWorkspaceIndex - 1].setReservedSlot(actor._delegate); this._workspaces[activeWorkspaceIndex - 1].setReservedSlot(actor._delegate);
this._dragOverLastX = 0; this._dragOverLastX = primary.x;
return; return;
} }
if (x == global.screen_width - 1 && this._workspaces[activeWorkspaceIndex + 1] && if (x >= primary.x + primary.width - 1 && this._workspaces[activeWorkspaceIndex + 1] &&
this._dragOverLastX != global.screen_width - 1) { this._dragOverLastX != primary.x + primary.width - 1) {
this._workspaces[activeWorkspaceIndex + 1].metaWorkspace.activate(global.get_current_time()); this._workspaces[activeWorkspaceIndex + 1].metaWorkspace.activate(global.get_current_time());
this._workspaces[activeWorkspaceIndex + 1].setReservedSlot(actor._delegate); this._workspaces[activeWorkspaceIndex + 1].setReservedSlot(actor._delegate);
this._dragOverLastX = global.screen_width - 1; this._dragOverLastX = primary.x + primary.width - 1;
return; return;
} }