Krolyxon
Commit ec73827

Branches

Refs →

nsxivwindow.h

86 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
24#include "types.h"
25
26#define BAR_SEPARATOR " | "
27
28typedef struct {
29 Display *dpy;
30 int scr;
31 int scrw, scrh;
32 Visual *vis;
33 Colormap cmap;
34 int depth;
35} win_env_t;
36
37typedef struct {
38 Window xwin;
39 win_env_t env;
40
41 unsigned long white;
42 unsigned long bgcol;
43 unsigned long fscol;
44 unsigned long selcol;
45 unsigned long barbgcol;
46 unsigned long barfgcol;
47 Pixmap pm;
48
49 int x;
50 int y;
51 unsigned int w;
52 unsigned int h; /* = win height - bar height */
53 unsigned int barh;
54 unsigned int bw;
55
56 bool fullscreen;
57
58 const char *lbar;
59 const char *rbar;
60} win_t;
61
62extern Atom wm_delete_win;
63
64void win_init(win_t*);
65void win_open(win_t*);
66void win_close(win_t*);
67
68bool win_configure(win_t*, XConfigureEvent*);
69void win_expose(win_t*, XExposeEvent*);
70bool win_moveresize(win_t*, int, int, unsigned int, unsigned int);
71
72void win_toggle_fullscreen(win_t*);
73void win_toggle_bar(win_t*);
74
75void win_clear(win_t*);
76void win_draw(win_t*);
77void win_draw_rect(win_t*, Pixmap, int, int, int, int, bool, int,
78 unsigned long);
79
80int win_textwidth(const char*, unsigned int, bool);
81
82void win_set_title(win_t*, const char*);
83void win_set_bar_info(win_t*, const char*, const char*);
84void win_set_cursor(win_t*, cursor_t);
85
86#endif /* WINDOW_H */