closing a window from the workspace menu should close the chosen client,

rather than the active tab in the same window
This commit is contained in:
markt 2007-02-06 19:04:32 +00:00
parent ebd2fa9a99
commit 07ea9ec4b4
5 changed files with 27 additions and 4 deletions

View file

@ -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

View file

@ -3870,12 +3870,16 @@ void FluxboxWindow::sendConfigureNotify(bool send_to_netizens) {
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);
}

View file

@ -24,3 +24,4 @@
#include "WindowCmd.hh"
FluxboxWindow *WindowCmd_base::s_win = 0;
WinClient *WindowCmd_base::s_client = 0;

View file

@ -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;
};

View file

@ -102,7 +102,7 @@ public:
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();
}