diff options
author | rathnor <rathnor> | 2003-11-19 12:57:27 (GMT) |
---|---|---|
committer | rathnor <rathnor> | 2003-11-19 12:57:27 (GMT) |
commit | d757c08e006dea8147d8219ea2e0ca1c84c9cf7e (patch) | |
tree | c9e803cdfebffccd5f8f6581233511ac6556580c /src | |
parent | 8dcca17e1d87375ebb4773e87ebbdb4a1b78ea7a (diff) | |
download | fluxbox-d757c08e006dea8147d8219ea2e0ca1c84c9cf7e.zip fluxbox-d757c08e006dea8147d8219ea2e0ca1c84c9cf7e.tar.bz2 |
some menu tweaking
Diffstat (limited to 'src')
-rw-r--r-- | src/FbTk/Menu.cc | 13 | ||||
-rw-r--r-- | src/IconButton.cc | 15 | ||||
-rw-r--r-- | src/Window.cc | 30 |
3 files changed, 30 insertions, 28 deletions
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc index 8b4a91e..8b4ddd2 100644 --- a/src/FbTk/Menu.cc +++ b/src/FbTk/Menu.cc | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Menu.cc,v 1.40 2003/11/01 00:12:53 rathnor Exp $ | 25 | // $Id: Menu.cc,v 1.41 2003/11/19 12:57:27 rathnor Exp $ |
26 | 26 | ||
27 | //use GNU extensions | 27 | //use GNU extensions |
28 | #ifndef _GNU_SOURCE | 28 | #ifndef _GNU_SOURCE |
@@ -425,11 +425,12 @@ void Menu::update(int active_index) { | |||
425 | if (! menu.width) menu.width = menu.item_w; | 425 | if (! menu.width) menu.width = menu.item_w; |
426 | 426 | ||
427 | menu.frame_h = (menu.item_h * menu.persub); | 427 | menu.frame_h = (menu.item_h * menu.persub); |
428 | if (menu.frame_h < 1) | 428 | if (menu.frame_h < 0) |
429 | menu.frame_h = 1; | 429 | menu.frame_h = 0; |
430 | 430 | ||
431 | menu.height = (title_vis ? menu.title_h + menu.title.borderWidth() : 0) + | 431 | menu.height = menu.frame_h; |
432 | menu.frame_h; | 432 | if (title_vis) |
433 | menu.height += menu.title_h + ((menu.frame_h>0)?menu.title.borderWidth():0); | ||
433 | 434 | ||
434 | if (menu.height < 1) | 435 | if (menu.height < 1) |
435 | menu.height = 1; | 436 | menu.height = 1; |
@@ -554,7 +555,7 @@ void Menu::show() { | |||
554 | raise(); | 555 | raise(); |
555 | visible = true; | 556 | visible = true; |
556 | 557 | ||
557 | if (! m_parent) { | 558 | if (! m_parent && shown != this) { |
558 | if (shown && (! shown->torn)) | 559 | if (shown && (! shown->torn)) |
559 | shown->hide(); | 560 | shown->hide(); |
560 | 561 | ||
diff --git a/src/IconButton.cc b/src/IconButton.cc index bc0c9d5..20fca8a 100644 --- a/src/IconButton.cc +++ b/src/IconButton.cc | |||
@@ -20,7 +20,7 @@ | |||
20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
21 | // DEALINGS IN THE SOFTWARE. | 21 | // DEALINGS IN THE SOFTWARE. |
22 | 22 | ||
23 | // $Id: IconButton.cc,v 1.11 2003/10/31 20:02:49 rathnor Exp $ | 23 | // $Id: IconButton.cc,v 1.12 2003/11/19 12:57:27 rathnor Exp $ |
24 | 24 | ||
25 | #include "IconButton.hh" | 25 | #include "IconButton.hh" |
26 | 26 | ||
@@ -53,18 +53,7 @@ public: | |||
53 | int x = event.xbutton.x_root - (m_win.menu().width() / 2); | 53 | int x = event.xbutton.x_root - (m_win.menu().width() / 2); |
54 | int y = event.xbutton.y_root - (m_win.menu().height() / 2); | 54 | int y = event.xbutton.y_root - (m_win.menu().height() / 2); |
55 | 55 | ||
56 | if (x < 0) | 56 | m_win.showMenu(x, y); |
57 | x = 0; | ||
58 | else if (x + m_win.menu().width() > m_win.screen().width()) | ||
59 | x = m_win.screen().width() - m_win.menu().width(); | ||
60 | |||
61 | if (y < 0) | ||
62 | y = 0; | ||
63 | else if (y + m_win.menu().height() > m_win.screen().height()) | ||
64 | y = m_win.screen().height() - m_win.menu().height(); | ||
65 | |||
66 | m_win.menu().move(x, y); | ||
67 | m_win.menu().show(); | ||
68 | } | 57 | } |
69 | private: | 58 | private: |
70 | FluxboxWindow &m_win; | 59 | FluxboxWindow &m_win; |
diff --git a/src/Window.cc b/src/Window.cc index cce7d16..90d4b19 100644 --- a/src/Window.cc +++ b/src/Window.cc | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Window.cc,v 1.243 2003/10/28 02:17:02 rathnor Exp $ | 25 | // $Id: Window.cc,v 1.244 2003/11/19 12:57:27 rathnor Exp $ |
26 | 26 | ||
27 | #include "Window.hh" | 27 | #include "Window.hh" |
28 | 28 | ||
@@ -1885,8 +1885,22 @@ void FluxboxWindow::restoreAttributes() { | |||
1885 | /** | 1885 | /** |
1886 | Show the window menu at pos mx, my | 1886 | Show the window menu at pos mx, my |
1887 | */ | 1887 | */ |
1888 | void FluxboxWindow::showMenu(int mx, int my) { | 1888 | void FluxboxWindow::showMenu(int menu_x, int menu_y) { |
1889 | m_windowmenu.move(mx, my); | 1889 | // move menu directly under titlebar |
1890 | |||
1891 | int head = screen().getHead(menu_x, menu_y); | ||
1892 | |||
1893 | // but not under screen | ||
1894 | if (menu_y + m_windowmenu.height() >= screen().maxBottom(head)) | ||
1895 | menu_y = screen().maxBottom(head) - m_windowmenu.height() - 1 - m_windowmenu.fbwindow().borderWidth(); | ||
1896 | |||
1897 | if (menu_x < static_cast<signed>(screen().maxLeft(head))) | ||
1898 | menu_x = screen().maxLeft(head); | ||
1899 | else if (menu_x + static_cast<signed>(m_windowmenu.width()) >= static_cast<signed>(screen().maxRight(head))) | ||
1900 | menu_x = screen().maxRight(head) - m_windowmenu.width() - 1; | ||
1901 | |||
1902 | |||
1903 | m_windowmenu.move(menu_x, menu_y); | ||
1890 | m_windowmenu.show(); | 1904 | m_windowmenu.show(); |
1891 | m_windowmenu.raise(); | 1905 | m_windowmenu.raise(); |
1892 | } | 1906 | } |
@@ -1900,14 +1914,12 @@ void FluxboxWindow::popupMenu() { | |||
1900 | m_windowmenu.hide(); | 1914 | m_windowmenu.hide(); |
1901 | return; | 1915 | return; |
1902 | } | 1916 | } |
1903 | // move menu directly under titlebar | 1917 | |
1904 | int diff_y = frame().titlebar().height() + frame().titlebar().borderWidth(); | 1918 | int menu_y = frame().titlebar().height() + frame().titlebar().borderWidth(); |
1905 | if (!decorations.titlebar) // if we don't have any titlebar | 1919 | if (!decorations.titlebar) // if we don't have any titlebar |
1906 | diff_y = 0; | 1920 | menu_y = 0; |
1907 | 1921 | ||
1908 | m_windowmenu.move(m_last_button_x, frame().y() + diff_y); | 1922 | showMenu(m_last_button_x, menu_y + frame().y()); |
1909 | m_windowmenu.show(); | ||
1910 | m_windowmenu.raise(); | ||
1911 | } | 1923 | } |
1912 | 1924 | ||
1913 | /** | 1925 | /** |