c - Starting with gdk_default_root_window -> Get all monitors -
i writing function x, y, width, , height of monitors of multi moniotr setup.
i found solution: https://stackoverflow.com/a/23608025/5062337
so implemented jsctypes:
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); // screen contains 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 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(); (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;
however tells me have 0 monitors.
so wondering, starting gdk_default_root_window, how info on monitors?
i know can union of monitors gdk_drawable_get_size
need individual monitor information please.
thanks
Comments
Post a Comment