2015-01-05 06:45:51 +00:00
|
|
|
binding = process.atomBinding 'screen'
|
|
|
|
|
|
|
|
checkAppIsReady = ->
|
|
|
|
unless process.type is 'renderer' or require('app').isReady()
|
|
|
|
throw new Error('Can not use screen module before the "ready" event of app module gets emitted')
|
|
|
|
|
2014-07-10 02:26:17 +00:00
|
|
|
module.exports =
|
2014-07-11 11:06:46 +00:00
|
|
|
if process.platform in ['linux', 'win32'] and process.type is 'renderer'
|
2014-07-10 02:26:17 +00:00
|
|
|
# On Linux we could not access screen in renderer process.
|
|
|
|
require('remote').require 'screen'
|
|
|
|
else
|
2015-01-05 06:45:51 +00:00
|
|
|
getCursorScreenPoint: ->
|
|
|
|
checkAppIsReady()
|
|
|
|
binding.getCursorScreenPoint()
|
|
|
|
getPrimaryDisplay: ->
|
|
|
|
checkAppIsReady()
|
|
|
|
binding.getPrimaryDisplay()
|