fix indentation and a few typos
authorDamien Fouilleul <damienf@nas.home>
Mon, 10 Feb 2014 12:14:19 +0000 (12:14 +0000)
committerDamien Fouilleul <damienf@nas.home>
Mon, 10 Feb 2014 12:14:19 +0000 (12:14 +0000)
configure.ac
src/lib/platform/X11/randr-edid.cpp
src/lib/platform/X11/randr-edid.h

index 58bd607e1c8b9ca652c21078050ce147b5a132dd..0e73e023023901a353fc3205550dd09f5433eb16 100644 (file)
@@ -211,7 +211,7 @@ case "${host}" in
     use_x11_xrandr="yes"
     AC_CHECK_HEADER(X11/Xlib.h,,[use_x11_xrandr="no"])
     AC_CHECK_HEADER(X11/Xatom.h,,[use_x11_xrandr="no"])
     use_x11_xrandr="yes"
     AC_CHECK_HEADER(X11/Xlib.h,,[use_x11_xrandr="no"])
     AC_CHECK_HEADER(X11/Xatom.h,,[use_x11_xrandr="no"])
-    AC_CHECK_HEADER(X11/extensions/Xrandr.h,,[use_xrandr="no"])
+    AC_CHECK_HEADER(X11/extensions/Xrandr.h,,[use_x11_xrandr="no"])
     AC_CHECK_LIB(X11,XOpenDisplay,,[use_x11_xrandr="no"])
     AC_CHECK_LIB(Xrandr,XRRGetScreenResources,,[use_x11_xrandr="no"])
     if test "x$use_x11_xrandr" = "xyes"; then
     AC_CHECK_LIB(X11,XOpenDisplay,,[use_x11_xrandr="no"])
     AC_CHECK_LIB(Xrandr,XRRGetScreenResources,,[use_x11_xrandr="no"])
     if test "x$use_x11_xrandr" = "xyes"; then
index 42071b345f18b6c45837030cc7ef7833059de976..4de17e4a111cd7705448dcc75bcad397c97cf3a1 100644 (file)
@@ -25,7 +25,7 @@
  * please contact Pulse-Eight Licensing for more information.
  *
  * For more information contact:
  * please contact Pulse-Eight Licensing for more information.
  *
  * For more information contact:
- * Pulse-Eight Licensing       <license@pulse-eight.com>
+ * Pulse-Eight Licensing     <license@pulse-eight.com>
  *     http://www.pulse-eight.com/
  *     http://www.pulse-eight.net/
  */
  *     http://www.pulse-eight.com/
  *     http://www.pulse-eight.net/
  */
