Browse files

X11: support rotated screens.

  • Loading branch information...
1 parent c7c6cb2 commit fd0e37ab4dce7829801ed466717012811ceb178b @elupus committed Jul 8, 2012
Showing with 11 additions and 0 deletions.
  1. +10 −0 xbmc/windowing/X11/XRandR.cpp
  2. +1 −0 xbmc/windowing/X11/XRandR.h
View
10 xbmc/windowing/X11/XRandR.cpp
@@ -102,6 +102,13 @@ bool CXRandR::Query(int screennum)
xoutput.y = (output->Attribute("y") != NULL ? atoi(output->Attribute("y")) : 0);
xoutput.wmm = (output->Attribute("wmm") != NULL ? atoi(output->Attribute("wmm")) : 0);
xoutput.hmm = (output->Attribute("hmm") != NULL ? atoi(output->Attribute("hmm")) : 0);
+ if (output->Attribute("rotation") != NULL
+ && (strcasecmp(output->Attribute("rotation"), "left") == 0 || strcasecmp(output->Attribute("rotation"), "right") == 0))
+ {
+ xoutput.isRotated = true;
+ }
+ else
+ xoutput.isRotated = false;
if (!xoutput.isConnected)
continue;
@@ -115,6 +122,9 @@ bool CXRandR::Query(int screennum)
xmode.hz = atof(mode->Attribute("hz"));
xmode.w = atoi(mode->Attribute("w"));
xmode.h = atoi(mode->Attribute("h"));
+ if(xoutput.isRotated)
+ std::swap(xmode.w, xmode.h);
+
xmode.isPreferred = (strcasecmp(mode->Attribute("preferred"), "true") == 0);
xmode.isCurrent = (strcasecmp(mode->Attribute("current"), "true") == 0);
xoutput.modes.push_back(xmode);
View
1 xbmc/windowing/X11/XRandR.h
@@ -88,6 +88,7 @@ class XOutput
int wmm;
int hmm;
std::vector<XMode> modes;
+ bool isRotated;
};
class CXRandR

0 comments on commit fd0e37a

Please sign in to comment.