aboutsummaryrefslogtreecommitdiff
path: root/src/Xinerama.hh
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/Xinerama.hh
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/Xinerama.hh')
-rw-r--r--src/Xinerama.hh18
1 files changed, 14 insertions, 4 deletions
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()->