1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
8 #ifdef TIME_WITH_SYS_TIME
11 #else // !TIME_WITH_SYS_TIME
12 # ifdef HAVE_SYS_TIME_H
13 # include <sys/time.h>
14 # else // !HAVE_SYS_TIME_H
16 # endif // HAVE_SYS_TIME_H
17 #endif // TIME_WITH_SYS_TIME
27 #include "workspace.hh"
28 #include "blackbox.hh"
30 class Slit
; // forward reference
35 enum TextJustify
{ LeftJustify
= 1, RightJustify
, CenterJustify
};
43 BColor l_text_focus
, l_text_unfocus
, b_pic_focus
,
45 BTexture f_focus
, f_unfocus
, t_focus
, t_unfocus
, l_focus
, l_unfocus
,
46 h_focus
, h_unfocus
, b_focus
, b_unfocus
, b_pressed
, b_pressed_focus
,
47 b_pressed_unfocus
, g_focus
, g_unfocus
;
49 PixmapMask close_button
, max_button
, icon_button
, stick_button
;
54 void doJustify(const std::string
&text
, int &start_pos
,
55 unsigned int max_length
, unsigned int modifier
) const;
58 class BScreen
: public ScreenInfo
{
60 bool root_colormap_installed
, managed
, geom_visible
;
66 BImageControl
*image_control
;
67 Configuration
*config
;
70 BlackboxWindowList iconList
, windowList
;
72 typedef std::vector
<Window
> WindowList
;
73 WindowList specialWindowList
, desktopWindowList
, systrayWindowList
;
75 Workspace
*current_workspace
;
77 unsigned int geom_w
, geom_h
;
78 unsigned long event_mask
;
82 RectList xineramaUsableArea
;
85 typedef std::list
<Strut
*> StrutList
;
87 typedef std::vector
<Workspace
*> WorkspaceList
;
88 WorkspaceList workspacesList
;
90 struct screen_resource
{
93 bool sloppy_focus
, auto_raise
, auto_edge_balance
, ordered_dither
,
94 opaque_move
, full_max
, focus_new
, focus_last
, click_raise
,
95 allow_scroll_lock
, window_corner_snap
, aa_fonts
,
96 ignore_shaded
, ignore_maximized
, workspace_warping
, shadow_fonts
;
98 int snap_to_windows
, snap_to_edges
;
99 unsigned int snap_offset
;
103 unsigned int workspaces
;
104 int placement_policy
,
105 snap_threshold
, row_direction
, col_direction
, root_scroll
,
108 unsigned int handle_width
, bevel_width
, frame_width
, border_width
,
111 std::string strftime_format
;
114 std::string screenstr
;
116 BScreen(const BScreen
&);
117 BScreen
& operator=(const BScreen
&);
119 void readDatabaseMask(const std::string
&rname
,
120 PixmapMask
&pixmapMask
,
121 const Configuration
&style
);
123 BTexture
readDatabaseTexture(const std::string
&rname
,
124 const std::string
&default_color
,
125 const Configuration
&style
,
126 bool allowNoTexture
= false);
127 BColor
readDatabaseColor(const std::string
&rname
,
128 const std::string
&default_color
,
129 const Configuration
&style
);
130 BFont
*readDatabaseFont(const std::string
&rbasename
,
131 const Configuration
&style
);
133 void LoadStyle(void);
135 void updateWorkArea(void);
139 void updateNetizenWorkspaceCount();
140 void updateNetizenWindowFocus();
143 enum { WindowNoSnap
= 0, WindowSnap
, WindowResistance
};
144 enum { RowSmartPlacement
= 1, ColSmartPlacement
, CascadePlacement
,
145 UnderMousePlacement
, ClickMousePlacement
, LeftRight
, RightLeft
,
146 TopBottom
, BottomTop
, IgnoreShaded
, IgnoreMaximized
};
147 enum { RoundBullet
= 1, TriangleBullet
, SquareBullet
, NoBullet
};
148 enum { Restart
= 1, RestartOther
, Exit
, Shutdown
, Execute
, Reconfigure
,
149 WindowShade
, WindowIconify
, WindowMaximize
, WindowClose
, WindowRaise
,
150 WindowLower
, WindowStick
, WindowKill
, SetStyle
};
151 enum FocusModel
{ SloppyFocus
, ClickToFocus
};
152 enum RootScrollDirection
{ NoScroll
= 0, NormalScroll
, ReverseScroll
};
154 BScreen(Blackbox
*bb
, unsigned int scrn
);
157 inline bool isSloppyFocus(void) const { return resource
.sloppy_focus
; }
158 inline bool isRootColormapInstalled(void) const
159 { return root_colormap_installed
; }
160 inline bool doAutoRaise(void) const { return resource
.auto_raise
; }
161 inline bool doClickRaise(void) const { return resource
.click_raise
; }
162 inline bool isScreenManaged(void) const { return managed
; }
163 inline bool doShadowFonts(void) const { return resource
.shadow_fonts
; }
164 inline bool doAAFonts(void) const { return resource
.aa_fonts
; }
165 inline bool doImageDither(void) const { return image_control
->doDither(); }
166 inline bool doOrderedDither(void) const { return resource
.ordered_dither
; }
167 inline bool doOpaqueMove(void) const { return resource
.opaque_move
; }
168 inline bool doFullMax(void) const { return resource
.full_max
; }
169 inline bool doFocusNew(void) const { return resource
.focus_new
; }
170 inline bool doFocusLast(void) const { return resource
.focus_last
; }
171 inline int getWindowToWindowSnap(void) const
172 { return resource
.snap_to_windows
; }
173 inline int getWindowToEdgeSnap(void) const
174 { return resource
.snap_to_edges
; }
175 inline bool getWindowCornerSnap(void) const
176 { return resource
.window_corner_snap
; }
177 inline bool allowScrollLock(void) const { return resource
.allow_scroll_lock
; }
178 inline bool doWorkspaceWarping(void) const
179 { return resource
.workspace_warping
; }
180 inline int rootScrollDirection(void) const { return resource
.root_scroll
; }
182 inline const GC
&getOpGC(void) const { return opGC
; }
184 inline Blackbox
*getBlackbox(void) { return blackbox
; }
185 inline BColor
*getBorderColor(void) { return &resource
.border_color
; }
186 inline BImageControl
*getImageControl(void) { return image_control
; }
188 Workspace
*getWorkspace(unsigned int index
) const;
190 inline Workspace
*getCurrentWorkspace(void) { return current_workspace
; }
192 inline unsigned int getHandleWidth(void) const
193 { return resource
.handle_width
; }
194 inline unsigned int getBevelWidth(void) const
195 { return resource
.bevel_width
; }
196 inline unsigned int getFrameWidth(void) const
197 { return resource
.frame_width
; }
198 inline unsigned int getBorderWidth(void) const
199 { return resource
.border_width
; }
200 inline unsigned int getResizeZones(void) const
201 { return resource
.resize_zones
; }
202 inline bool getPlaceIgnoreShaded(void) const
203 { return resource
.ignore_shaded
; }
204 inline bool getPlaceIgnoreMaximized(void) const
205 { return resource
.ignore_maximized
; }
207 inline unsigned int getCurrentWorkspaceID(void) const
208 { return current_workspace
->getID(); }
209 inline unsigned int getWorkspaceCount(void) const
210 { return workspacesList
.size(); }
211 inline unsigned int getIconCount(void) const { return iconList
.size(); }
212 inline unsigned int getNumberOfWorkspaces(void) const
213 { return resource
.workspaces
; }
214 inline int getPlacementPolicy(void) const
215 { return resource
.placement_policy
; }
216 inline int getSnapOffset(void) const
217 { return resource
.snap_offset
; }
218 inline int getSnapThreshold(void) const
219 { return resource
.snap_threshold
; }
220 inline int getResistanceSize(void) const
221 { return resource
.resistance_size
; }
222 inline int getRowPlacementDirection(void) const
223 { return resource
.row_direction
; }
224 inline int getColPlacementDirection(void) const
225 { return resource
.col_direction
; }
227 void changeWorkspaceCount(unsigned int new_count
);
229 inline void setRootColormapInstalled(bool r
) { root_colormap_installed
= r
; }
230 void saveSloppyFocus(bool s
);
231 void saveAutoRaise(bool a
);
232 void saveClickRaise(bool c
);
233 void saveWorkspaces(unsigned int w
);
234 void savePlacementPolicy(int p
);
235 void saveRowPlacementDirection(int d
);
236 void saveColPlacementDirection(int d
);
237 void saveSnapThreshold(int t
);
238 void saveSnapOffset(int o
);
239 void saveResistanceSize(int s
);
240 void saveImageDither(bool d
);
241 void saveShadowFonts(bool f
);
242 void saveAAFonts(bool f
);
243 void saveOpaqueMove(bool o
);
244 void saveFullMax(bool f
);
245 void saveFocusNew(bool f
);
246 void saveFocusLast(bool f
);
247 void saveWindowToEdgeSnap(int s
);
248 void saveWindowToWindowSnap(int s
);
249 void saveWindowCornerSnap(bool s
);
250 void saveResizeZones(unsigned int z
);
251 void savePlaceIgnoreShaded(bool i
);
252 void savePlaceIgnoreMaximized(bool i
);
253 void saveAllowScrollLock(bool a
);
254 void saveWorkspaceWarping(bool w
);
255 void saveRootScrollDirection(int d
);
257 inline const char *getStrftimeFormat(void)
258 { return resource
.strftime_format
.c_str(); }
259 void saveStrftimeFormat(const std::string
& format
);
261 inline WindowStyle
*getWindowStyle(void) { return &resource
.wstyle
; }
263 BlackboxWindow
*getIcon(unsigned int index
);
265 // allAvailableAreas should be used whenever possible instead of this function
266 // as then Xinerama will work correctly.
267 const Rect
& availableArea(void) const;
269 const RectList
& allAvailableAreas(void) const;
271 void updateAvailableArea(void);
272 void addStrut(Strut
*strut
);
273 void removeStrut(Strut
*strut
);
275 unsigned int addWorkspace(void);
276 unsigned int removeLastWorkspace(void);
277 void changeWorkspaceID(unsigned int id
);
278 void saveWorkspaceNames(void);
280 void addSystrayWindow(Window window
);
281 void removeSystrayWindow(Window window
);
283 void addIcon(BlackboxWindow
*w
);
284 void removeIcon(BlackboxWindow
*w
);
286 void updateClientList(void);
287 void updateStackingList(void);
288 void manageWindow(Window w
);
289 void unmanageWindow(BlackboxWindow
*w
, bool remap
);
290 void raiseWindows(Window
*workspace_stack
, unsigned int num
);
291 void lowerWindows(Window
*workspace_stack
, unsigned int num
);
292 void reassociateWindow(BlackboxWindow
*w
, unsigned int wkspc_id
,
294 void propagateWindowName(const BlackboxWindow
*bw
);
295 void prevFocus(void) const;
296 void nextFocus(void) const;
297 void raiseFocus(void) const;
300 void reconfigure(void);
301 void toggleFocusModel(FocusModel model
);
303 void showPosition(int x
, int y
);
304 void showGeometry(unsigned int gx
, unsigned int gy
);
305 void hideGeometry(void);
307 void buttonPressEvent(const XButtonEvent
*xbutton
);
308 void propertyNotifyEvent(const XPropertyEvent
*pe
);
312 #endif // __Screen_hh