From 07ea9ec4b4a2c1252c64dc34438c4bdeb5e3331b Mon Sep 17 00:00:00 2001 From: markt Date: Tue, 6 Feb 2007 19:04:32 +0000 Subject: closing a window from the workspace menu should close the chosen client, rather than the active tab in the same window --- ChangeLog | 5 +++++ src/Window.cc | 8 ++++++-- src/WindowCmd.cc | 1 + src/WindowCmd.hh | 15 ++++++++++++++- src/Workspace.cc | 2 +- 5 files changed, 27 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4976b30..201a575 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 diff --git a/src/Window.cc b/src/Window.cc index 1b3ef2f..c505edc 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -3870,12 +3870,16 @@ void FluxboxWindow::sendConfigureNotify(bool send_to_netizens) { void FluxboxWindow::close() { - if (m_client) + if (WindowCmd::window() == this && WindowCmd::client()) + WindowCmd::client()->sendClose(false); + else if (m_client) m_client->sendClose(false); } void FluxboxWindow::kill() { - if (m_client) + if (WindowCmd::window() == this && WindowCmd::client()) + WindowCmd::client()->sendClose(true); + else if (m_client) m_client->sendClose(true); } diff --git a/src/WindowCmd.cc b/src/WindowCmd.cc index 7a9c8f0..231e1a4 100644 --- a/src/WindowCmd.cc +++ b/src/WindowCmd.cc @@ -24,3 +24,4 @@ #include "WindowCmd.hh" FluxboxWindow *WindowCmd_base::s_win = 0; +WinClient *WindowCmd_base::s_client = 0; diff --git a/src/WindowCmd.hh b/src/WindowCmd.hh index 5eca723..17a4e86 100644 --- a/src/WindowCmd.hh +++ b/src/WindowCmd.hh @@ -26,14 +26,27 @@ #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; }; diff --git a/src/Workspace.cc b/src/Workspace.cc index caeb662..4b367ac 100644 --- a/src/Workspace.cc +++ b/src/Workspace.cc @@ -102,7 +102,7 @@ public: const FbTk::Menu *submenu() const { return &m_client.screen().windowMenu(); } void showSubmenu() { - WindowCmd::setWindow(m_client.fbwindow()); + WindowCmd::setClient(&m_client); FbTk::MenuItem::showSubmenu(); } -- cgit v0.11.2