aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormichael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2008-12-27 08:14:21 +0000
committermichael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2008-12-27 08:14:21 +0000
commit426e8c3cae8d64abc629da147f26344b87a26799 (patch)
tree60f93653fa6204943f24e1e37a08d69970b45c9c
parent86bd0d06e81a18de3e5d330eae4ebddcb756d8c3 (diff)
downloadlcd4linux-426e8c3cae8d64abc629da147f26344b87a26799.tar.gz
ported r819 from volker_dev
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@915 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
-rw-r--r--drv_X11.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/drv_X11.c b/drv_X11.c
index e676b90..0c6e41b 100644
--- a/drv_X11.c
+++ b/drv_X11.c
@@ -148,26 +148,30 @@ static int drv_X11_brightness(int brightness)
brightness = 0;
if (brightness > 255)
brightness = 255;
- Brightness = brightness;
- dim = Brightness / 255.0;
- col.R *= dim;
- col.G *= dim;
- col.B *= dim;
-
- debug("%s: set backlight to %d%%, original backlight color: 0x%02x%02x%02x%02x, dimmed: 0x%02x%02x%02x%02x",
- Name, (int) (dim * 100), BL_COL.R, BL_COL.G, BL_COL.B, BL_COL.A, col.R, col.G, col.B, col.A);
- for (i = 0; i < DCOLS * DROWS; i++) {
- drv_X11_FB[i] = col;
- }
- drv_X11_color(col);
+ if (Brightness != brightness) {
- XFillRectangle(dp, pm, gc, 0, 0, dimx + 2 * border + btnwidth, dimy + 2 * border);
- XSetWindowBackground(dp, w, xc.pixel);
- XClearWindow(dp, w);
+ Brightness = brightness;
+ dim = Brightness / 255.0;
+ col.R *= dim;
+ col.G *= dim;
+ col.B *= dim;
- /* redraw every LCD pixel */
- drv_X11_blit(0, 0, LROWS, LCOLS);
+ debug("%s: set backlight to %d%%, original backlight color: 0x%02x%02x%02x%02x, dimmed: 0x%02x%02x%02x%02x",
+ Name, (int) (dim * 100), BL_COL.R, BL_COL.G, BL_COL.B, BL_COL.A, col.R, col.G, col.B, col.A);
+ for (i = 0; i < DCOLS * DROWS; i++) {
+ drv_X11_FB[i] = col;
+ }
+
+ drv_X11_color(col);
+
+ XFillRectangle(dp, pm, gc, 0, 0, dimx + 2 * border + btnwidth, dimy + 2 * border);
+ XSetWindowBackground(dp, w, xc.pixel);
+ XClearWindow(dp, w);
+
+ /* redraw every LCD pixel */
+ drv_X11_blit(0, 0, LROWS, LCOLS);
+ }
return Brightness;
}