| 1 | /* sxiv: window.h |
| 2 | * Copyright (c) 2012 Bert Muennich <be.muennich at googlemail.com> |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify it |
| 5 | * under the terms of the GNU General Public License as published by the |
| 6 | * Free Software Foundation; either version 2 of the License, or (at your |
| 7 | * option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, but |
| 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | * General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License along |
| 15 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 | */ |
| 18 | |
| 19 | #ifndef WINDOW_H |
| 20 | #define WINDOW_H |
| 21 | |
| 22 | #include <X11/Xlib.h> |
| 23 | |
| 24 | #include "types.h" |
| 25 | |
| 26 | #define BAR_SEPARATOR " | " |
| 27 | |
| 28 | typedef struct { |
| 29 | Display *dpy; |
| 30 | int scr; |
| 31 | int scrw, scrh; |
| 32 | Visual *vis; |
| 33 | Colormap cmap; |
| 34 | int depth; |
| 35 | } win_env_t; |
| 36 | |
| 37 | typedef struct { |
| 38 | Window xwin; |
| 39 | win_env_t env; |
| 40 | |
| 41 | unsigned long black; |
| 42 | unsigned long white; |
| 43 | unsigned long bgcol; |
| 44 | unsigned long selcol; |
| 45 | unsigned long barbgcol; |
| 46 | unsigned long barfgcol; |
| 47 | Pixmap pm; |
| 48 | |
| 49 | int x; |
| 50 | int y; |
| 51 | unsigned int w; |
| 52 | unsigned int h; |
| 53 | unsigned int barh; |
| 54 | unsigned int bw; |
| 55 | |
| 56 | bool fullscreen; |
| 57 | |
| 58 | const char *lbar; |
| 59 | const char *rbar; |
| 60 | } win_t; |
| 61 | |
| 62 | extern Atom wm_delete_win; |
| 63 | |
| 64 | void win_init(win_t*); |
| 65 | void win_open(win_t*); |
| 66 | void win_close(win_t*); |
| 67 | |
| 68 | bool win_configure(win_t*, XConfigureEvent*); |
| 69 | bool win_moveresize(win_t*, int, int, unsigned int, unsigned int); |
| 70 | |
| 71 | void win_toggle_fullscreen(win_t*); |
| 72 | void win_toggle_bar(win_t*); |
| 73 | |
| 74 | void win_clear(win_t*); |
| 75 | void win_draw(win_t*); |
| 76 | void win_draw_rect(win_t*, Pixmap, int, int, int, int, bool, int, |
| 77 | unsigned long); |
| 78 | |
| 79 | void win_set_title(win_t*, const char*); |
| 80 | void win_set_bar_info(win_t*, const char*, const char*); |
| 81 | void win_set_cursor(win_t*, cursor_t); |
| 82 | |
| 83 | #endif /* WINDOW_H */ |