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

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