Skip to content
This repository has been archived by the owner on Oct 31, 2019. It is now read-only.

Commit

Permalink
Add a case to handle bi screen in Linux when separate screen + xinera…
Browse files Browse the repository at this point in the history
…ma are used #10
  • Loading branch information
mfe committed Nov 23, 2012
1 parent ff801fe commit 9ffd281
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 7 deletions.
27 changes: 20 additions & 7 deletions ColorTribe/ColorKeeper/src/core/ZooperLocalHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
#ifdef __WIN32__
#include "windows.h"
#endif
#ifdef __linux__
#include <GNULUTLoader.h>
#endif

#include <fstream>
#include <iostream>
Expand Down Expand Up @@ -86,13 +89,21 @@ void ZooperLocalHost::searchDisorders() {
os <<"_effectiveScreenNumber = "<< _effectiveScreenNumber<<endl;
os <<"_calibableScreenNumber = "<< _calibableScreenNumber<<endl;
_isSeparateXScreenDisorder = true;
} else if(_qtNbScreens == _edidNbScreens) {// one x screen for several screens
_effectiveScreenNumber = _edidNbScreens;
_calibableScreenNumber = _xNbScreens;
os<<"XScreen disorder"<<endl;
os <<"_effectiveScreenNumber = "<< _effectiveScreenNumber<<endl;
os <<"_calibableScreenNumber = "<< _calibableScreenNumber<<endl;
_isXScreenDisorder = true;
} else if(_qtNbScreens == _edidNbScreens) {// one x screen for several screens

if(GNULUTLoader::isScreenGammaAble(1)){
os<<"XScreenDisorder suppected but several LUTs can be loaded. Calibrable devices : "<<_qtNbScreens<<endl;
_effectiveScreenNumber = _qtNbScreens;
_calibableScreenNumber = _qtNbScreens;
}else{
_effectiveScreenNumber = _edidNbScreens;
_calibableScreenNumber = _xNbScreens;
os<<"XScreen disorder"<<endl;
os <<"_effectiveScreenNumber = "<< _effectiveScreenNumber<<endl;
os <<"_calibableScreenNumber = "<< _calibableScreenNumber<<endl;
_isXScreenDisorder = true;
}

} else if(_qtNbScreens != _edidNbScreens && _qtNbScreens>_edidNbScreens) {
os<<"XScreen disorder and one or more EDID(s) not found"<<endl;
os <<"_effectiveScreenNumber = "<< _effectiveScreenNumber<<endl;
Expand All @@ -102,6 +113,8 @@ void ZooperLocalHost::searchDisorders() {
_effectiveScreenNumber = _xNbScreens;
_calibableScreenNumber = _xNbScreens;



} else {
os<<"Unexpected disorder. Try with nbScreen = "<<_xNbScreens<<endl;
os <<"_effectiveScreenNumber = "<< _effectiveScreenNumber<<endl;
Expand Down
19 changes: 19 additions & 0 deletions ColorTribe/ColorLib_cpp/src/colorRamdac/lutloader/GNULUTLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,25 @@ int GNULUTLoader::setGammaRamp(const int screenIndex,
return 0;
}

bool GNULUTLoader::isScreenGammaAble(const unsigned int screenIndex){
Display* dpy = XOpenDisplay(NULL);
bool res;
int rampSize = -1;
try {
res = XF86VidModeGetGammaRampSize(dpy, screenIndex, &rampSize);
} catch(...) {
res=false;
}

if(rampSize<=0)
res=false;

XCloseDisplay(dpy) ;

return res;

}

unsigned short* GNULUTLoader::getGammaRamp(const int screenIndex, int * rampSize) const
throw (CannotGetLutException) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class GNULUTLoader : public AbstractLutLoader {
setGammaRamp(const int screenIndex,
const LUT2DCorrection * const lut) const throw (CannotSetLutException);
unsigned short* getGammaRamp(const int screenIndex, int * rampSize) const throw (CannotGetLutException);
static bool isScreenGammaAble(const unsigned int screenIndex);
#else
int setGammaRamp(const int screenIndex, const LUT2DCorrection * const lut) const throw (CannotSetLutException) =0;
unsigned short* getGammaRamp(const int screenIndex, int * rampSize) const throw (CannotGetLutException) =0;
Expand Down

0 comments on commit 9ffd281

Please sign in to comment.