all repos — fluxbox @ 07ea9ec4b4a2c1252c64dc34438c4bdeb5e3331b

custom fork of the fluxbox windowmanager

closing a window from the workspace menu should close the chosen client,
rather than the active tab in the same window
markt markt
commit

07ea9ec4b4a2c1252c64dc34438c4bdeb5e3331b

parent

ebd2fa9a99846381f3ef61f8b186f2c7373c419b

5 files changed, 27 insertions(+), 4 deletions(-)

jump to
M ChangeLogChangeLog

@@ -1,5 +1,10 @@

(Format: Year/Month/Day) Changes for 1.0rc3: +*07/02/06: + * Make selecting `close' from the workspace menu close the correct client, + rather than the active tab in the window -- selecting `close' from right + clicking on a tab is still wrong, as there are complications (Mark) + WindowCmd.cc/hh Window.cc Workspace.cc *07/02/05: * Made some changes to the way autogrouping in the apps file works (Mark) - Introduced new syntax [group] (workspace) to group new windows only with
M src/Window.ccsrc/Window.cc

@@ -3870,12 +3870,16 @@ }

void FluxboxWindow::close() { - if (m_client) + if (WindowCmd<void>::window() == this && WindowCmd<void>::client()) + WindowCmd<void>::client()->sendClose(false); + else if (m_client) m_client->sendClose(false); } void FluxboxWindow::kill() { - if (m_client) + if (WindowCmd<void>::window() == this && WindowCmd<void>::client()) + WindowCmd<void>::client()->sendClose(true); + else if (m_client) m_client->sendClose(true); }
M src/WindowCmd.ccsrc/WindowCmd.cc

@@ -24,3 +24,4 @@

#include "WindowCmd.hh" FluxboxWindow *WindowCmd_base::s_win = 0; +WinClient *WindowCmd_base::s_client = 0;
M src/WindowCmd.hhsrc/WindowCmd.hh

@@ -26,14 +26,27 @@ #define WINDOWCMD_HH

#include "FbTk/Command.hh" #include "Window.hh" +#include "WinClient.hh" /// holds context for WindowCmd class WindowCmd_base { public: - static void setWindow(FluxboxWindow *win) { s_win = win; } + // some window commands (e.g. close, kill, detach) need to know which client + // the command refers to, so we store it here as well, in case it is not the + // current client (selected from workspace menu, for example) + static void setWindow(FluxboxWindow *win) { + s_win = win; + s_client = (win ? &win->winClient() : 0); + } + static void setClient(WinClient *client) { + s_client = client; + s_win = (client ? client->fbwindow() : 0); + } static FluxboxWindow *window() { return s_win; } + static WinClient *client() { return s_client; } protected: static FluxboxWindow *s_win; + static WinClient *s_client; };
M src/Workspace.ccsrc/Workspace.cc

@@ -102,7 +102,7 @@ FbTk::Menu *submenu() { return &m_client.screen().windowMenu(); }

const FbTk::Menu *submenu() const { return &m_client.screen().windowMenu(); } void showSubmenu() { - WindowCmd<void>::setWindow(m_client.fbwindow()); + WindowCmd<void>::setClient(&m_client); FbTk::MenuItem::showSubmenu(); }