aboutsummaryrefslogtreecommitdiff
path: root/src/FbWinFrame.cc
diff options
context:
space:
mode:
authorJulien Viard de Galbert <julien@vdg.blogsite.org>2012-11-06 20:04:57 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2012-11-07 08:41:49 (GMT)
commit5c5ad62846f9041684458c0ed38c4b135b7f294d (patch)
tree7543fbc124f1f7a175ef000f248129f85f06d9e5 /src/FbWinFrame.cc
parente8f2e964c6a88e357bbc09b66cd3490cf9eed5ef (diff)
downloadfluxbox-5c5ad62846f9041684458c0ed38c4b135b7f294d.zip
fluxbox-5c5ad62846f9041684458c0ed38c4b135b7f294d.tar.bz2
Adds the OnTab keyword for the keys file
Adding the following lines to the keys file restore the old behaviour to use Mouse2 on tabs to start tabbing, and keep OnTitlebar Mouse2 to lower the window. OnTab Mouse2 :StartTabbing OnTab Move1 :StartMoving Note: Internal tabs are triggering both OnTab and OnTitlebar events.
Diffstat (limited to 'src/FbWinFrame.cc')
-rw-r--r--src/FbWinFrame.cc49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc
index 53cecf7..937f87f 100644
--- a/src/FbWinFrame.cc
+++ b/src/FbWinFrame.cc
@@ -35,10 +35,13 @@
35#include "Screen.hh" 35#include "Screen.hh"
36#include "FocusableTheme.hh" 36#include "FocusableTheme.hh"
37#include "IconButton.hh" 37#include "IconButton.hh"
38#include "RectangleUtil.hh"
38 39
39#include <algorithm> 40#include <algorithm>
40#include <X11/X.h> 41#include <X11/X.h>
41 42
43#include "Keys.hh"
44
42using std::max; 45using std::max;
43using std::mem_fun; 46using std::mem_fun;
44using std::string; 47using std::string;
@@ -1727,3 +1730,49 @@ bool FbWinFrame::insideTitlebar(Window win) const {
1727 gripRight().window() != win && 1730 gripRight().window() != win &&
1728 window().window() != win; 1731 window().window() != win;
1729} 1732}
1733
1734int FbWinFrame::getContext(Window win, int x, int y, int last_x, int last_y, bool doBorders) {
1735 int context = 0;
1736 if (gripLeft().window() == win) return Keys::ON_LEFTGRIP;
1737 if (gripRight().window() == win) return Keys::ON_RIGHTGRIP;
1738 if (doBorders) {
1739 using RectangleUtil::insideBorder;
1740 int borderw = window().borderWidth();
1741 if ( // if mouse is currently on the window border, ignore it
1742 (
1743 ! insideBorder(window(), x, y, borderw)
1744 && ( externalTabMode()
1745 || ! insideBorder(tabcontainer(), x, y, borderw) )
1746 )
1747 || // or if mouse was on border when it was last clicked
1748 (
1749 ! insideBorder(window(), last_x, last_y, borderw)
1750 && ( externalTabMode()
1751 || ! insideBorder(tabcontainer(), last_x, last_y, borderw ) )
1752 )
1753 ) context = Keys::ON_WINDOWBORDER;
1754 }
1755
1756 if (window().window() == win) return context | Keys::ON_WINDOW;
1757 // /!\ old code: handle = titlebar in motionNotifyEvent but only there !
1758 // handle() as border ??
1759 if (handle().window() == win) return Keys::ON_WINDOWBORDER | Keys::ON_WINDOW;
1760 if (titlebar().window() == win) return context | Keys::ON_TITLEBAR;
1761 if (label().window() == win) return context | Keys::ON_TITLEBAR;
1762 // internal tabs are on title bar
1763 if (tabcontainer().window() == win)
1764 return context | Keys::ON_TAB | (externalTabMode()?0:Keys::ON_TITLEBAR);
1765
1766
1767 FbTk::Container::ItemList::iterator it = tabcontainer().begin();
1768 FbTk::Container::ItemList::iterator it_end = tabcontainer().end();
1769 for (; it != it_end; ++it) {
1770 if ((*it)->window() == win)
1771 break;
1772 }
1773 // internal tabs are on title bar
1774 if (it != it_end)
1775 return context | Keys::ON_TAB | (externalTabMode()?0:Keys::ON_TITLEBAR);
1776
1777 return context;
1778}