prev_enabled->next_right = &*i;
prev_enabled = &*i;
}
+
+ if(!primary_monitor || !primary_monitor->desktop_mode)
+ {
+ // XRandR didn't give a sensible primary monitor. Try to guess one.
+ unsigned largest = 0;
+ for(list<Monitor>::iterator i=monitors.begin(); i!=monitors.end(); ++i)
+ if(i->desktop_mode)
+ {
+ unsigned size = i->desktop_mode->width*i->desktop_mode->height;
+ if(size>largest)
+ {
+ largest = size;
+ primary_monitor = &*i;
+ }
+ }
+ }
}
}
#endif