aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTomas Janousek <tomi@nomi.cz>2007-08-05 22:36:12 (GMT)
committerTomas Janousek <tomi@nomi.cz>2008-01-27 14:01:14 (GMT)
commit4faf1bf5c3fe07260b0a4c084db56b0bed12734a (patch)
tree60bf00665704a18258275d4917428006a841bcf1 /src
parentb405d36151d3a6d3074eb6bafb541a1d6228d85e (diff)
downloadfluxbox-4faf1bf5c3fe07260b0a4c084db56b0bed12734a.zip
fluxbox-4faf1bf5c3fe07260b0a4c084db56b0bed12734a.tar.bz2
"On head" menu -- reloading and refreshing bugfix.
We should reload the contents of this menu on Xinerama layout change. I switched it from FbMenu to ToggleMenu, because the selected head wasn't being updated properly. Signed-off-by: Tomas Janousek <tomi@nomi.cz>
Diffstat (limited to 'src')
-rw-r--r--src/Slit.cc12
-rw-r--r--src/Slit.hh7
-rw-r--r--src/Toolbar.cc12
-rw-r--r--src/Toolbar.hh7
-rw-r--r--src/Xinerama.hh18
5 files changed, 44 insertions, 12 deletions
diff --git a/src/Slit.cc b/src/Slit.cc
index 18c21f4..b8ff368 100644
--- a/src/Slit.cc
+++ b/src/Slit.cc
@@ -48,10 +48,6 @@
48#include "RootTheme.hh" 48#include "RootTheme.hh"
49#include "FbMenu.hh" 49#include "FbMenu.hh"
50 50
51#ifdef XINERAMA
52#include "Xinerama.hh"
53#endif // XINERAMA
54
55#include "SlitTheme.hh" 51#include "SlitTheme.hh"
56#include "SlitClient.hh" 52#include "SlitClient.hh"
57#include "Xutil.hh" 53#include "Xutil.hh"
@@ -270,6 +266,9 @@ Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename)
270 m_slitmenu(scr.menuTheme(), 266 m_slitmenu(scr.menuTheme(),
271 scr.imageControl(), 267 scr.imageControl(),
272 *scr.layerManager().getLayer(Layer::MENU)), 268 *scr.layerManager().getLayer(Layer::MENU)),
269#ifdef XINERAMA
270 m_xineramaheadmenu(0),
271#endif // XINERAMA
273 frame(scr.rootWindow()), 272 frame(scr.rootWindow()),
274 //For KDE dock applets 273 //For KDE dock applets
275 m_kwm1_dockwindow(XInternAtom(FbTk::App::instance()->display(), 274 m_kwm1_dockwindow(XInternAtom(FbTk::App::instance()->display(),
@@ -1113,6 +1112,10 @@ void Slit::exposeEvent(XExposeEvent &ev) {
1113 1112
1114void Slit::update(FbTk::Subject *subj) { 1113void Slit::update(FbTk::Subject *subj) {
1115 reconfigure(); 1114 reconfigure();
1115#ifdef XINERAMA
1116 if (subj == &m_screen.resizeSig() && m_xineramaheadmenu)
1117 m_xineramaheadmenu->reloadHeads();
1118#endif // XINERAMA
1116} 1119}
1117 1120
1118void Slit::clearWindow() { 1121void Slit::clearWindow() {
@@ -1254,6 +1257,7 @@ void Slit::setupMenu() {
1254#ifdef XINERAMA 1257#ifdef XINERAMA
1255 if (screen().hasXinerama()) { 1258 if (screen().hasXinerama()) {
1256 m_slitmenu.insert(_FB_XTEXT(Menu, OnHead, "On Head...", "Title of On Head menu"), 1259 m_slitmenu.insert(_FB_XTEXT(Menu, OnHead, "On Head...", "Title of On Head menu"),
1260 m_xineramaheadmenu =
1257 new XineramaHeadMenu<Slit>( 1261 new XineramaHeadMenu<Slit>(
1258 screen().menuTheme(), 1262 screen().menuTheme(),
1259 screen(), 1263 screen(),
diff --git a/src/Slit.hh b/src/Slit.hh
index 64ae6b4..a7f8e40 100644
--- a/src/Slit.hh
+++ b/src/Slit.hh
@@ -29,6 +29,10 @@
29#include "LayerMenu.hh" 29#include "LayerMenu.hh"
30#include "Layer.hh" 30#include "Layer.hh"
31 31
32#ifdef XINERAMA
33#include "Xinerama.hh"
34#endif // XINERAMA
35
32#include "FbTk/Menu.hh" 36#include "FbTk/Menu.hh"
33#include "FbTk/FbWindow.hh" 37#include "FbTk/FbWindow.hh"
34#include "FbTk/Timer.hh" 38#include "FbTk/Timer.hh"
@@ -144,6 +148,9 @@ private:
144 SlitClients m_client_list; 148 SlitClients m_client_list;
145 std::auto_ptr<LayerMenu> m_layermenu; 149 std::auto_ptr<LayerMenu> m_layermenu;
146 FbMenu m_clientlist_menu, m_slitmenu; 150 FbMenu m_clientlist_menu, m_slitmenu;
151#ifdef XINERAMA
152 XineramaHeadMenu<Slit> *m_xineramaheadmenu;
153#endif // XINERAMA
147 std::string m_filename; 154 std::string m_filename;
148 155
149 struct frame { 156 struct frame {
diff --git a/src/Toolbar.cc b/src/Toolbar.cc
index 2c7bde2..00cdfee 100644
--- a/src/Toolbar.cc
+++ b/src/Toolbar.cc
@@ -35,10 +35,6 @@
35#include "Screen.hh" 35#include "Screen.hh"
36#include "WindowCmd.hh" 36#include "WindowCmd.hh"
37 37
38#ifdef XINERAMA
39#include "Xinerama.hh"
40#endif // XINERAMA
41
42#include "Strut.hh" 38#include "Strut.hh"
43#include "FbTk/CommandParser.hh" 39#include "FbTk/CommandParser.hh"
44#include "Layer.hh" 40#include "Layer.hh"
@@ -216,6 +212,9 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, size_t width):
216 m_toolbarmenu(scrn.menuTheme(), 212 m_toolbarmenu(scrn.menuTheme(),
217 scrn.imageControl(), 213 scrn.imageControl(),
218 *scrn.layerManager().getLayer(Layer::MENU)), 214 *scrn.layerManager().getLayer(Layer::MENU)),
215#ifdef XINERAMA
216 m_xineramaheadmenu(0),
217#endif // XINERAMA
219 m_theme(scrn.screenNumber()), 218 m_theme(scrn.screenNumber()),
220 m_tool_factory(scrn), 219 m_tool_factory(scrn),
221 m_strut(0), 220 m_strut(0),
@@ -629,6 +628,10 @@ void Toolbar::update(FbTk::Subject *subj) {
629 else 628 else
630 reconfigure(); 629 reconfigure();
631 630
631#ifdef XINERAMA
632 if (subj == &m_screen.resizeSig() && m_xineramaheadmenu)
633 m_xineramaheadmenu->reloadHeads();
634#endif // XINERAMA
632} 635}
633 636
634void Toolbar::setPlacement(Toolbar::Placement where) { 637void Toolbar::setPlacement(Toolbar::Placement where) {
@@ -872,6 +875,7 @@ void Toolbar::setupMenus(bool skip_new_placement) {
872#ifdef XINERAMA 875#ifdef XINERAMA
873 if (screen().hasXinerama()) { 876 if (screen().hasXinerama()) {
874 menu().insert(_FB_XTEXT(Menu, OnHead, "On Head...", "Title of On Head menu"), 877 menu().insert(_FB_XTEXT(Menu, OnHead, "On Head...", "Title of On Head menu"),
878 m_xineramaheadmenu =
875 new XineramaHeadMenu<Toolbar>(screen().menuTheme(), 879 new XineramaHeadMenu<Toolbar>(screen().menuTheme(),
876 screen(), 880 screen(),
877 screen().imageControl(), 881 screen().imageControl(),
diff --git a/src/Toolbar.hh b/src/Toolbar.hh
index c528102..c295e24 100644
--- a/src/Toolbar.hh
+++ b/src/Toolbar.hh
@@ -31,6 +31,10 @@
31#include "ToolTheme.hh" 31#include "ToolTheme.hh"
32#include "Layer.hh" 32#include "Layer.hh"
33 33
34#ifdef XINERAMA
35#include "Xinerama.hh"
36#endif // XINERAMA
37
34#include "FbTk/Timer.hh" 38#include "FbTk/Timer.hh"
35#include "FbTk/Resource.hh" 39#include "FbTk/Resource.hh"
36#include "FbTk/Observer.hh" 40#include "FbTk/Observer.hh"
@@ -159,6 +163,9 @@ private:
159 FbTk::XLayerItem m_layeritem; ///< layer item, must be declared before layermenu 163 FbTk::XLayerItem m_layeritem; ///< layer item, must be declared before layermenu
160 LayerMenu m_layermenu; 164 LayerMenu m_layermenu;
161 FbMenu m_placementmenu, m_toolbarmenu; 165 FbMenu m_placementmenu, m_toolbarmenu;
166#ifdef XINERAMA
167 XineramaHeadMenu<Toolbar> *m_xineramaheadmenu;
168#endif // XINERAMA
162 169
163 170
164 // themes 171 // themes
diff --git a/src/Xinerama.hh b/src/Xinerama.hh
index f58b4f0..eab2e37 100644
--- a/src/Xinerama.hh
+++ b/src/Xinerama.hh
@@ -25,6 +25,7 @@
25 25
26#include "FbMenu.hh" 26#include "FbMenu.hh"
27#include "fluxbox.hh" 27#include "fluxbox.hh"
28#include "Screen.hh"
28 29
29#include "FbTk/RefCount.hh" 30#include "FbTk/RefCount.hh"
30#include "FbTk/SimpleCommand.hh" 31#include "FbTk/SimpleCommand.hh"
@@ -59,14 +60,16 @@ private:
59 60
60/// Create a xinerama menu 61/// Create a xinerama menu
61template <typename ItemType> 62template <typename ItemType>
62class XineramaHeadMenu : public FbMenu { 63class XineramaHeadMenu : public ToggleMenu {
63public: 64public:
64 XineramaHeadMenu(FbTk::ThemeProxy<FbTk::MenuTheme> &tm, BScreen &screen, 65 XineramaHeadMenu(FbTk::ThemeProxy<FbTk::MenuTheme> &tm, BScreen &screen,
65 FbTk::ImageControl &imgctrl, FbTk::XLayer &layer, 66 FbTk::ImageControl &imgctrl, FbTk::XLayer &layer,
66 ItemType &item, const FbTk::FbString & title = ""); 67 ItemType &item, const FbTk::FbString & title = "");
68 void reloadHeads();
67 69
68private: 70private:
69 ItemType &m_object; 71 ItemType &m_object;
72 BScreen &m_screen;
70}; 73};
71 74
72 75
@@ -75,15 +78,22 @@ XineramaHeadMenu<ItemType>::XineramaHeadMenu(
75 FbTk::ThemeProxy<FbTk::MenuTheme> &tm, BScreen &screen, 78 FbTk::ThemeProxy<FbTk::MenuTheme> &tm, BScreen &screen,
76 FbTk::ImageControl &imgctrl, FbTk::XLayer &layer, ItemType &item, 79 FbTk::ImageControl &imgctrl, FbTk::XLayer &layer, ItemType &item,
77 const FbTk::FbString & title): 80 const FbTk::FbString & title):
78 FbMenu(tm, imgctrl, layer), 81 ToggleMenu(tm, imgctrl, layer),
79 m_object(item) 82 m_object(item), m_screen(screen)
80{ 83{
81 setLabel(title); 84 setLabel(title);
85 reloadHeads();
86}
87
88template <typename ItemType>
89void XineramaHeadMenu<ItemType>::reloadHeads()
90{
91 removeAll();
82 FbTk::RefCount<FbTk::Command<void> > saverc_cmd(new FbTk::SimpleCommand<Fluxbox>( 92 FbTk::RefCount<FbTk::Command<void> > saverc_cmd(new FbTk::SimpleCommand<Fluxbox>(
83 *Fluxbox::instance(), 93 *Fluxbox::instance(),
84 &Fluxbox::save_rc)); 94 &Fluxbox::save_rc));
85 char tname[128]; 95 char tname[128];
86 for (int i=1; i <= screen.numHeads(); ++i) { 96 for (int i=1; i <= m_screen.numHeads(); ++i) {
87 // TODO: nls 97 // TODO: nls
88/* 98/*
89 sprintf(tname, I18n::instance()-> 99 sprintf(tname, I18n::instance()->