Krolyxon
Commit e2fa49e

Branches

Refs →

nsxivwindow.h

105 lines · 2.2 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_COUNT
40};
41
42typedef struct {
43 Display *dpy;
44 int scr;
45 int scrw, scrh;
46 Visual *vis;
47 Colormap cmap;
48 int depth;
49} win_env_t;
50
51typedef struct {
52 Window xwin;
53 win_env_t env;
54
55 unsigned long white;
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 XSizeHints sizehints;
68
69 bool fullscreen;
70
71 struct {
72 unsigned int h;
73 char l[BAR_L_LEN];
74 char r[BAR_R_LEN];
75 unsigned long bgcol;
76 unsigned long fgcol;
77 } bar;
78} win_t;
79
80extern Atom atoms[ATOM_COUNT];
81
82void win_init(win_t*);
83void win_open(win_t*);
84void win_close(win_t*);
85
86bool win_configure(win_t*, XConfigureEvent*);
87void win_expose(win_t*, XExposeEvent*);
88bool win_moveresize(win_t*, int, int, unsigned int, unsigned int);
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 */