File: screen.h

package info (click to toggle)
lcdproc 0.5.9-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 5,064 kB
  • sloc: ansic: 59,645; sh: 1,740; perl: 681; makefile: 417
file content (107 lines) | stat: -rw-r--r-- 2,293 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/** \file server/screen.h
 * Public interface to the screen management methods.
 *
 * \note If you only need 'struct Screen' to work with, you should use the
 *       following code (which does not create an indirect dependency on
 *       'struct Widget'):
 *
 * \code
 * #define INC_TYPES_ONLY 1
 * #include "screen.h"
 * #undef INC_TYPES_ONLY
 * \endcode
 */

/* This file is part of LCDd, the lcdproc server.
 *
 * This file is released under the GNU General Public License.
 * Refer to the COPYING file distributed with this package.
 *
 * Copyright (c) 1999, William Ferrell, Selene Scriven
 * 		 2003, Joris Robijn
 */

#ifndef SCREEN_H_TYPES
#define SCREEN_H_TYPES

#include "shared/LL.h"

#ifdef INC_TYPES_ONLY
# include "client.h"
#else
# define INC_TYPES_ONLY 1
# include "client.h"
# undef INC_TYPES_ONLY
#endif

typedef enum {	PRI_HIDDEN, PRI_BACKGROUND, PRI_INFO, PRI_FOREGROUND,
		PRI_ALERT, PRI_INPUT
} Priority;

typedef struct Screen {
	char *id;
	char *name;
	int width, height;
	int duration;
	int timeout;
	Priority priority;
	short int heartbeat;
	short int backlight;
	short int cursor;
	short int cursor_x;
	short int cursor_y;
	char *keys;
	LinkedList *widgetlist;
	struct Client *client;
} Screen;

extern int  default_duration ;
extern int  default_priority ;

#endif

#ifndef INC_TYPES_ONLY
#ifndef SCREEN_H_FNCS
#define SCREEN_H_FNCS

#define INC_TYPES_ONLY 1
#include "widget.h"
#undef INC_TYPES_ONLY

/* Creates a new screen */
Screen *screen_create(char *id, Client *client);

/* Destroys a screen */
int screen_destroy(Screen *s);

/* Add a widget to a screen */
int screen_add_widget(Screen *s, Widget *w);

/* Remove a widget from a screen (does not destroy it) */
int screen_remove_widget(Screen *s, Widget *w);

/* List functions */
static inline Widget *screen_getfirst_widget(Screen *s)
{
	return (Widget *) ((s != NULL)
			   ? LL_GetFirst(s->widgetlist)
			   : NULL);
}

static inline Widget *screen_getnext_widget(Screen *s)
{
	return (Widget *) ((s != NULL)
			   ? LL_GetNext(s->widgetlist)
			   : NULL);
}


/* Find a widget in a screen */
Widget *screen_find_widget(Screen *s, char *id);

/* Convert priority names to priority and vv */
Priority screen_pri_name_to_pri(char *pri_name);
char *screen_pri_to_pri_name(Priority pri);

#endif
#endif