]> git.webhop.me Git - lcd4linux.git/commitdiff
add keypadframe color as parameter, some minor fixups
authormichux <michux@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Sat, 28 Mar 2009 17:51:55 +0000 (17:51 +0000)
committermichux <michux@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Sat, 28 Mar 2009 17:51:55 +0000 (17:51 +0000)
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@1015 3ae390bd-cb1e-0410-b409-cd5a39f66f1f

drv_vnc.c
lcd4linux.conf.sample

index 2812068e98ce5bf0a4368754b35c2f4f07a699bc..5330030f33c95c0c014cc300ce7b8543963f2c61 100644 (file)
--- a/drv_vnc.c
+++ b/drv_vnc.c
 #include "drv_generic_keypad.h"
 
 //todo: fps limiter
-//      key widget
-
-/* 15 frames per second (if we can) */
-#define PICTURE_TIMEOUT (1.0/15.0)
+//      key widget text
 
 #define NO_MOUSE_BUTTON_PRESSED 0
 #define LEFT_MOUSE_BUTTON_PRESSED 1
@@ -83,6 +80,9 @@ static int keypadxofs = 0;
 static int keypadyofs = 0;
 static int keypadgap = 0;
 static int port = 5900;
+static unsigned char framer = 0;
+static unsigned char frameg = 0;
+static unsigned char frameb = 0;
 
 static rfbScreenInfoPtr server;        /* vnc device */
 static struct timeval osd_timestamp;
@@ -94,7 +94,7 @@ static int mouse_stat_old = 0;
 static int process_event = 0;
 
 /* draws a simple rect, used to display keypad */
-int draw_rect(int x, int y, int size, unsigned char col, unsigned char *buffer)
+int draw_rect(int x, int y, int size, unsigned char col, char *buffer)
 {
     int ofs, ofs2, i, ret;
     unsigned char colr, colg;
@@ -104,8 +104,9 @@ int draw_rect(int x, int y, int size, unsigned char col, unsigned char *buffer)
     /* check if mouse is in current rect */
     if (mouse_x > x && mouse_x < (x + size))
        if (mouse_y > y && mouse_y < (y + size)) {
-           colr = 128;
-           colg = 255;
+           colr = framer;
+           colg = frameg;
+           col = frameb;
            ret = 1;
        }
 
@@ -191,6 +192,8 @@ static void hook_mouseaction(int buttonMask, int x, int y, rfbClientPtr cl)
        /* show osd display if mouse is pressed */
        if (buttonMask == 1) {
            gettimeofday(&osd_timestamp, NULL);
+           mouse_x = x;
+           mouse_y = y;
            if (show_keypad_osd == 0) {
                /* no osd until yet, activate osd keypad ... */
                show_keypad_osd = 1;
@@ -236,6 +239,7 @@ static int drv_vnc_keypad(const int num)
 /* init the driver, read config */
 static int drv_vnc_open(const char *Section)
 {
+    int keypadcol;
     if (cfg_number(Section, "Xres", 320, 32, 2048, &xres) < 1) {
        info("[DRV_VNC] no '%s.Xres' entry from %s using default %d", Section, cfg_source(), xres);
     }
@@ -266,6 +270,15 @@ static int drv_vnc_open(const char *Section)
     if (cfg_number(Section, "Keypadgap", 10, 0, 2048, &keypadgap) < 1) {
        info("[DRV_VNC] no '%s.Keypadgap' entry from %s using default %d", Section, cfg_source(), keypadgap);
     }
+    if (cfg_number(Section, "Keypadcol", 255, 0, 0xffffff, &keypadcol) < 1) {
+       info("[DRV_VNC] no '%s.Keypadcol' entry from %s using default red", Section, cfg_source());
+       framer = 255;
+    } else {
+       framer = keypadcol & 0xff;
+       frameg = (keypadcol & 0xff00) >> 8;
+       frameb = (keypadcol & 0xff0000) >> 16;
+    }
+
     if (cfg_number(Section, "Port", 5900, 1, 65535, &port) < 1) {
        info("[DRV_VNC] no '%s.Port' entry from %s using default %d", Section, cfg_source(), port);
     }
index b15e546ba6b04cc7dbe927b8413ae0b5f872bbd0..020085b61d8329f3afc0b08a927fc54968c77a12 100644 (file)
@@ -516,6 +516,7 @@ Display VNC {
     Keypadxofs   '40'
     Keypadyofs   '70'
     Keypadygap   '10'
+    Keypadcol    '8745877'
     Osd_showtime '2000'
 }