Krolyxon
Commit 43a04c4

Branches

Refs →

nsxivwindow.h

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