aboutsummaryrefslogtreecommitdiff
path: root/src/ToolFactory.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2004-09-11 13:45:16 (GMT)
committerfluxgen <fluxgen>2004-09-11 13:45:16 (GMT)
commit768d98a39d3640f24ebe13e2c304fac3436a0a0d (patch)
tree3a5a60b06c4c2f3ba2e98e59c288c99ae93527b9 /src/ToolFactory.cc
parent37757769634c836895d205b0a5149ffffaae9bfb (diff)
downloadfluxbox_pavel-768d98a39d3640f24ebe13e2c304fac3436a0a0d.zip
fluxbox_pavel-768d98a39d3640f24ebe13e2c304fac3436a0a0d.tar.bz2
head specific strut, patch from Mathieu De Zutter
Diffstat (limited to 'src/ToolFactory.cc')
-rw-r--r--src/ToolFactory.cc30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/ToolFactory.cc b/src/ToolFactory.cc
index b897e43..6c1d4f8 100644
--- a/src/ToolFactory.cc
+++ b/src/ToolFactory.cc
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: ToolFactory.cc,v 1.7 2004/08/27 14:36:12 rathnor Exp $ 22// $Id: ToolFactory.cc,v 1.8 2004/09/11 13:40:57 fluxgen Exp $
23 23
24#include "ToolFactory.hh" 24#include "ToolFactory.hh"
25 25
@@ -43,6 +43,8 @@
43 43
44#include "FbTk/FbWindow.hh" 44#include "FbTk/FbWindow.hh"
45 45
46#include <utility>
47
46namespace { 48namespace {
47class ShowMenuAboveToolbar: public FbTk::Command { 49class ShowMenuAboveToolbar: public FbTk::Command {
48public: 50public:
@@ -51,20 +53,18 @@ public:
51 m_tbar.screen().hideMenus(); 53 m_tbar.screen().hideMenus();
52 // get last button pos 54 // get last button pos
53 const XEvent &event = Fluxbox::instance()->lastEvent(); 55 const XEvent &event = Fluxbox::instance()->lastEvent();
54 int x = event.xbutton.x_root - (m_tbar.menu().width() / 2); 56 int head = m_tbar.screen().getHead(event.xbutton.x_root, event.xbutton.y_root);
55 int y = event.xbutton.y_root - (m_tbar.menu().height() / 2); 57 std::pair<int, int> m =
56 58 m_tbar.screen().clampToHead( head,
57 if (x < 0) 59 event.xbutton.x_root - (m_tbar.menu().width() / 2),
58 x = 0; 60 event.xbutton.y_root - (m_tbar.menu().height() / 2),
59 else if (x + m_tbar.menu().width() > m_tbar.screen().width()) 61 m_tbar.menu().width(),
60 x = m_tbar.screen().width() - m_tbar.menu().width(); 62 m_tbar.menu().height());
61 63 m_tbar.menu().setScreen(m_tbar.screen().getHeadX(head),
62 if (y < 0) 64 m_tbar.screen().getHeadY(head),
63 y = 0; 65 m_tbar.screen().getHeadWidth(head),
64 else if (y + m_tbar.menu().height() > m_tbar.screen().height()) 66 m_tbar.screen().getHeadHeight(head));
65 y = m_tbar.screen().height() - m_tbar.menu().height(); 67 m_tbar.menu().move(m.first, m.second);
66
67 m_tbar.menu().move(x, y);
68 m_tbar.menu().show(); 68 m_tbar.menu().show();
69 } 69 }
70private: 70private: