_FLUXBOX_GROUP_LEFT wasn't being removed on detach, and the correct client in tabbed windows wasn't always being raised on restart

This commit is contained in:
markt 2006-12-20 16:10:02 +00:00
parent 1440919956
commit aee80a2424
3 changed files with 35 additions and 14 deletions

View file

@ -1,5 +1,8 @@
(Format: Year/Month/Day) (Format: Year/Month/Day)
Changes for 1.0rc3: Changes for 1.0rc3:
*06/12/20:
* Fixed a few bugs with tabbed windows on restart (Mark)
Window.cc FocusControl.hh
*06/12/19: *06/12/19:
* Little simplification of data structure for keybindings (Mark) * Little simplification of data structure for keybindings (Mark)
Side effects: Side effects:

View file

@ -95,6 +95,7 @@ public:
WinClient *lastFocusedWindow(FluxboxWindow &group, WinClient *ignore_client); WinClient *lastFocusedWindow(FluxboxWindow &group, WinClient *ignore_client);
FocusedWindows &creationOrderList() { return m_creation_order_list; } FocusedWindows &creationOrderList() { return m_creation_order_list; }
FocusedWindows &focusedOrderList() { return m_focused_list; }
void removeClient(WinClient &client); void removeClient(WinClient &client);
void shutdown(); void shutdown();

View file

@ -641,8 +641,8 @@ void FluxboxWindow::attachClient(WinClient &client, int x, int y) {
// reparent client win to this frame // reparent client win to this frame
frame().setClientWindow(client); frame().setClientWindow(client);
WinClient *was_focused = 0; bool was_focused = false;
WinClient *focused_win = FocusControl::focusedWindow(); WinClient *focused_win = 0;
// get the current window on the end of our client list // get the current window on the end of our client list
Window leftwin = None; Window leftwin = None;
@ -654,19 +654,31 @@ void FluxboxWindow::attachClient(WinClient &client, int x, int y) {
if (client.fbwindow() != 0) { if (client.fbwindow() != 0) {
FluxboxWindow *old_win = client.fbwindow(); // store old window FluxboxWindow *old_win = client.fbwindow(); // store old window
ClientList::iterator client_insert_pos = getClientInsertPosition(x, y); // figure out which client to raise at the end
FbTk::TextButton *button_insert_pos = NULL; if (FocusControl::focusedFbWindow() == old_win) {
if (client_insert_pos != m_clientlist.end()) was_focused = true;
focused_win = FocusControl::focusedWindow();
} else if (FocusControl::focusedFbWindow() != this) {
FocusControl::FocusedWindows focus_list =
screen().focusControl().focusedOrderList();
FocusControl::FocusedWindows::iterator it = focus_list.begin();
for (; it != focus_list.end() && !focused_win; ++it) {
if ((*it)->fbwindow() == this || (*it)->fbwindow() == old_win)
focused_win = *it;
}
}
ClientList::iterator client_insert_pos = getClientInsertPosition(x, y);
FbTk::TextButton *button_insert_pos = NULL;
if (client_insert_pos != m_clientlist.end())
button_insert_pos = m_labelbuttons[*client_insert_pos]; button_insert_pos = m_labelbuttons[*client_insert_pos];
// make sure we set new window search for each client // make sure we set new window search for each client
ClientList::iterator client_it = old_win->clientList().begin(); ClientList::iterator client_it = old_win->clientList().begin();
ClientList::iterator client_it_end = old_win->clientList().end(); ClientList::iterator client_it_end = old_win->clientList().end();
for (; client_it != client_it_end; ++client_it) { for (; client_it != client_it_end; ++client_it) {
// reparent window to this // reparent window to this
frame().setClientWindow(**client_it); frame().setClientWindow(**client_it);
if ((*client_it) == focused_win)
was_focused = focused_win;
moveResizeClient(**client_it, moveResizeClient(**client_it,
frame().clientArea().x(), frame().clientArea().x(),
@ -679,7 +691,7 @@ void FluxboxWindow::attachClient(WinClient &client, int x, int y) {
associateClient(*(*client_it)); associateClient(*(*client_it));
//null if we want the new button at the end of the list //null if we want the new button at the end of the list
if (x >= 0 && button_insert_pos) if (x >= 0 && button_insert_pos)
frame().moveLabelButtonLeftOf(*m_labelbuttons[*client_it], *button_insert_pos); frame().moveLabelButtonLeftOf(*m_labelbuttons[*client_it], *button_insert_pos);
(*client_it)->saveBlackboxAttribs(m_blackbox_attrib); (*client_it)->saveBlackboxAttribs(m_blackbox_attrib);
@ -687,8 +699,8 @@ void FluxboxWindow::attachClient(WinClient &client, int x, int y) {
// add client and move over all attached clients // add client and move over all attached clients
// from the old window to this list // from the old window to this list
m_clientlist.splice(client_insert_pos, old_win->m_clientlist); m_clientlist.splice(client_insert_pos, old_win->m_clientlist);
updateClientLeftWindow(); updateClientLeftWindow();
old_win->m_client = 0; old_win->m_client = 0;
delete old_win; delete old_win;
@ -702,8 +714,10 @@ void FluxboxWindow::attachClient(WinClient &client, int x, int y) {
frame().clientArea().width(), frame().clientArea().width(),
frame().clientArea().height()); frame().clientArea().height());
if (&client == focused_win) if (&client == FocusControl::focusedWindow()) {
was_focused = focused_win; was_focused = true;
focused_win = &client;
}
client.saveBlackboxAttribs(m_blackbox_attrib); client.saveBlackboxAttribs(m_blackbox_attrib);
m_clientlist.push_back(&client); m_clientlist.push_back(&client);
@ -716,13 +730,15 @@ void FluxboxWindow::attachClient(WinClient &client, int x, int y) {
m_workspacesig.notify(); m_workspacesig.notify();
m_layersig.notify(); m_layersig.notify();
if (was_focused != 0) if (was_focused)
// already has focus, we're just assuming the state of the old window // already has focus, we're just assuming the state of the old window
FocusControl::setFocusedWindow(&client); FocusControl::setFocusedWindow(&client);
frame().reconfigure(); frame().reconfigure();
// keep the current window on top // keep the current window on top
if (focused_win)
m_client = focused_win;
m_client->raise(); m_client->raise();
} }
@ -777,6 +793,7 @@ bool FluxboxWindow::detachClient(WinClient &client) {
// m_client must be valid as there should be at least one other window // m_client must be valid as there should be at least one other window
// otherwise this wouldn't be here (refer numClients() <= 1 return) // otherwise this wouldn't be here (refer numClients() <= 1 return)
client.setFluxboxWindow(screen().createWindow(client)); client.setFluxboxWindow(screen().createWindow(client));
client.setGroupLeftWindow(None);
return true; return true;
} }