@@ -46,121 +46,121 @@ using namespace PLATFORM;
 static const char * const edid_names[] = 
 { 
 #if (RANDR_MAJOR > 1) || (RANDR_MAJOR == 1 && RANDR_MINOR >2) 
 static const char * const edid_names[] = 
 { 
 #if (RANDR_MAJOR > 1) || (RANDR_MAJOR == 1 && RANDR_MINOR >2) 
-       RR_PROPERTY_RANDR_EDID,
+  RR_PROPERTY_RANDR_EDID,
 #else
 #else
-       "EDID",
+  "EDID",
 #endif
 #endif
-       "EDID_DATA",
-       "XFree86_DDC_EDID1_RAWDATA"
+  "EDID_DATA",
+  "XFree86_DDC_EDID1_RAWDATA"
 };
 
 #define EDID_NAME_COUNT (sizeof(edid_names)/sizeof(*edid_names))
 
 uint16_t CRandrEdidParser::GetPhysicalAddress(void)
 {
 };
 
 #define EDID_NAME_COUNT (sizeof(edid_names)/sizeof(*edid_names))
 
 uint16_t CRandrEdidParser::GetPhysicalAddress(void)
 {
-    uint16_t physical_address = 0;
+  uint16_t physical_address = 0;
 
 
-    /* open default X11 DISPLAY */
-    Display *disp = XOpenDisplay(NULL);
-    if( disp )
-    {
-        int event_base, error_base;
-        int maj, min;
+  /* open default X11 DISPLAY */
+  Display *disp = XOpenDisplay(NULL);
+  if( disp )
+  {
+    int event_base, error_base;
+    int maj, min;
 
 
-        if( XRRQueryExtension(disp, &event_base, &error_base)
-         && XRRQueryVersion(disp, &maj, &min) )
+    if( XRRQueryExtension(disp, &event_base, &error_base)
+     && XRRQueryVersion(disp, &maj, &min) )
+    {
+      int version = (maj << 8) | min;
+        
+      if( version >= 0x0102 )
+      {
+        size_t atom_avail = 0;
+        Atom edid_atoms[EDID_NAME_COUNT];
+
+        if( XInternAtoms(disp, (char **)edid_names, EDID_NAME_COUNT, True, edid_atoms) )
         {
         {
-            int version = (maj << 8) | min;
-                
-            if( version >= 0x0102 )
+          /* remove missing some atoms */
+          atom_avail = 0;
+          for(size_t atom_count=0; atom_count<EDID_NAME_COUNT; ++atom_count)
+          {
+            Atom edid_atom = edid_atoms[atom_count];
+            if( None != edid_atom )
             {
             {
-                size_t atom_avail = 0;
-                Atom edid_atoms[EDID_NAME_COUNT];
-
-                if( XInternAtoms(disp, (char **)edid_names, EDID_NAME_COUNT, True, edid_atoms) )
-                {
-                    /* remove missing some atoms */
-                    atom_avail = 0;
-                    for(size_t atom_count=0; atom_count<EDID_NAME_COUNT; ++atom_count)
-                    {
-                        Atom edid_atom = edid_atoms[atom_count];
-                        if( None != edid_atom )
-                        {
-                            if( atom_avail < atom_count )
-                            {
-                                edid_atoms[atom_avail] = edid_atom;
-                            }
-                            ++atom_avail;
-                        }
-                    }
-                }
+              if( atom_avail < atom_count )
+              {
+                edid_atoms[atom_avail] = edid_atom;
+              }
+              ++atom_avail;
+            }
+          }
+        }
 
 
-                if( atom_avail > 0 )
-                {
-                    int scr_count = ScreenCount(disp);
-                    int screen;
+        if( atom_avail > 0 )
+        {
+          int scr_count = ScreenCount(disp);
+          int screen;
 
 
-                    for(screen=0; screen<scr_count; ++screen)
-                    {
-                        XRRScreenResources *rsrc = NULL;
-                        Window root = RootWindow(disp, screen);
+          for(screen=0; screen<scr_count; ++screen)
+          {
+            XRRScreenResources *rsrc = NULL;
+            Window root = RootWindow(disp, screen);
 
 
-#if (RANDR_MAJOR > 1) || (RANDR_MAJOR == 1 && RANDR_MINOR >=2
-                        if( version >= 0x0103 )
-                        {
-                            /* get cached resources if they are available */
-                            rsrc = XRRGetScreenResourcesCurrent(disp, root);
-                        }
+#if (RANDR_MAJOR > 1) || (RANDR_MAJOR == 1 && RANDR_MINOR >=3
+            if( version >= 0x0103 )
+            {
+              /* get cached resources if they are available */
+              rsrc = XRRGetScreenResourcesCurrent(disp, root);
+            }
 
 
-                        if( NULL == rsrc )
+            if( NULL == rsrc )
 #endif
 #endif
-                            rsrc = XRRGetScreenResources(disp, root);
+              rsrc = XRRGetScreenResources(disp, root);
 
 
-                        if( NULL != rsrc )
+            if( NULL != rsrc )
+            {
+              int output_id;
+              for( output_id=0; 0 == physical_address && output_id < rsrc->noutput; ++output_id )
+              {
+                RROutput rr_output_id = rsrc->outputs[output_id];
+                XRROutputInfo *output_info = XRRGetOutputInfo(disp, rsrc, rr_output_id);
+                if( NULL != output_info )
+                {
+                  if( RR_Connected == output_info->connection )
+                  {
+                    for(size_t atom_count=0; 0 == physical_address && atom_count<atom_avail; ++atom_count)
+                    {
+                      Atom actual_type;
+                      int actual_format;
+                      unsigned long nitems;
+                      unsigned long bytes_after;
+                      unsigned char *data;
+                      int status;
+
+                      status = XRRGetOutputProperty(disp, rr_output_id, edid_atoms[atom_count], 0, 128, False, False,
+                            AnyPropertyType, &actual_type, &actual_format,
+                            &nitems, &bytes_after, &data);
+                      if( Success == status )
+                      {
+                        if((actual_type == XA_INTEGER) && (actual_format == 8) )
                         {
                         {
-                            int output_id;
-                            for( output_id=0; 0 == physical_address && output_id < rsrc->noutput; ++output_id )
-                            {
-                                RROutput rr_output_id = rsrc->outputs[output_id];
-                                XRROutputInfo *output_info = XRRGetOutputInfo(disp, rsrc, rr_output_id);
-                                if( NULL != output_info )
-                                {
-                                    if( RR_Connected == output_info->connection )
-                                    {
-                                        for(size_t atom_count=0; 0 == physical_address && atom_count<atom_avail; ++atom_count)
-                                        {
-                                            Atom actual_type;
-                                            int actual_format;
-                                            unsigned long nitems;
-                                            unsigned long bytes_after;
-                                            unsigned char *data;
-                                            int status;
-
-                                            status = XRRGetOutputProperty(disp, rr_output_id, edid_atoms[atom_count], 0, 128, False, False,
-                                                        AnyPropertyType, &actual_type, &actual_format,
-                                                        &nitems, &bytes_after, &data);
-                                            if( Success == status )
-                                            {
-                                                if((actual_type == XA_INTEGER) && (actual_format == 8) )
-                                                {
-                                                    physical_address = CEDIDParser::GetPhysicalAddressFromEDID(data, nitems);
-                                                }
-                                                XFree(data);
-                                            }
-                                        }
-                                    }
-                                    XRRFreeOutputInfo(output_info);
-                                }
-                                else
-                                    break;     /* problem ? */
-                            }
-                            XRRFreeScreenResources(rsrc);
+                          physical_address = CEDIDParser::GetPhysicalAddressFromEDID(data, nitems);
                         }
                         }
+                        XFree(data);
+                      }
                     }
                     }
+                  }
+                  XRRFreeOutputInfo(output_info);
                 }
                 }
+                else
+                  break;  /* problem ? */
+              }
+              XRRFreeScreenResources(rsrc);
             }
             }
+          }
         }
         }
-        XCloseDisplay(disp);
+      }
     }
     }
-    return physical_address;
+    XCloseDisplay(disp);
+  }
+  return physical_address;
 }
 }
index a648e7b8919ecf9e89e28cfdf1716d5ce4ff901f..b4150020fd793ea11db5907386fd3f441ce1b147 100644 (file)
@@ -42,6 +42,5 @@ namespace PLATFORM
     virtual ~CRandrEdidParser(void) {};
 
     uint16_t GetPhysicalAddress(void);
     virtual ~CRandrEdidParser(void) {};
 
     uint16_t GetPhysicalAddress(void);
-
   };
 }
   };
 }