From c4cf1c308cc02ede9d1e10891722a3a81e216dac Mon Sep 17 00:00:00 2001 From: "gavin%gavinsharp.com" Date: Thu, 29 Jun 2006 01:25:23 +0000 Subject: [PATCH] Bug 341577: Drag-and-drop of search engines on Mac looks ugly, patch by Phil Ringnalda , r=me/mconnor --- .../search/content/engineManager.js | 35 +++++++------------ .../search/content/engineManager.xul | 4 ++- 2 files changed, 16 insertions(+), 23 deletions(-) diff --git a/browser/components/search/content/engineManager.js b/browser/components/search/content/engineManager.js index 6a34095b3461..b5718d3b3249 100644 --- a/browser/components/search/content/engineManager.js +++ b/browser/components/search/content/engineManager.js @@ -140,34 +140,24 @@ var gEngineManagerDialog = { document.getElementById("cmd_movedown").setAttribute("disabled", disableButtons || lastSelected); - }, + } +}; - startDrag: function engineManager_startDrag(aEvent) { +var gDragObserver = { + onDragStart: function (aEvent, aXferData, aDragAction) { var selectedIndex = gEngineView.selectedIndex; if (selectedIndex == -1) return; - var transfer = Cc["@mozilla.org/widget/transferable;1"]. - createInstance(Ci.nsITransferable); - var dragData = Cc["@mozilla.org/supports-string;1"]. - createInstance(Ci.nsISupportsString); + aXferData.data = new TransferData(); + aXferData.data.addDataForFlavour(ENGINE_FLAVOR, selectedIndex.toString()); - transfer.addDataFlavor(ENGINE_FLAVOR); - - var indexStr = selectedIndex.toString(); - dragData.data = indexStr; // 2 bytes per character - transfer.setTransferData(ENGINE_FLAVOR, dragData, indexStr.length * 2); - - var transArray = Cc["@mozilla.org/supports-array;1"]. - createInstance(Ci.nsISupportsArray); - transfer.QueryInterface(Components.interfaces.nsISupports) - transArray.AppendElement(transfer); - - var dragService = Cc["@mozilla.org/widget/dragservice;1"]. - getService(Ci.nsIDragService); - dragService.invokeDragSession(aEvent.target, transArray, null, - Ci.nsIDragService.DRAGDROP_ACTION_MOVE); - } + aDragAction.action = Ci.nsIDragService.DRAGDROP_ACTION_MOVE; + }, + onDrop: function (aEvent, aXferData, aDragSession) { }, + onDragExit: function (aEvent, aDragSession) { }, + onDragOver: function (aEvent, aFlavour, aDragSession) { }, + getSupportedFlavours: function() { return null; } }; // "Operation" objects @@ -370,6 +360,7 @@ EngineView.prototype = { // Redraw, and adjust selection this.invalidate(); + this.selection.clearSelection(); this.selection.select(newIndex); } }, diff --git a/browser/components/search/content/engineManager.xul b/browser/components/search/content/engineManager.xul index 4e660a7d1101..e5e4bd4a04e8 100644 --- a/browser/components/search/content/engineManager.xul +++ b/browser/components/search/content/engineManager.xul @@ -55,6 +55,8 @@