diff options
author | rathnor <rathnor> | 2003-10-06 09:55:36 (GMT) |
---|---|---|
committer | rathnor <rathnor> | 2003-10-06 09:55:36 (GMT) |
commit | 29a69a69c1a2f51d6fb790534a0da8683ee24eb9 (patch) | |
tree | f8bfad0fedfd125933f2f9b2734e1706ef794dc0 | |
parent | e5dd3d2e85b55931003583ede06fec57c2caaa95 (diff) | |
download | fluxbox-29a69a69c1a2f51d6fb790534a0da8683ee24eb9.zip fluxbox-29a69a69c1a2f51d6fb790534a0da8683ee24eb9.tar.bz2 |
minor menu positioning tweaks
-rw-r--r-- | src/FbTk/Menu.cc | 12 | ||||
-rw-r--r-- | src/fluxbox.cc | 23 |
2 files changed, 18 insertions, 17 deletions
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc index 199fa77..ebaea3b 100644 --- a/src/FbTk/Menu.cc +++ b/src/FbTk/Menu.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: Menu.cc,v 1.38 2003/09/07 14:57:49 rathnor Exp $ | 25 | // $Id: Menu.cc,v 1.39 2003/10/06 09:55:36 rathnor Exp $ |
26 | 26 | ||
27 | //use GNU extensions | 27 | //use GNU extensions |
28 | #ifndef _GNU_SOURCE | 28 | #ifndef _GNU_SOURCE |
@@ -1231,18 +1231,18 @@ void Menu::enterNotifyEvent(XCrossingEvent &ce) { | |||
1231 | 1231 | ||
1232 | menu.x_shift = menu.x, menu.y_shift = menu.y; | 1232 | menu.x_shift = menu.x, menu.y_shift = menu.y; |
1233 | if (menu.x + menu.width > m_screen_width) { | 1233 | if (menu.x + menu.width > m_screen_width) { |
1234 | menu.x_shift = m_screen_width - menu.width - m_border_width; | 1234 | menu.x_shift = m_screen_width - menu.width - 2*m_border_width; |
1235 | shifted = true; | 1235 | shifted = true; |
1236 | } else if (menu.x < 0) { | 1236 | } else if (menu.x < 0) { |
1237 | menu.x_shift = -m_border_width; | 1237 | menu.x_shift = 0; //-m_border_width; |
1238 | shifted = true; | 1238 | shifted = true; |
1239 | } | 1239 | } |
1240 | 1240 | ||
1241 | if (menu.y + menu.height > m_screen_height) { | 1241 | if (menu.y + menu.height + 2*m_border_width > m_screen_height) { |
1242 | menu.y_shift = m_screen_height - menu.height - m_border_width; | 1242 | menu.y_shift = m_screen_height - menu.height - 2*m_border_width; |
1243 | shifted = true; | 1243 | shifted = true; |
1244 | } else if (menu.y + (signed) menu.title_h < 0) { | 1244 | } else if (menu.y + (signed) menu.title_h < 0) { |
1245 | menu.y_shift = -m_border_width;; | 1245 | menu.y_shift = 0; // -m_border_width;; |
1246 | shifted = true; | 1246 | shifted = true; |
1247 | } | 1247 | } |
1248 | 1248 | ||
diff --git a/src/fluxbox.cc b/src/fluxbox.cc index bc985a7..957ea15 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.196 2003/10/05 07:19:38 rathnor Exp $ | 25 | // $Id: fluxbox.cc,v 1.197 2003/10/06 09:55:36 rathnor Exp $ |
26 | 26 | ||
27 | #include "fluxbox.hh" | 27 | #include "fluxbox.hh" |
28 | 28 | ||
@@ -989,16 +989,16 @@ void Fluxbox::handleButtonEvent(XButtonEvent &be) { | |||
989 | 989 | ||
990 | if (mx + screen->getWorkspacemenu()->width() > | 990 | if (mx + screen->getWorkspacemenu()->width() > |
991 | screen->width()) { | 991 | screen->width()) { |
992 | mx = screen->width() - | 992 | mx = screen->width()-1 - |
993 | screen->getWorkspacemenu()->width() - | 993 | screen->getWorkspacemenu()->width() - |
994 | screen->getWorkspacemenu()->fbwindow().borderWidth(); | 994 | 2*screen->getWorkspacemenu()->fbwindow().borderWidth(); |
995 | } | 995 | } |
996 | 996 | ||
997 | if (my + screen->getWorkspacemenu()->height() > | 997 | if (my + screen->getWorkspacemenu()->height() > |
998 | screen->height()) { | 998 | screen->height()) { |
999 | my = screen->height() - | 999 | my = screen->height()-1 - |
1000 | screen->getWorkspacemenu()->height() - | 1000 | screen->getWorkspacemenu()->height() - |
1001 | screen->getWorkspacemenu()->fbwindow().borderWidth(); | 1001 | 2*screen->getWorkspacemenu()->fbwindow().borderWidth(); |
1002 | } | 1002 | } |
1003 | screen->getWorkspacemenu()->move(mx, my); | 1003 | screen->getWorkspacemenu()->move(mx, my); |
1004 | 1004 | ||
@@ -1007,27 +1007,28 @@ void Fluxbox::handleButtonEvent(XButtonEvent &be) { | |||
1007 | screen->getWorkspacemenu()->show(); | 1007 | screen->getWorkspacemenu()->show(); |
1008 | } | 1008 | } |
1009 | } else if (be.button == 3) { | 1009 | } else if (be.button == 3) { |
1010 | //calculate placement of workspace menu | 1010 | //calculate placement of root menu |
1011 | //and show/hide it | 1011 | //and show/hide it |
1012 | int mx = be.x_root - | 1012 | int mx = be.x_root - |
1013 | (screen->getRootmenu()->width() / 2); | 1013 | (screen->getRootmenu()->width() / 2); |
1014 | int my = be.y_root - | 1014 | int my = be.y_root - |
1015 | (screen->getRootmenu()->titleHeight() / 2); | 1015 | (screen->getRootmenu()->titleHeight() / 2); |
1016 | int borderw = screen->getRootmenu()->fbwindow().borderWidth(); | ||
1016 | 1017 | ||
1017 | if (mx < 0) mx = 0; | 1018 | if (mx < 0) mx = 0; |
1018 | if (my < 0) my = 0; | 1019 | if (my < 0) my = 0; |
1019 | 1020 | ||
1020 | if (mx + screen->getRootmenu()->width() > screen->width()) { | 1021 | if (mx + screen->getRootmenu()->width() + 2*borderw > screen->width()) { |
1021 | mx = screen->width() - | 1022 | mx = screen->width() - |
1022 | screen->getRootmenu()->width() - | 1023 | screen->getRootmenu()->width() - |
1023 | screen->getRootmenu()->fbwindow().borderWidth(); | 1024 | 2*borderw; |
1024 | } | 1025 | } |
1025 | 1026 | ||
1026 | if (my + screen->getRootmenu()->height() > | 1027 | if (my + screen->getRootmenu()->height() + 2*borderw > |
1027 | screen->height()) { | 1028 | screen->height()) { |
1028 | my = screen->height() - | 1029 | my = screen->height() - |
1029 | screen->getRootmenu()->height() - | 1030 | screen->getRootmenu()->height() - |
1030 | screen->getRootmenu()->fbwindow().borderWidth(); | 1031 | 2*borderw; |
1031 | } | 1032 | } |
1032 | screen->getRootmenu()->move(mx, my); | 1033 | screen->getRootmenu()->move(mx, my); |
1033 | 1034 | ||