wmcalc: Remove unused image files.
[dockapps.git] / wmradio / osd.c
blob8534eddeac3b4e94a00997d909b6f2266aeae519
1 /*
2 * Copyright (C) 12 Jun 2003 Tomas Cermak
4 * This file is part of wmradio preogram.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #include "osd.h"
21 #include <stdlib.h>
22 #include <stdio.h>
24 #ifdef HAVE_XOSD
25 #include <xosd.h>
26 xosd *osd = NULL;
27 #endif
29 int osd_init(char *progname, char *font, char *color,
30 int x, int y, int shadow, int timeout) {
32 #ifdef HAVE_XOSD
34 osd = xosd_init(! font ? font : "fixed" ,
35 ! color ? color : "LawnGreen",
36 timeout,
37 XOSD_top,
39 shadow,
40 1);
41 if(!osd) {
42 fprintf(stderr, "%s: OSD error\n", progname);
43 return 0;
47 if (!(osd = xosd_create(1))) {
48 fprintf(stderr, "%s: OSD error\n", progname);
49 return 0;
52 if (font) {
53 if (xosd_set_font(osd, font)) {
54 fprintf(stderr, "%s: OSD font init error\n", progname);
55 xosd_set_font(osd, "fixed");
58 else xosd_set_font(osd, "fixed");
60 if (color) {
61 if (xosd_set_colour(osd, color)) {
62 fprintf(stderr, "%s: OSD color init error\n", progname);
63 xosd_set_colour(osd, "LawnGreen");
66 else xosd_set_colour(osd, "LawnGreen");
68 xosd_set_vertical_offset(osd, y);
69 xosd_set_horizontal_offset(osd, x);
70 xosd_set_shadow_offset(osd, shadow);
71 xosd_set_timeout(osd, timeout);
73 return 1;
74 #else /* HAVE_XOSD */
75 printf("wmradio: warning - compiled without osd\n");
76 return 0;
77 #endif /* HAVE_XOSD */
80 void osd_print(char *string) {
81 #ifdef HAVE_XOSD
82 xosd_display (osd, 0, XOSD_string, string);
83 #endif /* HAVE_XOSD */
86 void osd_close() {
87 #ifdef HAVE_XOSD
88 xosd_destroy (osd);
89 #endif /* HAVE_XOSD */