From: "Carlos R. Mafra" <[email protected]>

This reverts commit fddbe08d91a1d075056e145d9563b478660d1cb4.

I think that was a bad idea to begin with. It's much more convenient to
adjust the lcd brightness using the special keys on the keyboard than
using the mouse wheel on a tiny area on the dockapp.

Signed-off-by: Carlos R. Mafra <[email protected]>
---
 Makefile         |  2 +-
 src/brightness.c | 62 --------------------------------------------------------
 src/brightness.h |  4 ----
 src/event.c      |  9 --------
 4 files changed, 1 insertion(+), 76 deletions(-)
 delete mode 100644 src/brightness.c
 delete mode 100644 src/brightness.h

diff --git a/Makefile b/Makefile
index d84b4f2..089acf3 100644
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,7 @@ CC = gcc
 LIBDIR = -L/usr/X11R6/lib
 LIBS   = -lXpm -lXext -lX11 
 CFLAGS =  -Wall -g 
-OBJS   =  main.o init.o event.o draw.o battery.o cpu.o autoscript.o pixmap.o 
brightness.o
+OBJS   =  main.o init.o event.o draw.o battery.o cpu.o autoscript.o pixmap.o
 EXE    = wmlaptop2
 
 
diff --git a/src/brightness.c b/src/brightness.c
deleted file mode 100644
index 771f46d..0000000
--- a/src/brightness.c
+++ /dev/null
@@ -1,62 +0,0 @@
-#include <stdio.h>
-#include <unistd.h>
-
-#include "brightness.h"
-
-/* This code is mostly based on wmpower's handling of the LCD */
-int set_lcd_brightness(int direction)
-{
-       FILE *fp;
-       static int actual_brightness=-1;
-       int new_brightness;
-       static int max_brightness;
-
-       fp= fopen("/sys/class/backlight/acpi_video0/actual_brightness", "r");
-       if (!fp) {
-               fprintf(stderr, "Unable to read current LCD brightness.\n");
-               return 0;
-       }
-       fscanf(fp, "%d", &actual_brightness);
-       fclose(fp);
-
-       fp= fopen("/sys/class/backlight/acpi_video0/max_brightness", "r");
-       if (!fp) {
-               fprintf(stderr, "Unable to read LCD maximum brightness.\n");
-               return 0;
-       }
-       fscanf(fp, "%d", &max_brightness);
-       fclose(fp);
-
-       if (direction == BRIGHTNESS_DOWN)
-               new_brightness = actual_brightness - 1;
-       if (direction == BRIGHTNESS_UP)
-               new_brightness = actual_brightness + 1;
-
-       if (new_brightness >= 0 && new_brightness <= max_brightness) {
-
-               fp= fopen("/sys/class/backlight/acpi_video0/brightness", "w+");
-               if (!fp) {
-                       fprintf(stderr, "Unable to set LCD brightness.\n");
-                       return 0;
-               }
-
-               fprintf(fp, "%d\n", new_brightness);
-               fclose(fp);
-
-               fp= fopen("/sys/class/backlight/acpi_video0/actual_brightness", 
"r");
-               if (!fp) {
-                       fprintf(stderr, "Unable to read LCD brightness.\n");
-                       return 0;
-               }
-               fscanf(fp, "%d", &actual_brightness);
-               fclose(fp);
-
-               if (actual_brightness != new_brightness) {
-                       fprintf(stderr, "Unable to set LCD brightness to %d\n", 
new_brightness);
-                       return 0;
-               }
-       }
-
-       usleep (125000); /* You must let some time pass between changes */
-       return 1;
-}
diff --git a/src/brightness.h b/src/brightness.h
deleted file mode 100644
index 92549a6..0000000
--- a/src/brightness.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#define BRIGHTNESS_UP 1
-#define BRIGHTNESS_DOWN 0
-
-int set_lcd_brightness(int direction);
diff --git a/src/event.c b/src/event.c
index c48d7e6..8d5677e 100644
--- a/src/event.c
+++ b/src/event.c
@@ -15,7 +15,6 @@
  */
 
 #include "event.h"
-#include "brightness.h"
 
 void event_handler()
 {
@@ -48,14 +47,6 @@ void event_handler()
                                /* if a cliccable region was clicked, the 
dockapp is redrawn */
                                if (j != -1)
                                        draw_all();
-                               if (e.xbutton.button == Button4) {
-                                       set_lcd_brightness(BRIGHTNESS_UP);
-                                       continue;
-                               }
-                               if (e.xbutton.button == Button5) {
-                                       set_lcd_brightness(BRIGHTNESS_DOWN);
-                                       continue;
-                               }
                                break;
 
                        case ButtonRelease:
-- 
1.8.0.1


-- 
To unsubscribe, send mail to [email protected].

Reply via email to