diff options
author | markt <markt> | 2006-08-09 04:20:06 (GMT) |
---|---|---|
committer | markt <markt> | 2006-08-09 04:20:06 (GMT) |
commit | bd8ef1bc87518d575a422dad43a24a32888e478e (patch) | |
tree | f70c9868a9b3b9dc55824665c90dfd021b393aed /src/FbTk | |
parent | 9b9d5a9617612928710570e024632ba62f0ff74f (diff) | |
download | fluxbox_paul-bd8ef1bc87518d575a422dad43a24a32888e478e.zip fluxbox_paul-bd8ef1bc87518d575a422dad43a24a32888e478e.tar.bz2 |
remove FbTk::Menu::enter/leaveNotifyEvent -- caused problems with placing submenus
Diffstat (limited to 'src/FbTk')
-rw-r--r-- | src/FbTk/Menu.cc | 77 | ||||
-rw-r--r-- | src/FbTk/Menu.hh | 6 |
2 files changed, 9 insertions, 74 deletions
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc index 3524ee1..ee678c1 100644 --- a/src/FbTk/Menu.cc +++ b/src/FbTk/Menu.cc | |||
@@ -101,17 +101,14 @@ Menu::Menu(MenuTheme &tm, ImageControl &imgctrl): | |||
101 | 101 | ||
102 | m_title_vis = true; | 102 | m_title_vis = true; |
103 | 103 | ||
104 | m_shifted = | 104 | m_internal_menu = |
105 | m_internal_menu = | ||
106 | m_moving = | 105 | m_moving = |
107 | m_torn = | 106 | m_torn = |
108 | m_visible = false; | 107 | m_visible = false; |
109 | 108 | ||
110 | 109 | ||
111 | 110 | ||
112 | menu.x_shift = | 111 | menu.x_move = |
113 | menu.y_shift = | ||
114 | menu.x_move = | ||
115 | menu.y_move = 0; | 112 | menu.y_move = 0; |
116 | 113 | ||
117 | m_which_sub = | 114 | m_which_sub = |
@@ -692,30 +689,25 @@ void Menu::drawSubmenu(unsigned int index) { | |||
692 | int new_y; | 689 | int new_y; |
693 | 690 | ||
694 | if (m_alignment == ALIGNTOP) { | 691 | if (m_alignment == ALIGNTOP) { |
695 | new_y = (((m_shifted) ? menu.y_shift : y()) + | 692 | new_y = (y() + ((m_title_vis) ? theme().titleHeight() + menu.title.borderWidth() : 0) - |
696 | ((m_title_vis) ? theme().titleHeight() + menu.title.borderWidth() : 0) - | ||
697 | ((item->submenu()->m_title_vis) ? | 693 | ((item->submenu()->m_title_vis) ? |
698 | item->submenu()->theme().titleHeight() + menu.window.borderWidth() : 0)); | 694 | item->submenu()->theme().titleHeight() + menu.window.borderWidth() : 0)); |
699 | } else { | 695 | } else { |
700 | new_y = (((m_shifted) ? menu.y_shift : y()) + | 696 | new_y = (y() + (theme().itemHeight() * i) + |
701 | (theme().itemHeight() * i) + | ||
702 | ((m_title_vis) ? theme().titleHeight() + menu.window.borderWidth() : 0) - | 697 | ((m_title_vis) ? theme().titleHeight() + menu.window.borderWidth() : 0) - |
703 | ((item->submenu()->m_title_vis) ? | 698 | ((item->submenu()->m_title_vis) ? |
704 | item->submenu()->theme().titleHeight() + menu.window.borderWidth() : 0)); | 699 | item->submenu()->theme().titleHeight() + menu.window.borderWidth() : 0)); |
705 | } | 700 | } |
706 | 701 | ||
707 | if (m_alignment == ALIGNBOTTOM && | 702 | if (m_alignment == ALIGNBOTTOM && |
708 | (new_y + item->submenu()->height()) > ((m_shifted) ? menu.y_shift : | 703 | (new_y + item->submenu()->height()) > (y() + height())) { |
709 | y()) + height()) { | 704 | new_y = (y() + height() - item->submenu()->height()); |
710 | new_y = (((m_shifted) ? menu.y_shift : y()) + | ||
711 | height() - item->submenu()->height()); | ||
712 | } | 705 | } |
713 | 706 | ||
714 | int borderw = item->submenu()->fbwindow().borderWidth(); | 707 | int borderw = item->submenu()->fbwindow().borderWidth(); |
715 | 708 | ||
716 | if ((new_x + item->submenu()->width()) + 2*borderw > m_screen_x + m_screen_width) { | 709 | if ((new_x + item->submenu()->width()) + 2*borderw > m_screen_x + m_screen_width) { |
717 | new_x = ((m_shifted) ? menu.x_shift : x()) - | 710 | new_x = x() - item->submenu()->width() - menu.window.borderWidth(); |
718 | item->submenu()->width() - menu.window.borderWidth(); | ||
719 | } | 711 | } |
720 | 712 | ||
721 | if (new_x < m_screen_x) | 713 | if (new_x < m_screen_x) |
@@ -735,7 +727,7 @@ void Menu::drawSubmenu(unsigned int index) { | |||
735 | item->submenu()->move(new_x, new_y); | 727 | item->submenu()->move(new_x, new_y); |
736 | if (! m_moving) | 728 | if (! m_moving) |
737 | clearItem(index); | 729 | clearItem(index); |
738 | 730 | ||
739 | if (! item->submenu()->isVisible()) { | 731 | if (! item->submenu()->isVisible()) { |
740 | item->showSubmenu(); | 732 | item->showSubmenu(); |
741 | item->submenu()->raise(); | 733 | item->submenu()->raise(); |
@@ -1060,59 +1052,6 @@ void Menu::exposeEvent(XExposeEvent &ee) { | |||
1060 | } | 1052 | } |
1061 | } | 1053 | } |
1062 | 1054 | ||
1063 | |||
1064 | void Menu::enterNotifyEvent(XCrossingEvent &ce) { | ||
1065 | |||
1066 | if (menu.frame != ce.window) | ||
1067 | return; | ||
1068 | |||
1069 | menu.x_shift = x(), menu.y_shift = y(); | ||
1070 | if (x() + width() > m_screen_x + m_screen_width) { | ||
1071 | menu.x_shift = m_screen_x + m_screen_width - width() - 2*theme().borderWidth(); | ||
1072 | m_shifted = true; | ||
1073 | } else if (x() < 0) { | ||
1074 | menu.x_shift = 0; //-theme().borderWidth(); | ||
1075 | m_shifted = true; | ||
1076 | } | ||
1077 | |||
1078 | if (y() + height() + 2*theme().borderWidth() > m_screen_y + m_screen_height) { | ||
1079 | menu.y_shift = m_screen_y + m_screen_height - height() - 2*theme().borderWidth(); | ||
1080 | m_shifted = true; | ||
1081 | } else if (y() + (signed) theme().titleHeight() < 0) { | ||
1082 | menu.y_shift = 0; // -theme().borderWidth();; | ||
1083 | m_shifted = true; | ||
1084 | } | ||
1085 | |||
1086 | |||
1087 | if (m_shifted) { | ||
1088 | menu.window.move(menu.x_shift, menu.y_shift); | ||
1089 | menu.title.parentMoved(); | ||
1090 | menu.frame.parentMoved(); | ||
1091 | clearWindow(); | ||
1092 | } | ||
1093 | |||
1094 | if (validIndex(m_which_sub)) { | ||
1095 | MenuItem *tmp = menuitems[m_which_sub]; | ||
1096 | if (tmp->submenu()->isVisible()) { | ||
1097 | int sbl = (ce.x / menu.item_w), i = (ce.y / theme().itemHeight()), | ||
1098 | w = (sbl * menu.persub) + i; | ||
1099 | |||
1100 | if (w != m_which_sub && (! tmp->submenu()->isTorn())) { | ||
1101 | tmp->submenu()->internal_hide(); | ||
1102 | |||
1103 | clearItem(m_which_sub); // not highlighted anymore | ||
1104 | m_which_sub = -1; | ||
1105 | } | ||
1106 | } | ||
1107 | } | ||
1108 | } | ||
1109 | |||
1110 | void Menu::leaveNotifyEvent(XCrossingEvent &ce) { | ||
1111 | if (menu.frame != ce.window) | ||
1112 | return; | ||
1113 | |||
1114 | } | ||
1115 | |||
1116 | void Menu::keyPressEvent(XKeyEvent &event) { | 1055 | void Menu::keyPressEvent(XKeyEvent &event) { |
1117 | KeySym ks; | 1056 | KeySym ks; |
1118 | char keychar[1]; | 1057 | char keychar[1]; |
diff --git a/src/FbTk/Menu.hh b/src/FbTk/Menu.hh index 4b749dc..7863fcb 100644 --- a/src/FbTk/Menu.hh +++ b/src/FbTk/Menu.hh | |||
@@ -107,8 +107,6 @@ public: | |||
107 | void buttonPressEvent(XButtonEvent &bp); | 107 | void buttonPressEvent(XButtonEvent &bp); |
108 | void buttonReleaseEvent(XButtonEvent &br); | 108 | void buttonReleaseEvent(XButtonEvent &br); |
109 | void motionNotifyEvent(XMotionEvent &mn); | 109 | void motionNotifyEvent(XMotionEvent &mn); |
110 | void enterNotifyEvent(XCrossingEvent &en); | ||
111 | void leaveNotifyEvent(XCrossingEvent &ce); | ||
112 | void exposeEvent(XExposeEvent &ee); | 110 | void exposeEvent(XExposeEvent &ee); |
113 | void keyPressEvent(XKeyEvent &ke); | 111 | void keyPressEvent(XKeyEvent &ke); |
114 | //@} | 112 | //@} |
@@ -220,7 +218,6 @@ private: | |||
220 | bool m_torn; ///< torn from parent | 218 | bool m_torn; ///< torn from parent |
221 | bool m_internal_menu; ///< whether we should destroy this menu or if it's managed somewhere else | 219 | bool m_internal_menu; ///< whether we should destroy this menu or if it's managed somewhere else |
222 | bool m_title_vis; ///< title visibility | 220 | bool m_title_vis; ///< title visibility |
223 | bool m_shifted; ///< if the menu is shifted to the other side of the parent | ||
224 | 221 | ||
225 | int m_which_sub, m_which_press, m_which_sbl; | 222 | int m_which_sub, m_which_press, m_which_sbl; |
226 | Alignment m_alignment; | 223 | Alignment m_alignment; |
@@ -230,8 +227,7 @@ private: | |||
230 | FbTk::FbWindow window, frame, title; | 227 | FbTk::FbWindow window, frame, title; |
231 | 228 | ||
232 | std::string label; | 229 | std::string label; |
233 | int x_move, y_move, x_shift, y_shift, sublevels, persub, minsub, | 230 | int x_move, y_move, sublevels, persub, minsub, grab_x, grab_y; |
234 | grab_x, grab_y; | ||
235 | 231 | ||
236 | unsigned int frame_h, item_w; | 232 | unsigned int frame_h, item_w; |
237 | } menu; | 233 | } menu; |