fbui | Framebuffer-based graphical environment |
| download: https://git.y1.nz/archives/fbui.tar.gz | |
| README | Files | Log | Refs |
libfbui/libfbui.h
1
2 /*=========================================================================
3 *
4 * libfbui, a library for accessing FBUI (in-kernel framebuffer GUI).
5 * Copyright (C) 2003-2004 Zachary T Smith, fbui@comcast.net
6 *
7 * This module is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This module is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this module; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 * (See the file COPYING in the main directory of this archive for
22 * more details.)
23 *
24 *=======================================================================*/
25
26
27 #ifndef _FBUI_H
28 #define _FBUI_H
29
30 #include <linux/fb.h>
31
32
33 typedef unsigned char uchar;
34 typedef unsigned char bool;
35
36 enum { true=1, false=0 };
37
38 #define LIBFBUI_COMMANDBUFLEN (4096)
39
40
41
42 typedef struct win {
43 int id;
44
45 unsigned short command [LIBFBUI_COMMANDBUFLEN + 1];
46 unsigned short command_ix;
47
48 int width, height;
49
50 struct win *next;
51 } Window;
52
53 typedef struct {
54 int fd;
55
56 Window *list;
57
58 unsigned char shift,ctrl,alt;
59 short width, height, depth;
60
61 /* needed for creating native-format pixmaps */
62 short red_offset, green_offset, blue_offset;
63 short red_length, green_length, blue_length;
64 } Display;
65
66 typedef struct {
67 Window *win;
68 short id;
69 char type;
70 short key;
71 short x,y,width,height;
72 } Event;
73
74
75
76 extern int fbui_poll_event (Display *dpy, Event *, unsigned short mask); /* returns <0 when error */
77 extern int fbui_wait_event (Display *dpy, Event *, unsigned short mask); /* returns <0 when error */
78
79 extern int fbui_read_mouse (Display *dpy, Window*, short*,short*);
80
81 extern int fbui_get_dims (Display *dpy, Window*, short*,short*);
82 extern int fbui_get_position (Display *dpy, Window*, short*,short*);
83
84 /* raw to ascii conversion: */
85 extern int fbui_convert_key (Display *, long);
86
87 extern int fbui_flush (Display *, Window *);
88
89 extern int fbui_cut (Display*,Window *wm, unsigned char *data, unsigned long length);
90 extern int fbui_paste (Display*,Window *wm, unsigned char *data, unsigned long max_length);
91 extern long fbui_cut_length (Display*,Window *wm);
92
93 extern int fbui_hide(Display*,Window *wm,short id);
94 extern int fbui_unhide(Display*,Window *wm,short id);
95 extern int fbui_delete(Display*,Window *wm,short id);
96 extern int fbui_redraw(Display*,Window *wm,short id);
97 extern int fbui_move_resize(Display*,Window *wm,short id,short,short,short,short);
98 extern int fbui_window_info (Display*,Window *wm,struct fbui_wininfo*,int);
99 extern int fbui_accelerator (Display* dpy, Window *wm,short key, short op);
100
101 extern int fbui_assign_keyfocus (Display*,Window *wm,short);
102 extern int fbui_assign_ptrfocus (Display*,Window *wm,short);
103
104 extern int fbui_placement (Display* dpy,Window *wm, int yes);
105
106 extern int fbui_draw_point (Display*,Window*, short x, short y,unsigned long);
107 extern unsigned long fbui_read_point (Display*,Window*, short x, short y);
108 extern int fbui_draw_vline (Display*,Window*, short x, short y0, short y1,unsigned long);
109 extern int fbui_draw_hline (Display*,Window*, short x0, short x1, short y,unsigned long);
110
111 extern int fbui_set_subtitle (Display*,Window*, char *);
112
113 extern int
114 fbui_tinyblit (Display *dpy, Window *win, short x, short y,
115 unsigned long color,
116 unsigned long bgcolor,
117 short width,
118 unsigned long bits);
119
120 extern int fbui_draw_line (Display*,Window*, short x0, short y0, short x1, short y1,unsigned long);
121 extern int fbui_invert_line (Display*,Window*, short x0, short y0, short x1, short y1);
122 extern int fbui_draw_string (Display*,Window*, struct fbui_font*,short, short, char *,unsigned long);
123 extern int fbui_set_font (Display *dpy, Window *win, struct fbui_font *font);
124 extern int fbui_clear (Display *, Window*);
125 extern int fbui_draw_rect (Display*,Window*, short x0, short y0, short x1, short y1,unsigned long);
126 extern int fbui_fill_area (Display*,Window*, short x0, short y0, short x1, short y1,unsigned long);
127 extern int fbui_clear_area (Display*,Window*, short x0, short y0, short x1, short y1);
128 extern int fbui_copy_area (Display*,Window*, short xsrc, short ysrc, short xdest, short ydest, short w, short h);
129 extern int fbui_put (Display*,Window*, short x, short y, short n, unsigned char *p);
130 extern int fbui_put_rgb (Display*,Window*, short x, short y, short n, unsigned long *p);
131 extern int fbui_put_rgb3 (Display*,Window*, short x, short y, short n, unsigned char *p);
132
133 extern Display *fbui_display_open ();
134 extern void fbui_display_close (Display *);
135
136 extern int fbui_window_close (Display *, Window*);
137
138 extern Window *fbui_window_open (Display *dpy, short width, short height,
139 short *width_return, short *height_return,
140 short max_width, short max_height,
141 short xrel, short yrel,
142 unsigned long *fgcolor_inout,
143 unsigned long *bgcolor_inout,
144 char*, char*,
145 char progtype,
146 char req_ctl,
147 char doing_autopositioning,
148 char vc,
149 char need_keys,
150 char receive_all_motion,
151 char initially_hidden,
152 int argc,char** argv);
153
154 /* special keys */
155 #define FBUI_DEL (127)
156
157 #define FBUISPECIALKEYSBASE 1024
158
159 #define FBUI_UP (FBUISPECIALKEYSBASE+0)
160 #define FBUI_DOWN (FBUISPECIALKEYSBASE+1)
161 #define FBUI_LEFT (FBUISPECIALKEYSBASE+2)
162 #define FBUI_RIGHT (FBUISPECIALKEYSBASE+3)
163 #define FBUI_F1 (FBUISPECIALKEYSBASE+4)
164 #define FBUI_F2 (FBUISPECIALKEYSBASE+5)
165 #define FBUI_F3 (FBUISPECIALKEYSBASE+6)
166 #define FBUI_F4 (FBUISPECIALKEYSBASE+7)
167 #define FBUI_F5 (FBUISPECIALKEYSBASE+8)
168 #define FBUI_F6 (FBUISPECIALKEYSBASE+9)
169 #define FBUI_F7 (FBUISPECIALKEYSBASE+10)
170 #define FBUI_F8 (FBUISPECIALKEYSBASE+11)
171 #define FBUI_F9 (FBUISPECIALKEYSBASE+12)
172 #define FBUI_F10 (FBUISPECIALKEYSBASE+13)
173 #define FBUI_F11 (FBUISPECIALKEYSBASE+14)
174 #define FBUI_F12 (FBUISPECIALKEYSBASE+15)
175 #define FBUI_INS (FBUISPECIALKEYSBASE+16)
176 #define FBUI_HOME (FBUISPECIALKEYSBASE+17)
177 #define FBUI_END (FBUISPECIALKEYSBASE+18)
178 #define FBUI_PGUP (FBUISPECIALKEYSBASE+19)
179 #define FBUI_PGDN (FBUISPECIALKEYSBASE+20)
180 #define FBUI_SCRLK (FBUISPECIALKEYSBASE+21)
181 #define FBUI_NUMLK (FBUISPECIALKEYSBASE+22)
182 #define FBUI_LEFTTAB (FBUISPECIALKEYSBASE+23)
183 #define FBUI_PRTSC (FBUISPECIALKEYSBASE+24)
184 #define FBUI_CAPSLK (FBUISPECIALKEYSBASE+25)
185
186
187 #define FONT_WEIGHT_LIGHT (0)
188 #define FONT_WEIGHT_MEDIUM (1)
189 #define FONT_WEIGHT_BOLD (2)
190 #define FONT_WEIGHT_BLACK (3)
191
192 typedef struct fbui_font Font;
193
194 extern void font_string_dims (Font *font, unsigned char*, short *w, short *ascent, short *descent);
195 extern void font_char_dims (Font *font, uchar ch, short *w, short *asc, short *desc);
196
197 extern Font* font_new (void);
198 extern void font_free (Font*);
199
200 extern char pcf_read (Font* pcf, char *path);
201
202 extern char *fbui_get_event_name (int type);
203
204 extern int display_fd;
205 extern Display *my_dpy;
206
207 void fbui_print_error (int value);
208 char *fbui_error_name (int value);
209
210
211 #define FATAL(s) { fbui_display_close (my_dpy); fprintf(stderr,"Error in %s(): %s\n",__FUNCTION__,s); exit(1); }
212 #define WARNING(s) { fprintf(stderr,"Warning in %s(): %s\n",__FUNCTION__,s); }
213
214
215
216
217 #endif
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.