From: Mikko Rasa Date: Sat, 12 Dec 2015 14:53:00 +0000 (+0200) Subject: Minor refactoring to initialize_monitor X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=60f2501901790f0fd34e1d82289a88867c3b38f3;p=geometrycompositor.git Minor refactoring to initialize_monitor --- 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);