source: neercs/trunk/src/neercs.h @ 2451

Last change on this file since 2451 was 2451, checked in by Pascal Terjan, 12 years ago
  • Remove termios stuff, does not do anything currently
  • Property svn:keywords set to Id
File size: 5.8 KB
Line 
1/*
2 *  neercs        console-based window manager
3 *  Copyright (c) 2006 Sam Hocevar <sam@zoy.org>
4 *                2008 Jean-Yves Lamoureux <jylam@lnxscene.org>
5 *                All Rights Reserved
6 *
7 *  $Id: neercs.h 2451 2008-06-18 21:08:44Z pterjan $
8 *
9 *  This program is free software. It comes without any warranty, to
10 *  the extent permitted by applicable law. You can redistribute it
11 *  and/or modify it under the terms of the Do What The Fuck You Want
12 *  To Public License, Version 2, as published by Sam Hocevar. See
13 *  http://sam.zoy.org/wtfpl/COPYING for more details.
14 */
15
16#include <stdint.h>
17#include <caca.h>
18
19enum wm_types
20{
21    WM_FULL,
22    WM_CARD,
23    WM_HSPLIT,
24    WM_VSPLIT,
25
26    WM_MAX,
27};
28
29
30struct screen
31{
32    /* Graphics stuff */
33    int init;
34    cucul_canvas_t *cv;
35    uint32_t clearattr;
36    uint8_t fg, bg;   /* ANSI-context fg/bg */
37    uint8_t dfg, dbg; /* Default fg/bg */
38    uint8_t bold, blink, italics, negative, concealed, underline;
39    uint8_t faint, strike, proportional; /* unsupported */
40
41    /* Other stuff */
42    int visible;                 /* Draw canvas and border flag */
43    int fd;                      /* pty fd */
44    unsigned char *buf;          /* text buffer */
45    long int total;              /* buffer length */
46    char *title;                 /* tty title */
47    int bell;                    /* bell occuring */
48    unsigned int scroll, s1, s2; /* FIXME, ANSI scroll properties */
49    int pid;                     /* running program pid */
50
51    int x, y;                    /* Canvas position */
52    int w, h;                    /* Canvas size */
53
54    int orig_x, orig_y;          /* Used by recurrents */
55    int orig_w, orig_h;          /* Used by recurrents */
56
57};
58
59struct screen_list
60{
61    int wm_type;                 /* Window manager type */
62    int in_bell;                 /* Bell occuring in a window  */
63    int dont_update_coords;      /* Used by recurrents */
64    /* Add-ons*/
65    int mini;                    /* Thumbnails */
66    int status;                  /* Status bar */
67    int help;                    /* help */
68
69    /* ScreenSaver stuff */
70    long long unsigned int screensaver_timeout;     /* Screensaver timeout in us */
71    int in_screensaver;
72    void *screensaver_data;
73
74    int pty, prevpty;            /* Current and previous window */
75    int count;                   /* Window count */
76    int width, height;           /* caca window size */
77    struct screen **screen;      /* Windows */
78};
79
80
81struct recurrent
82{
83    int (*function)(struct screen_list*, struct recurrent* rec, void *user, long long unsigned int t);
84    void *user;
85    long long unsigned int  start_time;
86    int kill_me;
87};
88
89struct recurrent_list
90{
91    int count;
92    struct recurrent **recurrent;
93};
94
95
96void version(void);
97
98
99
100int create_pty(char *cmd, unsigned int w, unsigned int h, int *cpid);
101#ifdef USE_GRAB
102int create_pty_grab(pid_t pid, unsigned int w, unsigned int h);
103int grab_process(pid_t pid, char *ptyname, int ptyfd);
104#endif
105
106long int import_term(struct screen_list *screen_list, struct screen *sc, void const *data, unsigned int size);
107int set_tty_size(int fd, unsigned int w, unsigned int h);
108int update_terms(struct screen_list* screen_list);
109void refresh_screens(cucul_canvas_t *cv,
110                     caca_display_t *dp,
111                     struct screen_list *screen_list);
112int update_screens_contents(struct screen_list* screen_list);
113long long get_ms(void);
114
115
116/* Screens management */
117struct screen* create_screen(int w, int h, char *command);
118#ifdef USE_GRAB
119struct screen* create_screen_grab(int w, int h, int pid);
120#endif
121int destroy_screen(struct screen *s);
122int add_screen(struct screen_list *list, struct screen *s);
123int remove_screen(struct screen_list *list, int n, int please_kill);
124void resize_screen(struct screen *s, int z, int h);
125
126/* Window managers */
127void update_windows_props(cucul_canvas_t *cv, struct screen_list *screen_list);
128void update_windows_props_cards(cucul_canvas_t *cv, struct screen_list *screen_list);
129void update_windows_props_hsplit(cucul_canvas_t *cv, struct screen_list *screen_list);
130void update_windows_props_full(cucul_canvas_t *cv, struct screen_list *screen_list);
131void update_windows_props_vsplit(cucul_canvas_t *cv, struct screen_list *screen_list);
132
133/* Effects and addons */
134void draw_thumbnails(cucul_canvas_t *cv, struct screen_list *screen_list);
135void draw_status(cucul_canvas_t *cv, struct screen_list *screen_list);
136void draw_help(cucul_canvas_t *cv, struct screen_list *screen_list);
137int close_screen_recurrent(struct screen_list*, struct recurrent* rec, void *user, long long unsigned int t);
138
139
140/* Screensavers */
141void screensaver_init(cucul_canvas_t *cv,
142                      caca_display_t *dp,
143                      struct screen_list *screen_list);
144void screensaver_kill(cucul_canvas_t *cv,
145                      caca_display_t *dp,
146                      struct screen_list *screen_list);
147
148void draw_screensaver(cucul_canvas_t *cv,
149                      caca_display_t *dp,
150                      struct screen_list *screen_list);
151void screensaver_flying_toasters(cucul_canvas_t *cv,
152                                 caca_display_t *dp,
153                                 struct screen_list *screen_list);
154
155void screensaver_flying_toasters_init(cucul_canvas_t *cv,
156                                 caca_display_t *dp,
157                                 struct screen_list *screen_list);
158
159void screensaver_flying_toasters_kill(cucul_canvas_t *cv,
160                                 caca_display_t *dp,
161                                 struct screen_list *screen_list);
162
163
164
165/* Recurrents */
166int add_recurrent(struct recurrent_list *list,
167                  int (*function)(struct screen_list*, struct recurrent* rec, void *user, long long unsigned int t),
168                  void *user);
169int remove_recurrent(struct recurrent_list *list, int n);
170
171
172#if 1
173#   define debug(f, z...) fprintf(stderr, f "\n", z)
174#else
175#   define debug(f, z...) do {} while(0)
176#endif
177
Note: See TracBrowser for help on using the repository browser.