| 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$ |
|---|
| 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 | enum wm_types |
|---|
| 20 | { |
|---|
| 21 | WM_FULL, |
|---|
| 22 | WM_CARD, |
|---|
| 23 | WM_HSPLIT, |
|---|
| 24 | WM_VSPLIT, |
|---|
| 25 | |
|---|
| 26 | WM_MAX, |
|---|
| 27 | }; |
|---|
| 28 | |
|---|
| 29 | struct screen |
|---|
| 30 | { |
|---|
| 31 | /* Graphics stuff */ |
|---|
| 32 | int init; |
|---|
| 33 | cucul_canvas_t *cv; |
|---|
| 34 | uint32_t clearattr; |
|---|
| 35 | uint8_t fg, bg; /* ANSI-context fg/bg */ |
|---|
| 36 | uint8_t dfg, dbg; /* Default fg/bg */ |
|---|
| 37 | uint8_t bold, blink, italics, negative, concealed, underline; |
|---|
| 38 | uint8_t faint, strike, proportional; /* unsupported */ |
|---|
| 39 | |
|---|
| 40 | /* Other stuff */ |
|---|
| 41 | int fd; |
|---|
| 42 | unsigned char *buf; |
|---|
| 43 | long int total; |
|---|
| 44 | |
|---|
| 45 | int x, y; |
|---|
| 46 | int w, h; |
|---|
| 47 | }; |
|---|
| 48 | |
|---|
| 49 | struct screen_list |
|---|
| 50 | { |
|---|
| 51 | int wm_type; |
|---|
| 52 | int count; |
|---|
| 53 | int width, height; |
|---|
| 54 | struct screen **screen; |
|---|
| 55 | }; |
|---|
| 56 | |
|---|
| 57 | |
|---|
| 58 | |
|---|
| 59 | long int import_term(struct screen *sc, void const *data, unsigned int size); |
|---|
| 60 | void draw_thumbnails(cucul_canvas_t *cv, struct screen_list *screen_list, int pty); |
|---|
| 61 | |
|---|
| 62 | int set_tty_size(int fd, unsigned int w, unsigned int h); |
|---|
| 63 | |
|---|
| 64 | |
|---|
| 65 | /* Screens management */ |
|---|
| 66 | struct screen* create_screen(int w, int h, char *command); |
|---|
| 67 | int destroy_screen(struct screen *s); |
|---|
| 68 | int add_screen(struct screen_list *list, struct screen *s); |
|---|
| 69 | int remove_screen(struct screen_list *list, int n); |
|---|
| 70 | void resize_screen(struct screen *s, int z, int h); |
|---|
| 71 | |
|---|
| 72 | /* Window managers */ |
|---|
| 73 | void update_windows_props(cucul_canvas_t *cv, struct screen_list *screen_list, int pty); |
|---|
| 74 | void update_windows_props_cards(cucul_canvas_t *cv, struct screen_list *screen_list, int pty); |
|---|
| 75 | void update_windows_props_hsplit(cucul_canvas_t *cv, struct screen_list *screen_list, int pty); |
|---|
| 76 | void update_windows_props_full(cucul_canvas_t *cv, struct screen_list *screen_list, int pty); |
|---|
| 77 | void update_windows_props_vsplit(cucul_canvas_t *cv, struct screen_list *screen_list, int pty); |
|---|
| 78 | |
|---|
| 79 | |
|---|
| 80 | #if 0 |
|---|
| 81 | # define debug(f, z...) fprintf(stderr, f "\n", #z) |
|---|
| 82 | #else |
|---|
| 83 | # define debug(f, z...) do {} while(0) |
|---|
| 84 | #endif |
|---|
| 85 | |
|---|