diff options
Diffstat (limited to 'src/Window.cc')
-rw-r--r-- | src/Window.cc | 30 |
1 files changed, 21 insertions, 9 deletions
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 | /** |