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
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)
52 struct BlackboxHints
{
53 unsigned long flags
, attrib
, workspace
, stack
, decoration
;
56 struct BlackboxAttributes
{
57 unsigned long flags
, attrib
, workspace
, stack
, decoration
;
58 int premax_x
, premax_y
;
59 unsigned int premax_w
, premax_h
;
62 #define PropBlackboxHintsElements (5)
63 #define PropBlackboxAttributesElements (9)
72 class Blackbox
: public Openbox
, public TimeoutHandler
{
75 Cursor session
, move
, ll_angle
, lr_angle
, ul_angle
, ur_angle
;
80 Time double_click_interval
;
82 std::string style_file
;
83 int colors_per_channel
;
84 timeval auto_raise_delay
;
85 unsigned long cache_life
, cache_max
;
86 std::string titlebar_layout
;
87 unsigned int mod_mask
; // modifier mask used for window-mouse interaction
91 bool xinerama_placement
, xinerama_maximize
, xinerama_snap
;
95 typedef std::map
<Window
, BlackboxWindow
*> WindowLookup
;
96 typedef WindowLookup::value_type WindowLookupPair
;
97 WindowLookup windowSearchList
;
99 typedef std::map
<Window
, BScreen
*> WindowScreenLookup
;
100 typedef WindowScreenLookup::value_type WindowScreenLookupPair
;
101 WindowScreenLookup systraySearchList
;
103 typedef std::map
<Window
, BWindowGroup
*> GroupLookup
;
104 typedef GroupLookup::value_type GroupLookupPair
;
105 GroupLookup groupSearchList
;
107 typedef std::list
<BScreen
*> ScreenList
;
108 ScreenList screenList
;
110 BScreen
*active_screen
;
111 BlackboxWindow
*focused_window
, *changing_window
;
113 Configuration config
;
116 bool no_focus
, reconfigure_wait
;
121 Blackbox(const Blackbox
&);
122 Blackbox
& operator=(const Blackbox
&);
126 void real_reconfigure(void);
128 virtual void process_event(XEvent
*);
132 Blackbox(int argc
, char **m_argv
, char *rc
= 0);
133 virtual ~Blackbox(void);
135 BWindowGroup
*searchGroup(Window window
);
136 BScreen
*searchSystrayWindow(Window window
);
137 BlackboxWindow
*searchWindow(Window window
);
138 BScreen
*searchScreen(Window window
);
141 inline bool doXineramaPlacement(void) const
142 { return resource
.xinerama_placement
; }
143 inline bool doXineramaMaximizing(void) const
144 { return resource
.xinerama_maximize
; }
145 inline bool doXineramaSnapping(void) const
146 { return resource
.xinerama_snap
; }
148 void saveXineramaPlacement(bool x
);
149 void saveXineramaMaximizing(bool x
);
150 void saveXineramaSnapping(bool x
);
153 void saveSystrayWindowSearch(Window window
, BScreen
*screen
);
154 void saveWindowSearch(Window window
, BlackboxWindow
*data
);
155 void saveGroupSearch(Window window
, BWindowGroup
*data
);
156 void removeSystrayWindowSearch(Window window
);
157 void removeWindowSearch(Window window
);
158 void removeGroupSearch(Window window
);
160 inline XAtom
*getXAtom(void) { return xatom
; }
162 inline BlackboxWindow
*getFocusedWindow(void) { return focused_window
; }
163 inline BlackboxWindow
*getChangingWindow(void) { return changing_window
; }
165 inline Configuration
*getConfig() { return &config
; }
166 inline const Time
&getDoubleClickInterval(void) const
167 { return resource
.double_click_interval
; }
168 inline const Time
&getLastTime(void) const { return last_time
; }
170 inline const char *getStyleFilename(void) const
171 { return resource
.style_file
.c_str(); }
173 inline int getColorsPerChannel(void) const
174 { return resource
.colors_per_channel
; }
176 inline std::string
getTitlebarLayout(void) const
177 { return resource
.titlebar_layout
; }
179 inline const timeval
&getAutoRaiseDelay(void) const
180 { return resource
.auto_raise_delay
; }
182 inline unsigned long getCacheLife(void) const
183 { return resource
.cache_life
; }
184 inline unsigned long getCacheMax(void) const
185 { return resource
.cache_max
; }
187 inline void setNoFocus(bool f
) { no_focus
= f
; }
189 inline Cursor
getSessionCursor(void) const
190 { return cursor
.session
; }
191 inline Cursor
getMoveCursor(void) const
192 { return cursor
.move
; }
193 inline Cursor
getLowerLeftAngleCursor(void) const
194 { return cursor
.ll_angle
; }
195 inline Cursor
getLowerRightAngleCursor(void) const
196 { return cursor
.lr_angle
; }
197 inline Cursor
getUpperLeftAngleCursor(void) const
198 { return cursor
.ul_angle
; }
199 inline Cursor
getUpperRightAngleCursor(void) const
200 { return cursor
.ur_angle
; }
202 inline unsigned int getMouseModMask(void) const
203 { return resource
.mod_mask
; }
205 void setFocusedWindow(BlackboxWindow
*win
);
206 void setChangingWindow(BlackboxWindow
*win
);
208 void saveStyleFilename(const std::string
& filename
);
209 void restart(const char *prog
= 0);
210 void reconfigure(void);
212 bool validateWindow(Window window
);
214 virtual bool handleSignal(int sig
);
216 virtual void timeout(void);
218 enum { B_AmericanDate
= 1, B_EuropeanDate
};
223 #endif // __blackbox_hh