aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drv_X11.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/drv_X11.c b/drv_X11.c
index eb79e93..e8a7aa3 100644
--- a/drv_X11.c
+++ b/drv_X11.c
@@ -46,6 +46,7 @@
#include <termios.h>
#include <fcntl.h>
#include <sys/time.h>
+#include <signal.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
@@ -108,7 +109,6 @@ static void drv_X11_color(RGBA c, int brightness)
error("%s: XAllocColor(%02x%02x%02x) failed!", Name, c.R, c.G, c.B);
}
XSetForeground(dp, gc, xc.pixel);
- XSetBackground(dp, gc, xc.pixel);
}
@@ -160,7 +160,7 @@ static int drv_X11_brightness(int brightness)
XSetWindowBackground(dp, w, xc.pixel);
/* redraw every LCD pixel */
- drv_X11_blit(0, 0, LROWS, LCOLS);
+ drv_X11_blit(0, 0, DROWS, DCOLS);
/* remember new brightness */
Brightness = brightness;
@@ -225,6 +225,7 @@ static void drv_X11_expose(const int x, const int y, const int width, const int
RGBA col;
RGBA lastCol = { 0, 0, 0, 0 };
int hasLastCol = 0;
+ int brightness = drv_X11_brightness(-1);
x0 = x - pixel;
x1 = x + pixel + width;
@@ -243,7 +244,7 @@ static void drv_X11_expose(const int x, const int y, const int width, const int
if (hasLastCol) {
/* if the color of this pixel is different to the last pixels draw the old ones */
if (col.R != lastCol.R || col.G != lastCol.G || col.B != lastCol.B) {
- drv_X11_color(lastCol, 255);
+ drv_X11_color(lastCol, brightness);
XFillRectangles(dp, w, gc, rect, nrect);
nrect = 0;
lastCol = col;
@@ -255,7 +256,7 @@ static void drv_X11_expose(const int x, const int y, const int width, const int
nrect++;
} else {
/* 1st shot: no old color */
- drv_X11_color(col, 255);
+ drv_X11_color(col, brightness);
XFillRectangle(dp, w, gc, xc, yc, pixel, pixel);
lastCol = col;
hasLastCol = 1;
@@ -263,7 +264,7 @@ static void drv_X11_expose(const int x, const int y, const int width, const int
}
}
/* draw the last block of rectangles */
- drv_X11_color(lastCol, 255);
+ drv_X11_color(lastCol, brightness);
XFillRectangles(dp, w, gc, rect, nrect);
/* Keypad on the right side */
@@ -317,7 +318,9 @@ static void drv_X11_timer( __attribute__ ((unused))
int yoffset = border + (DROWS / YRES) * rgap;
static int btn = 0;
- if (XCheckWindowEvent(dp, w, ExposureMask | ButtonPressMask | ButtonReleaseMask, &ev) == 0)
+ if (XCheckWindowEvent(dp, w, ExposureMask | ButtonPressMask | ButtonReleaseMask, &ev) == 0
+ /* there is no ClientMessageMask, so this will be checked separately */
+ && XCheckTypedWindowEvent(dp, w, ClientMessage, &ev) == 0)
return;
switch (ev.type) {
@@ -372,9 +375,12 @@ static void drv_X11_timer( __attribute__ ((unused))
case ClientMessage:
if ((Atom) (ev.xclient.data.l[0]) == wmDeleteMessage) {
info("%s: Window closed by WindowManager, quit.", Name);
- exit(0);
+ if (raise(SIGTERM) != 0) {
+ error("%s: Error raising SIGTERM: exit!", Name);
+ exit(1);
+ }
} else {
- debug("%s: Got client message 0x%lx %lx %lx %lx %lx", Name, ev.xclient.data.l[0],
+ debug("%s: Got XClient message 0x%lx %lx %lx %lx %lx", Name, ev.xclient.data.l[0],
ev.xclient.data.l[1], ev.xclient.data.l[2], ev.xclient.data.l[3], ev.xclient.data.l[4]);
}
@@ -503,7 +509,7 @@ static int drv_X11_start(const char *section)
XSetWMProperties(dp, w, NULL, NULL, NULL, 0, &sh, NULL, NULL);
wmDeleteMessage = XInternAtom(dp, "WM_DELETE_WINDOW", False);
- /* XSetWMProtocols(dp, w, &wmDeleteMessage, 1); *to be tested* */
+ XSetWMProtocols(dp, w, &wmDeleteMessage, 1);
drv_X11_color(BR_COL, 255);
XSetWindowBackground(dp, w, xc.pixel);
07:07:43 by reinelt]reinelt8-9/+152 2005-04-02[lcd4linux @ 2005-04-02 05:28:58 by reinelt]reinelt3-19/+27 2005-04-01[lcd4linux @ 2005-04-01 05:16:04 by reinelt]reinelt5-584/+694 2005-03-30[lcd4linux @ 2005-03-30 04:57:50 by reinelt]reinelt3-23/+67 2005-03-28[lcd4linux @ 2005-03-28 22:29:23 by reinelt]reinelt1-250/+346 2005-03-28[lcd4linux @ 2005-03-28 19:39:14 by reinelt]reinelt9-256/+1147 2005-03-25[lcd4linux @ 2005-03-25 15:44:43 by reinelt]reinelt1-2/+5 2005-03-23[lcd4linux @ 2005-03-23 12:23:35 by reinelt]reinelt1-27/+32 2005-02-24[lcd4linux @ 2005-02-24 07:07:55 by reinelt]reinelt1-0/+53 2005-02-24[lcd4linux @ 2005-02-24 07:06:45 by reinelt]reinelt11-28/+347 2005-02-24[lcd4linux @ 2005-02-24 06:51:40 by reinelt]reinelt1-4/+5 2005-01-30[lcd4linux @ 2005-01-30 06:43:22 by reinelt]reinelt4-69/+95 2005-01-29[lcd4linux @ 2005-01-29 09:30:56 by reinelt]reinelt1-8/+11 2005-01-22[lcd4linux @ 2005-01-22 22:57:57 by reinelt]reinelt9-47/+382 2005-01-22[lcd4linux @ 2005-01-22 12:44:41 by reinelt]reinelt1-3/+6 2005-01-18[lcd4linux @ 2005-01-18 06:30:21 by reinelt]reinelt89-261/+603 2005-01-17[lcd4linux @ 2005-01-17 06:38:48 by reinelt]reinelt1-1/+6 2005-01-17[lcd4linux @ 2005-01-17 06:29:24 by reinelt]reinelt3-33/+85