diff options
author | Tiago Vignatti <tiago.vignatti@intel.com> | 2012-03-12 19:40:09 -0300 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2012-03-20 22:43:54 -0400 |
commit | 5ab91ad8450004bbb425c784a6fb5cd62beab509 (patch) | |
tree | 3418194e0205404d7e7c83573266e4f1df593f72 /src/shell.c | |
parent | 1b079abe0e2c075ec4d600c492a72ec980e03baa (diff) |
compositor: use smoother range for backlight control
now it goes from 0 to 255.
Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
Diffstat (limited to 'src/shell.c')
-rw-r--r-- | src/shell.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/shell.c b/src/shell.c index b294c205..fa519226 100644 --- a/src/shell.c +++ b/src/shell.c @@ -1927,6 +1927,7 @@ backlight_binding(struct wl_input_device *device, uint32_t time, { struct weston_compositor *compositor = data; struct weston_output *output; + long backlight_new = 0; /* TODO: we're limiting to simple use cases, where we assume just * control on the primary display. We'd have to extend later if we @@ -1939,13 +1940,17 @@ backlight_binding(struct wl_input_device *device, uint32_t time, if (!output->set_backlight) return; - if ((key == KEY_F9 || key == KEY_BRIGHTNESSDOWN) && - output->backlight_current > 1) - output->backlight_current--; - else if ((key == KEY_F10 || key == KEY_BRIGHTNESSUP) && - output->backlight_current < 10) - output->backlight_current++; + if (key == KEY_F9 || key == KEY_BRIGHTNESSDOWN) + backlight_new = output->backlight_current - 25; + else if (key == KEY_F10 || key == KEY_BRIGHTNESSUP) + backlight_new = output->backlight_current + 25; + if (backlight_new < 5) + backlight_new = 5; + if (backlight_new > 255) + backlight_new = 255; + + output->backlight_current = backlight_new; output->set_backlight(output, output->backlight_current); } |