| 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 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 | 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 | unsigned int bw; |
| 50 | |
| 51 | bool 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 | bool win_configure(win_t*, XConfigureEvent*); |
| 61 | bool 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 */ |