diff options
author | markt <markt> | 2007-03-16 23:11:56 (GMT) |
---|---|---|
committer | markt <markt> | 2007-03-16 23:11:56 (GMT) |
commit | ca1ca328cff53d909bd59e49f830499f084e64fa (patch) | |
tree | 54d778153ff9892b78bdbcaa7e19026620d1a83f /src | |
parent | 84e9f9708546526ce12269b31bec6f0459f0852f (diff) | |
download | fluxbox-ca1ca328cff53d909bd59e49f830499f084e64fa.zip fluxbox-ca1ca328cff53d909bd59e49f830499f084e64fa.tar.bz2 |
maximizing window with aspect ratio caused windows to be made larger than the screen
Diffstat (limited to 'src')
-rw-r--r-- | src/WinClient.cc | 17 | ||||
-rw-r--r-- | src/WinClient.hh | 3 | ||||
-rw-r--r-- | src/Window.cc | 6 | ||||
-rw-r--r-- | src/Window.hh | 2 |
4 files changed, 20 insertions, 8 deletions
diff --git a/src/WinClient.cc b/src/WinClient.cc index 458ac01..bb8a25c 100644 --- a/src/WinClient.cc +++ b/src/WinClient.cc | |||
@@ -772,7 +772,8 @@ void closestPointToLine(double &ret_x, double &ret_y, | |||
772 | * See ICCCM section 4.1.2.3 | 772 | * See ICCCM section 4.1.2.3 |
773 | */ | 773 | */ |
774 | void WinClient::applySizeHints(int &width, int &height, | 774 | void WinClient::applySizeHints(int &width, int &height, |
775 | int *display_width, int *display_height) { | 775 | int *display_width, int *display_height, |
776 | bool maximizing) { | ||
776 | 777 | ||
777 | int i = width, j = height; | 778 | int i = width, j = height; |
778 | 779 | ||
@@ -810,6 +811,10 @@ void WinClient::applySizeHints(int &width, int &height, | |||
810 | * Consider that the aspect ratio is a line, and the current | 811 | * Consider that the aspect ratio is a line, and the current |
811 | * w/h is a point, so we're just using the formula for | 812 | * w/h is a point, so we're just using the formula for |
812 | * shortest distance from a point to a line! | 813 | * shortest distance from a point to a line! |
814 | * | ||
815 | * When maximizing, we must not increase any of the sizes, because we | ||
816 | * would end up with the window partly off a screen, so a simpler formula | ||
817 | * is used in that case. | ||
813 | */ | 818 | */ |
814 | 819 | ||
815 | if (min_aspect_y > 0 && max_aspect_y > 0 && | 820 | if (min_aspect_y > 0 && max_aspect_y > 0 && |
@@ -829,10 +834,16 @@ void WinClient::applySizeHints(int &width, int &height, | |||
829 | bool changed = false; | 834 | bool changed = false; |
830 | if (actual < min) { | 835 | if (actual < min) { |
831 | changed = true; | 836 | changed = true; |
832 | closestPointToLine(widthd, heightd, widthd, heightd, min); | 837 | if (maximizing) |
838 | heightd = widthd / min; | ||
839 | else | ||
840 | closestPointToLine(widthd, heightd, widthd, heightd, min); | ||
833 | } else if (actual > max) { | 841 | } else if (actual > max) { |
834 | changed = true; | 842 | changed = true; |
835 | closestPointToLine(widthd, heightd, widthd, heightd, max); | 843 | if (maximizing) |
844 | widthd = heightd * max; | ||
845 | else | ||
846 | closestPointToLine(widthd, heightd, widthd, heightd, max); | ||
836 | } | 847 | } |
837 | 848 | ||
838 | if (changed) { | 849 | if (changed) { |
diff --git a/src/WinClient.hh b/src/WinClient.hh index 8e8747c..40daa8e 100644 --- a/src/WinClient.hh +++ b/src/WinClient.hh | |||
@@ -90,7 +90,8 @@ public: | |||
90 | * to the user when resizing. | 90 | * to the user when resizing. |
91 | * We use pointers for display_* since they are optional. | 91 | * We use pointers for display_* since they are optional. |
92 | */ | 92 | */ |
93 | void applySizeHints(int &width, int &height, int *display_width = 0, int *display_height = 0); | 93 | void applySizeHints(int &width, int &height, int *display_width = 0, |
94 | int *display_height = 0, bool maximizing = false); | ||
94 | 95 | ||
95 | 96 | ||
96 | void setGroupLeftWindow(Window win); | 97 | void setGroupLeftWindow(Window win); |
diff --git a/src/Window.cc b/src/Window.cc index e471d6e..8e6b887 100644 --- a/src/Window.cc +++ b/src/Window.cc | |||
@@ -1711,7 +1711,7 @@ void FluxboxWindow::maximize(int type) { | |||
1711 | 1711 | ||
1712 | ResizeDirection old_resize_corner = m_resize_corner; | 1712 | ResizeDirection old_resize_corner = m_resize_corner; |
1713 | m_resize_corner = NOCORNER; | 1713 | m_resize_corner = NOCORNER; |
1714 | fixsize(); | 1714 | fixsize(0, 0, true); |
1715 | m_resize_corner = old_resize_corner; | 1715 | m_resize_corner = old_resize_corner; |
1716 | 1716 | ||
1717 | moveResize(m_last_resize_x, m_last_resize_y, m_last_resize_w, m_last_resize_h); | 1717 | moveResize(m_last_resize_x, m_last_resize_y, m_last_resize_w, m_last_resize_h); |
@@ -3779,7 +3779,7 @@ void FluxboxWindow::changeBlackboxHints(const BlackboxHints &net) { | |||
3779 | } | 3779 | } |
3780 | 3780 | ||
3781 | 3781 | ||
3782 | void FluxboxWindow::fixsize(int *user_w, int *user_h) { | 3782 | void FluxboxWindow::fixsize(int *user_w, int *user_h, bool maximizing) { |
3783 | int titlebar_height = (decorations.titlebar ? | 3783 | int titlebar_height = (decorations.titlebar ? |
3784 | frame().titlebar().height() + | 3784 | frame().titlebar().height() + |
3785 | frame().titlebar().borderWidth() : 0); | 3785 | frame().titlebar().borderWidth() : 0); |
@@ -3795,7 +3795,7 @@ void FluxboxWindow::fixsize(int *user_w, int *user_h) { | |||
3795 | // dy = new height (w/o decorations), similarly | 3795 | // dy = new height (w/o decorations), similarly |
3796 | int dh = m_last_resize_h - decoration_height; | 3796 | int dh = m_last_resize_h - decoration_height; |
3797 | 3797 | ||
3798 | m_client->applySizeHints(dw, dh, user_w, user_h); | 3798 | m_client->applySizeHints(dw, dh, user_w, user_h, maximizing); |
3799 | 3799 | ||
3800 | // update last resize | 3800 | // update last resize |
3801 | m_last_resize_w = dw; | 3801 | m_last_resize_w = dw; |
diff --git a/src/Window.hh b/src/Window.hh index 1e55fb5..3206fdd 100644 --- a/src/Window.hh +++ b/src/Window.hh | |||
@@ -472,7 +472,7 @@ private: | |||
472 | // modifies left and top if snap is necessary | 472 | // modifies left and top if snap is necessary |
473 | void doSnapping(int &left, int &top); | 473 | void doSnapping(int &left, int &top); |
474 | // user_w/h return the values that should be shown to the user | 474 | // user_w/h return the values that should be shown to the user |
475 | void fixsize(int *user_w = 0, int *user_h = 0); | 475 | void fixsize(int *user_w = 0, int *user_h = 0, bool maximizing = false); |
476 | void moveResizeClient(WinClient &client, int x, int y, unsigned int width, unsigned int height); | 476 | void moveResizeClient(WinClient &client, int x, int y, unsigned int width, unsigned int height); |
477 | /// sends configurenotify to all clients | 477 | /// sends configurenotify to all clients |
478 | void sendConfigureNotify(bool send_to_netizens = true); | 478 | void sendConfigureNotify(bool send_to_netizens = true); |