]> Dogcows Code - chaz/openbox/blob - src/bbscreen.hh
remove the redundant _size property in OBScreen, and set the geometry root property...
[chaz/openbox] / src / bbscreen.hh
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 #ifndef __Screen_hh
3 #define __Screen_hh
4
5 extern "C" {
6 #include <X11/Xlib.h>
7
8 #ifdef TIME_WITH_SYS_TIME
9 # include <sys/time.h>
10 # include <time.h>
11 #else // !TIME_WITH_SYS_TIME
12 # ifdef HAVE_SYS_TIME_H
13 # include <sys/time.h>
14 # else // !HAVE_SYS_TIME_H
15 # include <time.h>
16 # endif // HAVE_SYS_TIME_H
17 #endif // TIME_WITH_SYS_TIME
18 }
19
20 #include <list>
21 #include <vector>
22
23 #include "otk/color.hh"
24 #include "otk/font.hh"
25 #include "otk/texture.hh"
26 #include "otk/image.hh"
27 #include "otk/strut.hh"
28 #include "otk/property.hh"
29 #include "otk/configuration.hh"
30 #include "otk/style.hh"
31 #include "timer.hh"
32 #include "workspace.hh"
33 #include "blackbox.hh"
34
35 namespace ob {
36
37 class BScreen : public otk::ScreenInfo {
38 private:
39 bool root_colormap_installed, managed, geom_visible;
40 GC opGC;
41 Pixmap geom_pixmap;
42 Window geom_window;
43
44 Blackbox *blackbox;
45 otk::BImageControl *image_control;
46 otk::Configuration *config;
47 otk::OBProperty *xatom;
48
49 BlackboxWindowList iconList, windowList;
50
51 typedef std::vector<Window> WindowList;
52 WindowList specialWindowList, desktopWindowList, systrayWindowList;
53
54 Workspace *current_workspace;
55
56 unsigned int geom_w, geom_h;
57 unsigned long event_mask;
58
59 otk::Rect usableArea;
60 #ifdef XINERAMA
61 RectList xineramaUsableArea;
62 #endif // XINERAMA
63
64 typedef std::list<otk::Strut*> StrutList;
65 StrutList strutList;
66 typedef std::vector<Workspace*> WorkspaceList;
67 WorkspaceList workspacesList;
68
69 struct screen_resource {
70 otk::Style wstyle;
71
72 bool sloppy_focus, auto_raise, auto_edge_balance, ordered_dither,
73 opaque_move, full_max, focus_new, focus_last, click_raise,
74 allow_scroll_lock, window_corner_snap, aa_fonts,
75 ignore_shaded, ignore_maximized, workspace_warping, shadow_fonts;
76
77 int snap_to_windows, snap_to_edges;
78 unsigned int snap_offset;
79
80 unsigned int workspaces;
81 int placement_policy,
82 snap_threshold, row_direction, col_direction, root_scroll,
83 resistance_size;
84
85 unsigned int resize_zones;
86
87 std::string strftime_format;
88
89 } resource;
90 std::string screenstr;
91
92 BScreen(const BScreen&);
93 BScreen& operator=(const BScreen&);
94
95 void updateWorkArea(void);
96
97 public:
98 // XXX: temporary
99 void updateNetizenWorkspaceCount();
100 void updateNetizenWindowFocus();
101
102
103 enum { WindowNoSnap = 0, WindowSnap, WindowResistance };
104 enum { RowSmartPlacement = 1, ColSmartPlacement, CascadePlacement,
105 UnderMousePlacement, ClickMousePlacement, LeftRight, RightLeft,
106 TopBottom, BottomTop, IgnoreShaded, IgnoreMaximized };
107 enum { Restart = 1, RestartOther, Exit, Shutdown, Execute, Reconfigure,
108 WindowShade, WindowIconify, WindowMaximize, WindowClose, WindowRaise,
109 WindowLower, WindowStick, WindowKill, SetStyle };
110 enum FocusModel { SloppyFocus, ClickToFocus };
111 enum RootScrollDirection { NoScroll = 0, NormalScroll, ReverseScroll };
112
113 BScreen(Blackbox *bb, unsigned int scrn);
114 ~BScreen(void);
115
116 void LoadStyle(void);
117
118 inline bool isSloppyFocus(void) const { return resource.sloppy_focus; }
119 inline bool isRootColormapInstalled(void) const
120 { return root_colormap_installed; }
121 inline bool doAutoRaise(void) const { return resource.auto_raise; }
122 inline bool doClickRaise(void) const { return resource.click_raise; }
123 inline bool isScreenManaged(void) const { return managed; }
124 inline bool doShadowFonts(void) const { return resource.shadow_fonts; }
125 inline bool doAAFonts(void) const { return resource.aa_fonts; }
126 inline bool doImageDither(void) const { return image_control->doDither(); }
127 inline bool doOrderedDither(void) const { return resource.ordered_dither; }
128 inline bool doOpaqueMove(void) const { return resource.opaque_move; }
129 inline bool doFullMax(void) const { return resource.full_max; }
130 inline bool doFocusNew(void) const { return resource.focus_new; }
131 inline bool doFocusLast(void) const { return resource.focus_last; }
132 inline int getWindowToWindowSnap(void) const
133 { return resource.snap_to_windows; }
134 inline int getWindowToEdgeSnap(void) const
135 { return resource.snap_to_edges; }
136 inline bool getWindowCornerSnap(void) const
137 { return resource.window_corner_snap; }
138 inline bool allowScrollLock(void) const { return resource.allow_scroll_lock; }
139 inline bool doWorkspaceWarping(void) const
140 { return resource.workspace_warping; }
141 inline int rootScrollDirection(void) const { return resource.root_scroll; }
142
143 inline const GC &getOpGC(void) const { return opGC; }
144
145 inline Blackbox *getBlackbox(void) { return blackbox; }
146 inline otk::BColor *getBorderColor(void) {
147 return &resource.wstyle.border_color;
148 }
149 inline otk::BImageControl *getImageControl(void) { return image_control; }
150
151 Workspace *getWorkspace(unsigned int index) const;
152
153 inline Workspace *getCurrentWorkspace(void) { return current_workspace; }
154
155 inline unsigned int getResizeZones(void) const
156 { return resource.resize_zones; }
157 inline bool getPlaceIgnoreShaded(void) const
158 { return resource.ignore_shaded; }
159 inline bool getPlaceIgnoreMaximized(void) const
160 { return resource.ignore_maximized; }
161
162 inline unsigned int getCurrentWorkspaceID(void) const
163 { return current_workspace->getID(); }
164 inline unsigned int getWorkspaceCount(void) const
165 { return workspacesList.size(); }
166 inline unsigned int getIconCount(void) const { return iconList.size(); }
167 inline unsigned int getNumberOfWorkspaces(void) const
168 { return resource.workspaces; }
169 inline int getPlacementPolicy(void) const
170 { return resource.placement_policy; }
171 inline int getSnapOffset(void) const
172 { return resource.snap_offset; }
173 inline int getSnapThreshold(void) const
174 { return resource.snap_threshold; }
175 inline int getResistanceSize(void) const
176 { return resource.resistance_size; }
177 inline int getRowPlacementDirection(void) const
178 { return resource.row_direction; }
179 inline int getColPlacementDirection(void) const
180 { return resource.col_direction; }
181
182 void changeWorkspaceCount(unsigned int new_count);
183
184 inline void setRootColormapInstalled(bool r) { root_colormap_installed = r; }
185 void saveSloppyFocus(bool s);
186 void saveAutoRaise(bool a);
187 void saveClickRaise(bool c);
188 void saveWorkspaces(unsigned int w);
189 void savePlacementPolicy(int p);
190 void saveRowPlacementDirection(int d);
191 void saveColPlacementDirection(int d);
192 void saveSnapThreshold(int t);
193 void saveSnapOffset(int o);
194 void saveResistanceSize(int s);
195 void saveImageDither(bool d);
196 void saveShadowFonts(bool f);
197 void saveAAFonts(bool f);
198 void saveOpaqueMove(bool o);
199 void saveFullMax(bool f);
200 void saveFocusNew(bool f);
201 void saveFocusLast(bool f);
202 void saveWindowToEdgeSnap(int s);
203 void saveWindowToWindowSnap(int s);
204 void saveWindowCornerSnap(bool s);
205 void saveResizeZones(unsigned int z);
206 void savePlaceIgnoreShaded(bool i);
207 void savePlaceIgnoreMaximized(bool i);
208 void saveAllowScrollLock(bool a);
209 void saveWorkspaceWarping(bool w);
210 void saveRootScrollDirection(int d);
211
212 inline const char *getStrftimeFormat(void)
213 { return resource.strftime_format.c_str(); }
214 void saveStrftimeFormat(const std::string& format);
215
216 inline otk::Style *getWindowStyle(void) { return &resource.wstyle; }
217
218 BlackboxWindow *getIcon(unsigned int index);
219
220 // allAvailableAreas should be used whenever possible instead of this function
221 // as then Xinerama will work correctly.
222 const otk::Rect& availableArea(void) const;
223 #ifdef XINERAMA
224 const RectList& allAvailableAreas(void) const;
225 #endif // XINERAMA
226 void updateAvailableArea(void);
227 void addStrut(otk::Strut *strut);
228 void removeStrut(otk::Strut *strut);
229
230 unsigned int addWorkspace(void);
231 unsigned int removeLastWorkspace(void);
232 void changeWorkspaceID(unsigned int id);
233 void saveWorkspaceNames(void);
234
235 void addSystrayWindow(Window window);
236 void removeSystrayWindow(Window window);
237
238 void addIcon(BlackboxWindow *w);
239 void removeIcon(BlackboxWindow *w);
240
241 void updateClientList(void);
242 void updateStackingList(void);
243 void manageWindow(Window w);
244 void unmanageWindow(BlackboxWindow *w, bool remap);
245 void raiseWindows(Window *workspace_stack, unsigned int num);
246 void lowerWindows(Window *workspace_stack, unsigned int num);
247 void reassociateWindow(BlackboxWindow *w, unsigned int wkspc_id,
248 bool ignore_sticky);
249 void propagateWindowName(const BlackboxWindow *bw);
250 void prevFocus(void) const;
251 void nextFocus(void) const;
252 void raiseFocus(void) const;
253 void load_rc(void);
254 void save_rc(void);
255 void reconfigure(void);
256 void toggleFocusModel(FocusModel model);
257 void shutdown(void);
258 void showPosition(int x, int y);
259 void showGeometry(unsigned int gx, unsigned int gy);
260 void hideGeometry(void);
261
262 void buttonPressEvent(const XButtonEvent *xbutton);
263 void propertyNotifyEvent(const XPropertyEvent *pe);
264 };
265
266 }
267
268 #endif // __Screen_hh
This page took 0.050813 seconds and 4 git commands to generate.