Skip to content

Commit 8349325

Browse files
committed
Use new IPC API for sending event to window
1 parent 02db75d commit 8349325

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

lib/tab-bar-view.coffee

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
BrowserIpc = null # Defer require until actually used
1+
BrowserWindow = null # Defer require until actually used
22
RendererIpc = require('ipc')
33

44
{$, View} = require 'atom'
@@ -252,11 +252,19 @@ class TabBarView extends View
252252

253253
if not isNaN(fromProcessId) and not isNaN(fromProcessId)
254254
# Let the window where the drag started know that the tab was dropped
255-
BrowserIpc ?= require('remote').require('ipc')
256-
BrowserIpc.sendChannel(fromProcessId, fromRoutingId, 'tab:dropped', fromPaneId, fromIndex)
255+
browserWindow = @browserWindowForProcessIdAndRoutingId(fromProcessId, fromRoutingId)
256+
browserWindow?.webContents.send('tab:dropped', fromPaneId, fromIndex)
257257

258258
atom.focus()
259259

260+
browserWindowForProcessIdAndRoutingId: (processId, routingId) ->
261+
BrowserWindow ?= require('remote').require('browser-window')
262+
for browserWindow in BrowserWindow.getAllWindows()
263+
if browserWindow.getProcessId() is processId and browserWindow.getRoutingId() is routingId
264+
return browserWindow
265+
266+
null
267+
260268
moveItemBetweenPanes: (fromPane, fromIndex, toPane, toIndex, item) ->
261269
if toPane is fromPane
262270
toIndex-- if fromIndex < toIndex

0 commit comments

Comments
 (0)