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
|
/** Copyright 2011-2013 Thorsten Wißmann. All rights reserved.
*
* This software is licensed under the "Simplified BSD License".
* See LICENSE for details */
#ifndef __HERBSTLUFT_EWMH_H_
#define __HERBSTLUFT_EWMH_H_
#include <X11/Xlib.h>
#include <X11/Xproto.h>
#include <X11/Xatom.h>
#include <stdbool.h>
#include <array>
#define ENUM_WITH_ALIAS(Identifier, Alias) \
Identifier, Alias = Identifier
/* actions on NetWmState */
#define _NET_WM_STATE_REMOVE 0 /* remove/unset property */
#define _NET_WM_STATE_ADD 1 /* add/set property */
#define _NET_WM_STATE_TOGGLE 2 /* toggle property */
enum {
NetSupported = 0,
NetClientList,
NetClientListStacking,
NetNumberOfDesktops,
NetCurrentDesktop,
NetDesktopNames,
NetWmDesktop,
NetDesktopViewport,
NetActiveWindow,
NetWmName,
NetSupportingWmCheck,
NetWmWindowType,
NetWmState,
NetWmWindowOpacity,
NetMoveresizeWindow,
NetWmMoveresize,
NetFrameExtents,
/* window states */
NetWmStateFullscreen,
NetWmStateDemandsAttention,
/* window types */
ENUM_WITH_ALIAS(NetWmWindowTypeDesktop, NetWmWindowTypeFIRST),
NetWmWindowTypeDock,
NetWmWindowTypeToolbar,
NetWmWindowTypeMenu,
NetWmWindowTypeUtility,
NetWmWindowTypeSplash,
NetWmWindowTypeDialog,
NetWmWindowTypeDropdownMenu,
NetWmWindowTypePopupMenu,
NetWmWindowTypeTooltip,
NetWmWindowTypeNotification,
NetWmWindowTypeCombo,
NetWmWindowTypeDnd,
ENUM_WITH_ALIAS(NetWmWindowTypeNormal, NetWmWindowTypeLAST),
/* the count of hints */
NetCOUNT
};
// possible values for direction of a _NET_WM_MOVERESIZE client message
#define _NET_WM_MOVERESIZE_SIZE_TOPLEFT 0
#define _NET_WM_MOVERESIZE_SIZE_TOP 1
#define _NET_WM_MOVERESIZE_SIZE_TOPRIGHT 2
#define _NET_WM_MOVERESIZE_SIZE_RIGHT 3
#define _NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT 4
#define _NET_WM_MOVERESIZE_SIZE_BOTTOM 5
#define _NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT 6
#define _NET_WM_MOVERESIZE_SIZE_LEFT 7
#define _NET_WM_MOVERESIZE_MOVE 8 /* movement only */
#define _NET_WM_MOVERESIZE_SIZE_KEYBOARD 9 /* size via keyboard */
#define _NET_WM_MOVERESIZE_MOVE_KEYBOARD 10 /* move via keyboard */
#define _NET_WM_MOVERESIZE_CANCEL 11 /* cancel operation */
struct HSTag;
struct HSClient;
extern Atom g_netatom[NetCOUNT];
extern const std::array<const char*,NetCOUNT> g_netatom_names;
void ewmh_init();
void ewmh_destroy();
void ewmh_update_all();
void ewmh_add_client(Window win);
void ewmh_remove_client(Window win);
void ewmh_set_wmname(char* name);
void ewmh_update_wmname();
void ewmh_update_client_list();
void ewmh_get_original_client_list(Window** buf, unsigned long *count);
void ewmh_update_client_list_stacking();
void ewmh_update_desktops();
void ewmh_update_desktop_names();
void ewmh_update_active_window(Window win);
void ewmh_update_current_desktop();
void ewmh_update_window_state(struct HSClient* client);
void ewmh_update_frame_extents(Window win, int left, int right, int top, int bottom);
bool ewmh_is_window_state_set(Window win, Atom hint);
bool ewmh_is_fullscreen_set(Window win);
bool ewmh_is_desktop_window(Window win);
int ewmh_get_window_type(Window win); // returns an element of the NetWm-Enum
void ewmh_clear_client_properties(struct HSClient* client);
// set the desktop property of a window
void ewmh_window_update_tag(Window win, struct HSTag* tag);
void ewmh_handle_client_message(XEvent* event);
void ewmh_set_window_opacity(Window win, double opacity);
typedef enum {
// see icccm:
// http://www.x.org/releases/X11R7.7/doc/xorg-docs/icccm/icccm.html#WM_STATE_Property
WmStateWithdrawnState = 0,
WmStateNormalState = 1,
WmStateIconicState = 3,
} WmState;
void window_update_wm_state(Window win, WmState state);
#endif
|