aboutsummaryrefslogtreecommitdiff
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
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
-rw-r--r--ChangeLog5
-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
-rw-r--r--util/Makefile.am5
-rw-r--r--util/fluxbox-remote.cc49
10 files changed, 116 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 4d5120e..49cb8d6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,11 @@
1 (Format: Year/Month/Day) 1 (Format: Year/Month/Day)
2Changes for 1.0.0: 2Changes for 1.0.0:
3*07/07/03: 3*07/07/03:
4 * Added utility fluxbox-remote, which takes one argument and has fluxbox
5 execute it just like in the keys file (Mark)
6 Screen.cc util/fluxbox-remote.cc util/Makefile.am
7 * Update systemtray and KDE dockapps in slit when background changes (Mark)
8 Screen.cc/hh Systemtray.cc Slit.cc FbTk/FbPixmap.cc/hh
4 * Fixed resource usage due to Skype 1.4, bug #1745678 (Mark) 9 * Fixed resource usage due to Skype 1.4, bug #1745678 (Mark)
5 FbTk/FbPixmap.cc 10 FbTk/FbPixmap.cc
6*07/07/02: 11*07/07/02:
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
diff --git a/util/Makefile.am b/util/Makefile.am
index 263c456..2033608 100644
--- a/util/Makefile.am
+++ b/util/Makefile.am
@@ -2,13 +2,14 @@
2SUBDIRS= fbrun 2SUBDIRS= fbrun
3INCLUDES= -I$(top_srcdir)/src -I$(top_srcdir)/src/FbTk 3INCLUDES= -I$(top_srcdir)/src -I$(top_srcdir)/src/FbTk
4bin_SCRIPTS= fbsetbg fluxbox-generate_menu startfluxbox 4bin_SCRIPTS= fbsetbg fluxbox-generate_menu startfluxbox
5bin_PROGRAMS= fbsetroot fluxbox-update_configs 5bin_PROGRAMS= fbsetroot fluxbox-update_configs fluxbox-remote
6fbsetroot_SOURCES= fbsetroot.cc fbsetroot.hh 6fbsetroot_SOURCES= fbsetroot.cc fbsetroot.hh
7fbsetroot_LDADD=../src/FbRootWindow.o ../src/FbAtoms.o \ 7fbsetroot_LDADD=../src/FbRootWindow.o ../src/FbAtoms.o \
8 ../src/FbTk/libFbTk.a 8 ../src/FbTk/libFbTk.a
9fluxbox_update_configs_SOURCES= fluxbox-update_configs.cc 9fluxbox_update_configs_SOURCES= fluxbox-update_configs.cc
10fluxbox_update_configs_LDADD= ../src/defaults.o ../src/Resources.o \ 10fluxbox_update_configs_LDADD= ../src/defaults.o ../src/Resources.o \
11 ../src/FbTk/libFbTk.a 11 ../src/FbTk/libFbTk.a
12fluxbox_remote_SOURCES= fluxbox-remote.cc
12 13
13MAINTAINERCLEANFILES= Makefile.in 14MAINTAINERCLEANFILES= Makefile.in
14EXTRA_DIST= fbsetbg fluxbox-generate_menu.in \ 15EXTRA_DIST= fbsetbg fluxbox-generate_menu.in \
@@ -28,6 +29,8 @@ fbsetroot.o: fbsetroot.cc ../config.h $(srcdir)/fbsetroot.hh \
28fluxbox-update_configs.o: fluxbox-update_configs.cc ../config.h \ 29fluxbox-update_configs.o: fluxbox-update_configs.cc ../config.h \
29 $(top_srcdir)/src/defaults.hh 30 $(top_srcdir)/src/defaults.hh
30 31
32fluxbox-remote.o: fluxbox-remote.cc
33
31startfluxbox: startfluxbox.in 34startfluxbox: startfluxbox.in
32 @regex_cmd@ -e "s,@pkgdatadir@,$(pkgdatadir),g" \ 35 @regex_cmd@ -e "s,@pkgdatadir@,$(pkgdatadir),g" \
33 -e "s,@pkgbindir@,$(bindir),g" \ 36 -e "s,@pkgbindir@,$(bindir),g" \
diff --git a/util/fluxbox-remote.cc b/util/fluxbox-remote.cc
new file mode 100644
index 0000000..eb7a413
--- /dev/null
+++ b/util/fluxbox-remote.cc
@@ -0,0 +1,49 @@
1// fluxbox-remote.cc
2// Copyright (c) 2007 Fluxbox Team (fluxgen at fluxbox dot org)
3//
4// Permission is hereby granted, free of charge, to any person obtaining a
5// copy of this software and associated documentation files (the "Software"),
6// to deal in the Software without restriction, including without limitation
7// the rights to use, copy, modify, merge, publish, distribute, sublicense,
8// and/or sell copies of the Software, and to permit persons to whom the
9// Software is furnished to do so, subject to the following conditions:
10//
11// The above copyright notice and this permission notice shall be included in
12// all copies or substantial portions of the Software.
13//
14// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE.
21
22// $Id$
23
24#include <X11/Xlib.h>
25#include <X11/Xatom.h>
26#include <string.h>
27
28int main(int argc, char **argv) {
29
30 if (argc <= 1)
31 return 1;
32
33 Display *disp = XOpenDisplay(NULL);
34 if (!disp)
35 return 1;
36
37 Atom fbcmd_atom = XInternAtom(disp, "_FLUXBOX_COMMAND", False);
38 Window root = DefaultRootWindow(disp);
39
40 char *str = argv[1];
41 int ret = XChangeProperty(disp, root, fbcmd_atom,
42 XA_STRING, 8, PropModeReplace,
43 (unsigned char *) str, strlen(str));
44 XCloseDisplay(disp);
45
46 if (ret == Success)
47 return 0;
48 return 1;
49}