all repos — fluxbox @ abc86f0028402a54ef74c378cf5b6805f01e0347

custom fork of the fluxbox windowmanager

fix systemtray related things
rathnor rathnor
commit

abc86f0028402a54ef74c378cf5b6805f01e0347

parent

9b7775751decd095f091d122c1ce057c6a04b64d

4 files changed, 53 insertions(+), 17 deletions(-)

jump to
M ChangeLogChangeLog

@@ -1,6 +1,8 @@

(Format: Year/Month/Day) Changes for 0.9.10: *04/06/20: + * Fix various systray issues (Simon) + SystemTray.cc Toolbar.cc ToolbarItem.hh * Support _NET_WM_WINDOW_TYPE_DESKTOP (Simon) - eg nautilus desktop windows are on the bottom, not tabable, etc Ewmh.hh/cc Window.hh/cc
M src/SystemTray.ccsrc/SystemTray.cc

@@ -19,7 +19,7 @@ // 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: SystemTray.cc,v 1.10 2004/05/04 14:33:37 rathnor Exp $ +// $Id: SystemTray.cc,v 1.11 2004/06/20 10:29:51 rathnor Exp $ #include "SystemTray.hh"

@@ -62,6 +62,9 @@ if (winclient.fbwindow() != 0)

return; // if not kde dockapp... if (!winclient.screen().isKdeDockapp(winclient.window())) + return; + // if not our screen... + if (winclient.screenNumber() != m_tray.window().screenNumber()) return; winclient.setEventMask(StructureNotifyMask | SubstructureNotifyMask | EnterWindowMask);

@@ -96,6 +99,9 @@ SubstructureNotifyMask | SubstructureRedirectMask) {

FbTk::EventManager::instance()->add(*this, m_window); + // just try to blend in... (better than defaulting to white) + m_window.setBackgroundPixmap(ParentRelative); + // setup atom name to _NET_SYSTEM_TRAY_S<screen number> char intbuff[16]; sprintf(intbuff, "%d", m_window.screenNumber());

@@ -151,15 +157,26 @@

void SystemTray::resize(unsigned int width, unsigned int height) { if (width != m_window.width() || height != m_window.height()) { - m_window.resize(SystemTray::width(), height); - rearrangeClients(); + m_window.resize(width, height); + if (!m_clients.empty()) { + rearrangeClients(); + resizeSig().notify(); + } } } void SystemTray::moveResize(int x, int y, unsigned int width, unsigned int height) { - move(x, y); - resize(width, height); + if (width != m_window.width() || + height != m_window.height()) { + m_window.moveResize(x, y, width, height); + if (!m_clients.empty()) { + rearrangeClients(); + resizeSig().notify(); + } + } else { + move(x, y); + } } void SystemTray::hide() {

@@ -241,8 +258,6 @@ XChangeSaveSet(FbTk::App::instance()->display(), win, SetModeInsert);

traywin->reparent(m_window, 0, 0); traywin->show(); - resize(width(), m_clients.size()*height()); - rearrangeClients(); }

@@ -260,9 +275,8 @@ delete traywin;

resize(width(), height()); rearrangeClients(); if (m_clients.empty()) { - // so we send configurenotify signal to parent - m_window.resize(1, 1); - hide(); + // so we send notify signal to parent + resizeSig().notify(); } }

@@ -281,11 +295,13 @@ removeClient(event.xunmap.window);

} else if (event.type == ConfigureNotify) { // we got configurenotify from an client // check and see if we need to update it's size + // we don't let them be their size, we enforce ours (mwahaha) ClientList::iterator it = findClient(event.xconfigure.window); if (it != m_clients.end()) { if (static_cast<unsigned int>(event.xconfigure.width) != (*it)->width() || - static_cast<unsigned int>(event.xconfigure.height) != (*it)->height()) + static_cast<unsigned int>(event.xconfigure.height) != (*it)->height()) { (*it)->resize((*it)->width(), (*it)->height()); + } } } }

@@ -302,6 +318,8 @@ #ifdef DEBUG

cerr<<__FILE__<<"("<<__FUNCTION__<<"): "<<(*client_it)->width()<<", "<<(*client_it)->height()<<endl; #endif // DEBUG } + + resize(next_x, height()); } void SystemTray::removeAllClients() {
M src/Toolbar.ccsrc/Toolbar.cc

@@ -22,7 +22,7 @@ // 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: Toolbar.cc,v 1.144 2004/06/16 15:38:19 rathnor Exp $ +// $Id: Toolbar.cc,v 1.145 2004/06/20 10:29:51 rathnor Exp $ #include "Toolbar.hh"

@@ -405,6 +405,7 @@ ToolbarItem *item = m_tool_factory.create(*item_it, frame.window, *this);

if (item == 0) continue; m_item_list.push_back(item); + item->resizeSig().attach(this); } // show all items

@@ -564,9 +565,14 @@ }

void Toolbar::update(FbTk::Subject *subj) { - // either screen reconfigured or theme was reloaded - - reconfigure(); + // either screen reconfigured, theme was reloaded + // or a tool resized itself + + if (typeid(*subj) == typeid(ToolbarItem::ToolbarItemSubject)) { + rearrangeItems(); + } else { + reconfigure(); + } } void Toolbar::setPlacement(Toolbar::Placement where) {

@@ -921,6 +927,8 @@ last_bw = 0;

for (item_it = m_item_list.begin(); item_it != item_it_end; ++item_it) { if (!(*item_it)->active()) { (*item_it)->hide(); + // make sure it still gets told the toolbar height + (*item_it)->resize(1, height()); // width of 0 changes to 1 anyway continue; } int borderW = (*item_it)->borderWidth();

@@ -931,7 +939,6 @@ else

next_x += last_bw; last_bw = borderW; - (*item_it)->show(); if ((*item_it)->type() == ToolbarItem::RELATIVE) { int extra = 0; if (rounding_error != 0) { // distribute rounding error over all relatives

@@ -944,6 +951,7 @@ } else { // fixed size

(*item_it)->moveResize(next_x - borderW, -borderW, (*item_it)->width(), height()); } + (*item_it)->show(); next_x += (*item_it)->width(); } // unlock
M src/ToolbarItem.hhsrc/ToolbarItem.hh

@@ -20,10 +20,12 @@ // 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: ToolbarItem.hh,v 1.3 2003/10/31 10:37:09 rathnor Exp $ +// $Id: ToolbarItem.hh,v 1.4 2004/06/20 10:29:51 rathnor Exp $ #ifndef TOOLBARITEM_HH #define TOOLBARITEM_HH + +#include "FbTk/Subject.hh" /// An item in the toolbar that has either fixed or realive size to the toolbar class ToolbarItem {

@@ -50,11 +52,17 @@ virtual unsigned int borderWidth() const = 0;

// some items might be there, but effectively empty, so shouldn't appear virtual bool active() { return true; } + FbTk::Subject &resizeSig() { return m_resize_sig; } + void setType(Type type) { m_type = type; } Type type() const { return m_type; } + class ToolbarItemSubject : public FbTk::Subject {}; + private: Type m_type; + + ToolbarItemSubject m_resize_sig; }; #endif // TOOLBARITEM_HH