some menu tweaking
This commit is contained in:
parent
8dcca17e1d
commit
d757c08e00
4 changed files with 40 additions and 29 deletions
|
@ -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)
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
// 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 @@ void Menu::update(int active_index) {
|
|||
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 @@ void Menu::show() {
|
|||
raise();
|
||||
visible = true;
|
||||
|
||||
if (! m_parent) {
|
||||
if (! m_parent && shown != this) {
|
||||
if (shown && (! shown->torn))
|
||||
shown->hide();
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
// 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 @@ public:
|
|||
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;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
// 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 @@ void FluxboxWindow::restoreAttributes() {
|
|||
/**
|
||||
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 @@ void FluxboxWindow::popupMenu() {
|
|||
m_windowmenu.hide();
|
||||
return;
|
||||
}
|
||||
// move menu directly under titlebar
|
||||
int diff_y = frame().titlebar().height() + frame().titlebar().borderWidth();
|
||||
if (!decorations.titlebar) // if we don't have any titlebar
|
||||
diff_y = 0;
|
||||
|
||||
m_windowmenu.move(m_last_button_x, frame().y() + diff_y);
|
||||
m_windowmenu.show();
|
||||
m_windowmenu.raise();
|
||||
int menu_y = frame().titlebar().height() + frame().titlebar().borderWidth();
|
||||
if (!decorations.titlebar) // if we don't have any titlebar
|
||||
menu_y = 0;
|
||||
|
||||
showMenu(m_last_button_x, menu_y + frame().y());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue