mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
💉 BrowserWindow instance into ContextMenu
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user