diff options
author | rathnor <rathnor> | 2003-05-08 15:06:59 (GMT) |
---|---|---|
committer | rathnor <rathnor> | 2003-05-08 15:06:59 (GMT) |
commit | 768613f3e0603b9b498619a9e289ab3329c32503 (patch) | |
tree | ed878b8e8f732f835a5b57fdbec7538807e07845 /src/Window.cc | |
parent | d926e4d968609389b4a7c890c60762e12ce457f1 (diff) | |
download | fluxbox_pavel-768613f3e0603b9b498619a9e289ab3329c32503.zip fluxbox_pavel-768613f3e0603b9b498619a9e289ab3329c32503.tar.bz2 |
fix sloppy focus for embedded tabs
Diffstat (limited to 'src/Window.cc')
-rw-r--r-- | src/Window.cc | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/src/Window.cc b/src/Window.cc index fb07764..c3cbfa5 100644 --- a/src/Window.cc +++ b/src/Window.cc | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Window.cc,v 1.163 2003/05/08 02:20:52 rathnor Exp $ | 25 | // $Id: Window.cc,v 1.164 2003/05/08 15:06:59 rathnor Exp $ |
26 | 26 | ||
27 | #include "Window.hh" | 27 | #include "Window.hh" |
28 | 28 | ||
@@ -344,7 +344,7 @@ void FluxboxWindow::init() { | |||
344 | FbTk::EventManager &evm = *FbTk::EventManager::instance(); | 344 | FbTk::EventManager &evm = *FbTk::EventManager::instance(); |
345 | // we need motion notify so we mask it | 345 | // we need motion notify so we mask it |
346 | btn->window().setEventMask(ExposureMask | ButtonPressMask | ButtonReleaseMask | | 346 | btn->window().setEventMask(ExposureMask | ButtonPressMask | ButtonReleaseMask | |
347 | ButtonMotionMask); | 347 | ButtonMotionMask | EnterWindowMask); |
348 | 348 | ||
349 | FbTk::RefCount<FbTk::Command> set_client_cmd(new SetClientCmd(*m_client)); | 349 | FbTk::RefCount<FbTk::Command> set_client_cmd(new SetClientCmd(*m_client)); |
350 | btn->setOnClick(set_client_cmd); | 350 | btn->setOnClick(set_client_cmd); |
@@ -552,7 +552,7 @@ void FluxboxWindow::attachClient(WinClient &client) { | |||
552 | btn->show(); | 552 | btn->show(); |
553 | // we need motion notify so we mask it | 553 | // we need motion notify so we mask it |
554 | btn->window().setEventMask(ExposureMask | ButtonPressMask | | 554 | btn->window().setEventMask(ExposureMask | ButtonPressMask | |
555 | ButtonReleaseMask | ButtonMotionMask); | 555 | ButtonReleaseMask | ButtonMotionMask | EnterWindowMask); |
556 | 556 | ||
557 | 557 | ||
558 | FbTk::RefCount<FbTk::Command> | 558 | FbTk::RefCount<FbTk::Command> |
@@ -2515,10 +2515,27 @@ void FluxboxWindow::enterNotifyEvent(XCrossingEvent &ev) { | |||
2515 | !isVisible()) { | 2515 | !isVisible()) { |
2516 | return; | 2516 | return; |
2517 | } | 2517 | } |
2518 | |||
2519 | WinClient *client = 0; | ||
2520 | // don't waste our time scanning if we aren't real sloppy focus | ||
2521 | if (screen.isSloppyFocus()) { | ||
2522 | // determine if we're in a label button (tab) | ||
2523 | Client2ButtonMap::iterator it = m_labelbuttons.begin(); | ||
2524 | Client2ButtonMap::iterator it_end = m_labelbuttons.end(); | ||
2525 | for (; it != it_end; ++it) { | ||
2526 | if ((*it).second->window() == ev.window) { | ||
2527 | client = (*it).first; | ||
2528 | break; | ||
2529 | } | ||
2530 | } | ||
2531 | } | ||
2518 | if (ev.window == frame().window() || | 2532 | if (ev.window == frame().window() || |
2519 | ev.window == m_client->window()) { | 2533 | ev.window == m_client->window() || |
2520 | if ((screen.isSloppyFocus() || screen.isSemiSloppyFocus()) | 2534 | client) { |
2521 | && !isFocused()) { | 2535 | if ((screen.isSloppyFocus() || screen.isSemiSloppyFocus()) |
2536 | && !isFocused() || | ||
2537 | // or, we are focused, but it isn't the one we want | ||
2538 | client && screen.isSloppyFocus() && (m_client != client)) { | ||
2522 | 2539 | ||
2523 | // check that there aren't any subsequent leave notify events in the | 2540 | // check that there aren't any subsequent leave notify events in the |
2524 | // X event queue | 2541 | // X event queue |
@@ -2527,8 +2544,10 @@ void FluxboxWindow::enterNotifyEvent(XCrossingEvent &ev) { | |||
2527 | sa.w = ev.window; | 2544 | sa.w = ev.window; |
2528 | sa.enter = sa.leave = False; | 2545 | sa.enter = sa.leave = False; |
2529 | XCheckIfEvent(display, &dummy, queueScanner, (char *) &sa); | 2546 | XCheckIfEvent(display, &dummy, queueScanner, (char *) &sa); |
2530 | 2547 | ||
2531 | if ((!sa.leave || sa.inferior) && setInputFocus()) | 2548 | // if client is set, use setCurrent client, otherwise just setInputFocus |
2549 | if ((!sa.leave || sa.inferior) && | ||
2550 | ((client && setCurrentClient(*client, true)) || setInputFocus())) | ||
2532 | installColormap(True); | 2551 | installColormap(True); |
2533 | } | 2552 | } |
2534 | } | 2553 | } |