| 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 |
| 5 | * it under the terms of the GNU General Public License as published by |
| 6 | * the Free Software Foundation; either version 2 of the License, or |
| 7 | * (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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 17 | */ |
| 18 | |
| 19 | #ifndef WINDOW_H |
| 20 | #define WINDOW_H |
| 21 | |
| 22 | #include <X11/Xlib.h> |
| 23 | |
| 24 | #define CLEANMASK(mask) ((mask) & ~LockMask) |
| 25 | |
| 26 | typedef enum win_cur_e { |
| 27 | CURSOR_ARROW = 0, |
| 28 | CURSOR_HAND, |
| 29 | CURSOR_WATCH |
| 30 | } win_cur_t; |
| 31 | |
| 32 | typedef struct win_env_s { |
| 33 | Display *dpy; |
| 34 | int scr; |
| 35 | int scrw, scrh; |
| 36 | Visual *vis; |
| 37 | Colormap cmap; |
| 38 | int depth; |
| 39 | } win_env_t; |
| 40 | |
| 41 | typedef struct win_s { |
| 42 | Window xwin; |
| 43 | win_env_t env; |
| 44 | |
| 45 | unsigned long bgcol; |
| 46 | unsigned long selcol; |
| 47 | Pixmap pm; |
| 48 | |
| 49 | int x; |
| 50 | int y; |
| 51 | unsigned int w; |
| 52 | unsigned int h; |
| 53 | |
| 54 | unsigned int bw; |
| 55 | unsigned char fullscreen; |
| 56 | } win_t; |
| 57 | |
| 58 | extern Atom wm_delete_win; |
| 59 | |
| 60 | void win_open(win_t*); |
| 61 | void win_close(win_t*); |
| 62 | |
| 63 | int win_configure(win_t*, XConfigureEvent*); |
| 64 | int win_moveresize(win_t*, int, int, unsigned int, unsigned int); |
| 65 | |
| 66 | void win_toggle_fullscreen(win_t*); |
| 67 | |
| 68 | Pixmap win_create_pixmap(win_t*, int, int); |
| 69 | void win_free_pixmap(win_t*, Pixmap); |
| 70 | |
| 71 | void win_clear(win_t*); |
| 72 | void win_draw_pixmap(win_t*, Pixmap, int, int, int, int); |
| 73 | void win_draw_rect(win_t*, int, int, int, int, Bool); |
| 74 | void win_draw(win_t*); |
| 75 | |
| 76 | void win_set_title(win_t*, const char*); |
| 77 | void win_set_cursor(win_t*, win_cur_t); |
| 78 | |
| 79 | #endif /* WINDOW_H */ |