From 60f2501901790f0fd34e1d82289a88867c3b38f3 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 12 Dec 2015 16:53:00 +0200 Subject: [PATCH] Minor refactoring to initialize_monitor --- source/main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/main.c b/source/main.c index 4beab4b..6412285 100644 --- a/source/main.c +++ b/source/main.c @@ -529,13 +529,16 @@ void update_monitor_vertices(CompositedScreen *screen, CompositedMonitor *monito free(index_data); } -int initialize_monitor(Compositor *compositor, CompositedScreen *screen, CompositedMonitor *monitor, XRRScreenResources *xrr_res, unsigned index) +int initialize_monitor(Compositor *compositor, CompositedScreen *screen, XRRScreenResources *xrr_res, unsigned index) { + CompositedMonitor *monitor; XRROutputInfo *output; XRRCrtcInfo *crtc; unsigned buffers[2]; unsigned stride; + monitor = &screen->monitors[index]; + output = XRRGetOutputInfo(compositor->display, xrr_res, xrr_res->outputs[index]); monitor->enabled = !!output->crtc; if(!monitor->enabled) @@ -618,7 +621,7 @@ int initialize_screen(Compositor *compositor, unsigned number) screen->nmonitors = xrr_res->noutput; screen->monitors = (CompositedMonitor *)malloc(screen->nmonitors*sizeof(CompositedMonitor)); for(i=0; inmonitors; ++i) - if(!initialize_monitor(compositor, screen, &screen->monitors[i], xrr_res, i)) + if(!initialize_monitor(compositor, screen, xrr_res, i)) return 0; XRRFreeScreenResources(xrr_res); -- 2.45.2