1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
10 #endif // HAVE_STDIO_H
12 #ifdef TIME_WITH_SYS_TIME
13 # include <sys/time.h>
15 #else // !TIME_WITH_SYS_TIME
16 # ifdef HAVE_SYS_TIME_H
17 # include <sys/time.h>
18 # else // !HAVE_SYS_TIME_H
20 # endif // HAVE_SYS_TIME_H
21 #endif // TIME_WITH_SYS_TIME
28 #include "basedisplay.hh"
29 #include "configuration.hh"
33 #define AttribShaded (1l << 0)
34 #define AttribMaxHoriz (1l << 1)
35 #define AttribMaxVert (1l << 2)
36 #define AttribOmnipresent (1l << 3)
37 #define AttribWorkspace (1l << 4)
38 #define AttribStack (1l << 5)
39 #define AttribDecoration (1l << 6)
42 #define StackNormal (1)
43 #define StackBottom (2)
46 #define DecorNormal (1)
50 struct BlackboxHints
{
51 unsigned long flags
, attrib
, workspace
, stack
, decoration
;
54 struct BlackboxAttributes
{
55 unsigned long flags
, attrib
, workspace
, stack
, decoration
;
56 int premax_x
, premax_y
;
57 unsigned int premax_w
, premax_h
;
60 #define PropBlackboxHintsElements (5)
61 #define PropBlackboxAttributesElements (9)
70 class Blackbox
: public BaseDisplay
, public TimeoutHandler
{
73 Cursor session
, move
, ll_angle
, lr_angle
, ul_angle
, ur_angle
;
78 Time double_click_interval
;
80 std::string style_file
;
81 int colors_per_channel
;
82 timeval auto_raise_delay
;
83 unsigned long cache_life
, cache_max
;
84 std::string titlebar_layout
;
85 unsigned int mod_mask
; // modifier mask used for window-mouse interaction
89 bool xinerama_placement
, xinerama_maximize
, xinerama_snap
;
93 typedef std::map
<Window
, BlackboxWindow
*> WindowLookup
;
94 typedef WindowLookup::value_type WindowLookupPair
;
95 WindowLookup windowSearchList
;
97 typedef std::map
<Window
, BScreen
*> WindowScreenLookup
;
98 typedef WindowScreenLookup::value_type WindowScreenLookupPair
;
99 WindowScreenLookup systraySearchList
;
101 typedef std::map
<Window
, BWindowGroup
*> GroupLookup
;
102 typedef GroupLookup::value_type GroupLookupPair
;
103 GroupLookup groupSearchList
;
105 typedef std::list
<BScreen
*> ScreenList
;
106 ScreenList screenList
;
108 BScreen
*active_screen
;
109 BlackboxWindow
*focused_window
, *changing_window
;
111 Configuration config
;
114 bool no_focus
, reconfigure_wait
;
119 Blackbox(const Blackbox
&);
120 Blackbox
& operator=(const Blackbox
&);
124 void real_reconfigure(void);
126 virtual void process_event(XEvent
*);
130 Blackbox(char **m_argv
, char *dpy_name
= 0, char *rc
= 0);
131 virtual ~Blackbox(void);
133 BWindowGroup
*searchGroup(Window window
);
134 BScreen
*searchSystrayWindow(Window window
);
135 BlackboxWindow
*searchWindow(Window window
);
136 BScreen
*searchScreen(Window window
);
139 inline bool doXineramaPlacement(void) const
140 { return resource
.xinerama_placement
; }
141 inline bool doXineramaMaximizing(void) const
142 { return resource
.xinerama_maximize
; }
143 inline bool doXineramaSnapping(void) const
144 { return resource
.xinerama_snap
; }
146 void saveXineramaPlacement(bool x
);
147 void saveXineramaMaximizing(bool x
);
148 void saveXineramaSnapping(bool x
);
151 void saveSystrayWindowSearch(Window window
, BScreen
*screen
);
152 void saveWindowSearch(Window window
, BlackboxWindow
*data
);
153 void saveGroupSearch(Window window
, BWindowGroup
*data
);
154 void removeSystrayWindowSearch(Window window
);
155 void removeWindowSearch(Window window
);
156 void removeGroupSearch(Window window
);
158 inline XAtom
*getXAtom(void) { return xatom
; }
160 inline BlackboxWindow
*getFocusedWindow(void) { return focused_window
; }
161 inline BlackboxWindow
*getChangingWindow(void) { return changing_window
; }
163 inline Configuration
*getConfig() { return &config
; }
164 inline const Time
&getDoubleClickInterval(void) const
165 { return resource
.double_click_interval
; }
166 inline const Time
&getLastTime(void) const { return last_time
; }
168 inline const char *getStyleFilename(void) const
169 { return resource
.style_file
.c_str(); }
171 inline int getColorsPerChannel(void) const
172 { return resource
.colors_per_channel
; }
174 inline std::string
getTitlebarLayout(void) const
175 { return resource
.titlebar_layout
; }
177 inline const timeval
&getAutoRaiseDelay(void) const
178 { return resource
.auto_raise_delay
; }
180 inline unsigned long getCacheLife(void) const
181 { return resource
.cache_life
; }
182 inline unsigned long getCacheMax(void) const
183 { return resource
.cache_max
; }
185 inline void setNoFocus(bool f
) { no_focus
= f
; }
187 inline Cursor
getSessionCursor(void) const
188 { return cursor
.session
; }
189 inline Cursor
getMoveCursor(void) const
190 { return cursor
.move
; }
191 inline Cursor
getLowerLeftAngleCursor(void) const
192 { return cursor
.ll_angle
; }
193 inline Cursor
getLowerRightAngleCursor(void) const
194 { return cursor
.lr_angle
; }
195 inline Cursor
getUpperLeftAngleCursor(void) const
196 { return cursor
.ul_angle
; }
197 inline Cursor
getUpperRightAngleCursor(void) const
198 { return cursor
.ur_angle
; }
200 inline unsigned int getMouseModMask(void) const
201 { return resource
.mod_mask
; }
203 void setFocusedWindow(BlackboxWindow
*win
);
204 void setChangingWindow(BlackboxWindow
*win
);
206 void saveStyleFilename(const std::string
& filename
);
207 void restart(const char *prog
= 0);
208 void reconfigure(void);
210 bool validateWindow(Window window
);
212 virtual bool handleSignal(int sig
);
214 virtual void timeout(void);
216 enum { B_AmericanDate
= 1, B_EuropeanDate
};
220 #endif // __blackbox_hh