aboutsummaryrefslogtreecommitdiffstats
path: root/drv_X11.c
diff options
context:
space:
mode:
Diffstat (limited to 'drv_X11.c')
-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;
}