💉 BrowserWindow instance into ContextMenu

This commit is contained in:
Kevin Sawicki
2013-10-11 08:38:15 -07:00
parent e4219cae45
commit 317365e41f
2 changed files with 3 additions and 4 deletions

View File

@@ -83,7 +83,7 @@ class AtomWindow
when 1 then @browserWindow.restart()
@browserWindow.on 'context-menu', (menuTemplate) =>
new ContextMenu(menuTemplate)
new ContextMenu(menuTemplate, @browserWindow)
if @isSpec
# Spec window's web view should always have focus

View File

@@ -1,12 +1,11 @@
Menu = require 'menu'
BrowserWindow = require 'browser-window'
module.exports =
class ContextMenu
constructor: (template) ->
constructor: (template, browserWindow) ->
template = @createClickHandlers(template)
menu = Menu.buildFromTemplate(template)
menu.popup(BrowserWindow.getFocusedWindow())
menu.popup(browserWindow)
# Private: It's necessary to build the event handlers in this process, otherwise
# closures are drug across processes and failed to be garbage collected