aboutsummaryrefslogtreecommitdiff
path: root/src/WinClient.cc
diff options
context:
space:
mode:
authormarkt <markt>2007-03-16 23:11:56 (GMT)
committermarkt <markt>2007-03-16 23:11:56 (GMT)
commitca1ca328cff53d909bd59e49f830499f084e64fa (patch)
tree54d778153ff9892b78bdbcaa7e19026620d1a83f /src/WinClient.cc
parent84e9f9708546526ce12269b31bec6f0459f0852f (diff)
downloadfluxbox-ca1ca328cff53d909bd59e49f830499f084e64fa.zip
fluxbox-ca1ca328cff53d909bd59e49f830499f084e64fa.tar.bz2
maximizing window with aspect ratio caused windows to be made larger than the screen
Diffstat (limited to 'src/WinClient.cc')
-rw-r--r--src/WinClient.cc17
1 files changed, 14 insertions, 3 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 */
774void WinClient::applySizeHints(int &width, int &height, 774void 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) {