1/*
2 * Copyright 1992, 2005, 2007 Stefan Monnier.
3 *
4 * $Id: otp.h,v 1.1.1.1 2021/04/11 08:36:51 nia Exp $
5 *
6 * handles all the OnTopPriority-related issues.
7 *
8 */
9
10#ifndef _CTWM_OTP_H
11#define _CTWM_OTP_H
12
13/* kind of window */
14typedef enum WinType { WinWin, IconWin } WinType;
15
16/* Flags that might alter OTP (currently only EWMH bits) */
17#ifdef EWMH
18#define OTP_AFLAG_ABOVE      (1 << 0)
19#define OTP_AFLAG_BELOW      (1 << 1)
20#define OTP_AFLAG_FULLSCREEN (1 << 2)
21#endif
22
23
24/* Wrapper functions to maintain the internal list uptodate.  */
25int ReparentWindow(Display *display, TwmWindow *twm_win,
26                   WinType wintype, Window parent, int x, int y);
27void ReparentWindowAndIcon(Display *display, TwmWindow *twm_win,
28                           Window parent, int win_x, int win_y,
29                           int icon_x, int icon_y);
30
31/* misc functions that are not specific to OTP */
32bool isTransientOf(TwmWindow *, TwmWindow *);
33bool isSmallTransientOf(TwmWindow *, TwmWindow *);
34bool isGroupLeaderOf(TwmWindow *, TwmWindow *);
35bool isGroupLeader(TwmWindow *);
36
37/* functions to "move" windows */
38void OtpRaise(TwmWindow *, WinType);
39void OtpLower(TwmWindow *, WinType);
40void OtpRaiseLower(TwmWindow *, WinType);
41void OtpTinyRaise(TwmWindow *, WinType);
42void OtpTinyLower(TwmWindow *, WinType);
43void OtpCirculateSubwindows(VirtualScreen *vs, int direction);
44void OtpHandleCirculateNotify(VirtualScreen *vs, TwmWindow *twm_win,
45                              WinType wintype, int place);
46
47/* functions to change a window's OTP value */
48void OtpSetPriority(TwmWindow *, WinType, int, int);
49void OtpChangePriority(TwmWindow *, WinType, int);
50void OtpSwitchPriority(TwmWindow *, WinType);
51void OtpToggleSwitching(TwmWindow *, WinType);
52void OtpRecomputePrefs(TwmWindow *);
53void OtpForcePlacement(TwmWindow *, int, TwmWindow *);
54
55void OtpReassignIcon(TwmWindow *twm_win, Icon *old_icon);
56void OtpFreeIcon(TwmWindow *twm_win);
57
58void OtpSetAflagMask(TwmWindow *twm_win, unsigned mask, unsigned setto);
59void OtpSetAflag(TwmWindow *twm_win, unsigned flag);
60void OtpClearAflag(TwmWindow *twm_win, unsigned flag);
61void OtpStashAflagsFirstTime(TwmWindow *twm_win);
62void OtpRestackWindow(TwmWindow *twm_win);
63
64void OtpUnfocusWindow(TwmWindow *twm_win);
65void OtpFocusWindow(TwmWindow *twm_win);
66
67/* functions to manage the preferences. The second arg specifies icon prefs */
68void OtpScrInitData(ScreenInfo *);
69name_list **OtpScrSwitchingL(ScreenInfo *, WinType);
70name_list **OtpScrPriorityL(ScreenInfo *, WinType, int);
71void OtpScrSetSwitching(ScreenInfo *, WinType, bool);
72void OtpScrSetZero(ScreenInfo *, WinType, int);
73
74/* functions to inform OTP-manager of window creation/destruction */
75void OtpAdd(TwmWindow *, WinType);
76void OtpRemove(TwmWindow *, WinType);
77
78/* Iterators.  */
79TwmWindow *OtpBottomWin(void);
80TwmWindow *OtpTopWin(void);
81TwmWindow *OtpNextWinUp(TwmWindow *);
82TwmWindow *OtpNextWinDown(TwmWindow *);
83
84/* Other access functions */
85int OtpEffectiveDisplayPriority(TwmWindow *twm_win);
86int OtpEffectivePriority(TwmWindow *twm_win);
87bool OtpIsFocusDependent(TwmWindow *twm_win);
88
89/* Other debugging functions */
90bool OtpCheckConsistency(void);
91
92#endif /* _CTWM_OTP_H */
93