Krolyxon
Commit 7ea8a4e

Branches

Refs →

nsxivwindow.h

95 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
32typedef struct {
33 Display *dpy;
34 int scr;
35 int scrw, scrh;
36 Visual *vis;
37 Colormap cmap;
38 int depth;
39} win_env_t;
40
41typedef struct {
42 Window xwin;
43 win_env_t env;
44
45 unsigned long white;
46 unsigned long bgcol;
47 unsigned long fscol;
48 unsigned long selcol;
49 Pixmap pm;
50
51 int x;
52 int y;
53 unsigned int w;
54 unsigned int h; /* = win height - bar height */
55 unsigned int bw;
56
57 XSizeHints sizehints;
58
59 bool fullscreen;
60
61 struct {
62 unsigned int h;
63 char l[BAR_L_LEN];
64 char r[BAR_R_LEN];
65 unsigned long bgcol;
66 unsigned long fgcol;
67 } bar;
68} win_t;
69
70extern Atom wm_delete_win;
71
72void win_init(win_t*);
73void win_open(win_t*);
74void win_close(win_t*);
75
76bool win_configure(win_t*, XConfigureEvent*);
77void win_expose(win_t*, XExposeEvent*);
78bool win_moveresize(win_t*, int, int, unsigned int, unsigned int);
79
80void win_toggle_fullscreen(win_t*);
81void win_toggle_bar(win_t*);
82
83void win_clear(win_t*);
84void win_draw(win_t*);
85void win_draw_rect(win_t*, Pixmap, int, int, int, int, bool, int,
86 unsigned long);
87
88void win_update_bar(win_t*);
89
90int win_textwidth(const char*, unsigned int, bool);
91
92void win_set_title(win_t*, const char*);
93void win_set_cursor(win_t*, cursor_t);
94
95#endif /* WINDOW_H */