remove FbTk::Menu::enter/leaveNotifyEvent -- caused problems with placing submenus
This commit is contained in:
parent
9b9d5a9617
commit
bd8ef1bc87
3 changed files with 12 additions and 74 deletions
|
@ -1,5 +1,8 @@
|
||||||
(Format: Year/Month/Day)
|
(Format: Year/Month/Day)
|
||||||
Changes for 1.0rc3:
|
Changes for 1.0rc3:
|
||||||
|
*06/08/09:
|
||||||
|
* Remove some old code that messed up placing submenus (Mark)
|
||||||
|
FbTk/Menu.cc/hh
|
||||||
*06/08/08:
|
*06/08/08:
|
||||||
* Fix some warnings in gcc 4.1 (Mark)
|
* Fix some warnings in gcc 4.1 (Mark)
|
||||||
FbTk/FbPixmap.cc Screen.cc Window.cc WinClient.cc Ewmh.cc Gnome.cc
|
FbTk/FbPixmap.cc Screen.cc Window.cc WinClient.cc Ewmh.cc Gnome.cc
|
||||||
|
|
|
@ -101,17 +101,14 @@ Menu::Menu(MenuTheme &tm, ImageControl &imgctrl):
|
||||||
|
|
||||||
m_title_vis = true;
|
m_title_vis = true;
|
||||||
|
|
||||||
m_shifted =
|
m_internal_menu =
|
||||||
m_internal_menu =
|
|
||||||
m_moving =
|
m_moving =
|
||||||
m_torn =
|
m_torn =
|
||||||
m_visible = false;
|
m_visible = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
menu.x_shift =
|
menu.x_move =
|
||||||
menu.y_shift =
|
|
||||||
menu.x_move =
|
|
||||||
menu.y_move = 0;
|
menu.y_move = 0;
|
||||||
|
|
||||||
m_which_sub =
|
m_which_sub =
|
||||||
|
@ -692,30 +689,25 @@ void Menu::drawSubmenu(unsigned int index) {
|
||||||
int new_y;
|
int new_y;
|
||||||
|
|
||||||
if (m_alignment == ALIGNTOP) {
|
if (m_alignment == ALIGNTOP) {
|
||||||
new_y = (((m_shifted) ? menu.y_shift : y()) +
|
new_y = (y() + ((m_title_vis) ? theme().titleHeight() + menu.title.borderWidth() : 0) -
|
||||||
((m_title_vis) ? theme().titleHeight() + menu.title.borderWidth() : 0) -
|
|
||||||
((item->submenu()->m_title_vis) ?
|
((item->submenu()->m_title_vis) ?
|
||||||
item->submenu()->theme().titleHeight() + menu.window.borderWidth() : 0));
|
item->submenu()->theme().titleHeight() + menu.window.borderWidth() : 0));
|
||||||
} else {
|
} else {
|
||||||
new_y = (((m_shifted) ? menu.y_shift : y()) +
|
new_y = (y() + (theme().itemHeight() * i) +
|
||||||
(theme().itemHeight() * i) +
|
|
||||||
((m_title_vis) ? theme().titleHeight() + menu.window.borderWidth() : 0) -
|
((m_title_vis) ? theme().titleHeight() + menu.window.borderWidth() : 0) -
|
||||||
((item->submenu()->m_title_vis) ?
|
((item->submenu()->m_title_vis) ?
|
||||||
item->submenu()->theme().titleHeight() + menu.window.borderWidth() : 0));
|
item->submenu()->theme().titleHeight() + menu.window.borderWidth() : 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_alignment == ALIGNBOTTOM &&
|
if (m_alignment == ALIGNBOTTOM &&
|
||||||
(new_y + item->submenu()->height()) > ((m_shifted) ? menu.y_shift :
|
(new_y + item->submenu()->height()) > (y() + height())) {
|
||||||
y()) + height()) {
|
new_y = (y() + height() - item->submenu()->height());
|
||||||
new_y = (((m_shifted) ? menu.y_shift : y()) +
|
|
||||||
height() - item->submenu()->height());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int borderw = item->submenu()->fbwindow().borderWidth();
|
int borderw = item->submenu()->fbwindow().borderWidth();
|
||||||
|
|
||||||
if ((new_x + item->submenu()->width()) + 2*borderw > m_screen_x + m_screen_width) {
|
if ((new_x + item->submenu()->width()) + 2*borderw > m_screen_x + m_screen_width) {
|
||||||
new_x = ((m_shifted) ? menu.x_shift : x()) -
|
new_x = x() - item->submenu()->width() - menu.window.borderWidth();
|
||||||
item->submenu()->width() - menu.window.borderWidth();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new_x < m_screen_x)
|
if (new_x < m_screen_x)
|
||||||
|
@ -735,7 +727,7 @@ void Menu::drawSubmenu(unsigned int index) {
|
||||||
item->submenu()->move(new_x, new_y);
|
item->submenu()->move(new_x, new_y);
|
||||||
if (! m_moving)
|
if (! m_moving)
|
||||||
clearItem(index);
|
clearItem(index);
|
||||||
|
|
||||||
if (! item->submenu()->isVisible()) {
|
if (! item->submenu()->isVisible()) {
|
||||||
item->showSubmenu();
|
item->showSubmenu();
|
||||||
item->submenu()->raise();
|
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) {
|
void Menu::keyPressEvent(XKeyEvent &event) {
|
||||||
KeySym ks;
|
KeySym ks;
|
||||||
char keychar[1];
|
char keychar[1];
|
||||||
|
|
|
@ -107,8 +107,6 @@ public:
|
||||||
void buttonPressEvent(XButtonEvent &bp);
|
void buttonPressEvent(XButtonEvent &bp);
|
||||||
void buttonReleaseEvent(XButtonEvent &br);
|
void buttonReleaseEvent(XButtonEvent &br);
|
||||||
void motionNotifyEvent(XMotionEvent &mn);
|
void motionNotifyEvent(XMotionEvent &mn);
|
||||||
void enterNotifyEvent(XCrossingEvent &en);
|
|
||||||
void leaveNotifyEvent(XCrossingEvent &ce);
|
|
||||||
void exposeEvent(XExposeEvent &ee);
|
void exposeEvent(XExposeEvent &ee);
|
||||||
void keyPressEvent(XKeyEvent &ke);
|
void keyPressEvent(XKeyEvent &ke);
|
||||||
//@}
|
//@}
|
||||||
|
@ -220,7 +218,6 @@ private:
|
||||||
bool m_torn; ///< torn from parent
|
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_internal_menu; ///< whether we should destroy this menu or if it's managed somewhere else
|
||||||
bool m_title_vis; ///< title visibility
|
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;
|
int m_which_sub, m_which_press, m_which_sbl;
|
||||||
Alignment m_alignment;
|
Alignment m_alignment;
|
||||||
|
@ -230,8 +227,7 @@ private:
|
||||||
FbTk::FbWindow window, frame, title;
|
FbTk::FbWindow window, frame, title;
|
||||||
|
|
||||||
std::string label;
|
std::string label;
|
||||||
int x_move, y_move, x_shift, y_shift, sublevels, persub, minsub,
|
int x_move, y_move, sublevels, persub, minsub, grab_x, grab_y;
|
||||||
grab_x, grab_y;
|
|
||||||
|
|
||||||
unsigned int frame_h, item_w;
|
unsigned int frame_h, item_w;
|
||||||
} menu;
|
} menu;
|
||||||
|
|
Loading…
Reference in a new issue