all repos — fluxbox @ b70f4c144c0428324952f40939b2ada2a2d173a9

custom fork of the fluxbox windowmanager

fix updating of systemtray and kde dockapps in slit on background change
added fluxbox-remote.cc
markt markt
commit

b70f4c144c0428324952f40939b2ada2a2d173a9

parent

86031f9c75d7dada8fd61e5a0059d54fa42ce099

M ChangeLogChangeLog

@@ -1,6 +1,11 @@

(Format: Year/Month/Day) Changes for 1.0.0: *07/07/03: + * Added utility fluxbox-remote, which takes one argument and has fluxbox + execute it just like in the keys file (Mark) + Screen.cc util/fluxbox-remote.cc util/Makefile.am + * Update systemtray and KDE dockapps in slit when background changes (Mark) + Screen.cc/hh Systemtray.cc Slit.cc FbTk/FbPixmap.cc/hh * Fixed resource usage due to Skype 1.4, bug #1745678 (Mark) FbTk/FbPixmap.cc *07/07/02:
M src/FbTk/FbPixmap.ccsrc/FbTk/FbPixmap.cc

@@ -353,9 +353,10 @@ m_depth = 0;

return ret; } -void FbPixmap::rootwinPropertyNotify(int screen_num, Atom atom) { +// returns whether or not the background was changed +bool FbPixmap::rootwinPropertyNotify(int screen_num, Atom atom) { if (!FbTk::Transparent::haveRender()) - return; + return false; checkAtoms(); for (int i=0; root_prop_ids[i] != 0; ++i) {

@@ -379,14 +380,16 @@ root_pm = (Pixmap) (*data);

} XFree(data); if (root_pm != None) - setRootPixmap(screen_num, root_pm); + return setRootPixmap(screen_num, root_pm); } - break; + return false; } } + return false; } -void FbPixmap::setRootPixmap(int screen_num, Pixmap pm) { +// returns whether or not the background was changed +bool FbPixmap::setRootPixmap(int screen_num, Pixmap pm) { if (!m_root_pixmaps) { m_root_pixmaps = new Pixmap[ScreenCount(display())]; for (int i=0; i < ScreenCount(display()); ++i)

@@ -396,7 +399,9 @@

if (m_root_pixmaps[screen_num] != pm) { m_root_pixmaps[screen_num] = pm; FbWindow::updatedAlphaBackground(screen_num); + return true; } + return false; } Pixmap FbPixmap::getRootPixmap(int screen_num, bool force_update) {
M src/FbTk/FbPixmap.hhsrc/FbTk/FbPixmap.hh

@@ -70,8 +70,8 @@ inline unsigned int height() const { return m_height; }

inline unsigned int depth() const { return m_depth; } static Pixmap getRootPixmap(int screen_num, bool force_update=false); - static void setRootPixmap(int screen_num, Pixmap pm); - static void rootwinPropertyNotify(int screen_num, Atom atom); + static bool setRootPixmap(int screen_num, Pixmap pm); + static bool rootwinPropertyNotify(int screen_num, Atom atom); void create(Drawable src, unsigned int width, unsigned int height,
M src/Screen.ccsrc/Screen.cc

@@ -344,6 +344,7 @@ m_workspace_area_sig(*this), // workspace area signal

m_currentworkspace_sig(*this), // current workspace signal m_reconfigure_sig(*this), // reconfigure signal m_resize_sig(*this), + m_bg_change_sig(*this), m_layermanager(num_layers), m_windowtheme(new FbWinFrameTheme(scrn)), // the order of windowtheme and winbutton theme is important

@@ -780,6 +781,37 @@ const Icons::iterator it_end = iconList().end();

for (; it != it_end; ++it) fluxbox->updateFrameExtents(**it); +} + +void BScreen::propertyNotify(Atom atom) { + static Atom fbcmd_atom = XInternAtom(FbTk::App::instance()->display(), + "_FLUXBOX_COMMAND", False); + if (atom == fbcmd_atom) { + Atom xa_ret_type; + int ret_format; + unsigned long ret_nitems, ret_bytes_after; + char *str; + if (rootWindow().property(fbcmd_atom, 0l, 64l, + True, XA_STRING, &xa_ret_type, &ret_format, &ret_nitems, + &ret_bytes_after, (unsigned char **)&str) && str) { + + if (ret_bytes_after) { + XFree(str); + long len = 64 + (ret_bytes_after + 3)/4; + rootWindow().property(fbcmd_atom, 0l, len, + True, XA_STRING, &xa_ret_type, &ret_format, &ret_nitems, + &ret_bytes_after, (unsigned char **)&str); + } + + FbTk::RefCount<FbTk::Command> cmd(CommandParser::instance().parseLine(str)); + if (cmd.get()) + cmd->execute(); + XFree(str); + + } + // TODO: this doesn't belong in FbPixmap + } else if (FbTk::FbPixmap::rootwinPropertyNotify(screenNumber(), atom)) + m_bg_change_sig.notify(); } void BScreen::keyPressEvent(XKeyEvent &ke) {

@@ -1353,7 +1385,6 @@ }

bool BScreen::isKdeDockapp(Window client) const { //Check and see if client is KDE dock applet. - //If so add to Slit bool iskdedockapp = false; Atom ajunk; int ijunk;
M src/Screen.hhsrc/Screen.hh

@@ -233,11 +233,13 @@ FbTk::Subject &currentWorkspaceSig() { return m_currentworkspace_sig; }

/// reconfigure signal FbTk::Subject &reconfigureSig() { return m_reconfigure_sig; } FbTk::Subject &resizeSig() { return m_resize_sig; } + FbTk::Subject &bgChangeSig() { return m_bg_change_sig; } //@} /// called when the screen receives a signal from a subject void update(FbTk::Subject *subj); + void propertyNotify(Atom atom); void keyPressEvent(XKeyEvent &ke); void keyReleaseEvent(XKeyEvent &ke); void buttonPressEvent(XButtonEvent &be);

@@ -513,7 +515,8 @@ m_workspacenames_sig, ///< workspace names signal

m_workspace_area_sig, ///< workspace area changed signal m_currentworkspace_sig, ///< current workspace signal m_reconfigure_sig, ///< reconfigure signal - m_resize_sig; ///< resize signal + m_resize_sig, ///< resize signal + m_bg_change_sig; ///< background change signal FbTk::MultLayers m_layermanager;
M src/Slit.ccsrc/Slit.cc

@@ -306,6 +306,7 @@

// attach to theme and root window change signal m_slit_theme->reconfigSig().attach(this); scr.resizeSig().attach(this); + scr.bgChangeSig().attach(this); scr.reconfigureSig().attach(this); // if alpha changed (we disablethis signal when we get theme change sig) scr.addConfigMenu(_FB_XTEXT(Slit, Slit, "Slit", "The Slit"), m_slitmenu);

@@ -662,6 +663,13 @@ for (; client_it != client_it_end; ++client_it) {

// client created window? if ((*client_it)->window() != None && (*client_it)->visible()) { num_windows++; + + // get the dockapps to update their backgrounds + if (screen().isKdeDockapp((*client_it)->window())) { + (*client_it)->hide(); + (*client_it)->show(); + } + if (height_inc) { // increase height of slit for each client (VERTICAL mode) frame.height += (*client_it)->height() + bevel_width;
M src/SystemTray.ccsrc/SystemTray.cc

@@ -136,6 +136,7 @@ m_pixmap(0), m_num_visible_clients(0) {

FbTk::EventManager::instance()->add(*this, m_window); m_theme.reconfigSig().attach(this); + screen.bgChangeSig().attach(this); Fluxbox* fluxbox = Fluxbox::instance(); Display *disp = fluxbox->display();
M src/fluxbox.ccsrc/fluxbox.cc

@@ -703,7 +703,7 @@ // check transparency atoms if it's a root pm

BScreen *screen = searchScreen(e->xproperty.window); if (screen) { - FbTk::FbPixmap::rootwinPropertyNotify(screen->screenNumber(), e->xproperty.atom); + screen->propertyNotify(e->xproperty.atom); } }
M util/Makefile.amutil/Makefile.am

@@ -2,13 +2,14 @@ # util/Makefile.am for Fluxbox

SUBDIRS= fbrun INCLUDES= -I$(top_srcdir)/src -I$(top_srcdir)/src/FbTk bin_SCRIPTS= fbsetbg fluxbox-generate_menu startfluxbox -bin_PROGRAMS= fbsetroot fluxbox-update_configs +bin_PROGRAMS= fbsetroot fluxbox-update_configs fluxbox-remote fbsetroot_SOURCES= fbsetroot.cc fbsetroot.hh fbsetroot_LDADD=../src/FbRootWindow.o ../src/FbAtoms.o \ ../src/FbTk/libFbTk.a fluxbox_update_configs_SOURCES= fluxbox-update_configs.cc fluxbox_update_configs_LDADD= ../src/defaults.o ../src/Resources.o \ ../src/FbTk/libFbTk.a +fluxbox_remote_SOURCES= fluxbox-remote.cc MAINTAINERCLEANFILES= Makefile.in EXTRA_DIST= fbsetbg fluxbox-generate_menu.in \

@@ -27,6 +28,8 @@ $(top_srcdir)/src/FbRootWindow.hh $(top_srcdir)/src/FbAtoms.hh

fluxbox-update_configs.o: fluxbox-update_configs.cc ../config.h \ $(top_srcdir)/src/defaults.hh + +fluxbox-remote.o: fluxbox-remote.cc startfluxbox: startfluxbox.in @regex_cmd@ -e "s,@pkgdatadir@,$(pkgdatadir),g" \
A util/fluxbox-remote.cc

@@ -0,0 +1,49 @@

+// fluxbox-remote.cc +// Copyright (c) 2007 Fluxbox Team (fluxgen at fluxbox dot org) +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the "Software"), +// to deal in the Software without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. + +// $Id$ + +#include <X11/Xlib.h> +#include <X11/Xatom.h> +#include <string.h> + +int main(int argc, char **argv) { + + if (argc <= 1) + return 1; + + Display *disp = XOpenDisplay(NULL); + if (!disp) + return 1; + + Atom fbcmd_atom = XInternAtom(disp, "_FLUXBOX_COMMAND", False); + Window root = DefaultRootWindow(disp); + + char *str = argv[1]; + int ret = XChangeProperty(disp, root, fbcmd_atom, + XA_STRING, 8, PropModeReplace, + (unsigned char *) str, strlen(str)); + XCloseDisplay(disp); + + if (ret == Success) + return 0; + return 1; +}