all repos — fluxbox @ bd8ef1bc87518d575a422dad43a24a32888e478e

custom fork of the fluxbox windowmanager

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

bd8ef1bc87518d575a422dad43a24a32888e478e

parent

9b9d5a9617612928710570e024632ba62f0ff74f

3 files changed, 12 insertions(+), 74 deletions(-)

jump to
M ChangeLogChangeLog

@@ -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
M src/FbTk/Menu.ccsrc/FbTk/Menu.cc

@@ -101,17 +101,14 @@ tm.reconfigSig().attach(this);

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 @@ int new_x = x() + ((menu.item_w * (sbl + 1)) + menu.window.borderWidth());

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 @@

item->submenu()->move(new_x, new_y); if (! m_moving) clearItem(index); - + if (! item->submenu()->isVisible()) { item->showSubmenu(); item->submenu()->raise();

@@ -1058,59 +1050,6 @@ }

} } } -} - - -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) {
M src/FbTk/Menu.hhsrc/FbTk/Menu.hh

@@ -107,8 +107,6 @@ void handleEvent(XEvent &event);

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 @@ bool m_visible; ///< menu visibility

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 @@ Pixmap frame_pixmap, title_pixmap, hilite_pixmap;

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;