aboutsummaryrefslogtreecommitdiff
path: root/src/IconButton.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/IconButton.cc')
-rw-r--r--src/IconButton.cc19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/IconButton.cc b/src/IconButton.cc
index fa85cb2..edc2fc1 100644
--- a/src/IconButton.cc
+++ b/src/IconButton.cc
@@ -74,26 +74,29 @@ public:
74 explicit FocusCommand(const IconbarTool& tool, FluxboxWindow &win) : 74 explicit FocusCommand(const IconbarTool& tool, FluxboxWindow &win) :
75 m_win(win), m_tool(tool) { } 75 m_win(win), m_tool(tool) { }
76 void execute() { 76 void execute() {
77 if(m_win.isIconic() || !m_win.isFocused()) { 77 // this needs to be a local variable, as this object could be destroyed
78 // if the workspace is changed.
79 FluxboxWindow &win = m_win;
80 if(win.isIconic() || !win.isFocused()) {
78 switch(m_tool.deiconifyMode()) { 81 switch(m_tool.deiconifyMode()) {
79 case IconbarTool::SEMIFOLLOW: 82 case IconbarTool::SEMIFOLLOW:
80 if (m_win.isIconic()) { 83 if (win.isIconic()) {
81 m_win.screen().sendToWorkspace(m_win.screen().currentWorkspaceID(), &m_win); 84 win.screen().sendToWorkspace(win.screen().currentWorkspaceID(), &win);
82 } else { 85 } else {
83 m_win.screen().changeWorkspaceID(m_win.workspaceNumber()); 86 win.screen().changeWorkspaceID(win.workspaceNumber());
84 } 87 }
85 break; 88 break;
86 case IconbarTool::CURRENT: 89 case IconbarTool::CURRENT:
87 m_win.screen().sendToWorkspace(m_win.screen().currentWorkspaceID(), &m_win); 90 win.screen().sendToWorkspace(win.screen().currentWorkspaceID(), &win);
88 break; 91 break;
89 case IconbarTool::FOLLOW: 92 case IconbarTool::FOLLOW:
90 default: 93 default:
91 m_win.screen().changeWorkspaceID(m_win.workspaceNumber()); 94 win.screen().changeWorkspaceID(win.workspaceNumber());
92 break; 95 break;
93 }; 96 };
94 m_win.raiseAndFocus(); 97 win.raiseAndFocus();
95 } else 98 } else
96 m_win.iconify(); 99 win.iconify();
97 } 100 }
98 101
99private: 102private: