aboutsummaryrefslogtreecommitdiff
path: root/src/Basemenu.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-03-19 14:30:43 (GMT)
committerfluxgen <fluxgen>2002-03-19 14:30:43 (GMT)
commit95aeda26271cce3061a46a3ca0b122bc13c8f5c8 (patch)
treeaaa01d20e77a2445a20a0522d86296b981049b8e /src/Basemenu.cc
parent1871169b06d8b9909ff26b761d24a40a65ef18f9 (diff)
downloadfluxbox-95aeda26271cce3061a46a3ca0b122bc13c8f5c8.zip
fluxbox-95aeda26271cce3061a46a3ca0b122bc13c8f5c8.tar.bz2
Xinerama support
Diffstat (limited to 'src/Basemenu.cc')
-rw-r--r--src/Basemenu.cc82
1 files changed, 77 insertions, 5 deletions
diff --git a/src/Basemenu.cc b/src/Basemenu.cc
index 5328a2b..713b2f7 100644
--- a/src/Basemenu.cc
+++ b/src/Basemenu.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: Basemenu.cc,v 1.11 2002/03/18 15:42:34 fluxgen Exp $ 25// $Id: Basemenu.cc,v 1.12 2002/03/19 14:30:42 fluxgen Exp $
26 26
27// stupid macros needed to access some functions in version 2 of the GNU C 27// stupid macros needed to access some functions in version 2 of the GNU C
28// library 28// library
@@ -580,21 +580,59 @@ void Basemenu::drawSubmenu(int index) {
580 y = (((shifted) ? menu.y_shift : menu.y) + 580 y = (((shifted) ? menu.y_shift : menu.y) +
581 menu.height - item->submenu()->menu.height); 581 menu.height - item->submenu()->menu.height);
582 } 582 }
583
584 #ifdef XINERAMA
585 int head_x = 0,
586 head_y = 0,
587 head_w,
588 head_h;
589
590 unsigned int head = 0;
591 if (screen->hasXinerama()) {
592 head = screen->getHead(menu.x, menu.y);
593 head_x = screen->getHeadX(head);
594 head_y = screen->getHeadY(head);
595 head_w = screen->getHeadWidth(head);
596 head_h = screen->getHeadHeight(head);
597 } else {
598 head_w = screen->getWidth();
599 head_h = screen->getHeight();
600 }
601
602 if ((x + item->submenu()->getWidth()) > (head_x + head_w)) {
603 x = ((shifted) ? menu.x_shift : menu.x) -
604 item->submenu()->getWidth() - screen->getBorderWidth();
605 }
583 606
607 if (x < head_x)
608 x = head_x;
609
610 if ((y + item->submenu()->getHeight()) > (head_y + head_h)) {
611 y = head_y + head_h -
612 item->submenu()->getHeight() - screen->getBorderWidth2x();
613 }
614
615 if (y < head_y)
616 y = head_y;
617 #else // !XINERAMA
618
584 if ((x + item->submenu()->getWidth()) > screen->getWidth()) { 619 if ((x + item->submenu()->getWidth()) > screen->getWidth()) {
585 x = ((shifted) ? menu.x_shift : menu.x) - 620 x = ((shifted) ? menu.x_shift : menu.x) -
586 item->submenu()->getWidth() - screen->getBorderWidth(); 621 item->submenu()->getWidth() - screen->getBorderWidth();
587 } 622 }
588 623
589 if (x < 0) x = 0; 624 if (x < 0)
625 x = 0;
590 626
591 if ((y + item->submenu()->getHeight()) > screen->getHeight()) { 627 if ((y + item->submenu()->getHeight()) > screen->getHeight()) {
592 y = screen->getHeight() - item->submenu()->getHeight() - 628 y = screen->getHeight() - item->submenu()->getHeight() -
593 screen->getBorderWidth2x(); 629 screen->getBorderWidth2x();
594 } 630 }
595 631
596 if (y < 0) y = 0; 632 if (y < 0)
597 633 y = 0;
634 #endif // XINERAMA
635
598 item->submenu()->move(x, y); 636 item->submenu()->move(x, y);
599 if (! moving) 637 if (! moving)
600 drawItem(index, True); 638 drawItem(index, True);
@@ -1007,6 +1045,33 @@ void Basemenu::exposeEvent(XExposeEvent *ee) {
1007 1045
1008 1046
1009void Basemenu::enterNotifyEvent(XCrossingEvent *ce) { 1047void Basemenu::enterNotifyEvent(XCrossingEvent *ce) {
1048#ifdef XINERAMA
1049 int head = screen->hasXinerama() ? screen->getCurrHead() : 0;
1050
1051 if (ce->window == menu.frame) {
1052 menu.x_shift = menu.x, menu.y_shift = menu.y;
1053 if (menu.x + menu.width >
1054 (screen->getHeadX(head) + screen->getHeadWidth(head))) {
1055 menu.x_shift = screen->getHeadX(head) + screen->getHeadWidth(head) -
1056 menu.width - screen->getBorderWidth2x();
1057 shifted = True;
1058 } else if (menu.x < screen->getHeadX(head)) {
1059 menu.x_shift = screen->getHeadX(head);
1060 shifted = True;
1061 }
1062
1063 if (menu.y + menu.height >
1064 (screen->getHeadY(head) + screen->getHeadHeight(head))) {
1065 menu.y_shift = screen->getHeadY(head) + screen->getHeadHeight(head) -
1066 menu.height - screen->getBorderWidth2x();
1067 shifted = True;
1068 } else if (menu.y + (signed) menu.title_h < screen->getHeadY(head)) {
1069 menu.y_shift = screen->getHeadY(head);
1070 shifted = True;
1071 }
1072
1073#else // !XINERAMA
1074
1010 if (ce->window == menu.frame) { 1075 if (ce->window == menu.frame) {
1011 menu.x_shift = menu.x, menu.y_shift = menu.y; 1076 menu.x_shift = menu.x, menu.y_shift = menu.y;
1012 if (menu.x + menu.width > screen->getWidth()) { 1077 if (menu.x + menu.width > screen->getWidth()) {
@@ -1027,8 +1092,15 @@ void Basemenu::enterNotifyEvent(XCrossingEvent *ce) {
1027 shifted = True; 1092 shifted = True;
1028 } 1093 }
1029 1094
1030 if (shifted) 1095#endif // XINERAMA
1096
1097 if (shifted) {
1098 #ifdef XINERAMA
1099 menu.x = menu.x_shift; // need to do this to avoid jumping beetween heads
1100 menu.y = menu.y_shift;
1101 #endif // XINERAMA
1031 XMoveWindow(display, menu.window, menu.x_shift, menu.y_shift); 1102 XMoveWindow(display, menu.window, menu.x_shift, menu.y_shift);
1103 }
1032 1104
1033 if (which_sub >= 0) { 1105 if (which_sub >= 0) {
1034 BasemenuItem *tmp = menuitems[which_sub]; 1106 BasemenuItem *tmp = menuitems[which_sub];