all repos — fluxbox @ d757c08e006dea8147d8219ea2e0ca1c84c9cf7e

custom fork of the fluxbox windowmanager

some menu tweaking
rathnor rathnor
commit

d757c08e006dea8147d8219ea2e0ca1c84c9cf7e

parent

8dcca17e1d87375ebb4773e87ebbdb4a1b78ea7a

4 files changed, 39 insertions(+), 28 deletions(-)

jump to
M ChangeLogChangeLog

@@ -1,4 +1,13 @@

(Format: Year/Month/Day) +Changes for 0.9.7: +*03/11/19: + * Fix menu draw bug for empty submenus (Simon) + Menu.cc + * Fix menu placement for iconbar and titlebar activation, including + xinerama awareness (Simon) + Window.cc IconButton.cc + * Fix win menu hide straight after show when right click icon (Simon) + Menu.cc Changes for 0.9.6: *03/11/16: * Fixed sstream and strstream header check (Henrik)
M src/FbTk/Menu.ccsrc/FbTk/Menu.cc

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Menu.cc,v 1.40 2003/11/01 00:12:53 rathnor Exp $ +// $Id: Menu.cc,v 1.41 2003/11/19 12:57:27 rathnor Exp $ //use GNU extensions #ifndef _GNU_SOURCE

@@ -425,11 +425,12 @@ menu.width = (menu.sublevels * (menu.item_w));

if (! menu.width) menu.width = menu.item_w; menu.frame_h = (menu.item_h * menu.persub); - if (menu.frame_h < 1) - menu.frame_h = 1; + if (menu.frame_h < 0) + menu.frame_h = 0; - menu.height = (title_vis ? menu.title_h + menu.title.borderWidth() : 0) + - menu.frame_h; + menu.height = menu.frame_h; + if (title_vis) + menu.height += menu.title_h + ((menu.frame_h>0)?menu.title.borderWidth():0); if (menu.height < 1) menu.height = 1;

@@ -554,7 +555,7 @@ //!! TODO, this should probably be done explicit if one don't want to raise

raise(); visible = true; - if (! m_parent) { + if (! m_parent && shown != this) { if (shown && (! shown->torn)) shown->hide();
M src/IconButton.ccsrc/IconButton.cc

@@ -20,7 +20,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: IconButton.cc,v 1.11 2003/10/31 20:02:49 rathnor Exp $ +// $Id: IconButton.cc,v 1.12 2003/11/19 12:57:27 rathnor Exp $ #include "IconButton.hh"

@@ -53,18 +53,7 @@ const XEvent &event = Fluxbox::instance()->lastEvent();

int x = event.xbutton.x_root - (m_win.menu().width() / 2); int y = event.xbutton.y_root - (m_win.menu().height() / 2); - if (x < 0) - x = 0; - else if (x + m_win.menu().width() > m_win.screen().width()) - x = m_win.screen().width() - m_win.menu().width(); - - if (y < 0) - y = 0; - else if (y + m_win.menu().height() > m_win.screen().height()) - y = m_win.screen().height() - m_win.menu().height(); - - m_win.menu().move(x, y); - m_win.menu().show(); + m_win.showMenu(x, y); } private: FluxboxWindow &m_win;
M src/Window.ccsrc/Window.cc

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Window.cc,v 1.243 2003/10/28 02:17:02 rathnor Exp $ +// $Id: Window.cc,v 1.244 2003/11/19 12:57:27 rathnor Exp $ #include "Window.hh"

@@ -1885,8 +1885,22 @@

/** Show the window menu at pos mx, my */ -void FluxboxWindow::showMenu(int mx, int my) { - m_windowmenu.move(mx, my); +void FluxboxWindow::showMenu(int menu_x, int menu_y) { + // move menu directly under titlebar + + int head = screen().getHead(menu_x, menu_y); + + // but not under screen + if (menu_y + m_windowmenu.height() >= screen().maxBottom(head)) + menu_y = screen().maxBottom(head) - m_windowmenu.height() - 1 - m_windowmenu.fbwindow().borderWidth(); + + if (menu_x < static_cast<signed>(screen().maxLeft(head))) + menu_x = screen().maxLeft(head); + else if (menu_x + static_cast<signed>(m_windowmenu.width()) >= static_cast<signed>(screen().maxRight(head))) + menu_x = screen().maxRight(head) - m_windowmenu.width() - 1; + + + m_windowmenu.move(menu_x, menu_y); m_windowmenu.show(); m_windowmenu.raise(); }

@@ -1900,14 +1914,12 @@ if (m_windowmenu.isVisible()) {

m_windowmenu.hide(); return; } - // move menu directly under titlebar - int diff_y = frame().titlebar().height() + frame().titlebar().borderWidth(); + + int menu_y = frame().titlebar().height() + frame().titlebar().borderWidth(); if (!decorations.titlebar) // if we don't have any titlebar - diff_y = 0; + menu_y = 0; - m_windowmenu.move(m_last_button_x, frame().y() + diff_y); - m_windowmenu.show(); - m_windowmenu.raise(); + showMenu(m_last_button_x, menu_y + frame().y()); } /**