aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormarkt <markt>2007-07-03 18:50:53 (GMT)
committermarkt <markt>2007-07-03 18:50:53 (GMT)
commitb70f4c144c0428324952f40939b2ada2a2d173a9 (patch)
treed0cf56fc29b4eaf58144b04d3fcc4246e1b6ad2f /src
parent86031f9c75d7dada8fd61e5a0059d54fa42ce099 (diff)
downloadfluxbox-b70f4c144c0428324952f40939b2ada2a2d173a9.zip
fluxbox-b70f4c144c0428324952f40939b2ada2a2d173a9.tar.bz2
fix updating of systemtray and kde dockapps in slit on background change
added fluxbox-remote.cc
Diffstat (limited to 'src')
-rw-r--r--src/FbTk/FbPixmap.cc15
-rw-r--r--src/FbTk/FbPixmap.hh4
-rw-r--r--src/Screen.cc33
-rw-r--r--src/Screen.hh5
-rw-r--r--src/Slit.cc8
-rw-r--r--src/SystemTray.cc1
-rw-r--r--src/fluxbox.cc2
7 files changed, 58 insertions, 10 deletions
diff --git a/src/FbTk/FbPixmap.cc b/src/FbTk/FbPixmap.cc
index 75dfe34..9143232 100644
--- a/src/FbTk/FbPixmap.cc
+++ b/src/FbTk/FbPixmap.cc
@@ -353,9 +353,10 @@ Pixmap FbPixmap::release() {
353 return ret; 353 return ret;
354} 354}
355 355
356void FbPixmap::rootwinPropertyNotify(int screen_num, Atom atom) { 356// returns whether or not the background was changed
357bool FbPixmap::rootwinPropertyNotify(int screen_num, Atom atom) {
357 if (!FbTk::Transparent::haveRender()) 358 if (!FbTk::Transparent::haveRender())
358 return; 359 return false;
359 360
360 checkAtoms(); 361 checkAtoms();
361 for (int i=0; root_prop_ids[i] != 0; ++i) { 362 for (int i=0; root_prop_ids[i] != 0; ++i) {
@@ -379,14 +380,16 @@ void FbPixmap::rootwinPropertyNotify(int screen_num, Atom atom) {
379 } 380 }
380 XFree(data); 381 XFree(data);
381 if (root_pm != None) 382 if (root_pm != None)
382 setRootPixmap(screen_num, root_pm); 383 return setRootPixmap(screen_num, root_pm);
383 } 384 }
384 break; 385 return false;
385 } 386 }
386 } 387 }
388 return false;
387} 389}
388 390
389void FbPixmap::setRootPixmap(int screen_num, Pixmap pm) { 391// returns whether or not the background was changed
392bool FbPixmap::setRootPixmap(int screen_num, Pixmap pm) {
390 if (!m_root_pixmaps) { 393 if (!m_root_pixmaps) {
391 m_root_pixmaps = new Pixmap[ScreenCount(display())]; 394 m_root_pixmaps = new Pixmap[ScreenCount(display())];
392 for (int i=0; i < ScreenCount(display()); ++i) 395 for (int i=0; i < ScreenCount(display()); ++i)
@@ -396,7 +399,9 @@ void FbPixmap::setRootPixmap(int screen_num, Pixmap pm) {
396 if (m_root_pixmaps[screen_num] != pm) { 399 if (m_root_pixmaps[screen_num] != pm) {
397 m_root_pixmaps[screen_num] = pm; 400 m_root_pixmaps[screen_num] = pm;
398 FbWindow::updatedAlphaBackground(screen_num); 401 FbWindow::updatedAlphaBackground(screen_num);
402 return true;
399 } 403 }
404 return false;
400} 405}
401 406
402Pixmap FbPixmap::getRootPixmap(int screen_num, bool force_update) { 407Pixmap FbPixmap::getRootPixmap(int screen_num, bool force_update) {
diff --git a/src/FbTk/FbPixmap.hh b/src/FbTk/FbPixmap.hh
index dab364a..acae07e 100644
--- a/src/FbTk/FbPixmap.hh
+++ b/src/FbTk/FbPixmap.hh
@@ -70,8 +70,8 @@ public:
70 inline unsigned int depth() const { return m_depth; } 70 inline unsigned int depth() const { return m_depth; }
71 71
72 static Pixmap getRootPixmap(int screen_num, bool force_update=false); 72 static Pixmap getRootPixmap(int screen_num, bool force_update=false);
73 static void setRootPixmap(int screen_num, Pixmap pm); 73 static bool setRootPixmap(int screen_num, Pixmap pm);
74 static void rootwinPropertyNotify(int screen_num, Atom atom); 74 static bool rootwinPropertyNotify(int screen_num, Atom atom);
75 75
76 void create(Drawable src, 76 void create(Drawable src,
77 unsigned int width, unsigned int height, 77 unsigned int width, unsigned int height,
diff --git a/src/Screen.cc b/src/Screen.cc
index 7648f78..68f928b 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -344,6 +344,7 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
344 m_currentworkspace_sig(*this), // current workspace signal 344 m_currentworkspace_sig(*this), // current workspace signal
345 m_reconfigure_sig(*this), // reconfigure signal 345 m_reconfigure_sig(*this), // reconfigure signal
346 m_resize_sig(*this), 346 m_resize_sig(*this),
347 m_bg_change_sig(*this),
347 m_layermanager(num_layers), 348 m_layermanager(num_layers),
348 m_windowtheme(new FbWinFrameTheme(scrn)), 349 m_windowtheme(new FbWinFrameTheme(scrn)),
349 // the order of windowtheme and winbutton theme is important 350 // the order of windowtheme and winbutton theme is important
@@ -782,6 +783,37 @@ void BScreen::update(FbTk::Subject *subj) {
782 783
783} 784}
784 785
786void BScreen::propertyNotify(Atom atom) {
787 static Atom fbcmd_atom = XInternAtom(FbTk::App::instance()->display(),
788 "_FLUXBOX_COMMAND", False);
789 if (atom == fbcmd_atom) {
790 Atom xa_ret_type;
791 int ret_format;
792 unsigned long ret_nitems, ret_bytes_after;
793 char *str;
794 if (rootWindow().property(fbcmd_atom, 0l, 64l,
795 True, XA_STRING, &xa_ret_type, &ret_format, &ret_nitems,
796 &ret_bytes_after, (unsigned char **)&str) && str) {
797
798 if (ret_bytes_after) {
799 XFree(str);
800 long len = 64 + (ret_bytes_after + 3)/4;
801 rootWindow().property(fbcmd_atom, 0l, len,
802 True, XA_STRING, &xa_ret_type, &ret_format, &ret_nitems,
803 &ret_bytes_after, (unsigned char **)&str);
804 }
805
806 FbTk::RefCount<FbTk::Command> cmd(CommandParser::instance().parseLine(str));
807 if (cmd.get())
808 cmd->execute();
809 XFree(str);
810
811 }
812 // TODO: this doesn't belong in FbPixmap
813 } else if (FbTk::FbPixmap::rootwinPropertyNotify(screenNumber(), atom))
814 m_bg_change_sig.notify();
815}
816
785void BScreen::keyPressEvent(XKeyEvent &ke) { 817void BScreen::keyPressEvent(XKeyEvent &ke) {
786 Fluxbox::instance()->keys()->doAction(ke.type, ke.state, ke.keycode); 818 Fluxbox::instance()->keys()->doAction(ke.type, ke.state, ke.keycode);
787} 819}
@@ -1353,7 +1385,6 @@ void BScreen::updateNetizenConfigNotify(XEvent &e) {
1353 1385
1354bool BScreen::isKdeDockapp(Window client) const { 1386bool BScreen::isKdeDockapp(Window client) const {
1355 //Check and see if client is KDE dock applet. 1387 //Check and see if client is KDE dock applet.
1356 //If so add to Slit
1357 bool iskdedockapp = false; 1388 bool iskdedockapp = false;
1358 Atom ajunk; 1389 Atom ajunk;
1359 int ijunk; 1390 int ijunk;
diff --git a/src/Screen.hh b/src/Screen.hh
index 7409abd..7ea6f53 100644
--- a/src/Screen.hh
+++ b/src/Screen.hh
@@ -233,11 +233,13 @@ public:
233 /// reconfigure signal 233 /// reconfigure signal
234 FbTk::Subject &reconfigureSig() { return m_reconfigure_sig; } 234 FbTk::Subject &reconfigureSig() { return m_reconfigure_sig; }
235 FbTk::Subject &resizeSig() { return m_resize_sig; } 235 FbTk::Subject &resizeSig() { return m_resize_sig; }
236 FbTk::Subject &bgChangeSig() { return m_bg_change_sig; }
236 //@} 237 //@}
237 238
238 /// called when the screen receives a signal from a subject 239 /// called when the screen receives a signal from a subject
239 void update(FbTk::Subject *subj); 240 void update(FbTk::Subject *subj);
240 241
242 void propertyNotify(Atom atom);
241 void keyPressEvent(XKeyEvent &ke); 243 void keyPressEvent(XKeyEvent &ke);
242 void keyReleaseEvent(XKeyEvent &ke); 244 void keyReleaseEvent(XKeyEvent &ke);
243 void buttonPressEvent(XButtonEvent &be); 245 void buttonPressEvent(XButtonEvent &be);
@@ -513,7 +515,8 @@ private:
513 m_workspace_area_sig, ///< workspace area changed signal 515 m_workspace_area_sig, ///< workspace area changed signal
514 m_currentworkspace_sig, ///< current workspace signal 516 m_currentworkspace_sig, ///< current workspace signal
515 m_reconfigure_sig, ///< reconfigure signal 517 m_reconfigure_sig, ///< reconfigure signal
516 m_resize_sig; ///< resize signal 518 m_resize_sig, ///< resize signal
519 m_bg_change_sig; ///< background change signal
517 520
518 FbTk::MultLayers m_layermanager; 521 FbTk::MultLayers m_layermanager;
519 522
diff --git a/src/Slit.cc b/src/Slit.cc
index 118179b..a8e95a0 100644
--- a/src/Slit.cc
+++ b/src/Slit.cc
@@ -306,6 +306,7 @@ Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename)
306 // attach to theme and root window change signal 306 // attach to theme and root window change signal
307 m_slit_theme->reconfigSig().attach(this); 307 m_slit_theme->reconfigSig().attach(this);
308 scr.resizeSig().attach(this); 308 scr.resizeSig().attach(this);
309 scr.bgChangeSig().attach(this);
309 scr.reconfigureSig().attach(this); // if alpha changed (we disablethis signal when we get theme change sig) 310 scr.reconfigureSig().attach(this); // if alpha changed (we disablethis signal when we get theme change sig)
310 311
311 scr.addConfigMenu(_FB_XTEXT(Slit, Slit, "Slit", "The Slit"), m_slitmenu); 312 scr.addConfigMenu(_FB_XTEXT(Slit, Slit, "Slit", "The Slit"), m_slitmenu);
@@ -662,6 +663,13 @@ void Slit::reconfigure() {
662 // client created window? 663 // client created window?
663 if ((*client_it)->window() != None && (*client_it)->visible()) { 664 if ((*client_it)->window() != None && (*client_it)->visible()) {
664 num_windows++; 665 num_windows++;
666
667 // get the dockapps to update their backgrounds
668 if (screen().isKdeDockapp((*client_it)->window())) {
669 (*client_it)->hide();
670 (*client_it)->show();
671 }
672
665 if (height_inc) { 673 if (height_inc) {
666 // increase height of slit for each client (VERTICAL mode) 674 // increase height of slit for each client (VERTICAL mode)
667 frame.height += (*client_it)->height() + bevel_width; 675 frame.height += (*client_it)->height() + bevel_width;
diff --git a/src/SystemTray.cc b/src/SystemTray.cc
index 04e77fa..fdccda0 100644
--- a/src/SystemTray.cc
+++ b/src/SystemTray.cc
@@ -136,6 +136,7 @@ SystemTray::SystemTray(const FbTk::FbWindow& parent, ButtonTheme& theme, BScreen
136 136
137 FbTk::EventManager::instance()->add(*this, m_window); 137 FbTk::EventManager::instance()->add(*this, m_window);
138 m_theme.reconfigSig().attach(this); 138 m_theme.reconfigSig().attach(this);
139 screen.bgChangeSig().attach(this);
139 140
140 Fluxbox* fluxbox = Fluxbox::instance(); 141 Fluxbox* fluxbox = Fluxbox::instance();
141 Display *disp = fluxbox->display(); 142 Display *disp = fluxbox->display();
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index 352caf0..4ebfe95 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -703,7 +703,7 @@ void Fluxbox::handleEvent(XEvent * const e) {
703 703
704 BScreen *screen = searchScreen(e->xproperty.window); 704 BScreen *screen = searchScreen(e->xproperty.window);
705 if (screen) { 705 if (screen) {
706 FbTk::FbPixmap::rootwinPropertyNotify(screen->screenNumber(), e->xproperty.atom); 706 screen->propertyNotify(e->xproperty.atom);
707 } 707 }
708 } 708 }
709 709