Created
July 17, 2015 01:18
-
-
Save yajd/55441c9c3d0711ee4a38 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var collMonInfos = []; | |
var rootGdkWin = ostypes.API('gdk_get_default_root_window')(); | |
console.info('rootGdkWin:', rootGdkWin.toString(), uneval(rootGdkWin), cutils.jscGetDeepest(rootGdkWin)); | |
var rootGtkWin = ostypes.HELPER.gdkWinPtrToGtkWinPtr(rootGdkWin); | |
// the screen contains all monitors | |
var gdkScreen = ostypes.API('gtk_window_get_screen')(rootGtkWin); | |
var fullWidth = ostypes.API('gdk_screen_get_width')(gdkScreen); | |
var fullHeight = ostypes.API('gdk_screen_get_height')(gdkScreen); | |
console.info('fullWidth:', fullWidth.toString(), 'fullHeight:', fullHeight.toString()); | |
// collect data about each monitor | |
var monitors = []; | |
var nmons = ostypes.API('gdk_screen_get_n_monitors')(gdkScreen); | |
console.info('number of monitors:', nmons); | |
nmons = cutils.jscGetDeepest(nmons); | |
var rect = ostypes.TYPE.GdkRectangle(); | |
for (var i=0; i<nmons; i++) { | |
var mg = ostypes.API('gdk_screen_get_monitor_geometry')(gdkScreen, i, rect.address()); | |
collMonInfos.push({ | |
x: cutils.jscGetDeepest(rect.x), | |
y: cutils.jscGetDeepest(rect.y), | |
w: cutils.jscGetDeepest(rect.width), | |
h: cutils.jscGetDeepest(rect.height) | |
}) | |
} | |
return collMonInfos; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment