From 707fd2300d1b6794f795937ade2e81a7fda25957 Mon Sep 17 00:00:00 2001 From: robijn Date: Wed, 27 Mar 2002 22:38:12 +0000 Subject: [PATCH] - Now using driver names without 'in' (like lircin). - Added cursor control to client_functions.c - Removed HEART_ON etc. ; changed to HEARTBEAT_ON etc. (both existed) --- acinclude.m4 | 8 ++-- server/client_functions.c | 82 +++++++++++++++++++++++++++++++++------ server/drivers/lcd.h | 13 +++---- server/render.c | 2 +- server/render.h | 11 ++---- server/serverscreens.c | 3 ++ 6 files changed, 88 insertions(+), 31 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 490afe8..14da2e2 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -6,7 +6,7 @@ AC_ARG_ENABLE(drivers, [ drivers may be separated with commas.] [ Possible choices are:] [ mtxorb,cfontz,curses,text,lb216,] - [ hd44780,joy,irman,lircin,bayrad,glk,] + [ hd44780,joy,irman,lirc,bayrad,glk,] [ stv5730,sed1330,sed1520,svga,lcdm001,t6963] [ \"all\" compiles all drivers], drivers="$enableval", @@ -51,7 +51,7 @@ fi AC_CHECK_HEADER(ncurses.h, dnl We have ncurses.h and libncurses, add driver. LIBCURSES="-lncurses" - DRIVERS="$DRIVERS curses_drv${SO}" + DRIVERS="$DRIVERS curses${SO}" actdrivers=["$actdrivers curses"] , dnl else @@ -63,7 +63,7 @@ dnl else AC_CHECK_HEADER(curses.h, dnl We have curses.h and libcurses, add driver. LIBCURSES="-lcurses" - DRIVERS="$DRIVERS curses_drv${SO}" + DRIVERS="$DRIVERS curses${SO}" actdrivers=["$actdrivers curses"] , dnl else @@ -132,7 +132,7 @@ dnl else AC_CHECK_LIB(lirc_client, main, LIBLIRC_CLIENT="-llirc_client" DRIVERS="$DRIVERS lirc${SO}" - actdrivers=["$actdrivers lircin"] + actdrivers=["$actdrivers lirc"] , dnl else AC_MSG_WARN([The lirc driver needs the lirc client library]) diff --git a/server/client_functions.c b/server/client_functions.c index a37a62f..163c58b 100644 --- a/server/client_functions.c +++ b/server/client_functions.c @@ -560,7 +560,8 @@ screen_del_func (client * c, int argc, char **argv) * name, priority, or duration * * usage: screen_set [ -priority ] [ -name ] [ -duration ] - * [ -wid ] [ -hgt ] [ -heartbeat ] + * [ -wid ] [ -hgt ] [ -heartbeat ] [ -cursor ] + * [ -cursor_x ] [ -cursor_y ] */ int screen_set_func (client * c, int argc, char **argv) @@ -654,19 +655,19 @@ screen_set_func (client * c, int argc, char **argv) /* set the heartbeat type...*/ if (0 == strcmp (argv[i], "on")) - s->heartbeat = HEART_ON; + s->heartbeat = HEARTBEAT_ON; if (0 == strcmp (argv[i], "heart")) - s->heartbeat = HEART_ON; + s->heartbeat = HEARTBEAT_ON; if (0 == strcmp (argv[i], "normal")) - s->heartbeat = HEART_ON; + s->heartbeat = HEARTBEAT_ON; if (0 == strcmp (argv[i], "default")) - s->heartbeat = HEART_ON; + s->heartbeat = HEARTBEAT_ON; if (0 == strcmp (argv[i], "off")) - s->heartbeat = HEART_OFF; + s->heartbeat = HEARTBEAT_OFF; if (0 == strcmp (argv[i], "none")) - s->heartbeat = HEART_OFF; + s->heartbeat = HEARTBEAT_OFF; if (0 == strcmp (argv[i], "slash")) - s->heartbeat = HEART_OPEN; + s->heartbeat = HEARTBEAT_SLASH; sock_send_string(c->sock, "success\n"); } else { sock_send_string (c->sock, "huh? -heartbeat requires a parameter\n"); @@ -722,8 +723,7 @@ screen_set_func (client * c, int argc, char **argv) sock_send_string (c->sock, "huh? -timeout requires a parameter\n"); } } - - /* Handle the backlight parameter*/ + /* Handle the "backlight" parameter*/ else if (strcmp (argv[i], "backlight") == 0) { if (argc > i + 1) { i++; @@ -759,7 +759,67 @@ screen_set_func (client * c, int argc, char **argv) } else { sock_send_string (c->sock, "huh? -backlight requires a parameter\n"); } - } else sock_send_string (c->sock, "huh? invalid parameter\n"); + } + /* Handle the "cursor" parameter */ + else if (strcmp (argv[i], "cursor") == 0) { + if (argc > i + 1) { + i++; + debug (RPT_DEBUG, "screen_set: cursor=\"%s\"", argv[i]); + + /* set the heartbeat type...*/ + if (0 == strcmp (argv[i], "off")) + s->heartbeat = CURSOR_OFF; + if (0 == strcmp (argv[i], "on")) + s->cursor = CURSOR_DEFAULT_ON; + if (0 == strcmp (argv[i], "under")) + s->cursor = CURSOR_UNDER; + if (0 == strcmp (argv[i], "block")) + s->cursor = CURSOR_BLOCK; + sock_send_string(c->sock, "success\n"); + } else { + sock_send_string (c->sock, "huh? -cursor requires a parameter\n"); + } + } + /* Handle the "cursor_x" parameter */ + else if (strcmp (p, "cursor_x") == 0) { + if (argc > i + 1) { + i++; + debug (RPT_DEBUG, "screen_set: cursor_x=\"%s\"", argv[i]); + + /* set the position...*/ + number = atoi (argv[i]); + if (number > 0 && number <= s->wid) { + s->cursor_x = number; + sock_send_string(c->sock, "success\n"); + } + else { + sock_send_string(c->sock, "huh? cursor position outside screen\n"); + } + } else { + sock_send_string (c->sock, "huh? -cursor_x requires a parameter\n"); + } + } + /* Handle the "cursor_y" parameter */ + else if (strcmp (p, "cursor_y") == 0) { + if (argc > i + 1) { + i++; + debug (RPT_DEBUG, "screen_set: cursor_y=\"%s\"", argv[i]); + + /* set the position...*/ + number = atoi (argv[i]); + if (number > 0 && number <= s->hgt) { + s->cursor_y = number; + sock_send_string(c->sock, "success\n"); + } + else { + sock_send_string(c->sock, "huh? cursor position outside screen\n"); + } + } else { + sock_send_string (c->sock, "huh? -cursor_y requires a parameter\n"); + } + } + + else sock_send_string (c->sock, "huh? invalid parameter\n"); }/* done checking argv*/ return 0; } diff --git a/server/drivers/lcd.h b/server/drivers/lcd.h index 1102cdf..62558f9 100644 --- a/server/drivers/lcd.h +++ b/server/drivers/lcd.h @@ -42,19 +42,16 @@ #define BACKLIGHT_WARNING 2 #define BACKLIGHT_RED_ALERT 3 -// Icons for icon function +/* Icons for icon function */ #define ICON_BLOCK_FILLED 0 #define ICON_HEART_OPEN 8 #define ICON_HEART_FILLED 9 /* Heartbeat data, taken from render.h */ -/* ??? What do all these mean ? */ -#define HEART_OFF 1 -#define HEART_ON 2 -#define HEART_OPEN 3 -#define HEARTBEAT_OFF HEART_OFF -#define HEARTBEAT_ON HEART_ON -#define HEARTBEAT_OPEN HEART_OPEN +/* ??? What does OPEN mean here ? */ +#define HEARTBEAT_OFF 0 +#define HEARTBEAT_ON 1 +#define HEARTBEAT_OPEN 2 /* Patterns for hbar / vbar */ #define BAR_POS 0x001 /* default */ diff --git a/server/render.c b/server/render.c index 6ffbfb9..04124ec 100644 --- a/server/render.c +++ b/server/render.c @@ -39,7 +39,7 @@ #include "widget.h" #include "render.h" -int heartbeat = HEART_OPEN; +int heartbeat = HEARTBEAT_OPEN; int backlight = BACKLIGHT_OPEN; int backlight_state = BACKLIGHT_OPEN; int backlight_brightness = 255; diff --git a/server/render.h b/server/render.h index adb7483..b9b49b0 100644 --- a/server/render.h +++ b/server/render.h @@ -14,13 +14,10 @@ #include "screen.h" -#define HEART_OFF 1 -#define HEART_ON 2 -#define HEART_OPEN 3 - -#define HEARTBEAT_OFF HEART_OFF -#define HEARTBEAT_ON HEART_ON -#define HEARTBEAT_OPEN HEART_OPEN +#define HEARTBEAT_OFF 0 +#define HEARTBEAT_ON 1 +#define HEARTBEAT_OPEN 2 +#define HEARTBEAT_SLASH 3 #define SERVER_SCREEN_NEVER 0 #define SERVER_SCREEN_NOSCREEN 1 diff --git a/server/serverscreens.c b/server/serverscreens.c index 9f632ec..397cec8 100644 --- a/server/serverscreens.c +++ b/server/serverscreens.c @@ -186,6 +186,9 @@ goodbye_screen () char *l16 = " LCDproc! "; #endif + if( !display_props ) + return 0; + drivers_clear (); if (display_props->height >= 4) {