You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When invoking XineramaQueryScreens (in xinerama.nim,) the function merely returns a PXineramaScreenInfo - i.e. a pointer to a XineramaScreenInfo object.
The original C Xlib XineramaQueryScreens function returns a pointer to a pointer of PXineramaScreenInfo objects. (i.e. a pointer to an array of XineramaScreenInfo objects.) As it is now in Nim I can only access the first XineramaScreenInfo object, not the second.
I'm sure there is a way to force cast this PXineramaScreenInfo into an array of PXineramaScreenInfos. I'm not so up to speed with Nim yet, but I guess I can figure it out.
In any case, I thought I'd report this little quirk.
⇒ KJ
The text was updated successfully, but these errors were encountered:
let pDisplay = XOpenDisplay(nil)
var numberOfMonitors: cint
let screenInfo = XineramaQueryScreens(pDisplay, numberOfMonitors.addr())
let arrayPointer = cast[ptr UncheckedArray[XineramaScreenInfo]](screenInfo)
Now arrayPointer can be used to access the metrics of each monitor, e.g.:
arrayPointer[0].width = width of the first monitor
arrayPointer[1].width = width of the second monitor
... just leaving a trail here in case someone does a web search on this.
Just ran into this on a two-monitor set-up.
When invoking XineramaQueryScreens (in xinerama.nim,) the function merely returns a PXineramaScreenInfo - i.e. a pointer to a XineramaScreenInfo object.
The original C Xlib XineramaQueryScreens function returns a pointer to a pointer of PXineramaScreenInfo objects. (i.e. a pointer to an array of XineramaScreenInfo objects.) As it is now in Nim I can only access the first XineramaScreenInfo object, not the second.
I'm sure there is a way to force cast this PXineramaScreenInfo into an array of PXineramaScreenInfos. I'm not so up to speed with Nim yet, but I guess I can figure it out.
In any case, I thought I'd report this little quirk.
⇒ KJ
The text was updated successfully, but these errors were encountered: