aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormarkt <markt>2007-02-06 19:04:32 (GMT)
committermarkt <markt>2007-02-06 19:04:32 (GMT)
commit07ea9ec4b4a2c1252c64dc34438c4bdeb5e3331b (patch)
tree70a13ec7275abf62999528295623ab2ddaee4d71 /src
parentebd2fa9a99846381f3ef61f8b186f2c7373c419b (diff)
downloadfluxbox-07ea9ec4b4a2c1252c64dc34438c4bdeb5e3331b.zip
fluxbox-07ea9ec4b4a2c1252c64dc34438c4bdeb5e3331b.tar.bz2
closing a window from the workspace menu should close the chosen client,
rather than the active tab in the same window
Diffstat (limited to 'src')
-rw-r--r--src/Window.cc8
-rw-r--r--src/WindowCmd.cc1
-rw-r--r--src/WindowCmd.hh15
-rw-r--r--src/Workspace.cc2
4 files changed, 22 insertions, 4 deletions
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) {
3870 3870
3871 3871
3872void FluxboxWindow::close() { 3872void FluxboxWindow::close() {
3873 if (m_client) 3873 if (WindowCmd<void>::window() == this && WindowCmd<void>::client())
3874 WindowCmd<void>::client()->sendClose(false);
3875 else if (m_client)
3874 m_client->sendClose(false); 3876 m_client->sendClose(false);
3875} 3877}
3876 3878
3877void FluxboxWindow::kill() { 3879void FluxboxWindow::kill() {
3878 if (m_client) 3880 if (WindowCmd<void>::window() == this && WindowCmd<void>::client())
3881 WindowCmd<void>::client()->sendClose(true);
3882 else if (m_client)
3879 m_client->sendClose(true); 3883 m_client->sendClose(true);
3880} 3884}
3881 3885
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 @@
24#include "WindowCmd.hh" 24#include "WindowCmd.hh"
25 25
26FluxboxWindow *WindowCmd_base::s_win = 0; 26FluxboxWindow *WindowCmd_base::s_win = 0;
27WinClient *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 @@
26 26
27#include "FbTk/Command.hh" 27#include "FbTk/Command.hh"
28#include "Window.hh" 28#include "Window.hh"
29#include "WinClient.hh"
29 30
30/// holds context for WindowCmd 31/// holds context for WindowCmd
31class WindowCmd_base { 32class WindowCmd_base {
32public: 33public:
33 static void setWindow(FluxboxWindow *win) { s_win = win; } 34 // some window commands (e.g. close, kill, detach) need to know which client
35 // the command refers to, so we store it here as well, in case it is not the
36 // current client (selected from workspace menu, for example)
37 static void setWindow(FluxboxWindow *win) {
38 s_win = win;
39 s_client = (win ? &win->winClient() : 0);
40 }
41 static void setClient(WinClient *client) {
42 s_client = client;
43 s_win = (client ? client->fbwindow() : 0);
44 }
34 static FluxboxWindow *window() { return s_win; } 45 static FluxboxWindow *window() { return s_win; }
46 static WinClient *client() { return s_client; }
35protected: 47protected:
36 static FluxboxWindow *s_win; 48 static FluxboxWindow *s_win;
49 static WinClient *s_client;
37}; 50};
38 51
39 52
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:
102 const FbTk::Menu *submenu() const { return &m_client.screen().windowMenu(); } 102 const FbTk::Menu *submenu() const { return &m_client.screen().windowMenu(); }
103 103
104 void showSubmenu() { 104 void showSubmenu() {
105 WindowCmd<void>::setWindow(m_client.fbwindow()); 105 WindowCmd<void>::setClient(&m_client);
106 FbTk::MenuItem::showSubmenu(); 106 FbTk::MenuItem::showSubmenu();
107 } 107 }
108 108