1 /*
2  * Copyright 1992, 2005, 2007 Stefan Monnier.
3  *
4  * $Id: otp.h,v 1.7 2005/04/08 16:59:17 monnier 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 */
14 typedef 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.  */
25 int ReparentWindow(Display *display, TwmWindow *twm_win,
26                    WinType wintype, Window parent, int x, int y);
27 void 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 */
32 bool isTransientOf(TwmWindow *, TwmWindow *);
33 bool isSmallTransientOf(TwmWindow *, TwmWindow *);
34 bool isGroupLeaderOf(TwmWindow *, TwmWindow *);
35 bool isGroupLeader(TwmWindow *);
36 
37 /* functions to "move" windows */
38 void OtpRaise(TwmWindow *, WinType);
39 void OtpLower(TwmWindow *, WinType);
40 void OtpRaiseLower(TwmWindow *, WinType);
41 void OtpTinyRaise(TwmWindow *, WinType);
42 void OtpTinyLower(TwmWindow *, WinType);
43 void OtpCirculateSubwindows(VirtualScreen *vs, int direction);
44 void OtpHandleCirculateNotify(VirtualScreen *vs, TwmWindow *twm_win,
45                               WinType wintype, int place);
46 
47 /* functions to change a window's OTP value */
48 void OtpSetPriority(TwmWindow *, WinType, int, int);
49 void OtpChangePriority(TwmWindow *, WinType, int);
50 void OtpSwitchPriority(TwmWindow *, WinType);
51 void OtpToggleSwitching(TwmWindow *, WinType);
52 void OtpRecomputePrefs(TwmWindow *);
53 void OtpForcePlacement(TwmWindow *, int, TwmWindow *);
54 
55 void OtpReassignIcon(TwmWindow *twm_win, Icon *old_icon);
56 void OtpFreeIcon(TwmWindow *twm_win);
57 
58 void OtpSetAflagMask(TwmWindow *twm_win, unsigned mask, unsigned setto);
59 void OtpSetAflag(TwmWindow *twm_win, unsigned flag);
60 void OtpClearAflag(TwmWindow *twm_win, unsigned flag);
61 void OtpStashAflagsFirstTime(TwmWindow *twm_win);
62 void OtpRestackWindow(TwmWindow *twm_win);
63 
64 void OtpUnfocusWindow(TwmWindow *twm_win);
65 void OtpFocusWindow(TwmWindow *twm_win);
66 
67 /* functions to manage the preferences. The second arg specifies icon prefs */
68 void OtpScrInitData(ScreenInfo *);
69 name_list **OtpScrSwitchingL(ScreenInfo *, WinType);
70 name_list **OtpScrPriorityL(ScreenInfo *, WinType, int);
71 void OtpScrSetSwitching(ScreenInfo *, WinType, bool);
72 void OtpScrSetZero(ScreenInfo *, WinType, int);
73 
74 /* functions to inform OTP-manager of window creation/destruction */
75 void OtpAdd(TwmWindow *, WinType);
76 void OtpRemove(TwmWindow *, WinType);
77 
78 /* Iterators.  */
79 TwmWindow *OtpBottomWin(void);
80 TwmWindow *OtpTopWin(void);
81 TwmWindow *OtpNextWinUp(TwmWindow *);
82 TwmWindow *OtpNextWinDown(TwmWindow *);
83 
84 /* Other access functions */
85 int OtpEffectiveDisplayPriority(TwmWindow *twm_win);
86 int OtpEffectivePriority(TwmWindow *twm_win);
87 bool OtpIsFocusDependent(TwmWindow *twm_win);
88 
89 /* Other debugging functions */
90 bool OtpCheckConsistency(void);
91 
92 #endif /* _CTWM_OTP_H */
93