Krolyxon
Commit 5ca20ad

Branches

Refs →

nsxivwindow.h

102 lines · 2.1 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 Pixmap pm;
60
61 int x;
62 int y;
63 unsigned int w;
64 unsigned int h; /* = win height - bar height */
65 unsigned int bw;
66
67 bool fullscreen;
68
69 struct {
70 unsigned int h;
71 char l[BAR_L_LEN];
72 char r[BAR_R_LEN];
73 unsigned long bgcol;
74 unsigned long fgcol;
75 } bar;
76} win_t;
77
78extern Atom atoms[ATOM_COUNT];
79
80void win_init(win_t*);
81void win_open(win_t*);
82void win_close(win_t*);
83
84bool win_configure(win_t*, XConfigureEvent*);
85void win_expose(win_t*, XExposeEvent*);
86
87void win_toggle_fullscreen(win_t*);
88void win_toggle_bar(win_t*);
89
90void win_clear(win_t*);
91void win_draw(win_t*);
92void win_draw_rect(win_t*, Pixmap, int, int, int, int, bool, int,
93 unsigned long);
94
95void win_update_bar(win_t*);
96
97int win_textwidth(const char*, unsigned int, bool);
98
99void win_set_title(win_t*, const char*);
100void win_set_cursor(win_t*, cursor_t);
101
102#endif /* WINDOW_H */