diff options
Diffstat (limited to 'src/FbCommands.cc')
-rw-r--r-- | src/FbCommands.cc | 40 |
1 files changed, 12 insertions, 28 deletions
diff --git a/src/FbCommands.cc b/src/FbCommands.cc index 4dffd8d..be52e47 100644 --- a/src/FbCommands.cc +++ b/src/FbCommands.cc | |||
@@ -22,6 +22,7 @@ | |||
22 | #include "FbCommands.hh" | 22 | #include "FbCommands.hh" |
23 | #include "fluxbox.hh" | 23 | #include "fluxbox.hh" |
24 | #include "Screen.hh" | 24 | #include "Screen.hh" |
25 | #include "ScreenPlacement.hh" | ||
25 | #include "CommandDialog.hh" | 26 | #include "CommandDialog.hh" |
26 | #include "FocusControl.hh" | 27 | #include "FocusControl.hh" |
27 | #include "Workspace.hh" | 28 | #include "Workspace.hh" |
@@ -71,7 +72,7 @@ using std::ios; | |||
71 | 72 | ||
72 | namespace { | 73 | namespace { |
73 | 74 | ||
74 | void showMenu(const BScreen &screen, FbTk::Menu &menu) { | 75 | void showMenu(BScreen &screen, FbTk::Menu &menu) { |
75 | 76 | ||
76 | // check if menu has changed | 77 | // check if menu has changed |
77 | if (typeid(menu) == typeid(FbMenu)) { | 78 | if (typeid(menu) == typeid(FbMenu)) { |
@@ -82,36 +83,19 @@ void showMenu(const BScreen &screen, FbTk::Menu &menu) { | |||
82 | 83 | ||
83 | FbMenu::setWindow(FocusControl::focusedFbWindow()); | 84 | FbMenu::setWindow(FocusControl::focusedFbWindow()); |
84 | 85 | ||
85 | Window root_ret; // not used | 86 | Window ignored_w; |
86 | Window window_ret; // not used | 87 | int ignored_i; |
88 | unsigned int ignored_ui; | ||
87 | 89 | ||
88 | int rx = 0, ry = 0; | 90 | int x = 0; |
89 | int wx, wy; // not used | 91 | int y = 0; |
90 | unsigned int mask; // not used | ||
91 | 92 | ||
92 | XQueryPointer(menu.fbwindow().display(), | 93 | XQueryPointer(menu.fbwindow().display(), |
93 | screen.rootWindow().window(), &root_ret, &window_ret, | 94 | screen.rootWindow().window(), &ignored_w, &ignored_w, |
94 | &rx, &ry, &wx, &wy, &mask); | 95 | &x, &y, &ignored_i, &ignored_i, &ignored_ui); |
95 | 96 | ||
96 | int borderw = menu.fbwindow().borderWidth(); | 97 | screen.placementStrategy() |
97 | int head = screen.getHead(rx, ry); | 98 | .placeAndShowMenu(menu, x, y, false); |
98 | |||
99 | menu.updateMenu(); | ||
100 | pair<int, int> m = | ||
101 | screen.clampToHead(head, | ||
102 | rx - menu.width() / 2, | ||
103 | ry - menu.titleWindow().height() / 2, | ||
104 | menu.width() + 2*borderw, | ||
105 | menu.height() + 2*borderw); | ||
106 | |||
107 | menu.move(m.first, m.second); | ||
108 | menu.setScreen(screen.getHeadX(head), | ||
109 | screen.getHeadY(head), | ||
110 | screen.getHeadWidth(head), | ||
111 | screen.getHeadHeight(head)); | ||
112 | |||
113 | menu.show(); | ||
114 | menu.grabInputFocus(); | ||
115 | } | 99 | } |
116 | 100 | ||
117 | } | 101 | } |