Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 290649 | Differences between
and this patch

Collapse All | Expand All

(-)a/nls/fluxbox-nls.hh (+1 lines)
Lines 84-89 enum { Link Here
84
        ConfigmenuMaxIgnoreInc = 27,
84
        ConfigmenuMaxIgnoreInc = 27,
85
        ConfigmenuMaxDisableMove = 28,
85
        ConfigmenuMaxDisableMove = 28,
86
        ConfigmenuMaxDisableResize = 29,
86
        ConfigmenuMaxDisableResize = 29,
87
	ConfigmenuStrictMouseFocus = 30,
87
88
88
	EwmhSet = 5,
89
	EwmhSet = 5,
89
	EwmhOutOfMemoryClientList = 1,
90
	EwmhOutOfMemoryClientList = 1,
(-)a/src/ClientMenu.cc (-1 / +6 lines)
Lines 25-30 Link Here
25
#include "Screen.hh"
25
#include "Screen.hh"
26
#include "Window.hh"
26
#include "Window.hh"
27
#include "WindowCmd.hh"
27
#include "WindowCmd.hh"
28
#include "FocusControl.hh"
28
#include <X11/keysym.h>
29
#include <X11/keysym.h>
29
30
30
#include "FbTk/MenuItem.hh"
31
#include "FbTk/MenuItem.hh"
Lines 53-60 public: Link Here
53
54
54
        m_client.focus();
55
        m_client.focus();
55
        fbwin->raise();
56
        fbwin->raise();
56
        if ((mods & ControlMask) == 0)
57
        if ((mods & ControlMask) == 0) {
58
            // Ignore any focus changes due to this menu closing
59
            // (even in StrictMouseFocus mode)
60
            m_client.screen().focusControl().ignoreAtPointer(true);
57
            parent->hide();
61
            parent->hide();
62
        }
58
    }
63
    }
59
64
60
    const std::string &label() const { return m_client.title(); }
65
    const std::string &label() const { return m_client.title(); }
