aboutsummaryrefslogtreecommitdiff
path: root/src/fluxbox.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/fluxbox.cc')
-rw-r--r--src/fluxbox.cc74
1 files changed, 30 insertions, 44 deletions
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index 324fb05..320aa93 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: fluxbox.cc,v 1.253 2004/09/11 12:33:14 rathnor Exp $ 25// $Id: fluxbox.cc,v 1.254 2004/09/11 13:38:58 fluxgen Exp $
26 26
27#include "fluxbox.hh" 27#include "fluxbox.hh"
28 28
@@ -1104,28 +1104,20 @@ void Fluxbox::handleButtonEvent(XButtonEvent &be) {
1104 screen->getRootmenu().hide(); 1104 screen->getRootmenu().hide();
1105 1105
1106 } else if (be.button == 2) { 1106 } else if (be.button == 2) {
1107 int mx = be.x_root - 1107 int borderw = screen->getWorkspacemenu().fbwindow().borderWidth();
1108 (screen->getWorkspacemenu().width() / 2); 1108 int head = screen->getHead(be.x_root, be.y_root);
1109 int my = be.y_root - 1109
1110 (screen->getWorkspacemenu().titleWindow().height() / 2); 1110 pair<int, int> m =
1111 1111 screen->clampToHead(head,
1112 if (mx < 0) mx = 0; 1112 be.x_root - (screen->getWorkspacemenu().width() / 2),
1113 if (my < 0) my = 0; 1113 be.y_root - (screen->getWorkspacemenu().titleWindow().height() / 2),
1114 1114 screen->getWorkspacemenu().width() + 2*borderw,
1115 if (mx + screen->getWorkspacemenu().width() > 1115 screen->getWorkspacemenu().height() + 2*borderw);
1116 screen->width()) { 1116 screen->getWorkspacemenu().move(m.first, m.second);
1117 mx = screen->width()-1 - 1117 screen->getWorkspacemenu().setScreen(screen->getHeadX(head),
1118 screen->getWorkspacemenu().width() - 1118 screen->getHeadY(head),
1119 2*screen->getWorkspacemenu().fbwindow().borderWidth(); 1119 screen->getHeadWidth(head),
1120 } 1120 screen->getHeadHeight(head));
1121
1122 if (my + screen->getWorkspacemenu().height() >
1123 screen->height()) {
1124 my = screen->height()-1 -
1125 screen->getWorkspacemenu().height() -
1126 2*screen->getWorkspacemenu().fbwindow().borderWidth();
1127 }
1128 screen->getWorkspacemenu().move(mx, my);
1129 1121
1130 if (! screen->getWorkspacemenu().isVisible()) { 1122 if (! screen->getWorkspacemenu().isVisible()) {
1131 screen->getWorkspacemenu().removeParent(); 1123 screen->getWorkspacemenu().removeParent();
@@ -1135,29 +1127,23 @@ void Fluxbox::handleButtonEvent(XButtonEvent &be) {
1135 } else if (be.button == 3) { 1127 } else if (be.button == 3) {
1136 //calculate placement of root menu 1128 //calculate placement of root menu
1137 //and show/hide it 1129 //and show/hide it
1138 int mx = be.x_root -
1139 (screen->getRootmenu().width() / 2);
1140 int my = be.y_root -
1141 (screen->getRootmenu().titleWindow().height() / 2);
1142 int borderw = screen->getRootmenu().fbwindow().borderWidth();
1143 1130
1144 if (mx < 0) mx = 0; 1131 int borderw = screen->getRootmenu().fbwindow().borderWidth();
1145 if (my < 0) my = 0; 1132 int head = screen->getHead(be.x_root, be.y_root);
1133
1134 pair<int, int> m =
1135 screen->clampToHead(head,
1136 be.x_root - (screen->getRootmenu().width() / 2),
1137 be.y_root - (screen->getRootmenu().titleWindow().height() / 2),
1138 screen->getRootmenu().width() + 2*borderw,
1139 screen->getRootmenu().height() + 2*borderw);
1140
1141 screen->getRootmenu().move(m.first, m.second);
1142 screen->getRootmenu().setScreen(screen->getHeadX(head),
1143 screen->getHeadY(head),
1144 screen->getHeadWidth(head),
1145 screen->getHeadHeight(head));
1146 1146
1147 if (mx + screen->getRootmenu().width() + 2*borderw > screen->width()) {
1148 mx = screen->width() -
1149 screen->getRootmenu().width() -
1150 2*borderw;
1151 }
1152
1153 if (my + screen->getRootmenu().height() + 2*borderw >
1154 screen->height()) {
1155 my = screen->height() -
1156 screen->getRootmenu().height() -
1157 2*borderw;
1158 }
1159 screen->getRootmenu().move(mx, my);
1160
1161 if (! screen->getRootmenu().isVisible()) { 1147 if (! screen->getRootmenu().isVisible()) {
1162 checkMenu(); 1148 checkMenu();
1163 screen->getRootmenu().show(); 1149 screen->getRootmenu().show();