#include <X11/Xlib.h>
+#include <X11/Xatom.h>
#ifdef WITH_XRANDR
#include <X11/extensions/Xrandr.h>
#endif
{
XRRScreenResources *res = XRRGetScreenResources(priv->display, priv->root_window);
RROutput primary = XRRGetOutputPrimary(priv->display, priv->root_window);
+ Atom edid_prop = XInternAtom(priv->display, RR_PROPERTY_RANDR_EDID, true);
map<RRMode, XRRModeInfo *> modes_by_id;
for(int i=0; i<res->nmode; ++i)
monitor.name.assign(output->name, output->nameLen);
priv->monitors.push_back(res->outputs[i]);
+ if(edid_prop)
+ {
+ Atom prop_type;
+ int prop_format;
+ unsigned long length;
+ unsigned long overflow;
+ unsigned char *edid = 0;
+ XRRGetOutputProperty(priv->display, res->outputs[i], edid_prop, 0, 32, false, false, XA_INTEGER, &prop_type, &prop_format, &length, &overflow, &edid);
+ if(prop_type==XA_INTEGER && prop_format==8)
+ {
+ for(unsigned j=0; j<4; ++j)
+ {
+ unsigned offset = 54+j*18;
+ if(edid[offset]==0 && edid[offset+1]==0 && edid[offset+3]==0xFC)
+ {
+ unsigned k;
+ for(k=0; (k<13 && edid[offset+5+k]!=0x0A); ++k) ;
+ monitor.name.assign(reinterpret_cast<char *>(edid+offset+5), k);
+ }
+ }
+ }
+ XFree(edid);
+ }
+
if(crtc)
{
monitor.desktop_rotation = rotation_from_sys(crtc->rotation);