remove FbTk::Menu::enter/leaveNotifyEvent -- caused problems with placing submenus

This commit is contained in:
markt 2006-08-09 04:20:06 +00:00
parent 9b9d5a9617
commit bd8ef1bc87
3 changed files with 12 additions and 74 deletions

View file

@ -1,5 +1,8 @@
(Format: Year/Month/Day)
Changes for 1.0rc3:
*06/08/09:
* Remove some old code that messed up placing submenus (Mark)
FbTk/Menu.cc/hh
*06/08/08:
* Fix some warnings in gcc 4.1 (Mark)
FbTk/FbPixmap.cc Screen.cc Window.cc WinClient.cc Ewmh.cc Gnome.cc

View file

@ -101,17 +101,14 @@ Menu::Menu(MenuTheme &tm, ImageControl &imgctrl):
m_title_vis = true;
m_shifted =
m_internal_menu =
m_internal_menu =
m_moving =
m_torn =
m_visible = false;
menu.x_shift =
menu.y_shift =
menu.x_move =
menu.x_move =
menu.y_move = 0;
m_which_sub =
@ -692,30 +689,25 @@ void Menu::drawSubmenu(unsigned int index) {
int new_y;
if (m_alignment == ALIGNTOP) {
new_y = (((m_shifted) ? menu.y_shift : y()) +
((m_title_vis) ? theme().titleHeight() + menu.title.borderWidth() : 0) -
new_y = (y() + ((m_title_vis) ? theme().titleHeight() + menu.title.borderWidth() : 0) -
((item->submenu()->m_title_vis) ?
item->submenu()->theme().titleHeight() + menu.window.borderWidth() : 0));
} else {
new_y = (((m_shifted) ? menu.y_shift : y()) +
(theme().itemHeight() * i) +
new_y = (y() + (theme().itemHeight() * i) +
((m_title_vis) ? theme().titleHeight() + menu.window.borderWidth() : 0) -
((item->submenu()->m_title_vis) ?
item->submenu()->theme().titleHeight() + menu.window.borderWidth() : 0));
}
if (m_alignment == ALIGNBOTTOM &&
(new_y + item->submenu()->height()) > ((m_shifted) ? menu.y_shift :
y()) + height()) {
new_y = (((m_shifted) ? menu.y_shift : y()) +
height() - item->submenu()->height());
(new_y + item->submenu()->height()) > (y() + height())) {
new_y = (y() + height() - item->submenu()->height());
}
int borderw = item->submenu()->fbwindow().borderWidth();
if ((new_x + item->submenu()->width()) + 2*borderw > m_screen_x + m_screen_width) {
new_x = ((m_shifted) ? menu.x_shift : x()) -
item->submenu()->width() - menu.window.borderWidth();
new_x = x() - item->submenu()->width() - menu.window.borderWidth();
}
if (new_x < m_screen_x)
@ -735,7 +727,7 @@ void Menu::drawSubmenu(unsigned int index) {
item->submenu()->move(new_x, new_y);
if (! m_moving)
clearItem(index);
if (! item->submenu()->isVisible()) {
item->showSubmenu();
item->submenu()->raise();
@ -1060,59 +1052,6 @@ void Menu::exposeEvent(XExposeEvent &ee) {
}
}
void Menu::enterNotifyEvent(XCrossingEvent &ce) {
if (menu.frame != ce.window)
return;
menu.x_shift = x(), menu.y_shift = y();
if (x() + width() > m_screen_x + m_screen_width) {
menu.x_shift = m_screen_x + m_screen_width - width() - 2*theme().borderWidth();
m_shifted = true;
} else if (x() < 0) {
menu.x_shift = 0; //-theme().borderWidth();
m_shifted = true;
}
if (y() + height() + 2*theme().borderWidth() > m_screen_y + m_screen_height) {
menu.y_shift = m_screen_y + m_screen_height - height() - 2*theme().borderWidth();
m_shifted = true;
} else if (y() + (signed) theme().titleHeight() < 0) {
menu.y_shift = 0; // -theme().borderWidth();;
m_shifted = true;
}
if (m_shifted) {
menu.window.move(menu.x_shift, menu.y_shift);
menu.title.parentMoved();
menu.frame.parentMoved();
clearWindow();
}
if (validIndex(m_which_sub)) {
MenuItem *tmp = menuitems[m_which_sub];
if (tmp->submenu()->isVisible()) {
int sbl = (ce.x / menu.item_w), i = (ce.y / theme().itemHeight()),
w = (sbl * menu.persub) + i;
if (w != m_which_sub && (! tmp->submenu()->isTorn())) {
tmp->submenu()->internal_hide();
clearItem(m_which_sub); // not highlighted anymore
m_which_sub = -1;
}
}
}
}
void Menu::leaveNotifyEvent(XCrossingEvent &ce) {
if (menu.frame != ce.window)
return;
}
void Menu::keyPressEvent(XKeyEvent &event) {
KeySym ks;
char keychar[1];

View file

@ -107,8 +107,6 @@ public:
void buttonPressEvent(XButtonEvent &bp);
void buttonReleaseEvent(XButtonEvent &br);
void motionNotifyEvent(XMotionEvent &mn);
void enterNotifyEvent(XCrossingEvent &en);
void leaveNotifyEvent(XCrossingEvent &ce);
void exposeEvent(XExposeEvent &ee);
void keyPressEvent(XKeyEvent &ke);
//@}
@ -220,7 +218,6 @@ private:
bool m_torn; ///< torn from parent
bool m_internal_menu; ///< whether we should destroy this menu or if it's managed somewhere else
bool m_title_vis; ///< title visibility
bool m_shifted; ///< if the menu is shifted to the other side of the parent
int m_which_sub, m_which_press, m_which_sbl;
Alignment m_alignment;
@ -230,8 +227,7 @@ private:
FbTk::FbWindow window, frame, title;
std::string label;
int x_move, y_move, x_shift, y_shift, sublevels, persub, minsub,
grab_x, grab_y;
int x_move, y_move, sublevels, persub, minsub, grab_x, grab_y;
unsigned int frame_h, item_w;
} menu;