new option Offset for xosd driver
This commit is contained in:
@@ -6,6 +6,10 @@ Key:
|
||||
* Something changed / fixed
|
||||
|
||||
v.0.5dev (ongoing development)
|
||||
* lcdexec: notification when called program finishes
|
||||
* xosd driver: offset from top-left corner
|
||||
|
||||
v.0.5.2 (unreleased)
|
||||
* fix switching on/off the Load screen in lcdproc client using the menu
|
||||
* refactor adv_bignum: support height > 4, loadable chars with offset
|
||||
* ged rid of global variables buffer & tmp in lcdproc client
|
||||
|
||||
@@ -950,7 +950,10 @@ Speed=19200
|
||||
# set display size [default: 20x4]
|
||||
Size=20x4
|
||||
|
||||
# font to use, in XLFD format, as given by "xfontsel"
|
||||
# Offset in pixels from the top-left corner of the monitor [default: 0x0]
|
||||
Offset=200x200
|
||||
|
||||
# X font to use, in XLFD format, as given by "xfontsel"
|
||||
Font=-*-terminus-*-r-*-*-*-320-*-*-*-*-*
|
||||
|
||||
# EOF
|
||||
|
||||
@@ -34,6 +34,24 @@ on-screen display (OSD) used by most modern televisions and video-players.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command>Offset=</command>
|
||||
<arg choice="plain">
|
||||
<replaceable>X-OFFSET</replaceable>
|
||||
<literal>x</literal>
|
||||
<replaceable>Y-OFFSET</replaceable>
|
||||
</arg>
|
||||
</term>
|
||||
<listitem><para>
|
||||
Offset (in pixels) of the top-left corner of <package>LCDproc</package>'s
|
||||
xosd window from the top-left corner of the monitor.
|
||||
If not given, it defaults to <literal>0x0</literal>.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
Offset=200x200
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command>Font=</command>
|
||||
@@ -52,6 +70,46 @@ on-screen display (OSD) used by most modern televisions and video-players.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<!--
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command>Contrast=</command>
|
||||
<arg choice="plain"><replaceable>CONTRAST</replaceable></arg>
|
||||
</term>
|
||||
<listitem><para>
|
||||
Set the initial contrast.
|
||||
Legal values for <replaceable>CONTRAST</replaceable> are <literal>0</literal> - <literal>1000</literal>.
|
||||
If not given, the default value is <literal>500</literal>.
|
||||
</para>
|
||||
<note><para>
|
||||
This parameter can be set but it does not change anything in the driver.
|
||||
</para></note>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command>Brightness=</command>
|
||||
<arg choice="plain"><replaceable>BRIGHTNESS</replaceable></arg>
|
||||
</term>
|
||||
<listitem><para>
|
||||
Set the initial brightness [default: <literal>1000</literal>; legal: <literal>1</literal> - <literal>1000</literal>]
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command>OffBrightness=</command>
|
||||
<arg choice="plain"><replaceable>BRIGHTNESS</replaceable></arg>
|
||||
</term>
|
||||
<listitem><para>
|
||||
Set the initial off-brightness [default: <literal>500</literal>; legal: <literal>1</literal> - <literal>1000</literal>]
|
||||
This value is used when the display is normally
|
||||
switched off in case LCDd is inactive
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
-->
|
||||
</variablelist>
|
||||
|
||||
</sect3>
|
||||
|
||||
@@ -57,7 +57,9 @@ MODULE_EXPORT char *symbol_prefix = "xosdlib_drv_";
|
||||
MODULE_EXPORT int
|
||||
xosdlib_drv_init (Driver *drvthis)
|
||||
{
|
||||
char size[LCD_MAX_WIDTH+1] = DEFAULT_SIZE;
|
||||
const char *size;
|
||||
const char *offset;
|
||||
int x, y;
|
||||
int tmp;
|
||||
|
||||
PrivateData *p;
|
||||
@@ -84,9 +86,7 @@ xosdlib_drv_init (Driver *drvthis)
|
||||
int w;
|
||||
int h;
|
||||
|
||||
strncpy(size, drvthis->config_get_string(drvthis->name, "Size",
|
||||
0, DEFAULT_SIZE), sizeof(size));
|
||||
size[sizeof(size) - 1] = '\0';
|
||||
size = drvthis->config_get_string(drvthis->name, "Size", 0, DEFAULT_SIZE);
|
||||
debug(RPT_INFO, "%s: Size (in config) is '%s'", __FUNCTION__, size);
|
||||
if ((sscanf(size, "%dx%d", &w, &h) != 2) ||
|
||||
(w <= 0) || (w > LCD_MAX_WIDTH) ||
|
||||
@@ -110,6 +110,20 @@ xosdlib_drv_init (Driver *drvthis)
|
||||
}
|
||||
report(RPT_INFO, "%s: using size %dx%d", drvthis->name, p->width, p->height);
|
||||
|
||||
/* Which x/y offsets */
|
||||
offset = drvthis->config_get_string(drvthis->name, "Offset", 0, DEFAULT_OFFSET);
|
||||
debug(RPT_INFO, "%s: Offset (in config) is '%s'", __FUNCTION__, offset);
|
||||
if (sscanf(offset, "%dx%d", &x, &y) != 2) {
|
||||
report(RPT_WARNING, "%s: cannot read Offset: %s. using default %s",
|
||||
drvthis->name, offset, DEFAULT_OFFSET);
|
||||
sscanf(DEFAULT_OFFSET, "%dx%d", &x, &y);
|
||||
}
|
||||
p->xoffs= x;
|
||||
p->yoffs = y;
|
||||
|
||||
report(RPT_INFO, "%s: using offset %dx%d", drvthis->name, p->xoffs, p->yoffs);
|
||||
|
||||
|
||||
/* Which backlight brightness */
|
||||
tmp = drvthis->config_get_int(drvthis->name, "Brightness", 0, DEFAULT_BRIGHTNESS);
|
||||
debug(RPT_INFO, "%s: Brightness (in config) is '%d'", __FUNCTION__, tmp);
|
||||
@@ -144,10 +158,20 @@ xosdlib_drv_init (Driver *drvthis)
|
||||
}
|
||||
|
||||
/* set font */
|
||||
if (xosd_set_font(p->osd, p->font) == -1) {
|
||||
if (xosd_set_font(p->osd, p->font) != 0) {
|
||||
report(RPT_ERR, "%s: xosd_set_font() failed", drvthis->name);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* set x/y offsets */
|
||||
if (xosd_set_horizontal_offset(p->osd, p->xoffs) != 0) {
|
||||
report(RPT_ERR, "%s: xosd_set_horizontal_offset() failed", drvthis->name);
|
||||
return -1;
|
||||
}
|
||||
if (xosd_set_vertical_offset(p->osd, p->yoffs) != 0) {
|
||||
report(RPT_ERR, "%s: xosd_set_vertical_offset() failed", drvthis->name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* make sure the frame buffer is there... */
|
||||
p->framebuf = (unsigned char *) malloc(p->width * p->height);
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#define DEFAULT_FONT "fixed"
|
||||
#define DEFAULT_SIZE "20x4"
|
||||
#define DEFAULT_OFFSET "0x0"
|
||||
#define DEFAULT_CONTRAST 500
|
||||
#define DEFAULT_BRIGHTNESS 1000
|
||||
#define DEFAULT_OFFBRIGHTNESS 500
|
||||
|
||||
Reference in New Issue
Block a user