aboutsummaryrefslogtreecommitdiff
path: root/src/ToolFactory.cc
diff options
context:
space:
mode:
authorMathias Gumz <akira at fluxbox dot org>2011-02-24 10:21:16 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2011-02-24 10:21:16 (GMT)
commitf0ffaf890f65d9902ba23e2cd019de5ddba071c5 (patch)
treeecfbba4c6b1f60f5f3d259c8d9e2ef77ec261d54 /src/ToolFactory.cc
parent49623390b623bcf4851e5cdd972e4c37d5103ecf (diff)
downloadfluxbox-f0ffaf890f65d9902ba23e2cd019de5ddba071c5.zip
fluxbox-f0ffaf890f65d9902ba23e2cd019de5ddba071c5.tar.bz2
moved Menu placement into ScreenPlacement::placeAndShowMenu()
Diffstat (limited to 'src/ToolFactory.cc')
-rw-r--r--src/ToolFactory.cc25
1 files changed, 7 insertions, 18 deletions
diff --git a/src/ToolFactory.cc b/src/ToolFactory.cc
index 84184eb..b998a88 100644
--- a/src/ToolFactory.cc
+++ b/src/ToolFactory.cc
@@ -35,32 +35,21 @@
35 35
36#include "FbTk/CommandParser.hh" 36#include "FbTk/CommandParser.hh"
37#include "Screen.hh" 37#include "Screen.hh"
38#include "ScreenPlacement.hh"
38#include "Toolbar.hh" 39#include "Toolbar.hh"
39#include "fluxbox.hh" 40#include "fluxbox.hh"
40 41
41#include <utility>
42
43namespace { 42namespace {
44class ShowMenuAboveToolbar: public FbTk::Command<void> { 43class ShowMenuAboveToolbar: public FbTk::Command<void> {
45public: 44public:
46 explicit ShowMenuAboveToolbar(Toolbar &tbar):m_tbar(tbar) { } 45 explicit ShowMenuAboveToolbar(Toolbar &tbar):m_tbar(tbar) { }
47 void execute() { 46 void execute() {
48 // get last button pos 47
49 const XEvent &event = Fluxbox::instance()->lastEvent(); 48 const XEvent& e= Fluxbox::instance()->lastEvent();
50 int head = m_tbar.screen().getHead(event.xbutton.x_root, event.xbutton.y_root); 49
51 std::pair<int, int> m = 50 m_tbar.screen()
52 m_tbar.screen().clampToHead( head, 51 .placementStrategy()
53 event.xbutton.x_root - (m_tbar.menu().width() / 2), 52 .placeAndShowMenu(m_tbar.menu(), e.xbutton.x_root, e.xbutton.y_root, false);
54 event.xbutton.y_root - (m_tbar.menu().height() / 2),
55 m_tbar.menu().width(),
56 m_tbar.menu().height());
57 m_tbar.menu().setScreen(m_tbar.screen().getHeadX(head),
58 m_tbar.screen().getHeadY(head),
59 m_tbar.screen().getHeadWidth(head),
60 m_tbar.screen().getHeadHeight(head));
61 m_tbar.menu().move(m.first, m.second);
62 m_tbar.menu().show();
63 m_tbar.menu().grabInputFocus();
64 } 53 }
65private: 54private:
66 Toolbar &m_tbar; 55 Toolbar &m_tbar;