diff options
Diffstat (limited to 'src/Screen.hh')
-rw-r--r-- | src/Screen.hh | 89 |
1 files changed, 37 insertions, 52 deletions
diff --git a/src/Screen.hh b/src/Screen.hh index 1155998..eaeac91 100644 --- a/src/Screen.hh +++ b/src/Screen.hh | |||
@@ -22,20 +22,21 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Screen.hh,v 1.128 2003/12/18 18:03:21 fluxgen Exp $ | 25 | // $Id: Screen.hh,v 1.129 2003/12/19 00:34:23 fluxgen Exp $ |
26 | 26 | ||
27 | #ifndef SCREEN_HH | 27 | #ifndef SCREEN_HH |
28 | #define SCREEN_HH | 28 | #define SCREEN_HH |
29 | 29 | ||
30 | #include "Resource.hh" | 30 | |
31 | #include "Subject.hh" | ||
32 | #include "MultLayers.hh" | ||
33 | #include "FbRootWindow.hh" | 31 | #include "FbRootWindow.hh" |
34 | #include "NotCopyable.hh" | ||
35 | #include "Observer.hh" | ||
36 | #include "fluxbox.hh" | ||
37 | #include "MenuTheme.hh" | 32 | #include "MenuTheme.hh" |
38 | 33 | ||
34 | #include "FbTk/Resource.hh" | ||
35 | #include "FbTk/Subject.hh" | ||
36 | #include "FbTk/MultLayers.hh" | ||
37 | #include "FbTk/NotCopyable.hh" | ||
38 | #include "FbTk/Observer.hh" | ||
39 | |||
39 | #include <X11/Xlib.h> | 40 | #include <X11/Xlib.h> |
40 | #include <X11/Xresource.h> | 41 | #include <X11/Xresource.h> |
41 | 42 | ||
@@ -45,7 +46,9 @@ | |||
45 | #include <vector> | 46 | #include <vector> |
46 | #include <fstream> | 47 | #include <fstream> |
47 | #include <memory> | 48 | #include <memory> |
49 | #include <map> | ||
48 | 50 | ||
51 | class FluxboxWindow; | ||
49 | class Netizen; | 52 | class Netizen; |
50 | class FbWinFrameTheme; | 53 | class FbWinFrameTheme; |
51 | class RootTheme; | 54 | class RootTheme; |
@@ -61,7 +64,7 @@ class ImageControl; | |||
61 | class XLayerItem; | 64 | class XLayerItem; |
62 | class FbWindow; | 65 | class FbWindow; |
63 | class Subject; | 66 | class Subject; |
64 | }; | 67 | } |
65 | 68 | ||
66 | /// Handles screen connection, screen clients and workspaces | 69 | /// Handles screen connection, screen clients and workspaces |
67 | /** | 70 | /** |
@@ -69,6 +72,14 @@ class Subject; | |||
69 | */ | 72 | */ |
70 | class BScreen : public FbTk::Observer, private FbTk::NotCopyable { | 73 | class BScreen : public FbTk::Observer, private FbTk::NotCopyable { |
71 | public: | 74 | public: |
75 | enum FocusModel { SLOPPYFOCUS=0, SEMISLOPPYFOCUS, CLICKTOFOCUS }; | ||
76 | enum FocusDir { FOCUSUP, FOCUSDOWN, FOCUSLEFT, FOCUSRIGHT }; | ||
77 | enum PlacementPolicy { ROWSMARTPLACEMENT, COLSMARTPLACEMENT, CASCADEPLACEMENT, UNDERMOUSEPLACEMENT}; | ||
78 | enum RowDirection { LEFTRIGHT, RIGHTLEFT}; | ||
79 | enum ColumnDirection { TOPBOTTOM, BOTTOMTOP}; | ||
80 | |||
81 | typedef std::vector<FluxboxWindow *> Icons; | ||
82 | typedef std::list<WinClient *> FocusedWindows; | ||
72 | typedef std::vector<Workspace *> Workspaces; | 83 | typedef std::vector<Workspace *> Workspaces; |
73 | typedef std::vector<std::string> WorkspaceNames; | 84 | typedef std::vector<std::string> WorkspaceNames; |
74 | 85 | ||
@@ -77,8 +88,8 @@ public: | |||
77 | int scrn, int number_of_layers); | 88 | int scrn, int number_of_layers); |
78 | ~BScreen(); | 89 | ~BScreen(); |
79 | 90 | ||
80 | inline bool isSloppyFocus() const { return (*resource.focus_model == Fluxbox::SLOPPYFOCUS); } | 91 | inline bool isSloppyFocus() const { return (*resource.focus_model == SLOPPYFOCUS); } |
81 | inline bool isSemiSloppyFocus() const { return (*resource.focus_model == Fluxbox::SEMISLOPPYFOCUS); } | 92 | inline bool isSemiSloppyFocus() const { return (*resource.focus_model == SEMISLOPPYFOCUS); } |
82 | inline bool isRootColormapInstalled() const { return root_colormap_installed; } | 93 | inline bool isRootColormapInstalled() const { return root_colormap_installed; } |
83 | inline bool isScreenManaged() const { return managed; } | 94 | inline bool isScreenManaged() const { return managed; } |
84 | inline bool isSloppyWindowGrouping() const { return *resource.sloppy_window_grouping; } | 95 | inline bool isSloppyWindowGrouping() const { return *resource.sloppy_window_grouping; } |
@@ -95,12 +106,12 @@ public: | |||
95 | inline bool antialias() const { return *resource.antialias; } | 106 | inline bool antialias() const { return *resource.antialias; } |
96 | 107 | ||
97 | inline FbTk::ImageControl &imageControl() { return *m_image_control.get(); } | 108 | inline FbTk::ImageControl &imageControl() { return *m_image_control.get(); } |
98 | const FbTk::Menu * const getRootmenu() const { return m_rootmenu.get(); } | 109 | const FbTk::Menu &getRootmenu() const { return *m_rootmenu.get(); } |
99 | FbTk::Menu * const getRootmenu() { return m_rootmenu.get(); } | 110 | FbTk::Menu &getRootmenu() { return *m_rootmenu.get(); } |
100 | 111 | ||
101 | inline const std::string &getRootCommand() const { return *resource.rootcommand; } | 112 | inline const std::string &getRootCommand() const { return *resource.rootcommand; } |
102 | inline const std::string &getResizeMode() const { return *resource.resizemode; } | 113 | inline const std::string &getResizeMode() const { return *resource.resizemode; } |
103 | inline Fluxbox::FocusModel getFocusModel() const { return *resource.focus_model; } | 114 | inline FocusModel getFocusModel() const { return *resource.focus_model; } |
104 | 115 | ||
105 | inline Slit *slit() { return m_slit.get(); } | 116 | inline Slit *slit() { return m_slit.get(); } |
106 | inline const Slit *slit() const { return m_slit.get(); } | 117 | inline const Slit *slit() const { return m_slit.get(); } |
@@ -109,8 +120,8 @@ public: | |||
109 | inline Workspace *currentWorkspace() { return m_current_workspace; } | 120 | inline Workspace *currentWorkspace() { return m_current_workspace; } |
110 | inline const Workspace *currentWorkspace() const { return m_current_workspace; } | 121 | inline const Workspace *currentWorkspace() const { return m_current_workspace; } |
111 | 122 | ||
112 | const FbTk::Menu *getWorkspacemenu() const { return workspacemenu.get(); } | 123 | const FbTk::Menu &getWorkspacemenu() const { return *workspacemenu.get(); } |
113 | FbTk::Menu *getWorkspacemenu() { return workspacemenu.get(); } | 124 | FbTk::Menu &getWorkspacemenu() { return *workspacemenu.get(); } |
114 | 125 | ||
115 | 126 | ||
116 | 127 | ||
@@ -127,8 +138,6 @@ public: | |||
127 | inline unsigned int width() const { return rootWindow().width(); } | 138 | inline unsigned int width() const { return rootWindow().width(); } |
128 | inline unsigned int height() const { return rootWindow().height(); } | 139 | inline unsigned int height() const { return rootWindow().height(); } |
129 | inline unsigned int screenNumber() const { return rootWindow().screenNumber(); } | 140 | inline unsigned int screenNumber() const { return rootWindow().screenNumber(); } |
130 | typedef std::vector<FluxboxWindow *> Icons; | ||
131 | typedef std::list<WinClient *> FocusedWindows; | ||
132 | 141 | ||
133 | /// @return number of workspaces | 142 | /// @return number of workspaces |
134 | inline unsigned int getCount() const { return m_workspaces_list.size(); } | 143 | inline unsigned int getCount() const { return m_workspaces_list.size(); } |
@@ -168,39 +177,22 @@ public: | |||
168 | /// @return the resource value of number of workspace | 177 | /// @return the resource value of number of workspace |
169 | inline int getNumberOfWorkspaces() const { return *resource.workspaces; } | 178 | inline int getNumberOfWorkspaces() const { return *resource.workspaces; } |
170 | 179 | ||
171 | inline int getPlacementPolicy() const { return resource.placement_policy; } | 180 | inline PlacementPolicy getPlacementPolicy() const { return *resource.placement_policy; } |
172 | inline int getEdgeSnapThreshold() const { return *resource.edge_snap_threshold; } | 181 | inline int getEdgeSnapThreshold() const { return *resource.edge_snap_threshold; } |
173 | inline int getRowPlacementDirection() const { return resource.row_direction; } | 182 | inline RowDirection getRowPlacementDirection() const { return *resource.row_direction; } |
174 | inline int getColPlacementDirection() const { return resource.col_direction; } | 183 | inline ColumnDirection getColPlacementDirection() const { return *resource.col_direction; } |
175 | 184 | ||
176 | inline void setRootColormapInstalled(bool r) { root_colormap_installed = r; } | 185 | inline void setRootColormapInstalled(bool r) { root_colormap_installed = r; } |
177 | inline void saveRootCommand(std::string rootcmd) { *resource.rootcommand = rootcmd; } | 186 | inline void saveRootCommand(std::string rootcmd) { *resource.rootcommand = rootcmd; } |
178 | inline void saveResizeMode(std::string resizem) { *resource.resizemode = resizem; } | 187 | inline void saveResizeMode(std::string resizem) { *resource.resizemode = resizem; } |
179 | inline void saveFocusModel(Fluxbox::FocusModel model) { resource.focus_model = model; } | 188 | inline void saveFocusModel(FocusModel model) { resource.focus_model = model; } |
180 | inline void saveWorkspaces(int w) { *resource.workspaces = w; } | 189 | inline void saveWorkspaces(int w) { *resource.workspaces = w; } |
181 | |||
182 | inline void savePlacementPolicy(int p) { resource.placement_policy = p; } | ||
183 | inline void saveRowPlacementDirection(int d) { resource.row_direction = d; } | ||
184 | inline void saveColPlacementDirection(int d) { resource.col_direction = d; } | ||
185 | inline void saveEdgeSnapThreshold(int t) { resource.edge_snap_threshold = t; } | 190 | inline void saveEdgeSnapThreshold(int t) { resource.edge_snap_threshold = t; } |
186 | inline void saveImageDither(bool d) { resource.image_dither = d; } | 191 | inline void saveImageDither(bool d) { resource.image_dither = d; } |
187 | 192 | ||
188 | inline void saveOpaqueMove(bool o) { resource.opaque_move = o; } | ||
189 | inline void saveFullMax(bool f) { resource.full_max = f; } | ||
190 | inline void saveFocusNew(bool f) { resource.focus_new = f; } | ||
191 | inline void saveFocusLast(bool f) { resource.focus_last = f; } | ||
192 | inline void saveSloppyWindowGrouping(bool s) { resource.sloppy_window_grouping = s; } | ||
193 | inline void saveWorkspaceWarping(bool s) { resource.workspace_warping = s; } | ||
194 | inline void saveDesktopWheeling(bool s) { resource.desktop_wheeling = s; } | ||
195 | 193 | ||
196 | void setAntialias(bool value); | ||
197 | |||
198 | inline const char *getStrftimeFormat() { return resource.strftime_format.c_str(); } | ||
199 | 194 | ||
200 | inline int getDateFormat() { return resource.date_format; } | 195 | void setAntialias(bool value); |
201 | inline void saveDateFormat(int f) { resource.date_format = f; } | ||
202 | inline bool isClock24Hour() { return resource.clock24hour; } | ||
203 | inline void saveClock24Hour(bool c) { resource.clock24hour = c; } | ||
204 | 196 | ||
205 | inline FbWinFrameTheme &winFrameTheme() { return *m_windowtheme.get(); } | 197 | inline FbWinFrameTheme &winFrameTheme() { return *m_windowtheme.get(); } |
206 | inline const FbWinFrameTheme &winFrameTheme() const { return *m_windowtheme.get(); } | 198 | inline const FbWinFrameTheme &winFrameTheme() const { return *m_windowtheme.get(); } |
@@ -213,7 +205,6 @@ public: | |||
213 | FbRootWindow &rootWindow() { return m_root_window; } | 205 | FbRootWindow &rootWindow() { return m_root_window; } |
214 | const FbRootWindow &rootWindow() const { return m_root_window; } | 206 | const FbRootWindow &rootWindow() const { return m_root_window; } |
215 | 207 | ||
216 | FluxboxWindow *getIcon(unsigned int index); | ||
217 | FbTk::MultLayers &layerManager() { return m_layermanager; } | 208 | FbTk::MultLayers &layerManager() { return m_layermanager; } |
218 | const FbTk::MultLayers &layerManager() const { return m_layermanager; } | 209 | const FbTk::MultLayers &layerManager() const { return m_layermanager; } |
219 | FbTk::ResourceManager &resourceManager() { return m_resource_manager; } | 210 | FbTk::ResourceManager &resourceManager() { return m_resource_manager; } |
@@ -255,7 +246,7 @@ public: | |||
255 | void raiseFocus(); | 246 | void raiseFocus(); |
256 | void setFocusedWindow(WinClient &winclient); | 247 | void setFocusedWindow(WinClient &winclient); |
257 | 248 | ||
258 | enum FocusDir { FOCUSUP, FOCUSDOWN, FOCUSLEFT, FOCUSRIGHT }; | 249 | |
259 | void dirFocus(FluxboxWindow &win, FocusDir dir); | 250 | void dirFocus(FluxboxWindow &win, FocusDir dir); |
260 | 251 | ||
261 | void reconfigure(); | 252 | void reconfigure(); |
@@ -334,8 +325,7 @@ public: | |||
334 | bool isShuttingdown() const { return m_shutdown; } | 325 | bool isShuttingdown() const { return m_shutdown; } |
335 | 326 | ||
336 | 327 | ||
337 | enum { ROWSMARTPLACEMENT = 1, COLSMARTPLACEMENT, CASCADEPLACEMENT, | 328 | |
338 | UNDERMOUSEPLACEMENT, LEFTRIGHT, RIGHTLEFT, TOPBOTTOM, BOTTOMTOP }; | ||
339 | 329 | ||
340 | // prevFocus/nextFocus option bits | 330 | // prevFocus/nextFocus option bits |
341 | enum { CYCLEGROUPS = 0x01, CYCLESKIPSTUCK = 0x02, CYCLESKIPSHADED = 0x04, | 331 | enum { CYCLEGROUPS = 0x01, CYCLESKIPSTUCK = 0x02, CYCLESKIPSHADED = 0x04, |
@@ -428,18 +418,13 @@ private: | |||
428 | antialias, auto_raise, click_raises; | 418 | antialias, auto_raise, click_raises; |
429 | FbTk::Resource<std::string> rootcommand; | 419 | FbTk::Resource<std::string> rootcommand; |
430 | FbTk::Resource<std::string> resizemode; | 420 | FbTk::Resource<std::string> resizemode; |
431 | FbTk::Resource<Fluxbox::FocusModel> focus_model; | 421 | FbTk::Resource<FocusModel> focus_model; |
432 | bool ordered_dither; | 422 | bool ordered_dither; |
433 | FbTk::Resource<int> workspaces, edge_snap_threshold, menu_alpha, menu_delay, menu_delay_close; | 423 | FbTk::Resource<int> workspaces, edge_snap_threshold, menu_alpha, menu_delay, menu_delay_close; |
434 | FbTk::Resource<FbTk::MenuTheme::MenuMode> menu_mode; | 424 | FbTk::Resource<FbTk::MenuTheme::MenuMode> menu_mode; |
435 | 425 | FbTk::Resource<PlacementPolicy> placement_policy; | |
436 | int placement_policy, row_direction, col_direction; | 426 | FbTk::Resource<RowDirection> row_direction; |
437 | 427 | FbTk::Resource<ColumnDirection> col_direction; | |
438 | std::string strftime_format; | ||
439 | |||
440 | bool clock24hour; | ||
441 | int date_format; | ||
442 | |||
443 | 428 | ||
444 | } resource; | 429 | } resource; |
445 | 430 | ||