diff options
author | rathnor <rathnor> | 2003-04-16 13:43:50 (GMT) |
---|---|---|
committer | rathnor <rathnor> | 2003-04-16 13:43:50 (GMT) |
commit | 06e830812e143c6fbf6838bc222ba6171f1a64e7 (patch) | |
tree | 55d92a3624bd8047b52f1e0693658e932a0c029c | |
parent | b47337fca633bac22443b2a156a755e45971f6f0 (diff) | |
download | fluxbox-06e830812e143c6fbf6838bc222ba6171f1a64e7.zip fluxbox-06e830812e143c6fbf6838bc222ba6171f1a64e7.tar.bz2 |
fix saving of toolbar + slit layers - simon
-rw-r--r-- | src/LayerMenu.hh | 29 | ||||
-rw-r--r-- | src/Screen.hh | 5 | ||||
-rw-r--r-- | src/Slit.cc | 5 | ||||
-rw-r--r-- | src/Slit.hh | 7 | ||||
-rw-r--r-- | src/Toolbar.cc | 10 | ||||
-rw-r--r-- | src/Toolbar.hh | 7 | ||||
-rw-r--r-- | src/ToolbarHandler.hh | 4 | ||||
-rw-r--r-- | src/Window.cc | 8 |
8 files changed, 52 insertions, 23 deletions
diff --git a/src/LayerMenu.hh b/src/LayerMenu.hh index 1a48878..3eafa3f 100644 --- a/src/LayerMenu.hh +++ b/src/LayerMenu.hh | |||
@@ -20,13 +20,16 @@ | |||
20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
21 | // DEALINGS IN THE SOFTWARE. | 21 | // DEALINGS IN THE SOFTWARE. |
22 | 22 | ||
23 | // $Id: LayerMenu.hh,v 1.1 2003/02/18 22:09:02 rathnor Exp $ | 23 | // $Id: LayerMenu.hh,v 1.2 2003/04/16 13:43:41 rathnor Exp $ |
24 | 24 | ||
25 | #ifndef LAYERMENU_HH | 25 | #ifndef LAYERMENU_HH |
26 | #define LAYERMENU_HH | 26 | #define LAYERMENU_HH |
27 | 27 | ||
28 | #include "MenuItem.hh" | 28 | #include "MenuItem.hh" |
29 | #include "FbMenu.hh" | 29 | #include "FbMenu.hh" |
30 | #include "FbCommands.hh" | ||
31 | #include "RefCount.hh" | ||
32 | #include "SimpleCommand.hh" | ||
30 | 33 | ||
31 | class Fluxbox; | 34 | class Fluxbox; |
32 | 35 | ||
@@ -36,12 +39,16 @@ class Fluxbox; | |||
36 | template <typename ItemType> | 39 | template <typename ItemType> |
37 | class LayerMenuItem : public FbTk::MenuItem { | 40 | class LayerMenuItem : public FbTk::MenuItem { |
38 | public: | 41 | public: |
42 | LayerMenuItem(const char *label, ItemType *object, int layernum, | ||
43 | FbTk::RefCount<FbTk::Command> &cmd): | ||
44 | FbTk::MenuItem(label,cmd), m_object(object), m_layernum(layernum) {} | ||
39 | LayerMenuItem(const char *label, ItemType *object, int layernum): | 45 | LayerMenuItem(const char *label, ItemType *object, int layernum): |
40 | FbTk::MenuItem(label), m_object(object), m_layernum(layernum) {} | 46 | FbTk::MenuItem(label), m_object(object), m_layernum(layernum) {} |
41 | 47 | ||
42 | bool isEnabled() const { return m_object->getLayerItem().getLayerNum() != m_layernum; } ; | 48 | bool isEnabled() const { return m_object->getLayerItem().getLayerNum() != m_layernum; } ; |
43 | void click(int button, int time) { | 49 | void click(int button, int time) { |
44 | m_object->moveToLayer(m_layernum); | 50 | m_object->moveToLayer(m_layernum); |
51 | FbTk::MenuItem::click(button, time); | ||
45 | } | 52 | } |
46 | 53 | ||
47 | private: | 54 | private: |
@@ -55,7 +62,7 @@ template <typename ItemType> | |||
55 | class LayerMenu : public FbMenu { | 62 | class LayerMenu : public FbMenu { |
56 | public: | 63 | public: |
57 | LayerMenu(FbTk::MenuTheme &tm, int screen_num, FbTk::ImageControl &imgctrl, | 64 | LayerMenu(FbTk::MenuTheme &tm, int screen_num, FbTk::ImageControl &imgctrl, |
58 | FbTk::XLayer &layer, ItemType *item); | 65 | FbTk::XLayer &layer, ItemType *item, bool save_rc); |
59 | 66 | ||
60 | private: | 67 | private: |
61 | ItemType *m_object; | 68 | ItemType *m_object; |
@@ -64,7 +71,7 @@ private: | |||
64 | 71 | ||
65 | template <typename ItemType> | 72 | template <typename ItemType> |
66 | LayerMenu<ItemType>::LayerMenu(FbTk::MenuTheme &tm, int screen_num, FbTk::ImageControl &imgctrl, | 73 | LayerMenu<ItemType>::LayerMenu(FbTk::MenuTheme &tm, int screen_num, FbTk::ImageControl &imgctrl, |
67 | FbTk::XLayer &layer, ItemType *item): | 74 | FbTk::XLayer &layer, ItemType *item, bool save_rc): |
68 | FbMenu(tm, screen_num, imgctrl, layer), | 75 | FbMenu(tm, screen_num, imgctrl, layer), |
69 | m_object(item) | 76 | m_object(item) |
70 | { | 77 | { |
@@ -86,11 +93,21 @@ LayerMenu<ItemType>::LayerMenu(FbTk::MenuTheme &tm, int screen_num, FbTk::ImageC | |||
86 | {0, 0, "Desktop", fluxbox->getDesktopLayer()}, | 93 | {0, 0, "Desktop", fluxbox->getDesktopLayer()}, |
87 | }; | 94 | }; |
88 | 95 | ||
96 | FbTk::RefCount<FbTk::Command> saverc_cmd(new FbTk::SimpleCommand<Fluxbox>( | ||
97 | *Fluxbox::instance(), | ||
98 | &Fluxbox::save_rc)); | ||
99 | |||
89 | for (size_t i=0; i < 6; ++i) { | 100 | for (size_t i=0; i < 6; ++i) { |
90 | // TODO: fetch nls string | 101 | // TODO: fetch nls string |
91 | insert(new LayerMenuItem<ItemType>( | 102 | if (save_rc) { |
92 | layer_menuitems[i].default_str, | 103 | insert(new LayerMenuItem<ItemType>( |
93 | m_object, layer_menuitems[i].layernum)); | 104 | layer_menuitems[i].default_str, |
105 | m_object, layer_menuitems[i].layernum, saverc_cmd)); | ||
106 | } else { | ||
107 | insert(new LayerMenuItem<ItemType>( | ||
108 | layer_menuitems[i].default_str, | ||
109 | m_object, layer_menuitems[i].layernum)); | ||
110 | } | ||
94 | } | 111 | } |
95 | update(); | 112 | update(); |
96 | } | 113 | } |
diff --git a/src/Screen.hh b/src/Screen.hh index e0d2398..33fa03c 100644 --- a/src/Screen.hh +++ b/src/Screen.hh | |||
@@ -22,7 +22,7 @@ | |||
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.77 2003/04/16 00:36:09 fluxgen Exp $ | 25 | // $Id: Screen.hh,v 1.78 2003/04/16 13:43:42 rathnor Exp $ |
26 | 26 | ||
27 | #ifndef SCREEN_HH | 27 | #ifndef SCREEN_HH |
28 | #define SCREEN_HH | 28 | #define SCREEN_HH |
@@ -36,7 +36,6 @@ | |||
36 | #include "MultLayers.hh" | 36 | #include "MultLayers.hh" |
37 | #include "XLayerItem.hh" | 37 | #include "XLayerItem.hh" |
38 | #include "ToolbarHandler.hh" | 38 | #include "ToolbarHandler.hh" |
39 | #include "fluxbox.hh" | ||
40 | 39 | ||
41 | #include <X11/Xlib.h> | 40 | #include <X11/Xlib.h> |
42 | #include <X11/Xresource.h> | 41 | #include <X11/Xresource.h> |
@@ -206,6 +205,8 @@ public: | |||
206 | inline void saveToolbarMode(ToolbarHandler::ToolbarMode m) { *resource.toolbar_mode = m; } | 205 | inline void saveToolbarMode(ToolbarHandler::ToolbarMode m) { *resource.toolbar_mode = m; } |
207 | inline void saveToolbarPlacement(Toolbar::Placement place) { *resource.toolbar_placement = place; } | 206 | inline void saveToolbarPlacement(Toolbar::Placement place) { *resource.toolbar_placement = place; } |
208 | inline void saveToolbarOnHead(int head) { *resource.toolbar_on_head = head; } | 207 | inline void saveToolbarOnHead(int head) { *resource.toolbar_on_head = head; } |
208 | inline void saveToolbarLayer(Fluxbox::Layer layer) { *resource.toolbar_layernum = layer; } | ||
209 | inline void saveSlitLayer(Fluxbox::Layer layer) { *resource.slit_layernum = layer; } | ||
209 | 210 | ||
210 | inline void savePlacementPolicy(int p) { resource.placement_policy = p; } | 211 | inline void savePlacementPolicy(int p) { resource.placement_policy = p; } |
211 | inline void saveRowPlacementDirection(int d) { resource.row_direction = d; } | 212 | inline void saveRowPlacementDirection(int d) { resource.row_direction = d; } |
diff --git a/src/Slit.cc b/src/Slit.cc index 5c69298..bb910f7 100644 --- a/src/Slit.cc +++ b/src/Slit.cc | |||
@@ -22,7 +22,7 @@ | |||
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: Slit.cc,v 1.38 2003/04/14 14:53:12 fluxgen Exp $ | 25 | // $Id: Slit.cc,v 1.39 2003/04/16 13:43:43 rathnor Exp $ |
26 | 26 | ||
27 | #include "Slit.hh" | 27 | #include "Slit.hh" |
28 | 28 | ||
@@ -254,7 +254,8 @@ Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename) | |||
254 | scr.getScreenNumber(), | 254 | scr.getScreenNumber(), |
255 | *scr.getImageControl(), | 255 | *scr.getImageControl(), |
256 | *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), | 256 | *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), |
257 | this)); | 257 | this, |
258 | true)); | ||
258 | 259 | ||
259 | // default placement and direction | 260 | // default placement and direction |
260 | m_direction = HORIZONTAL; | 261 | m_direction = HORIZONTAL; |
diff --git a/src/Slit.hh b/src/Slit.hh index 5bb6aa9..fec338d 100644 --- a/src/Slit.hh +++ b/src/Slit.hh | |||
@@ -22,7 +22,7 @@ | |||
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: Slit.hh,v 1.20 2003/02/20 16:38:17 fluxgen Exp $ | 25 | /// $Id: Slit.hh,v 1.21 2003/04/16 13:43:44 rathnor Exp $ |
26 | 26 | ||
27 | #ifndef SLIT_HH | 27 | #ifndef SLIT_HH |
28 | #define SLIT_HH | 28 | #define SLIT_HH |
@@ -32,6 +32,8 @@ | |||
32 | #include "Timer.hh" | 32 | #include "Timer.hh" |
33 | #include "XLayerItem.hh" | 33 | #include "XLayerItem.hh" |
34 | #include "LayerMenu.hh" | 34 | #include "LayerMenu.hh" |
35 | #include "fluxbox.hh" | ||
36 | #include "Screen.hh" | ||
35 | 37 | ||
36 | #include <X11/Xlib.h> | 38 | #include <X11/Xlib.h> |
37 | #include <X11/Xutil.h> | 39 | #include <X11/Xutil.h> |
@@ -40,7 +42,6 @@ | |||
40 | #include <string> | 42 | #include <string> |
41 | #include <memory> | 43 | #include <memory> |
42 | 44 | ||
43 | class BScreen; | ||
44 | class SlitClient; | 45 | class SlitClient; |
45 | 46 | ||
46 | /// Handles dock apps | 47 | /// Handles dock apps |
@@ -102,7 +103,7 @@ public: | |||
102 | void configureRequestEvent(XConfigureRequestEvent &event); | 103 | void configureRequestEvent(XConfigureRequestEvent &event); |
103 | //@} | 104 | //@} |
104 | 105 | ||
105 | void moveToLayer(int layernum) { m_layeritem->moveToLayer(layernum); } | 106 | void moveToLayer(int layernum) { m_layeritem->moveToLayer(layernum); m_screen.saveSlitLayer((Fluxbox::Layer) layernum); } |
106 | FbTk::XLayerItem &getLayerItem() { return *m_layeritem; } | 107 | FbTk::XLayerItem &getLayerItem() { return *m_layeritem; } |
107 | 108 | ||
108 | virtual void timeout(); | 109 | virtual void timeout(); |
diff --git a/src/Toolbar.cc b/src/Toolbar.cc index 3efcabd..6471804 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.cc | |||
@@ -22,7 +22,7 @@ | |||
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: Toolbar.cc,v 1.71 2003/04/16 12:53:14 fluxgen Exp $ | 25 | // $Id: Toolbar.cc,v 1.72 2003/04/16 13:43:44 rathnor Exp $ |
26 | 26 | ||
27 | #include "Toolbar.hh" | 27 | #include "Toolbar.hh" |
28 | 28 | ||
@@ -256,7 +256,8 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, FbTk::Menu &menu, size_t wi | |||
256 | scrn.getScreenNumber(), | 256 | scrn.getScreenNumber(), |
257 | *scrn.getImageControl(), | 257 | *scrn.getImageControl(), |
258 | *scrn.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), | 258 | *scrn.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), |
259 | this), | 259 | this, |
260 | true), | ||
260 | m_theme(scrn.getScreenNumber()), | 261 | m_theme(scrn.getScreenNumber()), |
261 | m_place(BOTTOMCENTER), | 262 | m_place(BOTTOMCENTER), |
262 | m_themelistener(*this), | 263 | m_themelistener(*this), |
@@ -1193,3 +1194,8 @@ void Toolbar::HideHandler::timeout() { | |||
1193 | toolbar->frame.window.move(toolbar->frame.x, toolbar->frame.y); | 1194 | toolbar->frame.window.move(toolbar->frame.x, toolbar->frame.y); |
1194 | } | 1195 | } |
1195 | } | 1196 | } |
1197 | |||
1198 | void Toolbar::moveToLayer(int layernum) { | ||
1199 | m_layeritem.moveToLayer(layernum); | ||
1200 | m_screen.saveToolbarLayer((Fluxbox::Layer) layernum); | ||
1201 | } | ||
diff --git a/src/Toolbar.hh b/src/Toolbar.hh index 9ed481b..8905655 100644 --- a/src/Toolbar.hh +++ b/src/Toolbar.hh | |||
@@ -22,7 +22,7 @@ | |||
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: Toolbar.hh,v 1.26 2003/03/03 21:51:08 rathnor Exp $ | 25 | // $Id: Toolbar.hh,v 1.27 2003/04/16 13:43:48 rathnor Exp $ |
26 | 26 | ||
27 | #ifndef TOOLBAR_HH | 27 | #ifndef TOOLBAR_HH |
28 | #define TOOLBAR_HH | 28 | #define TOOLBAR_HH |
@@ -37,10 +37,11 @@ | |||
37 | #include "XLayer.hh" | 37 | #include "XLayer.hh" |
38 | #include "XLayerItem.hh" | 38 | #include "XLayerItem.hh" |
39 | #include "LayerMenu.hh" | 39 | #include "LayerMenu.hh" |
40 | #include "fluxbox.hh" | ||
40 | 41 | ||
41 | #include <memory> | 42 | #include <memory> |
42 | 43 | ||
43 | 44 | class BScreen; | |
44 | namespace FbTk { | 45 | namespace FbTk { |
45 | class ImageControl; | 46 | class ImageControl; |
46 | }; | 47 | }; |
@@ -86,7 +87,7 @@ public: | |||
86 | inline FbTk::Menu &layermenu() { return m_layermenu; } | 87 | inline FbTk::Menu &layermenu() { return m_layermenu; } |
87 | inline const FbTk::Menu &layermenu() const { return m_layermenu; } | 88 | inline const FbTk::Menu &layermenu() const { return m_layermenu; } |
88 | 89 | ||
89 | void moveToLayer(int layernum) { m_layeritem.moveToLayer(layernum); } | 90 | void moveToLayer(int layernum); |
90 | 91 | ||
91 | FbTk::XLayerItem &getLayerItem() { return m_layeritem; } | 92 | FbTk::XLayerItem &getLayerItem() { return m_layeritem; } |
92 | 93 | ||
diff --git a/src/ToolbarHandler.hh b/src/ToolbarHandler.hh index 6e5f450..1f084ba 100644 --- a/src/ToolbarHandler.hh +++ b/src/ToolbarHandler.hh | |||
@@ -20,7 +20,7 @@ | |||
20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
21 | // DEALINGS IN THE SOFTWARE. | 21 | // DEALINGS IN THE SOFTWARE. |
22 | 22 | ||
23 | // $Id: ToolbarHandler.hh,v 1.1 2003/03/03 21:51:09 rathnor Exp $ | 23 | // $Id: ToolbarHandler.hh,v 1.2 2003/04/16 13:43:49 rathnor Exp $ |
24 | 24 | ||
25 | #ifndef TOOLBARHANDLER_HH | 25 | #ifndef TOOLBARHANDLER_HH |
26 | #define TOOLBARHANDLER_HH | 26 | #define TOOLBARHANDLER_HH |
@@ -29,8 +29,8 @@ | |||
29 | #include "Menu.hh" | 29 | #include "Menu.hh" |
30 | #include "Toolbar.hh" | 30 | #include "Toolbar.hh" |
31 | 31 | ||
32 | class FluxboxWindow; | ||
33 | class BScreen; | 32 | class BScreen; |
33 | class FluxboxWindow; | ||
34 | 34 | ||
35 | class ToolbarHandler : public AtomHandler { | 35 | class ToolbarHandler : public AtomHandler { |
36 | public: | 36 | public: |
diff --git a/src/Window.cc b/src/Window.cc index a2a9d02..fd070f9 100644 --- a/src/Window.cc +++ b/src/Window.cc | |||
@@ -22,7 +22,7 @@ | |||
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: Window.cc,v 1.140 2003/04/16 12:27:49 fluxgen Exp $ | 25 | // $Id: Window.cc,v 1.141 2003/04/16 13:43:50 rathnor Exp $ |
26 | 26 | ||
27 | #include "Window.hh" | 27 | #include "Window.hh" |
28 | 28 | ||
@@ -207,7 +207,8 @@ FluxboxWindow::FluxboxWindow(WinClient &client, BScreen &scr, FbWinFrameTheme &t | |||
207 | scr.getScreenNumber(), | 207 | scr.getScreenNumber(), |
208 | *scr.getImageControl(), | 208 | *scr.getImageControl(), |
209 | *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), | 209 | *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), |
210 | this), | 210 | this, |
211 | false), | ||
211 | old_decoration(DECOR_NORMAL), | 212 | old_decoration(DECOR_NORMAL), |
212 | m_client(&client), | 213 | m_client(&client), |
213 | m_frame(tm, *scr.getImageControl(), scr.getScreenNumber(), 0, 0, 100, 100), | 214 | m_frame(tm, *scr.getImageControl(), scr.getScreenNumber(), 0, 0, 100, 100), |
@@ -238,7 +239,8 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen &scr, FbWinFrameTheme &tm, | |||
238 | scr.getScreenNumber(), | 239 | scr.getScreenNumber(), |
239 | *scr.getImageControl(), | 240 | *scr.getImageControl(), |
240 | *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), | 241 | *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), |
241 | this), | 242 | this, |
243 | false), | ||
242 | old_decoration(DECOR_NORMAL), | 244 | old_decoration(DECOR_NORMAL), |
243 | m_client(new WinClient(w, *this)), | 245 | m_client(new WinClient(w, *this)), |
244 | m_frame(tm, *scr.getImageControl(), scr.getScreenNumber(), 0, 0, 100, 100), | 246 | m_frame(tm, *scr.getImageControl(), scr.getScreenNumber(), 0, 0, 100, 100), |