By default, Bugzilla does not search the list of RESOLVED bugs.
You can force it to do so by putting the upper-case word ALL in front of your search query, e.g.: ALL tdelibs
We recommend searching for bugs this way, as you may discover that your bug has already been resolved and fixed in a later release. View | Details | Raw Unified | Return to bug 1506
Collapse All | Expand All

(-)trinity-tdelibs-3.5.13.2~pre60+35563d61/krandr/libkrandr.cc.xrandr_gamma (-10 / +20 lines)
Lines 24-29 Link Here
24
24
25
#include <tqtimer.h>
25
#include <tqtimer.h>
26
#include <tqstringlist.h>
26
#include <tqstringlist.h>
27
#include <tqregexp.h>
27
28
28
#include <klocale.h>
29
#include <klocale.h>
29
#include <kmessagebox.h>
30
#include <kmessagebox.h>
Lines 638-644 Link Here
638
		TQString xrandr_command_output = exec(command.ascii());
639
		TQString xrandr_command_output = exec(command.ascii());
639
		xrandr_command_output = xrandr_command_output.stripWhiteSpace();
640
		xrandr_command_output = xrandr_command_output.stripWhiteSpace();
640
		if (test) {
641
		if (test) {
641
			if (xrandr_command_output != "") {
642
			// In case gamma settings is not supported, try again without '--gamma' parameter
643
			if (xrandr_command_output == "xrandr: Gamma size is 0.") {
644
				command = command.replace(TQRegExp("--gamma [0-9\\.]*:[0-9\\.]*:[0-9\\.]*"), "");
645
				xrandr_command_output = exec(command.ascii());
646
				xrandr_command_output = xrandr_command_output.stripWhiteSpace();
647
			}
648
			
649
			if(xrandr_command_output.startsWith("xrandr: Failed to get size of gamma for output")) {
650
				KMessageBox::sorry(0, xrandr_command_output, i18n("Setting gamma failed."));
651
			} else if (xrandr_command_output != "") {
642
				applySystemwideDisplayConfiguration(oldconfig, FALSE, kde_confdir);
652
				applySystemwideDisplayConfiguration(oldconfig, FALSE, kde_confdir);
643
				accepted = false;
653
				accepted = false;
644
				destroyScreenInformationObject(oldconfig);
654
				destroyScreenInformationObject(oldconfig);
Lines 1160-1178 Link Here
1160
				// It may not always be 100% correct, or even anywhere close...
1170
				// It may not always be 100% correct, or even anywhere close...
1161
				// Essentially it "undoes" the LUT gamma calculation from xrandr
1171
				// Essentially it "undoes" the LUT gamma calculation from xrandr
1162
				// lut_gamma->green[i] = (pow(i/(size - 1), desired_gamma.green) * (size - 1) * 256);
1172
				// lut_gamma->green[i] = (pow(i/(size - 1), desired_gamma.green) * (size - 1) * 256);
1173
				screendata->gamma_red = 2.2;
1174
				screendata->gamma_green = 2.2;
1175
				screendata->gamma_blue = 2.2;
1163
				if (current_crtc) {
1176
				if (current_crtc) {
1164
					//int slot = 127;
1177
					//int slot = 127;
1165
					int slot = 7;
1178
					int slot = 7;
1166
					int size = XRRGetCrtcGammaSize(randr_display, current_crtc->id);
1179
					int size = XRRGetCrtcGammaSize(randr_display, current_crtc->id);
1167
					XRRCrtcGamma *gammastruct = XRRGetCrtcGamma (randr_display, current_crtc->id);
1180
					if(size>0) {
1168
					screendata->gamma_red = log(gammastruct->red[slot]/((size-1.0)*256.0))/log(slot/(size-1.0));
1181
						XRRCrtcGamma *gammastruct = XRRGetCrtcGamma (randr_display, current_crtc->id);
1169
					screendata->gamma_green = log(gammastruct->green[slot]/((size-1.0)*256.0))/log(slot/(size-1.0));
1182
						screendata->gamma_red = log(gammastruct->red[slot]/((size-1.0)*256.0))/log(slot/(size-1.0));
1170
					screendata->gamma_blue = log(gammastruct->blue[slot]/((size-1.0)*256.0))/log(slot/(size-1.0));
1183
						screendata->gamma_green = log(gammastruct->green[slot]/((size-1.0)*256.0))/log(slot/(size-1.0));
1171
				}
1184
						screendata->gamma_blue = log(gammastruct->blue[slot]/((size-1.0)*256.0))/log(slot/(size-1.0));
1172
				else {
1185
					}
1173
					screendata->gamma_red = 2.2;
1174
					screendata->gamma_green = 2.2;
1175
					screendata->gamma_blue = 2.2;
1176
				}
1186
				}
1177
				// Round off the gamma to one decimal place
1187
				// Round off the gamma to one decimal place
1178
				screendata->gamma_red = floorf(screendata->gamma_red * 10 + 0.5) / 10;
1188
				screendata->gamma_red = floorf(screendata->gamma_red * 10 + 0.5) / 10;

Return to bug 1506