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

Last change on this file since 2429 was 2429, checked in by Pascal Terjan, 13 years ago
  • Remove one of the reads of /proc
  • Property svn:keywords set to Id
File size: 3.2 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 2429 2008-06-15 17:17:36Z 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
19
20#define CURRENTSCREEN screen_list->screen[screen_list->pty]
21
22
23enum wm_types
24{
25    WM_FULL,
26    WM_CARD,
27    WM_HSPLIT,
28    WM_VSPLIT,
29
30    WM_MAX,
31};
32
33struct 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
60struct 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
77int create_pty(char *cmd, unsigned int w, unsigned int h, int *cpid);
78int create_pty_grab(pid_t pid, unsigned int w, unsigned int h);
79int grab_process(pid_t pid, char *ptyname, int ptyfd);
80
81long int import_term(struct screen_list *screen_list, struct screen *sc, void const *data, unsigned int size);
82int set_tty_size(int fd, unsigned int w, unsigned int h);
83int update_terms(struct screen_list* screen_list);
84void refresh_screens(cucul_canvas_t *cv,
85                     caca_display_t *dp,
86                     struct screen_list *screen_list);
87int update_screens_contents(struct screen_list* screen_list);
88
89/* Screens management */
90struct screen* create_screen(int w, int h, char *command);
91struct screen* create_screen_grab(int w, int h, int pid);
92int destroy_screen(struct screen *s);
93int add_screen(struct screen_list *list, struct screen *s);
94int remove_screen(struct screen_list *list, int n, int please_kill);
95void resize_screen(struct screen *s, int z, int h);
96
97/* Window managers */
98void update_windows_props(cucul_canvas_t *cv, struct screen_list *screen_list);
99void update_windows_props_cards(cucul_canvas_t *cv, struct screen_list *screen_list);
100void update_windows_props_hsplit(cucul_canvas_t *cv, struct screen_list *screen_list);
101void update_windows_props_full(cucul_canvas_t *cv, struct screen_list *screen_list);
102void update_windows_props_vsplit(cucul_canvas_t *cv, struct screen_list *screen_list);
103
104/* Effects and addons */
105void draw_thumbnails(cucul_canvas_t *cv, struct screen_list *screen_list);
106void draw_status(cucul_canvas_t *cv, struct screen_list *screen_list);
107void draw_help(cucul_canvas_t *cv, struct screen_list *screen_list);
108
109
110#if 0
111#   define debug(f, z...) fprintf(stderr, f "\n", z)
112#else
113#   define debug(f, z...) do {} while(0)
114#endif
115
Note: See TracBrowser for help on using the repository browser.