| 1 | /* sxiv: window.h |
| 2 | * Copyright (c) 2011 Bert Muennich <muennich at informatik.hu-berlin.de> |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; either version 2 |
| 7 | * of the License, or (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 51 Franklin Street, 5th 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 | typedef struct { |
| 27 | Display *dpy; |
| 28 | int scr; |
| 29 | int scrw, scrh; |
| 30 | Visual *vis; |
| 31 | Colormap cmap; |
| 32 | int depth; |
| 33 | } win_env_t; |
| 34 | |
| 35 | typedef struct { |
| 36 | Window xwin; |
| 37 | win_env_t env; |
| 38 | |
| 39 | unsigned long black; |
| 40 | unsigned long white; |
| 41 | unsigned long bgcol; |
| 42 | unsigned long selcol; |
| 43 | Pixmap pm; |
| 44 | |
| 45 | int x; |
| 46 | int y; |
| 47 | unsigned int w; |
| 48 | unsigned int h; |
| 49 | |
| 50 | unsigned int bw; |
| 51 | unsigned char fullscreen; |
| 52 | } win_t; |
| 53 | |
| 54 | extern Atom wm_delete_win; |
| 55 | |
| 56 | void win_init(win_t*); |
| 57 | void win_open(win_t*); |
| 58 | void win_close(win_t*); |
| 59 | |
| 60 | int win_configure(win_t*, XConfigureEvent*); |
| 61 | int win_moveresize(win_t*, int, int, unsigned int, unsigned int); |
| 62 | |
| 63 | void win_toggle_fullscreen(win_t*); |
| 64 | |
| 65 | void win_clear(win_t*); |
| 66 | void win_draw(win_t*); |
| 67 | void win_draw_rect(win_t*, Pixmap, int, int, int, int, Bool, int, |
| 68 | unsigned long); |
| 69 | |
| 70 | void win_set_title(win_t*, const char*); |
| 71 | void win_set_cursor(win_t*, cursor_t); |
| 72 | |
| 73 | #endif /* WINDOW_H */ |