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 "otk/timer.hh"
29 #include "otk/property.hh"
31 #include "otk/configuration.hh"
34 #define AttribShaded (1l << 0)
35 #define AttribMaxHoriz (1l << 1)
36 #define AttribMaxVert (1l << 2)
37 #define AttribOmnipresent (1l << 3)
38 #define AttribWorkspace (1l << 4)
39 #define AttribStack (1l << 5)
40 #define AttribDecoration (1l << 6)
43 #define StackNormal (1)
44 #define StackBottom (2)
47 #define DecorNormal (1)
53 struct BlackboxHints
{
54 unsigned long flags
, attrib
, workspace
, stack
, decoration
;
57 struct BlackboxAttributes
{
58 unsigned long flags
, attrib
, workspace
, stack
, decoration
;
59 int premax_x
, premax_y
;
60 unsigned int premax_w
, premax_h
;
63 #define PropBlackboxHintsElements (5)
64 #define PropBlackboxAttributesElements (9)
73 class Blackbox
: public Openbox
{
76 Cursor session
, move
, ll_angle
, lr_angle
, ul_angle
, ur_angle
;
81 Time double_click_interval
;
83 std::string style_file
;
84 int colors_per_channel
;
85 timeval auto_raise_delay
;
86 unsigned long cache_life
, cache_max
;
87 std::string titlebar_layout
;
88 unsigned int mod_mask
; // modifier mask used for window-mouse interaction
92 bool xinerama_placement
, xinerama_maximize
, xinerama_snap
;
96 typedef std::map
<Window
, BlackboxWindow
*> WindowLookup
;
97 typedef WindowLookup::value_type WindowLookupPair
;
98 WindowLookup windowSearchList
;
100 typedef std::map
<Window
, BScreen
*> WindowScreenLookup
;
101 typedef WindowScreenLookup::value_type WindowScreenLookupPair
;
102 WindowScreenLookup systraySearchList
;
104 typedef std::map
<Window
, BWindowGroup
*> GroupLookup
;
105 typedef GroupLookup::value_type GroupLookupPair
;
106 GroupLookup groupSearchList
;
108 typedef std::list
<BScreen
*> ScreenList
;
109 ScreenList screenList
;
111 BScreen
*active_screen
;
112 BlackboxWindow
*focused_window
, *changing_window
;
114 otk::Configuration config
;
115 otk::OBProperty
*xatom
;
117 bool no_focus
, reconfigure_wait
;
122 Blackbox(const Blackbox
&);
123 Blackbox
& operator=(const Blackbox
&);
127 void real_reconfigure(void);
129 virtual void process_event(XEvent
*);
133 Blackbox(int argc
, char **m_argv
, char *rc
= 0);
134 virtual ~Blackbox(void);
136 BWindowGroup
*searchGroup(Window window
);
137 BScreen
*searchSystrayWindow(Window window
);
138 BlackboxWindow
*searchWindow(Window window
);
139 BScreen
*searchScreen(Window window
);
142 inline bool doXineramaPlacement(void) const
143 { return resource
.xinerama_placement
; }
144 inline bool doXineramaMaximizing(void) const
145 { return resource
.xinerama_maximize
; }
146 inline bool doXineramaSnapping(void) const
147 { return resource
.xinerama_snap
; }
149 void saveXineramaPlacement(bool x
);
150 void saveXineramaMaximizing(bool x
);
151 void saveXineramaSnapping(bool x
);
154 void saveSystrayWindowSearch(Window window
, BScreen
*screen
);
155 void saveWindowSearch(Window window
, BlackboxWindow
*data
);
156 void saveGroupSearch(Window window
, BWindowGroup
*data
);
157 void removeSystrayWindowSearch(Window window
);
158 void removeWindowSearch(Window window
);
159 void removeGroupSearch(Window window
);
161 inline otk::OBProperty
*getXAtom(void) { return xatom
; }
163 inline BlackboxWindow
*getFocusedWindow(void) { return focused_window
; }
164 inline BlackboxWindow
*getChangingWindow(void) { return changing_window
; }
166 inline otk::Configuration
*getConfig() { return &config
; }
167 inline const Time
&getDoubleClickInterval(void) const
168 { return resource
.double_click_interval
; }
169 inline const Time
&getLastTime(void) const { return last_time
; }
171 inline const char *getStyleFilename(void) const
172 { return resource
.style_file
.c_str(); }
174 inline int getColorsPerChannel(void) const
175 { return resource
.colors_per_channel
; }
177 inline std::string
getTitlebarLayout(void) const
178 { return resource
.titlebar_layout
; }
180 inline const timeval
&getAutoRaiseDelay(void) const
181 { return resource
.auto_raise_delay
; }
183 inline unsigned long getCacheLife(void) const
184 { return resource
.cache_life
; }
185 inline unsigned long getCacheMax(void) const
186 { return resource
.cache_max
; }
188 inline void setNoFocus(bool f
) { no_focus
= f
; }
190 inline Cursor
getSessionCursor(void) const
191 { return cursor
.session
; }
192 inline Cursor
getMoveCursor(void) const
193 { return cursor
.move
; }
194 inline Cursor
getLowerLeftAngleCursor(void) const
195 { return cursor
.ll_angle
; }
196 inline Cursor
getLowerRightAngleCursor(void) const
197 { return cursor
.lr_angle
; }
198 inline Cursor
getUpperLeftAngleCursor(void) const
199 { return cursor
.ul_angle
; }
200 inline Cursor
getUpperRightAngleCursor(void) const
201 { return cursor
.ur_angle
; }
203 inline unsigned int getMouseModMask(void) const
204 { return resource
.mod_mask
; }
206 void setFocusedWindow(BlackboxWindow
*win
);
207 void setChangingWindow(BlackboxWindow
*win
);
209 void saveStyleFilename(const std::string
& filename
);
210 void restart(const char *prog
= 0);
211 void reconfigure(void);
213 bool validateWindow(Window window
);
215 virtual bool handleSignal(int sig
);
217 static void timeout(Blackbox
*t
);
219 enum { B_AmericanDate
= 1, B_EuropeanDate
};
224 #endif // __blackbox_hh