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 2421 2008-06-15 15:13:41Z jylam $ |
---|
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 <cucul.h> |
---|
18 | |
---|
19 | |
---|
20 | #define CURRENTSCREEN screen_list->screen[screen_list->pty] |
---|
21 | |
---|
22 | |
---|
23 | enum wm_types |
---|
24 | { |
---|
25 | WM_FULL, |
---|
26 | WM_CARD, |
---|
27 | WM_HSPLIT, |
---|
28 | WM_VSPLIT, |
---|
29 | |
---|
30 | WM_MAX, |
---|
31 | }; |
---|
32 | |
---|
33 | struct screen |
---|
34 | { |
---|
35 | /* Graphics stuff */ |
---|
36 | int init; |
---|
37 | cucul_canvas_t *cv; |
---|
38 | uint32_t clearattr; |
---|
39 | uint8_t fg, bg; /* ANSI-context fg/bg */ |
---|
40 | uint8_t dfg, dbg; /* Default fg/bg */ |
---|
41 | uint8_t bold, blink, italics, negative, concealed, underline; |
---|
42 | uint8_t faint, strike, proportional; /* unsupported */ |
---|
43 | |
---|
44 | /* Other stuff */ |
---|
45 | int visible; |
---|
46 | int fd; |
---|
47 | unsigned char *buf; |
---|
48 | char *title; |
---|
49 | long int total; |
---|
50 | int bell; |
---|
51 | unsigned int scroll, s1, s2; |
---|
52 | int pid; |
---|
53 | |
---|
54 | int kill_time; |
---|
55 | |
---|
56 | int x, y; |
---|
57 | int w, h; |
---|
58 | }; |
---|
59 | |
---|
60 | struct screen_list |
---|
61 | { |
---|
62 | int wm_type; |
---|
63 | int in_bell; |
---|
64 | /* Add-ons*/ |
---|
65 | int mini; |
---|
66 | int status; |
---|
67 | int help; |
---|
68 | |
---|
69 | |
---|
70 | int pty, prevpty; |
---|
71 | int count; |
---|
72 | int width, height; |
---|
73 | struct screen **screen; |
---|
74 | }; |
---|
75 | |
---|
76 | |
---|
77 | int create_pty(char *cmd, unsigned int w, unsigned int h, int *cpid); |
---|
78 | |
---|
79 | long int import_term(struct screen_list *screen_list, struct screen *sc, void const *data, unsigned int size); |
---|
80 | int set_tty_size(int fd, unsigned int w, unsigned int h); |
---|
81 | int update_terms(struct screen_list* screen_list); |
---|
82 | void refresh_screens(cucul_canvas_t *cv, |
---|
83 | caca_display_t *dp, |
---|
84 | struct screen_list *screen_list); |
---|
85 | int update_screens_contents(struct screen_list* screen_list); |
---|
86 | |
---|
87 | /* Screens management */ |
---|
88 | struct screen* create_screen(int w, int h, char *command); |
---|
89 | int destroy_screen(struct screen *s); |
---|
90 | int add_screen(struct screen_list *list, struct screen *s); |
---|
91 | int remove_screen(struct screen_list *list, int n, int please_kill); |
---|
92 | void resize_screen(struct screen *s, int z, int h); |
---|
93 | |
---|
94 | /* Window managers */ |
---|
95 | void update_windows_props(cucul_canvas_t *cv, struct screen_list *screen_list); |
---|
96 | void update_windows_props_cards(cucul_canvas_t *cv, struct screen_list *screen_list); |
---|
97 | void update_windows_props_hsplit(cucul_canvas_t *cv, struct screen_list *screen_list); |
---|
98 | void update_windows_props_full(cucul_canvas_t *cv, struct screen_list *screen_list); |
---|
99 | void update_windows_props_vsplit(cucul_canvas_t *cv, struct screen_list *screen_list); |
---|
100 | |
---|
101 | /* Effects and addons */ |
---|
102 | void draw_thumbnails(cucul_canvas_t *cv, struct screen_list *screen_list); |
---|
103 | void draw_status(cucul_canvas_t *cv, struct screen_list *screen_list); |
---|
104 | void draw_help(cucul_canvas_t *cv, struct screen_list *screen_list); |
---|
105 | |
---|
106 | |
---|
107 | |
---|
108 | |
---|
109 | #if 0 |
---|
110 | # define debug(f, z...) fprintf(stderr, f "\n", z) |
---|
111 | #else |
---|
112 | # define debug(f, z...) do {} while(0) |
---|
113 | #endif |
---|
114 | |
---|