From 63ac5deee691f7b528399c0f03e100e983a8cb55 Mon Sep 17 00:00:00 2001 From: rathnor Date: Sun, 27 Apr 2003 14:36:05 +0000 Subject: fix nextFocus problem with tabbed windows --- src/Screen.cc | 33 ++++++++++++++++++++++++++++++--- src/Screen.hh | 3 ++- src/Window.cc | 48 +++++++++++++++++++----------------------------- src/Window.hh | 4 ++-- 4 files changed, 53 insertions(+), 35 deletions(-) diff --git a/src/Screen.cc b/src/Screen.cc index 8e5e830..8712fa3 100644 --- a/src/Screen.cc +++ b/src/Screen.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.138 2003/04/26 18:27:01 fluxgen Exp $ +// $Id: Screen.cc,v 1.139 2003/04/27 14:36:03 rathnor Exp $ #include "Screen.hh" @@ -500,6 +500,7 @@ BScreen::BScreen(ResourceManager &rm, m_currentworkspace_sig(*this), // current workspace signal m_layermanager(num_layers), cycling_focus(false), + cycling_last(0), m_windowtheme(new FbWinFrameTheme(scrn)), m_menutheme(new FbTk::MenuTheme(scrn)), resource(rm, screenname, altscreenname), @@ -1474,6 +1475,7 @@ void BScreen::nextFocus(int opts) { if (!cycling_focus) { cycling_focus = True; cycling_window = focused_list.begin(); + cycling_last = 0; } else { // already cycling, so restack to put windows back in their proper order m_layermanager.restack(); @@ -1498,7 +1500,18 @@ void BScreen::nextFocus(int opts) { (fbwin->isStuck() || fbwin->getWorkspaceNumber() == getCurrentWorkspaceID())) { // either on this workspace, or stuck - if (! (doSkipWindow(fbwin, opts) || !fbwin->setInputFocus()) ) { + + // keep track of the originally selected window in a set + WinClient &last_client = fbwin->winClient(); + + if (! (doSkipWindow(fbwin, opts) || !fbwin->setCurrentClient(**it)) ) { + // moved onto a new fbwin + if (!cycling_last || cycling_last->fbwindow() != fbwin) { + if (cycling_last) + // set back to orig current Client in that fbwin + cycling_last->fbwindow()->setCurrentClient(*cycling_last, false); + cycling_last = &last_client; + } fbwin->tempRaise(); break; } @@ -1552,6 +1565,7 @@ void BScreen::prevFocus(int opts) { if (!cycling_focus) { cycling_focus = True; cycling_window = focused_list.end(); + cycling_last = 0; } else { // already cycling, so restack to put windows back in their proper order m_layermanager.restack(); @@ -1577,7 +1591,19 @@ void BScreen::prevFocus(int opts) { (fbwin->isStuck() || fbwin->getWorkspaceNumber() == getCurrentWorkspaceID())) { // either on this workspace, or stuck - if (! (doSkipWindow(fbwin, opts) || !fbwin->setInputFocus()) ) { + + // keep track of the originally selected window in a set + WinClient &last_client = fbwin->winClient(); + + + if (! (doSkipWindow(fbwin, opts) || !fbwin->setCurrentClient(**it)) ) { + // moved onto a new fbwin + if (!cycling_last || cycling_last->fbwindow() != fbwin) { + if (cycling_last) + // set back to orig current Client in that fbwin + cycling_last->fbwindow()->setCurrentClient(*cycling_last, false); + cycling_last = &last_client; + } fbwin->tempRaise(); break; } @@ -2389,6 +2415,7 @@ bool BScreen::doSkipWindow(const FluxboxWindow *w, int opts) { void BScreen::notifyReleasedKeys(XKeyEvent &ke) { if (cycling_focus) { cycling_focus = false; + cycling_last = 0; // put currently focused window to top WinClient *client = *cycling_window; focused_list.erase(cycling_window); diff --git a/src/Screen.hh b/src/Screen.hh index e048b27..39c32fb 100644 --- a/src/Screen.hh +++ b/src/Screen.hh @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Screen.hh,v 1.87 2003/04/26 14:47:40 fluxgen Exp $ +// $Id: Screen.hh,v 1.88 2003/04/27 14:36:04 rathnor Exp $ #ifndef SCREEN_HH #define SCREEN_HH @@ -357,6 +357,7 @@ private: // Screen global so it works for sticky windows too. FocusedWindows focused_list; FocusedWindows::iterator cycling_window; + WinClient *cycling_last; std::auto_ptr m_slit; diff --git a/src/Window.cc b/src/Window.cc index 5c40cc0..01f99f4 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -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.152 2003/04/27 12:31:43 fluxgen Exp $ +// $Id: Window.cc,v 1.153 2003/04/27 14:36:04 rathnor Exp $ #include "Window.hh" @@ -702,16 +702,15 @@ void FluxboxWindow::prevClient() { setInputFocus(); } -void FluxboxWindow::setCurrentClient(WinClient &client) { +bool FluxboxWindow::setCurrentClient(WinClient &client, bool setinput) { // make sure it's in our list if (client.m_win != this) - return; + return false; m_client = &client; m_client->raise(); - Fluxbox::instance()->setFocusedWindow(this); m_frame.setLabelButtonFocus(*m_labelbuttons[m_client]); - setInputFocus(); + return setinput && setInputFocus(); } bool FluxboxWindow::isGroupable() const { @@ -2321,21 +2320,15 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) { doSnapping(dx, dy); if (! screen.doOpaqueMove()) { - XDrawRectangle(display, screen.getRootWindow(), - screen.rootTheme().opGC(), + XDrawRectangle(display, screen.getRootWindow(), screen.rootTheme().opGC(), last_move_x, last_move_y, - m_frame.width() + - 2*frame().window().borderWidth() - 1, - m_frame.height() + - 2*frame().window().borderWidth() - 1); + m_frame.width() + 2*frame().window().borderWidth()-1, + m_frame.height() + 2*frame().window().borderWidth()-1); - XDrawRectangle(display, screen.getRootWindow(), - screen.rootTheme().opGC(), + XDrawRectangle(display, screen.getRootWindow(), screen.rootTheme().opGC(), dx, dy, - m_frame.width() + - 2*frame().window().borderWidth()-1, - m_frame.height() + - 2*frame().window().borderWidth()-1); + m_frame.width() + 2*frame().window().borderWidth()-1, + m_frame.height() + 2*frame().window().borderWidth()-1); last_move_x = dx; last_move_y = dy; } else { @@ -2356,8 +2349,7 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) { startResizing(me.window, me.x, me.y, left); } else if (resizing) { // draw over old rect - XDrawRectangle(display, screen.getRootWindow(), - screen.rootTheme().opGC(), + XDrawRectangle(display, screen.getRootWindow(), screen.rootTheme().opGC(), last_resize_x, last_resize_y, last_resize_w - 1 + 2 * m_frame.window().borderWidth(), last_resize_h - 1 + 2 * m_frame.window().borderWidth()); @@ -2385,8 +2377,7 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) { } // draw resize rectangle - XDrawRectangle(display, screen.getRootWindow(), - screen.rootTheme().opGC(), + XDrawRectangle(display, screen.getRootWindow(), screen.rootTheme().opGC(), last_resize_x, last_resize_y, last_resize_w - 1 + 2 * m_frame.window().borderWidth(), last_resize_h - 1 + 2 * m_frame.window().borderWidth()); @@ -2477,6 +2468,7 @@ void FluxboxWindow::enterNotifyEvent(XCrossingEvent &ev) { ev.window == m_client->window()) { if ((screen.isSloppyFocus() || screen.isSemiSloppyFocus()) && !isFocused()) { + // check that there aren't any subsequent leave notify events in the // X event queue @@ -2488,6 +2480,7 @@ void FluxboxWindow::enterNotifyEvent(XCrossingEvent &ev) { if ((!sa.leave || sa.inferior) && setInputFocus()) installColormap(True); + } } @@ -2653,18 +2646,15 @@ void FluxboxWindow::stopMoving() { if (! screen.doOpaqueMove()) { - XDrawRectangle(FbTk::App::instance()->display(), - screen.getRootWindow(), screen.rootTheme().opGC(), + XDrawRectangle(FbTk::App::instance()->display(), screen.getRootWindow(), screen.rootTheme().opGC(), last_move_x, last_move_y, - frame().width() + 2*frame().window().borderWidth() - 1, - frame().height() + 2*frame().window().borderWidth() - 1); - + frame().width() + 2*frame().window().borderWidth()-1, + frame().height() + 2*frame().window().borderWidth()-1); moveResize(last_move_x, last_move_y, m_frame.width(), m_frame.height()); - if (workspace_number != getScreen().getCurrentWorkspaceID()) { - deiconify(true, false); + screen.reassociateWindow(this, getScreen().getCurrentWorkspaceID(), true); + m_frame.show(); } - fluxbox->ungrab(); } else moveResize(m_frame.x(), m_frame.y(), m_frame.width(), m_frame.height()); diff --git a/src/Window.hh b/src/Window.hh index 0f8053f..cbeb6ac 100644 --- a/src/Window.hh +++ b/src/Window.hh @@ -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.63 2003/04/26 14:05:47 rathnor Exp $ +// $Id: Window.hh,v 1.64 2003/04/27 14:36:05 rathnor Exp $ #ifndef WINDOW_HH #define WINDOW_HH @@ -124,7 +124,7 @@ public: /// remove client from client list bool removeClient(WinClient &client); /// set new current client and raise it - void setCurrentClient(WinClient &client); + bool setCurrentClient(WinClient &client, bool setinput = true); WinClient *findClient(Window win); void nextClient(); void prevClient(); -- cgit v0.11.2