diff options
author | fluxgen <fluxgen> | 2001-12-11 20:47:02 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2001-12-11 20:47:02 (GMT) |
commit | 18830ac9add80cbd3bf7369307d7e35a519dca9b (patch) | |
tree | 4759a5434a34ba317fe77bbf8b0ed9bb57bb6018 /src/Screen.hh | |
parent | 1523b48bff07dead084af3064ad11c79a9b25df0 (diff) | |
download | fluxbox-18830ac9add80cbd3bf7369307d7e35a519dca9b.zip fluxbox-18830ac9add80cbd3bf7369307d7e35a519dca9b.tar.bz2 |
Initial revision
Diffstat (limited to 'src/Screen.hh')
-rw-r--r-- | src/Screen.hh | 349 |
1 files changed, 349 insertions, 0 deletions
diff --git a/src/Screen.hh b/src/Screen.hh new file mode 100644 index 0000000..8ab49d5 --- /dev/null +++ b/src/Screen.hh | |||
@@ -0,0 +1,349 @@ | |||
1 | // Screen.hh for fluxbox | ||
2 | // Copyright (c) 2001 Henrik Kinnunen (fluxgen@linuxmail.org) | ||
3 | // | ||
4 | // Screen.hh for Blackbox - an X11 Window manager | ||
5 | // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) | ||
6 | // | ||
7 | // Permission is hereby granted, free of charge, to any person obtaining a | ||
8 | // copy of this software and associated documentation files (the "Software"), | ||
9 | // to deal in the Software without restriction, including without limitation | ||
10 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
11 | // and/or sell copies of the Software, and to permit persons to whom the | ||
12 | // Software is furnished to do so, subject to the following conditions: | ||
13 | // | ||
14 | // The above copyright notice and this permission notice shall be included in | ||
15 | // all copies or substantial portions of the Software. | ||
16 | // | ||
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
20 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
23 | // DEALINGS IN THE SOFTWARE. | ||
24 | |||
25 | |||
26 | |||
27 | #ifndef __Screen_hh | ||
28 | #define __Screen_hh | ||
29 | |||
30 | #include <X11/Xlib.h> | ||
31 | #include <X11/Xresource.h> | ||
32 | |||
33 | #ifdef TIME_WITH_SYS_TIME | ||
34 | # include <sys/time.h> | ||
35 | # include <time.h> | ||
36 | #else // !TIME_WITH_SYS_TIME | ||
37 | # ifdef HAVE_SYS_TIME_H | ||
38 | # include <sys/time.h> | ||
39 | # else // !HAVE_SYS_TIME_H | ||
40 | # include <time.h> | ||
41 | # endif // HAVE_SYS_TIME_H | ||
42 | #endif // TIME_WITH_SYS_TIME | ||
43 | |||
44 | #include <stdio.h> | ||
45 | |||
46 | #include "Theme.hh" | ||
47 | |||
48 | // forward declaration | ||
49 | class BScreen; | ||
50 | #ifndef _BASEDISPLAY_HH_ | ||
51 | #include "BaseDisplay.hh" | ||
52 | #endif | ||
53 | #ifndef _CONFIGMENU_HH_ | ||
54 | #include "Configmenu.hh" | ||
55 | #endif | ||
56 | #ifndef _ICON_HH_ | ||
57 | #include "Icon.hh" | ||
58 | #endif | ||
59 | #ifndef _LINKEDLIST_HH_ | ||
60 | #include "LinkedList.hh" | ||
61 | #endif | ||
62 | #ifndef _NETIZEN_HH_ | ||
63 | #include "Netizen.hh" | ||
64 | #endif | ||
65 | #ifndef _ROOTMENU_HH_ | ||
66 | #include "Rootmenu.hh" | ||
67 | #endif | ||
68 | #ifndef _TIMER_HH_ | ||
69 | #include "Timer.hh" | ||
70 | #endif | ||
71 | #ifndef _WORKSPACE_HH_ | ||
72 | #include "Workspace.hh" | ||
73 | #endif | ||
74 | #ifndef _WORKSPACEMENU_HH_ | ||
75 | #include "Workspacemenu.hh" | ||
76 | #endif | ||
77 | #ifndef _FLUXBOX_HH_ | ||
78 | #include "fluxbox.hh" | ||
79 | #endif | ||
80 | |||
81 | #ifdef SLIT | ||
82 | # include "Slit.hh" | ||
83 | #endif // SLIT | ||
84 | |||
85 | class BScreen : public ScreenInfo { | ||
86 | public: | ||
87 | BScreen(Fluxbox *, int); | ||
88 | ~BScreen(void); | ||
89 | |||
90 | inline const Bool &isToolbarOnTop(void) const | ||
91 | { return resource.toolbar_on_top; } | ||
92 | inline const Bool &doToolbarAutoHide(void) const | ||
93 | { return resource.toolbar_auto_hide; } | ||
94 | inline const Bool &isSloppyFocus(void) const | ||
95 | { return resource.sloppy_focus; } | ||
96 | inline const Bool &isSemiSloppyFocus(void) const | ||
97 | { return resource.semi_sloppy_focus; } | ||
98 | inline const Bool &isRootColormapInstalled(void) const | ||
99 | { return root_colormap_installed; } | ||
100 | inline const Bool &isScreenManaged(void) const { return managed; } | ||
101 | inline const Bool &isTabRotateVertical(void) const | ||
102 | { return resource.tab_rotate_vertical; } | ||
103 | inline const Bool &doAutoRaise(void) const { return resource.auto_raise; } | ||
104 | inline const Bool &doImageDither(void) const | ||
105 | { return resource.image_dither; } | ||
106 | inline const Bool &doOrderedDither(void) const | ||
107 | { return resource.ordered_dither; } | ||
108 | inline const Bool &doOpaqueMove(void) const { return resource.opaque_move; } | ||
109 | inline const Bool &doFullMax(void) const { return resource.full_max; } | ||
110 | inline const Bool &doFocusNew(void) const { return resource.focus_new; } | ||
111 | inline const Bool &doFocusLast(void) const { return resource.focus_last; } | ||
112 | |||
113 | inline const GC &getOpGC() const { return theme->getOpGC(); } | ||
114 | |||
115 | inline const BColor *getBorderColor(void) { return &theme->getBorderColor(); } | ||
116 | inline BImageControl *getImageControl(void) { return image_control; } | ||
117 | inline Rootmenu *getRootmenu(void) { return rootmenu; } | ||
118 | |||
119 | #ifdef SLIT | ||
120 | inline const Bool &isSlitOnTop(void) const { return resource.slit_on_top; } | ||
121 | inline const Bool &doSlitAutoHide(void) const | ||
122 | { return resource.slit_auto_hide; } | ||
123 | inline Slit *getSlit(void) { return slit; } | ||
124 | inline const int &getSlitPlacement(void) const | ||
125 | { return resource.slit_placement; } | ||
126 | inline const int &getSlitDirection(void) const | ||
127 | { return resource.slit_direction; } | ||
128 | inline void saveSlitPlacement(int p) { resource.slit_placement = p; } | ||
129 | inline void saveSlitDirection(int d) { resource.slit_direction = d; } | ||
130 | inline void saveSlitOnTop(Bool t) { resource.slit_on_top = t; } | ||
131 | inline void saveSlitAutoHide(Bool t) { resource.slit_auto_hide = t; } | ||
132 | #endif // SLIT | ||
133 | |||
134 | inline Toolbar *getToolbar(void) { return toolbar; } | ||
135 | |||
136 | inline Workspace *getWorkspace(int w) { return workspacesList->find(w); } | ||
137 | inline Workspace *getCurrentWorkspace(void) { return current_workspace; } | ||
138 | |||
139 | inline Workspacemenu *getWorkspacemenu(void) { return workspacemenu; } | ||
140 | |||
141 | inline const unsigned int &getHandleWidth(void) const | ||
142 | { return theme->getHandleWidth(); } | ||
143 | inline const unsigned int &getBevelWidth(void) const | ||
144 | { return theme->getBevelWidth(); } | ||
145 | inline const unsigned int &getFrameWidth(void) const | ||
146 | { return theme->getFrameWidth(); } | ||
147 | inline const unsigned int &getBorderWidth(void) const | ||
148 | { return theme->getBorderWidth(); } | ||
149 | inline const unsigned int getBorderWidth2x(void) const | ||
150 | { return theme->getBorderWidth()*2; } | ||
151 | |||
152 | inline const int getCurrentWorkspaceID() | ||
153 | { return current_workspace->getWorkspaceID(); } | ||
154 | inline const int getCount(void) { return workspacesList->count(); } | ||
155 | inline const int getIconCount(void) { return iconList->count(); } | ||
156 | inline LinkedList<FluxboxWindow> *getIconList(void) { return iconList; } | ||
157 | inline const int &getNumberOfWorkspaces(void) const | ||
158 | { return resource.workspaces; } | ||
159 | inline const int &getToolbarPlacement(void) const | ||
160 | { return resource.toolbar_placement; } | ||
161 | inline const int &getToolbarWidthPercent(void) const | ||
162 | { return resource.toolbar_width_percent; } | ||
163 | inline const int &getPlacementPolicy(void) const | ||
164 | { return resource.placement_policy; } | ||
165 | inline const int &getEdgeSnapThreshold(void) const | ||
166 | { return resource.edge_snap_threshold; } | ||
167 | inline const int &getRowPlacementDirection(void) const | ||
168 | { return resource.row_direction; } | ||
169 | inline const int &getColPlacementDirection(void) const | ||
170 | { return resource.col_direction; } | ||
171 | inline const int getTabPlacement(void) | ||
172 | { return resource.tab_placement; } | ||
173 | inline const int getTabAlignment(void) | ||
174 | { return resource.tab_alignment; } | ||
175 | |||
176 | inline void setRootColormapInstalled(Bool r) { root_colormap_installed = r; } | ||
177 | inline void saveSloppyFocus(Bool s) { resource.sloppy_focus = s; } | ||
178 | inline void saveSemiSloppyFocus(Bool s) { resource.semi_sloppy_focus = s; } | ||
179 | inline void saveAutoRaise(Bool a) { resource.auto_raise = a; } | ||
180 | inline void saveWorkspaces(int w) { resource.workspaces = w; } | ||
181 | inline void saveToolbarOnTop(Bool r) { resource.toolbar_on_top = r; } | ||
182 | inline void saveToolbarAutoHide(Bool r) { resource.toolbar_auto_hide = r; } | ||
183 | inline void saveToolbarWidthPercent(int w) | ||
184 | { resource.toolbar_width_percent = w; } | ||
185 | inline void saveToolbarPlacement(int p) { resource.toolbar_placement = p; } | ||
186 | inline void savePlacementPolicy(int p) { resource.placement_policy = p; } | ||
187 | inline void saveRowPlacementDirection(int d) { resource.row_direction = d; } | ||
188 | inline void saveColPlacementDirection(int d) { resource.col_direction = d; } | ||
189 | inline void saveEdgeSnapThreshold(int t) | ||
190 | { resource.edge_snap_threshold = t; } | ||
191 | inline void saveImageDither(Bool d) { resource.image_dither = d; } | ||
192 | inline void saveOpaqueMove(Bool o) { resource.opaque_move = o; } | ||
193 | inline void saveFullMax(Bool f) { resource.full_max = f; } | ||
194 | inline void saveFocusNew(Bool f) { resource.focus_new = f; } | ||
195 | inline void saveFocusLast(Bool f) { resource.focus_last = f; } | ||
196 | inline void saveTabPlacement(unsigned int p) { resource.tab_placement = p; } | ||
197 | inline void saveTabAlignment(unsigned int a) { resource.tab_alignment = a; } | ||
198 | inline void saveTabRotateVertical(Bool r) | ||
199 | { resource.tab_rotate_vertical = r; } | ||
200 | inline void iconUpdate(void) { iconmenu->update(); } | ||
201 | inline Iconmenu *getIconmenu(void) { return iconmenu; } | ||
202 | |||
203 | |||
204 | #ifdef HAVE_STRFTIME | ||
205 | inline char *getStrftimeFormat(void) { return resource.strftime_format; } | ||
206 | void saveStrftimeFormat(char *); | ||
207 | #else // !HAVE_STRFTIME | ||
208 | inline int getDateFormat(void) { return resource.date_format; } | ||
209 | inline void saveDateFormat(int f) { resource.date_format = f; } | ||
210 | inline Bool isClock24Hour(void) { return resource.clock24hour; } | ||
211 | inline void saveClock24Hour(Bool c) { resource.clock24hour = c; } | ||
212 | #endif // HAVE_STRFTIME | ||
213 | |||
214 | inline WindowStyle *getWindowStyle(void) { return theme->getWindowStyle(); } | ||
215 | inline MenuStyle *getMenuStyle(void) { return theme->getMenuStyle(); } | ||
216 | inline ToolbarStyle *getToolbarStyle(void) { return theme->getToolbarStyle(); } | ||
217 | |||
218 | FluxboxWindow *getIcon(int); | ||
219 | |||
220 | int addWorkspace(void); | ||
221 | int removeLastWorkspace(void); | ||
222 | //scroll workspaces | ||
223 | void nextWorkspace(); | ||
224 | void prevWorkspace(); | ||
225 | |||
226 | void removeWorkspaceNames(void); | ||
227 | void updateWorkspaceNamesAtom(void); | ||
228 | |||
229 | void addWorkspaceName(char *); | ||
230 | void addNetizen(Netizen *); | ||
231 | void removeNetizen(Window); | ||
232 | void addIcon(FluxboxWindow *); | ||
233 | void removeIcon(FluxboxWindow *); | ||
234 | void getNameOfWorkspace(int, char **); | ||
235 | void changeWorkspaceID(int); | ||
236 | void raiseWindows(Window *, int); | ||
237 | void reassociateWindow(FluxboxWindow *, int, Bool); | ||
238 | void prevFocus(void); | ||
239 | void nextFocus(void); | ||
240 | void raiseFocus(void); | ||
241 | void reconfigure(void); | ||
242 | void rereadMenu(void); | ||
243 | void shutdown(void); | ||
244 | void showPosition(int, int); | ||
245 | void showGeometry(unsigned int, unsigned int); | ||
246 | void hideGeometry(void); | ||
247 | |||
248 | void updateNetizenCurrentWorkspace(void); | ||
249 | void updateNetizenWorkspaceCount(void); | ||
250 | void updateNetizenWindowFocus(void); | ||
251 | void updateNetizenWindowAdd(Window, unsigned long); | ||
252 | void updateNetizenWindowDel(Window); | ||
253 | void updateNetizenConfigNotify(XEvent *); | ||
254 | void updateNetizenWindowRaise(Window); | ||
255 | void updateNetizenWindowLower(Window); | ||
256 | |||
257 | enum { RowSmartPlacement = 1, ColSmartPlacement, CascadePlacement, LeftRight, | ||
258 | RightLeft, TopBottom, BottomTop }; | ||
259 | enum { LeftJustify = 1, RightJustify, CenterJustify }; | ||
260 | enum { RoundBullet = 1, TriangleBullet, SquareBullet, NoBullet }; | ||
261 | enum { Restart = 1, RestartOther, Exit, Shutdown, Execute, Reconfigure, | ||
262 | WindowShade, WindowIconify, WindowMaximize, WindowClose, WindowRaise, | ||
263 | WindowLower, WindowStick, WindowKill, SetStyle, WindowTab}; | ||
264 | |||
265 | private: | ||
266 | Theme *theme; | ||
267 | |||
268 | Bool root_colormap_installed, managed, geom_visible; | ||
269 | GC opGC; | ||
270 | Pixmap geom_pixmap; | ||
271 | Window geom_window; | ||
272 | |||
273 | Fluxbox *fluxbox; | ||
274 | BImageControl *image_control; | ||
275 | Configmenu *configmenu; | ||
276 | Iconmenu *iconmenu; | ||
277 | |||
278 | Rootmenu *rootmenu; | ||
279 | |||
280 | LinkedList<Rootmenu> *rootmenuList; | ||
281 | LinkedList<Netizen> *netizenList; | ||
282 | LinkedList<FluxboxWindow> *iconList; | ||
283 | |||
284 | #ifdef SLIT | ||
285 | Slit *slit; | ||
286 | #endif // SLIT | ||
287 | |||
288 | Toolbar *toolbar; | ||
289 | Workspace *current_workspace; | ||
290 | Workspacemenu *workspacemenu; | ||
291 | |||
292 | unsigned int geom_w, geom_h; | ||
293 | unsigned long event_mask; | ||
294 | |||
295 | LinkedList<char> *workspaceNames; | ||
296 | LinkedList<Workspace> *workspacesList; | ||
297 | |||
298 | struct resource { | ||
299 | // WindowStyle wstyle; | ||
300 | // ToolbarStyle tstyle; | ||
301 | // MenuStyle mstyle; | ||
302 | |||
303 | Bool toolbar_on_top, toolbar_auto_hide, sloppy_focus, auto_raise, | ||
304 | auto_edge_balance, image_dither, ordered_dither, opaque_move, full_max, | ||
305 | focus_new, focus_last, tab_rotate_vertical, semi_sloppy_focus; | ||
306 | // BColor border_color; | ||
307 | // XrmDatabase stylerc; | ||
308 | |||
309 | int workspaces, toolbar_placement, toolbar_width_percent, placement_policy, | ||
310 | edge_snap_threshold, row_direction, col_direction; | ||
311 | |||
312 | unsigned int tab_placement, tab_alignment; | ||
313 | |||
314 | #ifdef SLIT | ||
315 | Bool slit_on_top, slit_auto_hide; | ||
316 | int slit_placement, slit_direction; | ||
317 | #endif // SLIT | ||
318 | |||
319 | // unsigned int handle_width, frame_width, | ||
320 | // border_width, border_width_2x; | ||
321 | |||
322 | #ifdef HAVE_STRFTIME | ||
323 | char *strftime_format; | ||
324 | #else // !HAVE_STRFTIME | ||
325 | Bool clock24hour; | ||
326 | int date_format; | ||
327 | #endif // HAVE_STRFTIME | ||
328 | |||
329 | |||
330 | } resource; | ||
331 | |||
332 | |||
333 | protected: | ||
334 | Bool parseMenuFile(FILE *, Rootmenu *); | ||
335 | |||
336 | bool readDatabaseTexture(char *, char *, BTexture *, unsigned long); | ||
337 | bool readDatabaseColor(char *, char *, BColor *, unsigned long); | ||
338 | |||
339 | void readDatabaseFontSet(char *, char *, XFontSet *); | ||
340 | XFontSet createFontSet(char *); | ||
341 | void readDatabaseFont(char *, char *, XFontStruct **); | ||
342 | |||
343 | void InitMenu(void); | ||
344 | |||
345 | |||
346 | }; | ||
347 | |||
348 | |||
349 | #endif // __Screen_hh | ||