forked from nsf/bmpanel2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xutil.h
151 lines (127 loc) · 4.06 KB
/
xutil.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#pragma once
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include <X11/cursorfont.h>
#include <X11/extensions/shape.h>
#include "config.h"
#include "util.h"
#ifdef HAVE_XINERAMA
#include <X11/extensions/Xinerama.h>
#endif
#ifdef HAVE_XRANDR
#include <X11/extensions/Xrandr.h>
#endif
enum x_atom {
XATOM_WM_STATE,
XATOM_NET_DESKTOP_NAMES,
XATOM_NET_WM_STATE,
XATOM_NET_ACTIVE_WINDOW,
XATOM_NET_CLOSE_WINDOW,
XATOM_NET_WM_NAME,
XATOM_NET_WM_ICON_NAME,
XATOM_NET_WM_VISIBLE_ICON_NAME,
XATOM_NET_WORKAREA,
XATOM_NET_WM_ICON,
XATOM_NET_WM_ICON_GEOMETRY,
XATOM_NET_WM_VISIBLE_NAME,
XATOM_NET_WM_STATE_SKIP_TASKBAR,
XATOM_NET_WM_STATE_SHADED,
XATOM_NET_WM_STATE_HIDDEN,
XATOM_NET_WM_STATE_DEMANDS_ATTENTION,
XATOM_NET_WM_DESKTOP,
XATOM_NET_MOVERESIZE_WINDOW,
XATOM_NET_WM_WINDOW_TYPE,
XATOM_NET_WM_WINDOW_TYPE_DOCK,
XATOM_NET_WM_WINDOW_TYPE_DESKTOP,
XATOM_NET_WM_STRUT,
XATOM_NET_WM_STRUT_PARTIAL,
XATOM_NET_CLIENT_LIST,
XATOM_NET_CLIENT_LIST_STACKING,
XATOM_NET_NUMBER_OF_DESKTOPS,
XATOM_NET_CURRENT_DESKTOP,
XATOM_NET_FRAME_EXTENTS,
XATOM_NET_SYSTEM_TRAY_OPCODE,
XATOM_NET_SHOWING_DESKTOP,
XATOM_UTF8_STRING,
XATOM_MOTIF_WM_HINTS,
XATOM_XROOTPMAP_ID,
XATOM_XROOTPMAP_ID2,
XATOM_XDND_AWARE,
XATOM_XDND_POSITION,
XATOM_XDND_STATUS,
XATOM_COUNT
};
struct x_monitor {
int x;
int y;
int width;
int height;
};
struct x_connection {
Display *dpy;
int screen;
int screen_width;
int screen_height;
struct x_monitor *monitors;
int monitors_n;
Visual *default_visual;
Colormap default_colormap;
int default_depth;
Visual *argb_visual;
Colormap argb_colormap;
Window root;
Pixmap root_pixmap;
Atom atoms[XATOM_COUNT];
};
void x_connect(struct x_connection *c, const char *display);
void x_disconnect(struct x_connection *c);
void x_update_monitors_info(struct x_connection *c);
/*
* default window is (ommiting 5 parameters):
* parent = c->root
* border_width = 0
* depth = c->default_depth
* class = InputOutput
* visual = c->default_visual
*/
Window x_create_default_window(struct x_connection *c,
int x, int y, unsigned int w, unsigned int h,
unsigned long valuemask, XSetWindowAttributes *attrs);
/*
* default pixmap is (ommiting 2 parameters):
* d = c->root
* depth = c->default_depth
*/
Pixmap x_create_default_pixmap(struct x_connection *c,
unsigned int w, unsigned int h);
Window x_create_default_embedder(struct x_connection *c, Window parent,
Window icon, unsigned int w, unsigned int h);
/* allocated by Xlib, should be released with XFree */
void *x_get_prop_data(struct x_connection *c, Window win, Atom prop,
Atom type, int *items);
int x_get_prop_int(struct x_connection *c, Window win, Atom at);
Window x_get_prop_window(struct x_connection *c, Window win, Atom at);
Pixmap x_get_prop_pixmap(struct x_connection *c, Window win, Atom at);
int x_get_window_desktop(struct x_connection *c, Window win);
void x_set_prop_int(struct x_connection *c, Window win, Atom type, int value);
void x_set_prop_visualid(struct x_connection *c, Window win,
Atom type, VisualID value);
void x_set_prop_atom(struct x_connection *c, Window win, Atom type, Atom at);
void x_set_prop_array(struct x_connection *c, Window win, Atom type,
const long *values, size_t len);
int x_is_window_visible_on_panel(struct x_connection *c, Window win);
int x_is_window_visible_on_screen(struct x_connection *c, Window win);
int x_is_window_iconified(struct x_connection *c, Window win);
int x_is_window_demands_attention(struct x_connection *c, Window win);
void x_realloc_window_name(struct strbuf *sb, struct x_connection *c,
Window win, Atom *atom, Atom *atype);
void x_send_netwm_message(struct x_connection *c, Window win,
Atom a, long l0, long l1, long l2, long l3, long l4);
void x_send_dnd_message(struct x_connection *c, Window win,
Atom a, long l0, long l1, long l2, long l3, long l4);
void x_update_root_pmap(struct x_connection *c);
void x_translate_coordinates(struct x_connection *c, int x, int y,
int *xout, int *yout, Window win);
void x_set_error_trap();
int x_done_error_trap();