(-)a/src/FocusControl.cc (-5 / +19 lines)
Lines 401-421 void FocusControl::dirFocus(FluxboxWindow &win, FocusDir dir) { Link Here
401
401
402
}
402
}
403
403
404
void FocusControl::ignoreAtPointer()
404
void FocusControl::ignoreAtPointer(bool force)
405
{
405
{
406
    int ignore_i;
406
    int ignore_i, ignore_x, ignore_y;
407
    unsigned int ignore_ui;
407
    unsigned int ignore_ui;
408
    Window ignore_w;
408
    Window ignore_w;
409
409
410
    XQueryPointer(m_screen.rootWindow().display(),
410
    XQueryPointer(m_screen.rootWindow().display(),
411
        m_screen.rootWindow().window(), &ignore_w, &ignore_w,
411
        m_screen.rootWindow().window(), &ignore_w, &ignore_w,
412
        &m_ignore_mouse_x, &m_ignore_mouse_y,
412
        &ignore_x, &ignore_y,
413
        &ignore_i, &ignore_i, &ignore_ui);
413
        &ignore_i, &ignore_i, &ignore_ui);
414
415
    this->ignoreAt(ignore_x, ignore_y, force);
416
}
417
418
void FocusControl::ignoreAt(int x, int y, bool force)
419
{
420
	if (force || this->focusModel() == MOUSEFOCUS) {
421
		m_ignore_mouse_x = x; m_ignore_mouse_y = y;
422
	}
414
}
423
}
415
424
416
void FocusControl::ignoreAt(int x, int y)
425
void FocusControl::ignoreCancel()
417
{
426
{
418
    m_ignore_mouse_x = x; m_ignore_mouse_y = y;
427
	m_ignore_mouse_x = m_ignore_mouse_y = -1;
419
}
428
}
420
429
421
bool FocusControl::isIgnored(int x, int y)
430
bool FocusControl::isIgnored(int x, int y)
Lines 489-494 void FocusControl::revertFocus(BScreen &screen) { Link Here
489
        else {
498
        else {
490
            switch (screen.focusControl().focusModel()) {
499
            switch (screen.focusControl().focusModel()) {
491
            case FocusControl::MOUSEFOCUS:
500
            case FocusControl::MOUSEFOCUS:
501
            case FocusControl::STRICTMOUSEFOCUS:
492
                XSetInputFocus(screen.rootWindow().display(),
502
                XSetInputFocus(screen.rootWindow().display(),
493
                               PointerRoot, None, CurrentTime);
503
                               PointerRoot, None, CurrentTime);
494
                break;
504
                break;
Lines 594-599 std::string FbTk::Resource<FocusControl::FocusModel>::getString() const { Link Here
594
    switch (m_value) {
604
    switch (m_value) {
595
    case FocusControl::MOUSEFOCUS:
605
    case FocusControl::MOUSEFOCUS:
596
        return string("MouseFocus");
606
        return string("MouseFocus");
607
    case FocusControl::STRICTMOUSEFOCUS:
608
        return string("StrictMouseFocus");
597
    case FocusControl::CLICKFOCUS:
609
    case FocusControl::CLICKFOCUS:
598
        return string("ClickFocus");
610
        return string("ClickFocus");
599
    }
611
    }
Lines 606-611 void FbTk::Resource<FocusControl::FocusModel>:: Link Here
606
setFromString(char const *strval) {
618
setFromString(char const *strval) {
607
    if (strcasecmp(strval, "MouseFocus") == 0) 
619
    if (strcasecmp(strval, "MouseFocus") == 0) 
608
        m_value = FocusControl::MOUSEFOCUS;
620
        m_value = FocusControl::MOUSEFOCUS;
621
    else if (strcasecmp(strval, "StrictMouseFocus") == 0)
622
        m_value = FocusControl::STRICTMOUSEFOCUS;
609
    else if (strcasecmp(strval, "ClickToFocus") == 0) 
623
    else if (strcasecmp(strval, "ClickToFocus") == 0) 
610
        m_value = FocusControl::CLICKFOCUS;
624
        m_value = FocusControl::CLICKFOCUS;
611
    else
625
    else
(-)a/src/FocusControl.hh (-5 / +12 lines)
Lines 42-49 public: Link Here
42
    typedef std::list<Focusable *> Focusables;
42
    typedef std::list<Focusable *> Focusables;
43
    /// main focus model
43
    /// main focus model
44
    enum FocusModel { 
44
    enum FocusModel { 
45
        MOUSEFOCUS = 0, ///< focus follows mouse
45
        MOUSEFOCUS = 0,  ///< focus follows mouse, but only when the mouse is moving
46
        CLICKFOCUS      ///< focus on click
46
        CLICKFOCUS,      ///< focus on click
47
        STRICTMOUSEFOCUS ///< focus always follows mouse, even when stationary
47
    };
48
    };
48
    /// focus model for tabs
49
    /// focus model for tabs
49
    enum TabFocusModel { 
50
    enum TabFocusModel { 
Lines 90-103 public: Link Here
90
     */
91
     */
91
    void dirFocus(FluxboxWindow &win, FocusDir dir);
92
    void dirFocus(FluxboxWindow &win, FocusDir dir);
92
    /// @return true if focus mode is mouse focus
93
    /// @return true if focus mode is mouse focus
93
    bool isMouseFocus() const { return focusModel() == MOUSEFOCUS; }
94
    bool isMouseFocus() const { return focusModel() != CLICKFOCUS; }
94
    /// @return true if tab focus mode is mouse tab focus
95
    /// @return true if tab focus mode is mouse tab focus
95
    bool isMouseTabFocus() const { return tabFocusModel() == MOUSETABFOCUS; }
96
    bool isMouseTabFocus() const { return tabFocusModel() == MOUSETABFOCUS; }
96
97
97
    /// Set the "ignore" pointer location to the current pointer location
98
    /// Set the "ignore" pointer location to the current pointer location
98
    void ignoreAtPointer();
99
    /// @param force If true, ignore even in StrictMouseFocus mode
100
    void ignoreAtPointer(bool force = false);
99
    /// Set the "ignore" pointer location to the given coordinates
101
    /// Set the "ignore" pointer location to the given coordinates
100
    void ignoreAt(int x, int y);
102
    /// @param x Current X position of the pointer
103
    /// @param y Current Y position of the pointer
104
    /// @param force If true, ignore even in StrictMouseFocus mode
105
    void ignoreAt(int x, int y, bool force = false);
106
    /// unset the "ignore" pointer location
107
    void ignoreCancel();
101
    /// @return true if events at the given X/Y coordinate should be ignored
108
    /// @return true if events at the given X/Y coordinate should be ignored
102
    /// (ie, they were previously cached via one of the ignoreAt calls)
109
    /// (ie, they were previously cached via one of the ignoreAt calls)
103
    bool isIgnored(int x, int y);
110
    bool isIgnored(int x, int y);
(-)a/src/Screen.cc (-1 / +6 lines)
Lines 1554-1561 void BScreen::setupConfigmenu(FbTk::Menu &menu) { Link Here
1554
               "Click To Focus", "Click to focus",
1554
               "Click To Focus", "Click to focus",
1555
               FocusControl::CLICKFOCUS);
1555
               FocusControl::CLICKFOCUS);
1556
    _FOCUSITEM(Configmenu, MouseFocus,
1556
    _FOCUSITEM(Configmenu, MouseFocus,
1557
               "Mouse Focus", "Mouse Focus",
1557
               "Mouse Focus (Keyboard Friendly)",
1558
               "Mouse Focus (Keyboard Friendly)",
1558
               FocusControl::MOUSEFOCUS);
1559
               FocusControl::MOUSEFOCUS);
1560
    _FOCUSITEM(Configmenu, StrictMouseFocus,
1561
               "Mouse Focus (Strict)",
1562
               "Mouse Focus (Strict)",
1563
               FocusControl::STRICTMOUSEFOCUS);
1559
#undef _FOCUSITEM
1564
#undef _FOCUSITEM
1560
1565
1561
    focus_menu->insert(new FbTk::MenuSeparator());
1566
    focus_menu->insert(new FbTk::MenuSeparator());

Return to bug 290649