Skip to content

Commit e595043

Browse files
author
BoboTiG
committed
MSSLinux: fix monitor count
1 parent 8709b53 commit e595043

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

mss.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,8 @@ def enum_display_monitors(self, screen=0):
467467
root = cast(self.root, POINTER(Display))
468468
mon = self.xrandr.XRRGetScreenResources(self.display, root)
469469
self.debug('enum_display_monitors', 'number of monitors',
470-
mon.contents.noutput - 1)
471-
for num in range(mon.contents.noutput - 1):
470+
mon.contents.ncrtc)
471+
for num in range(mon.contents.ncrtc):
472472
crtc_info = self.xrandr.XRRGetCrtcInfo(self.display, mon,
473473
mon.contents.crtcs[num])
474474
yield ({

test/test-linux

-128 Bytes
Binary file not shown.

test/test-linux.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ void each_screen(void) {
120120
display = XOpenDisplay(NULL);
121121
root = XDefaultRootWindow(display);
122122
monitors = XRRGetScreenResources(display, root);
123-
for ( n = 0; n < monitors->noutput - 1; ++n ) {
123+
for ( n = 0; n < monitors->ncrtc; ++n ) {
124124
gettimeofday(&start, NULL);
125125
crtc_info = XRRGetCrtcInfo(display, monitors, monitors->crtcs[n]);
126126

@@ -151,7 +151,7 @@ void each_screen(void) {
151151
}
152152
}
153153
XFree(image);
154-
XRRFreeCrtcInfo(crtc_info);
154+
XFree(crtc_info);
155155

156156
gettimeofday(&end, NULL);
157157
printf("Screen %d: %dx%d @ %u msec\n", n, width, height, (1000000 * end.tv_sec + end.tv_usec) - (1000000 * start.tv_sec + start.tv_usec));
@@ -162,7 +162,7 @@ void each_screen(void) {
162162
fwrite(pixels, sizeof(unsigned char), sizeof(unsigned char) * width * height * 3, fh);
163163
fclose(fh);
164164
}
165-
XRRFreeScreenResources(monitors);
165+
XFree(monitors);
166166
XCloseDisplay(display);
167167

168168
return;

0 commit comments

Comments
 (0)