From 200a19dad9de3131fd3054b43fd2d94754947c3a Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 9 Jun 2015 18:25:24 +0800 Subject: [PATCH] linux: Don't use clipboard module in renderer process --- atom/common/api/lib/clipboard.coffee | 29 ++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/atom/common/api/lib/clipboard.coffee b/atom/common/api/lib/clipboard.coffee index 44dadb8cd9ee..9a7a6abfa47f 100644 --- a/atom/common/api/lib/clipboard.coffee +++ b/atom/common/api/lib/clipboard.coffee @@ -1,12 +1,17 @@ -binding = process.atomBinding 'clipboard' -module.exports = - availableFormats: (type='standard') -> binding._availableFormats type - has: (format, type='standard') -> binding._has format, type - read: (format, type='standard') -> binding._read format, type - readText: (type='standard') -> binding._readText type - writeText: (text, type='standard') -> binding._writeText text, type - readHtml: (type='standard') -> binding._readHtml type - writeHtml: (markup, type='standard') -> binding._writeHtml markup, type - readImage: (type='standard') -> binding._readImage type - writeImage: (image, type='standard') -> binding._writeImage image, type - clear: (type='standard') -> binding._clear type +if process.platform is 'linux' and process.type is 'renderer' + # On Linux we could not access clipboard in renderer process. + module.exports = require('remote').require 'clipboard' +else + binding = process.atomBinding 'clipboard' + + module.exports = + availableFormats: (type='standard') -> binding._availableFormats type + has: (format, type='standard') -> binding._has format, type + read: (format, type='standard') -> binding._read format, type + readText: (type='standard') -> binding._readText type + writeText: (text, type='standard') -> binding._writeText text, type + readHtml: (type='standard') -> binding._readHtml type + writeHtml: (markup, type='standard') -> binding._writeHtml markup, type + readImage: (type='standard') -> binding._readImage type + writeImage: (image, type='standard') -> binding._writeImage image, type + clear: (type='standard') -> binding._clear type