diff --git a/src/context-menu-manager.coffee b/src/context-menu-manager.coffee index 4dc54cede..5f993eaa1 100644 --- a/src/context-menu-manager.coffee +++ b/src/context-menu-manager.coffee @@ -4,6 +4,7 @@ fs = require 'fs-plus' {calculateSpecificity, validateSelector} = require 'clear-cut' {Disposable} = require 'event-kit' {remote} = require 'electron' +ipcHelpers = require './ipc-helpers' MenuHelpers = require './menu-helpers' platformContextMenu = require('../package.json')?._atomMenu?['context-menu'] @@ -200,7 +201,8 @@ class ContextMenuManager menuTemplate = @templateForEvent(event) return unless menuTemplate?.length > 0 - remote.getCurrentWindow().emit('context-menu', menuTemplate) + + ipcHelpers.call('window-method', 'openContextMenu', menuTemplate) return clear: -> diff --git a/src/main-process/atom-window.coffee b/src/main-process/atom-window.coffee index 3c163ba25..f43481c92 100644 --- a/src/main-process/atom-window.coffee +++ b/src/main-process/atom-window.coffee @@ -101,10 +101,12 @@ class AtomWindow hasProjectPath: -> @getLoadSettings().initialPaths?.length > 0 setupContextMenu: -> - ContextMenu = require './context-menu' - @browserWindow.on 'context-menu', (menuTemplate) => - new ContextMenu(menuTemplate, this) + @openContextMenu(menuTemplate) + + openContextMenu: (menuTemplate) -> + ContextMenu = require './context-menu' + new ContextMenu(menuTemplate, this) containsPaths: (paths) -> for pathToCheck in paths