Skip to content

Commit

Permalink
whitespace and indentation fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jumper149 committed Jan 26, 2020
1 parent d784c1f commit 7806b43
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 44 deletions.
86 changes: 43 additions & 43 deletions backends/scg/scg.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,51 +7,51 @@
#include <math.h>

int main(int argc, char **argv) {
Display *dpy = XOpenDisplay(NULL);

if(dpy == NULL) {
return 12; // exit code 12, if no display is found
Display *dpy = XOpenDisplay(NULL);

if(dpy == NULL) {
return 12; // exit code 12, if no display is found
}

int screen = DefaultScreen(dpy);
Window root = RootWindow(dpy, screen);
XRRScreenResources *res = XRRGetScreenResourcesCurrent(dpy, root);

double gamma_r;
double gamma_g;
double gamma_b;

/* parsing */
if (argc == 4) {
gamma_r = atof(argv[1]);
gamma_g = atof(argv[2]);
gamma_b = atof(argv[3]);
}else {
return 1;
}

int num_crtcs = res->ncrtc;
for (int c = 0; c < res->ncrtc; c++) {
int crtcxid = res->crtcs[c];

int size = XRRGetCrtcGammaSize(dpy, crtcxid);
XRRCrtcGamma *crtc_gamma = XRRAllocGamma(size);

for (int i = 0; i < size; i++) {
double g = 65535.0 * i / size;
crtc_gamma->red[i] = g * gamma_r;
crtc_gamma->green[i] = g * gamma_g;
crtc_gamma->blue[i] = g * gamma_b;
}
XRRSetCrtcGamma(dpy, crtcxid, crtc_gamma);

XFree(crtc_gamma);
}

XRRFreeScreenResources(res);
XCloseDisplay(dpy);

int screen = DefaultScreen(dpy);
Window root = RootWindow(dpy, screen);

XRRScreenResources *res = XRRGetScreenResourcesCurrent(dpy, root);

double gamma_r;
double gamma_g;
double gamma_b;

/* parsing */
if (argc == 4) {
gamma_r = atof(argv[1]);
gamma_g = atof(argv[2]);
gamma_b = atof(argv[3]);
}else {
return 1;
}

int num_crtcs = res->ncrtc;
for (int c = 0; c < res->ncrtc; c++) {
int crtcxid = res->crtcs[c];

int size = XRRGetCrtcGammaSize(dpy, crtcxid);

XRRCrtcGamma *crtc_gamma = XRRAllocGamma(size);

for (int i = 0; i < size; i++) {
double g = 65535.0 * i / size;
crtc_gamma->red[i] = g * gamma_r;
crtc_gamma->green[i] = g * gamma_g;
crtc_gamma->blue[i] = g * gamma_b;
}
XRRSetCrtcGamma(dpy, crtcxid, crtc_gamma);

XFree(crtc_gamma);
}
XRRFreeScreenResources(res);
XCloseDisplay(dpy);
return 0;
return 0;
}

/*
Expand Down
2 changes: 1 addition & 1 deletion blugon.1
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ You can copy the default 'gamma' configuration into your home directory:
There are more templates for 'gamma' in "/usr/share/blugon/".
Syntax in 'gamma' has to be in one of the following two forms:

$ [hour] [minute] [red] [green] [blue]
$ [hour] [minute] [red] [green] [blue]
$ [hour] [minute] [temperature]

[red], [green], [blue] between 0 and 1
Expand Down

0 comments on commit 7806b43

Please sign in to comment.