Skip to content

Commit

Permalink
Merge pull request #3 from tompreston/tpreston/fix-x11-screen
Browse files Browse the repository at this point in the history
Fix incorrect use of X11 screen and output
  • Loading branch information
beku authored Jan 10, 2018
2 parents 08beada + f802e22 commit ea2de67
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ where the available options are:

* -display <host:dpy> or -d
* -screen <screen-#> or -s
* -output <output-#> or -o
* -clear or -c
* -noaction <LUT-size> or -n
* -verbose or -v
Expand Down Expand Up @@ -225,6 +226,8 @@ may be written in C++ to ease modularisation of the code and allow
utilization by other software.

### history
#### 0.10: 2018-01-10
- Fix incorrect use of X11 screen and output
#### 0.9: 2014-11-09
- fix rounding errors from upsampling of gamma ramps
- fix -printramps uses integers
Expand Down
15 changes: 13 additions & 2 deletions xcalib.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ usage (void)
#ifndef _WIN32
fprintf (stdout, " -display <host:dpy> or -d\n");
fprintf (stdout, " -screen <screen-#> or -s\n");
fprintf (stdout, " -output <output-#> or -o\n");
#else
fprintf (stdout, " -screen <monitor-#> or -s\n");
#endif
Expand Down Expand Up @@ -560,6 +561,7 @@ main (int argc, char *argv[])
XF86VidModeGamma gamma;
Display *dpy = NULL;
char *displayname = NULL;
int xoutput = 0;
#ifdef FGLRX
int controller = -1;
FGLRX_X11Gamma_C16native fglrx_gammaramps;
Expand Down Expand Up @@ -626,6 +628,15 @@ main (int argc, char *argv[])
screen = atoi (argv[i]);
continue;
}
#ifndef _WIN32
/* X11 output */
if (!strcmp (argv[i], "-o") || !strcmp (argv[i], "-output")) {
if (++i >= argc)
usage ();
xoutput = atoi (argv[i]);
continue;
}
#endif
#ifdef FGLRX
/* ATI controller index (for FGLRX only) */
if (!strcmp (argv[i], "-x") || !strcmp (argv[i], "-controller")) {
Expand Down Expand Up @@ -869,7 +880,7 @@ main (int argc, char *argv[])
int major_versionp = 0;
int minor_versionp = 0;
int n = 0;
Window root = RootWindow(dpy, DefaultScreen( dpy ));
Window root = RootWindow(dpy, screen);

XRRQueryVersion( dpy, &major_versionp, &minor_versionp );
xrr_version = major_versionp*100 + minor_versionp;
Expand All @@ -886,7 +897,7 @@ main (int argc, char *argv[])
XRROutputInfo * output_info = XRRGetOutputInfo( dpy, res,
output);
if(output_info->crtc)
if(ncrtc++ == screen)
if(ncrtc++ == xoutput)
{
crtc = output_info->crtc;
ramp_size = XRRGetCrtcGammaSize( dpy, crtc );
Expand Down

0 comments on commit ea2de67

Please sign in to comment.