1/*
2 * Copyright 2014 Olaf Seibert
3 */
4
5#ifndef _CTWM_EWMH_H
6#define _CTWM_EWMH_H
7
8/*
9 * Switch for experimental code to treat a Desktop window as a Root
10 * window for the purposes of key and button bindings.
11 * It doesn't work as nicely as I hoped though; maybe I'll get some
12 * better idea.
13 */
14/* #define EWMH_DESKTOP_ROOT */
15
16typedef enum EwmhWindowType {
17	wt_Normal,
18	wt_Desktop,
19	wt_Dock,
20} EwmhWindowType;
21
22/*
23 * The window is to reserve space at the edge of the screen.
24 */
25typedef struct EwmhStrut {
26	struct EwmhStrut *next;
27	struct TwmWindow *win;
28
29	int left;
30	int right;
31	int top;
32	int bottom;
33} EwmhStrut;
34
35#define EWMH_HAS_STRUT                  0x0001
36
37#define EWMH_STATE_MAXIMIZED_VERT       0x0010  /* for _NET_WM_STATE */
38#define EWMH_STATE_MAXIMIZED_HORZ       0x0020  /* for _NET_WM_STATE */
39#define EWMH_STATE_FULLSCREEN           0x0040  /* for _NET_WM_STATE */
40#define EWMH_STATE_SHADED               0x0080  /* for _NET_WM_STATE */
41#define EWMH_STATE_ABOVE                0x0100  /* for _NET_WM_STATE */
42#define EWMH_STATE_BELOW                0x0200  /* for _NET_WM_STATE */
43#define EWMH_STATE_ALL                  0xFFF0
44
45/*
46 * OTP priorities of the window types we recognize
47 */
48/* Initial vals for these types, if the user hasn't set something else */
49#define EWMH_PRI_DESKTOP                -8
50#define EWMH_PRI_DOCK                    4
51
52/* STATE_FULLSCREEN windows with focus get jammed here */
53#define EWMH_PRI_FULLSCREEN              6
54
55/* STATE_ABOVE/BELOW get +/- this to what they would be otherwise */
56#define EWMH_PRI_ABOVE                   2
57
58void EwmhInit(void);
59bool EwmhInitScreenEarly(ScreenInfo *scr);
60void EwmhInitScreenLate(ScreenInfo *scr);
61#ifdef VSCREEN
62void EwmhInitVirtualRoots(ScreenInfo *scr);
63#endif
64void EwmhTerminate(void);
65void EwmhSelectionClear(XSelectionClearEvent *sev);
66bool EwmhClientMessage(XClientMessageEvent *msg);
67Image *EwmhGetIcon(ScreenInfo *scr, TwmWindow *twm_win);
68int EwmhHandlePropertyNotify(XPropertyEvent *event, TwmWindow *twm_win);
69void EwmhSet_NET_WM_DESKTOP(TwmWindow *twm_win);
70void EwmhSet_NET_WM_DESKTOP_ws(TwmWindow *twm_win, WorkSpace *ws);
71int EwmhGetOccupation(TwmWindow *twm_win);
72void EwmhUnmapNotify(TwmWindow *twm_win);
73void EwmhAddClientWindow(TwmWindow *new_win);
74void EwmhDeleteClientWindow(TwmWindow *old_win);
75void EwmhSet_NET_CLIENT_LIST_STACKING(void);
76void EwmhSet_NET_ACTIVE_WINDOW(Window w);
77void EwmhGetProperties(TwmWindow *twm_win);
78int EwmhGetInitPriority(TwmWindow *twm_win);
79bool EwmhHasBorder(TwmWindow *twm_win);
80bool EwmhHasTitle(TwmWindow *twm_win);
81bool EwmhOnWindowRing(TwmWindow *twm_win);
82void EwmhSet_NET_FRAME_EXTENTS(TwmWindow *twm_win);
83void EwmhSet_NET_SHOWING_DESKTOP(int state);
84void EwmhSet_NET_WM_STATE(TwmWindow *twm_win, int changes);
85
86#endif /* _CTWM_EWMH_H */
87