aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
9 files changed, 111 insertions, 11 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 293247b..55b74e1 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -348,6 +348,7 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
348 m_currentworkspace_sig(*this), // current workspace signal 348 m_currentworkspace_sig(*this), // current workspace signal
349 m_reconfigure_sig(*this), // reconfigure signal 349 m_reconfigure_sig(*this), // reconfigure signal
350 m_resize_sig(*this), 350 m_resize_sig(*this),
351 m_bg_change_sig(*this),
351 m_layermanager(num_layers), 352 m_layermanager(num_layers),
352 m_windowtheme(new FbWinFrameTheme(scrn)), 353 m_windowtheme(new FbWinFrameTheme(scrn)),
353 // the order of windowtheme and winbutton theme is important 354 // the order of windowtheme and winbutton theme is important
@@ -795,6 +796,37 @@ void BScreen::update(FbTk::Subject *subj) {
795 796
796} 797}
797 798
799void BScreen::propertyNotify(Atom atom) {
800 static Atom fbcmd_atom = XInternAtom(FbTk::App::instance()->display(),
801 "_FLUXBOX_COMMAND", False);
802 if (atom == fbcmd_atom) {
803 Atom xa_ret_type;
804 int ret_format;
805 unsigned long ret_nitems, ret_bytes_after;
806 char *str;
807 if (rootWindow().property(fbcmd_atom, 0l, 64l,
808 True, XA_STRING, &xa_ret_type, &ret_format, &ret_nitems,
809 &ret_bytes_after, (unsigned char **)&str) && str) {
810
811 if (ret_bytes_after) {
812 XFree(str);
813 long len = 64 + (ret_bytes_after + 3)/4;
814 rootWindow().property(fbcmd_atom, 0l, len,
815 True, XA_STRING, &xa_ret_type, &ret_format, &ret_nitems,
816 &ret_bytes_after, (unsigned char **)&str);
817 }
818
819 FbTk::RefCount<FbTk::Command> cmd(CommandParser::instance().parseLine(str));
820 if (cmd.get())
821 cmd->execute();
822 XFree(str);
823
824 }
825 // TODO: this doesn't belong in FbPixmap
826 } else if (FbTk::FbPixmap::rootwinPropertyNotify(screenNumber(), atom))
827 m_bg_change_sig.notify();
828}
829
798void BScreen::keyPressEvent(XKeyEvent &ke) { 830void BScreen::keyPressEvent(XKeyEvent &ke) {
799 if (!m_typing_ahead) { 831 if (!m_typing_ahead) {
800 Fluxbox::instance()->keys()->doAction(ke.type, ke.state, ke.keycode, 832 Fluxbox::instance()->keys()->doAction(ke.type, ke.state, ke.keycode,
@@ -1408,7 +1440,6 @@ void BScreen::updateNetizenConfigNotify(XEvent &e) {
1408 1440
1409bool BScreen::isKdeDockapp(Window client) const { 1441bool BScreen::isKdeDockapp(Window client) const {
1410 //Check and see if client is KDE dock applet. 1442 //Check and see if client is KDE dock applet.
1411 //If so add to Slit
1412 bool iskdedockapp = false; 1443 bool iskdedockapp = false;
1413 Atom ajunk; 1444 Atom ajunk;
1414 int ijunk; 1445 int ijunk;
diff --git a/src/Screen.hh b/src/Screen.hh
index 0d2534d..ce24ca7 100644
--- a/src/Screen.hh
+++ b/src/Screen.hh
@@ -237,11 +237,13 @@ public:
237 /// reconfigure signal 237 /// reconfigure signal
238 FbTk::Subject &reconfigureSig() { return m_reconfigure_sig; } 238 FbTk::Subject &reconfigureSig() { return m_reconfigure_sig; }
239 FbTk::Subject &resizeSig() { return m_resize_sig; } 239 FbTk::Subject &resizeSig() { return m_resize_sig; }
240 FbTk::Subject &bgChangeSig() { return m_bg_change_sig; }
240 //@} 241 //@}
241 242
242 /// called when the screen receives a signal from a subject 243 /// called when the screen receives a signal from a subject
243 void update(FbTk::Subject *subj); 244 void update(FbTk::Subject *subj);
244 245
246 void propertyNotify(Atom atom);
245 void keyPressEvent(XKeyEvent &ke); 247 void keyPressEvent(XKeyEvent &ke);
246 void keyReleaseEvent(XKeyEvent &ke); 248 void keyReleaseEvent(XKeyEvent &ke);
247 void buttonPressEvent(XButtonEvent &be); 249 void buttonPressEvent(XButtonEvent &be);
@@ -521,7 +523,8 @@ private:
521 m_workspace_area_sig, ///< workspace area changed signal 523 m_workspace_area_sig, ///< workspace area changed signal
522 m_currentworkspace_sig, ///< current workspace signal 524 m_currentworkspace_sig, ///< current workspace signal
523 m_reconfigure_sig, ///< reconfigure signal 525 m_reconfigure_sig, ///< reconfigure signal
524 m_resize_sig; ///< resize signal 526 m_resize_sig, ///< resize signal
527 m_bg_change_sig; ///< background change signal
525 528
526 FbTk::MultLayers m_layermanager; 529 FbTk::MultLayers m_layermanager;
527 530
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 5210def..57597a2 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -706,7 +706,7 @@ void Fluxbox::handleEvent(XEvent * const e) {
706 706
707 BScreen *screen = searchScreen(e->xproperty.window); 707 BScreen *screen = searchScreen(e->xproperty.window);
708 if (screen) { 708 if (screen) {
709 FbTk::FbPixmap::rootwinPropertyNotify(screen->screenNumber(), e->xproperty.atom); 709 screen->propertyNotify(e->xproperty.atom);
710 } 710 }
711 } 711 }
712 712
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}