fix up a number of things for when a window hides while moving,
including a crash bug
This commit is contained in:
parent
7ed9104ea8
commit
9069ae0d80
6 changed files with 66 additions and 47 deletions
|
@ -1,5 +1,10 @@
|
|||
(Format: Year/Month/Day)
|
||||
Changes for 0.9.10:
|
||||
*04/05/13:
|
||||
* Fix a crash when a window closes while [opaque] moving (Simon)
|
||||
- also tidy up several related things when a window hides
|
||||
- don't call frame().hide() explicitly, use FBW.hide(bool)
|
||||
Window.hh/cc Workspace.hh/cc Screen.cc
|
||||
*04/05/04:
|
||||
* Fix EventManager bug/memory leak (possibly caused crash) (Simon)
|
||||
EventManager.hh/cc
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// $Id: Screen.cc,v 1.277 2004/05/02 21:12:22 fluxgen Exp $
|
||||
// $Id: Screen.cc,v 1.278 2004/05/13 01:48:17 rathnor Exp $
|
||||
|
||||
|
||||
#include "Screen.hh"
|
||||
|
@ -851,7 +851,7 @@ void BScreen::changeWorkspaceID(unsigned int id) {
|
|||
}
|
||||
}
|
||||
|
||||
currentWorkspace()->hideAll();
|
||||
currentWorkspace()->hideAll(false);
|
||||
|
||||
// set new workspace
|
||||
m_current_workspace = getWorkspace(id);
|
||||
|
@ -903,7 +903,7 @@ void BScreen::sendToWorkspace(unsigned int id, FluxboxWindow *win, bool changeWS
|
|||
|
||||
// if the window isn't on current workspace, hide it
|
||||
if (id != currentWorkspace()->workspaceID())
|
||||
win->withdraw();
|
||||
win->withdraw(true);
|
||||
|
||||
reassociateWindow(win, id, true);
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// $Id: Window.cc,v 1.286 2004/05/03 13:45:23 rathnor Exp $
|
||||
// $Id: Window.cc,v 1.287 2004/05/13 01:48:18 rathnor Exp $
|
||||
|
||||
#include "Window.hh"
|
||||
|
||||
|
@ -302,11 +302,12 @@ FluxboxWindow::~FluxboxWindow() {
|
|||
cerr<<__FILE__<<"("<<__LINE__<<"): m_labelbuttons.size = "<<m_labelbuttons.size()<<endl;
|
||||
#endif // DEBUG
|
||||
|
||||
if (moving || resizing || m_attaching_tab) {
|
||||
screen().hideGeometry();
|
||||
screen().hidePosition();
|
||||
ungrabPointer(CurrentTime);
|
||||
}
|
||||
if (moving)
|
||||
stopMoving(true);
|
||||
if (resizing)
|
||||
stopResizing(true);
|
||||
if (m_attaching_tab)
|
||||
attachTo(0, 0, true);
|
||||
|
||||
// no longer a valid window to do stuff with
|
||||
Fluxbox::instance()->removeWindowSearchGroup(frame().window().window());
|
||||
|
@ -1265,10 +1266,22 @@ bool FluxboxWindow::setInputFocus() {
|
|||
return ret;
|
||||
}
|
||||
|
||||
void FluxboxWindow::hide() {
|
||||
// don't hide the frame directly, use this function
|
||||
void FluxboxWindow::hide(bool interrupt_moving) {
|
||||
#ifdef DEBUG
|
||||
cerr<<__FILE__<<"("<<__FUNCTION__<<")["<<this<<"]"<<endl;
|
||||
#endif // DEBUG
|
||||
// resizing always stops on hides
|
||||
if (resizing)
|
||||
stopResizing(true);
|
||||
|
||||
if (interrupt_moving) {
|
||||
if (moving)
|
||||
stopMoving(true);
|
||||
if (m_attaching_tab)
|
||||
attachTo(0, 0, true);
|
||||
}
|
||||
|
||||
menu().hide();
|
||||
frame().hide();
|
||||
}
|
||||
|
@ -1284,12 +1297,11 @@ void FluxboxWindow::iconify() {
|
|||
if (isIconic()) // no need to iconify if we're already
|
||||
return;
|
||||
|
||||
menu().hide();
|
||||
iconic = true;
|
||||
|
||||
setState(IconicState);
|
||||
|
||||
frame().hide();
|
||||
hide(true);
|
||||
|
||||
ClientList::iterator client_it = m_clientlist.begin();
|
||||
const ClientList::iterator client_it_end = m_clientlist.end();
|
||||
|
@ -1374,15 +1386,10 @@ void FluxboxWindow::deiconify(bool reassoc, bool do_raise) {
|
|||
/**
|
||||
Set window in withdrawn state
|
||||
*/
|
||||
void FluxboxWindow::withdraw() {
|
||||
void FluxboxWindow::withdraw(bool interrupt_moving) {
|
||||
iconic = false;
|
||||
|
||||
if (isResizing())
|
||||
stopResizing();
|
||||
|
||||
frame().hide();
|
||||
|
||||
menu().hide();
|
||||
hide(interrupt_moving);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2083,7 +2090,7 @@ void FluxboxWindow::mapRequestEvent(XMapRequestEvent &re) {
|
|||
break;
|
||||
|
||||
case WithdrawnState:
|
||||
withdraw();
|
||||
withdraw(true);
|
||||
break;
|
||||
|
||||
case NormalState: {
|
||||
|
@ -2176,7 +2183,7 @@ void FluxboxWindow::destroyNotifyEvent(XDestroyWindowEvent &de) {
|
|||
cerr<<__FILE__<<"("<<__LINE__<<"): DestroyNotifyEvent this="<<this<<endl;
|
||||
#endif // DEBUG
|
||||
if (numClients() == 1)
|
||||
frame().hide();
|
||||
hide();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2847,7 +2854,7 @@ void FluxboxWindow::startMoving(Window win) {
|
|||
}
|
||||
}
|
||||
|
||||
void FluxboxWindow::stopMoving() {
|
||||
void FluxboxWindow::stopMoving(bool interrupted) {
|
||||
moving = false;
|
||||
Fluxbox *fluxbox = Fluxbox::instance();
|
||||
|
||||
|
@ -2859,13 +2866,15 @@ void FluxboxWindow::stopMoving() {
|
|||
m_last_move_x, m_last_move_y,
|
||||
frame().width() + 2*frame().window().borderWidth()-1,
|
||||
frame().height() + 2*frame().window().borderWidth()-1);
|
||||
moveResize(m_last_move_x, m_last_move_y, frame().width(), frame().height());
|
||||
if (m_workspace_number != screen().currentWorkspaceID()) {
|
||||
screen().reassociateWindow(this, screen().currentWorkspaceID(), true);
|
||||
frame().show();
|
||||
if (!interrupted) {
|
||||
moveResize(m_last_move_x, m_last_move_y, frame().width(), frame().height());
|
||||
if (m_workspace_number != screen().currentWorkspaceID()) {
|
||||
screen().reassociateWindow(this, screen().currentWorkspaceID(), true);
|
||||
frame().show();
|
||||
}
|
||||
}
|
||||
fluxbox->ungrab();
|
||||
} else {
|
||||
} else if (!interrupted) {
|
||||
moveResize(frame().x(), frame().y(), frame().width(), frame().height());
|
||||
sendConfigureNotify();
|
||||
}
|
||||
|
@ -2873,7 +2882,7 @@ void FluxboxWindow::stopMoving() {
|
|||
|
||||
screen().hidePosition();
|
||||
ungrabPointer(CurrentTime);
|
||||
|
||||
|
||||
FbTk::App::instance()->sync(false); //make sure the redraw is made before we continue
|
||||
}
|
||||
|
||||
|
@ -3048,7 +3057,7 @@ void FluxboxWindow::startResizing(Window win, int x, int y) {
|
|||
m_last_resize_h - 1 + 2 * frame().window().borderWidth());
|
||||
}
|
||||
|
||||
void FluxboxWindow::stopResizing(Window win) {
|
||||
void FluxboxWindow::stopResizing(bool interrupted) {
|
||||
resizing = false;
|
||||
|
||||
parent().drawRectangle(screen().rootTheme().opGC(),
|
||||
|
@ -3058,26 +3067,31 @@ void FluxboxWindow::stopResizing(Window win) {
|
|||
|
||||
screen().hideGeometry();
|
||||
|
||||
fixsize();
|
||||
|
||||
moveResize(m_last_resize_x, m_last_resize_y,
|
||||
if (!interrupted) {
|
||||
fixsize();
|
||||
|
||||
moveResize(m_last_resize_x, m_last_resize_y,
|
||||
m_last_resize_w, m_last_resize_h);
|
||||
}
|
||||
|
||||
ungrabPointer(CurrentTime);
|
||||
}
|
||||
|
||||
void FluxboxWindow::attachTo(int x, int y) {
|
||||
void FluxboxWindow::attachTo(int x, int y, bool interrupted) {
|
||||
if (m_attaching_tab == 0)
|
||||
return;
|
||||
|
||||
ungrabPointer(CurrentTime);
|
||||
|
||||
|
||||
parent().drawRectangle(screen().rootTheme().opGC(),
|
||||
m_last_move_x, m_last_move_y,
|
||||
m_labelbuttons[m_attaching_tab]->width(),
|
||||
m_labelbuttons[m_attaching_tab]->height());
|
||||
Fluxbox::instance()->ungrab();
|
||||
|
||||
if (interrupted)
|
||||
return;
|
||||
|
||||
int dest_x = 0, dest_y = 0;
|
||||
Window child = 0;
|
||||
|
||||
|
@ -3160,8 +3174,7 @@ void FluxboxWindow::restore(WinClient *client, bool remap) {
|
|||
cerr<<__FILE__<<"("<<__FUNCTION__<<"): numClients() = "<<numClients()<<endl;
|
||||
#endif // DEBUG
|
||||
if (numClients() == 0) {
|
||||
|
||||
frame().hide();
|
||||
hide(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3260,7 +3273,7 @@ void FluxboxWindow::changeBlackboxHints(const BlackboxHints &net) {
|
|||
screen().reassociateWindow(this, net.workspace, true);
|
||||
|
||||
if (screen().currentWorkspaceID() != net.workspace)
|
||||
withdraw();
|
||||
withdraw(true);
|
||||
else
|
||||
deiconify();
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// $Id: Window.hh,v 1.113 2004/05/02 21:06:27 fluxgen Exp $
|
||||
// $Id: Window.hh,v 1.114 2004/05/13 01:48:18 rathnor Exp $
|
||||
|
||||
#ifndef WINDOW_HH
|
||||
#define WINDOW_HH
|
||||
|
@ -184,13 +184,14 @@ public:
|
|||
// map this window
|
||||
void show();
|
||||
// unmap this window
|
||||
void hide();
|
||||
void hide() { hide(true); }
|
||||
void hide(bool interrupt_moving);
|
||||
void iconify();
|
||||
void deiconify(bool reassoc = true, bool do_raise = true);
|
||||
/// close current client
|
||||
void close();
|
||||
/// set the window in withdrawn state
|
||||
void withdraw();
|
||||
void withdraw(bool interrupt_moving);
|
||||
/// toggle maximize
|
||||
void maximize(int type = MAX_FULL);
|
||||
/// maximizes the window horizontal
|
||||
|
@ -384,11 +385,11 @@ private:
|
|||
void grabButtons();
|
||||
|
||||
void startMoving(Window win);
|
||||
void stopMoving();
|
||||
void stopMoving(bool interrupted = false);
|
||||
void startResizing(Window win, int x, int y);
|
||||
void stopResizing(Window win=0);
|
||||
void stopResizing(bool interrupted = false);
|
||||
/// try to attach current attaching client to a window at pos x, y
|
||||
void attachTo(int x, int y);
|
||||
void attachTo(int x, int y, bool interrupted = false);
|
||||
|
||||
bool getState();
|
||||
/// gets title string from client window and updates frame's title
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// $Id: Workspace.cc,v 1.95 2004/03/21 09:00:25 rathnor Exp $
|
||||
// $Id: Workspace.cc,v 1.96 2004/05/13 01:48:18 rathnor Exp $
|
||||
|
||||
#include "Workspace.hh"
|
||||
|
||||
|
@ -218,12 +218,12 @@ void Workspace::showAll() {
|
|||
}
|
||||
|
||||
|
||||
void Workspace::hideAll() {
|
||||
void Workspace::hideAll(bool interrupt_moving) {
|
||||
Windows::reverse_iterator it = m_windowlist.rbegin();
|
||||
Windows::reverse_iterator it_end = m_windowlist.rend();
|
||||
for (; it != it_end; ++it) {
|
||||
if (! (*it)->isStuck())
|
||||
(*it)->withdraw();
|
||||
(*it)->withdraw(interrupt_moving);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ public:
|
|||
/// Set workspace name
|
||||
void setName(const std::string &name);
|
||||
void showAll();
|
||||
void hideAll();
|
||||
void hideAll(bool interrupt_moving);
|
||||
void removeAll();
|
||||
void reconfigure();
|
||||
void shutdown();
|
||||
|
|
Loading…
Reference in a new issue