Krolyxon
Commit 3f25b90

Branches

Refs →

nsxivwindow.h

89 lines · 2.1 KB · Objective-C

1/* sxiv: window.h
2 * Copyright (c) 2012 Bert Muennich <be.muennich at googlemail.com>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
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
27typedef struct {
28 Display *dpy;
29 int scr;
30 int scrw, scrh;
31 Visual *vis;
32 Colormap cmap;
33 int depth;
34} win_env_t;
35
36typedef struct {
37 Window xwin;
38 win_env_t env;
39
40 unsigned long white;
41 unsigned long bgcol;
42 unsigned long fscol;
43 unsigned long selcol;
44 Pixmap pm;
45
46 int x;
47 int y;
48 unsigned int w;
49 unsigned int h; /* = win height - bar height */
50 unsigned int bw;
51
52 XSizeHints sizehints;
53
54 bool fullscreen;
55
56 struct {
57 unsigned int h;
58 char *l;
59 char *r;
60 unsigned long bgcol;
61 unsigned long fgcol;
62 } bar;
63} win_t;
64
65extern Atom wm_delete_win;
66
67void win_init(win_t*);
68void win_open(win_t*);
69void win_close(win_t*);
70
71bool win_configure(win_t*, XConfigureEvent*);
72void win_expose(win_t*, XExposeEvent*);
73bool win_moveresize(win_t*, int, int, unsigned int, unsigned int);
74
75void win_toggle_fullscreen(win_t*);
76void win_toggle_bar(win_t*);
77
78void win_clear(win_t*);
79void win_draw(win_t*);
80void win_draw_rect(win_t*, Pixmap, int, int, int, int, bool, int,
81 unsigned long);
82
83int win_textwidth(const char*, unsigned int, bool);
84
85void win_set_title(win_t*, const char*);
86void win_set_bar_info(win_t*, char*, char*);
87void win_set_cursor(win_t*, cursor_t);
88
89#endif /* WINDOW_H */