diff --git a/modules/linux-cursors.js b/modules/linux-cursors.js new file mode 100644 index 0000000..6b9a74c --- /dev/null +++ b/modules/linux-cursors.js @@ -0,0 +1,133 @@ +/* +Copyright 2020 Intel Corporation + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +try +{ + + var X11 = require('monitor-info')._X11; + var GM = require('monitor-info')._gm; + + if (!require('monitor-info').Location_X11FIXES) + { + throw ('XFixes Extension is required'); + } + + var XFIXES = GM.CreateNativeProxy(require('monitor-info').Location_X11FIXES); + XFIXES.CreateMethod('XFixesSelectCursorInput'); + XFIXES.CreateMethod('XFixesGetCursorImage'); + XFIXES.CreateMethod('XFixesGetCursorName'); + XFIXES.CreateMethod('XFixesQueryExtension'); + +} +catch(e) +{ + console.log('error: ' + e); +} + + +if (!process.env.XAUTHORITY || !process.env.DISPLAY) +{ + var xinfo = this.getXInfo(require('user-sessions').getUid(require('user-sessions').whoami())); + process.setenv('XAUTHORITY', xinfo.xauthority); + process.setenv('DISPLAY', xinfo.display); +} + +var display = X11.XOpenDisplay(GM.CreateVariable(process.env.DISPLAY)); +if (display.Val == 0) +{ + console.log('XOpen Failed'); + throw('XOpen Failed'); +} + +var screenCount = X11.XScreenCount(display).Val; +var ifo = []; +for(var i=0;i ' + name.String); + } + } + else + { + console.log('NOTIFY: ' + notification, eventbase, XFixesCursorNotify); + } + } +}); + +console.log(' -- ');