Krolyxon
Commit 39671a1

Branches

Refs →

nsxivwindow.h

103 lines · 2.0 KB · Objective-C

1/* Copyright 2011 Bert Muennich
2 *
3 * This file is part of sxiv.
4 *
5 * sxiv is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published
7 * by the Free Software Foundation; either version 2 of the License,
8 * or (at your option) any later version.
9 *
10 * sxiv is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with sxiv. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef WINDOW_H
20#define WINDOW_H
21
22#include <X11/Xlib.h>
23#include <X11/Xutil.h>
24
25#include "types.h"
26
27enum {
28 BAR_L_LEN = 512,
29 BAR_R_LEN = 64
30};
31
32enum {
33 ATOM_WM_DELETE_WINDOW,
34 ATOM__NET_WM_NAME,
35 ATOM__NET_WM_ICON_NAME,
36 ATOM__NET_WM_ICON,
37 ATOM__NET_WM_STATE,
38 ATOM__NET_WM_STATE_FULLSCREEN,
39 ATOM__NET_SUPPORTED,
40 ATOM_COUNT
41};
42
43typedef struct {
44 Display *dpy;
45 int scr;
46 int scrw, scrh;
47 Visual *vis;
48 Colormap cmap;
49 int depth;
50} win_env_t;
51
52typedef struct {
53 Window xwin;
54 win_env_t env;
55
56 unsigned long bgcol;
57 unsigned long fscol;
58 unsigned long selcol;
59
60 int x;
61 int y;
62 unsigned int w;
63 unsigned int h; /* = win height - bar height */
64 unsigned int bw;
65
66 bool fullscreen;
67
68 struct {
69 int w;
70 int h;
71 Pixmap pm;
72 } buf;
73
74 struct {
75 unsigned int h;
76 char l[BAR_L_LEN];
77 char r[BAR_R_LEN];
78 unsigned long bgcol;
79 unsigned long fgcol;
80 } bar;
81} win_t;
82
83extern Atom atoms[ATOM_COUNT];
84
85void win_init(win_t*);
86void win_open(win_t*);
87void win_close(win_t*);
88
89bool win_configure(win_t*, XConfigureEvent*);
90
91void win_toggle_fullscreen(win_t*);
92void win_toggle_bar(win_t*);
93
94void win_clear(win_t*);
95void win_draw(win_t*);
96void win_draw_rect(win_t*, int, int, int, int, bool, int, unsigned long);
97
98int win_textwidth(const char*, unsigned int, bool);
99
100void win_set_title(win_t*, const char*);
101void win_set_cursor(win_t*, cursor_t);
102
103#endif /* WINDOW_H */