summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrbuj <[email protected]>2019-03-11 21:35:52 +0100
committerRobert Antoni Buj Gelonch <[email protected]>2020-05-26 16:38:33 +0200
commitc16d44300d87c3dbd7bfde9b9d1c8f1a503694a3 (patch)
treef4ff8a833b23ebe223ce05cc6579eae4a5d6cb2f /src
parent093a0ac9a4fb519a70ae43790a025742e928ec96 (diff)
downloadmarco-c16d44300d87c3dbd7bfde9b9d1c8f1a503694a3.tar.bz2
marco-c16d44300d87c3dbd7bfde9b9d1c8f1a503694a3.tar.xz
Use rounded values instead of truncate them
If the decimal value is from .1 to .5, round(arg) returns the integer value less than the argument. Otherwise, if the decimal value is from .6 to .9, it returns the integer value greater than the arg.
Diffstat (limited to 'src')
-rw-r--r--src/core/constraints.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/core/constraints.c b/src/core/constraints.c
index ed70b40b..64ce497a 100644
--- a/src/core/constraints.c
+++ b/src/core/constraints.c
@@ -23,6 +23,8 @@
* 02110-1301, USA.
*/
+#define _GNU_SOURCE
+
#include <config.h>
#include "constraints.h"
#include "workspace.h"
@@ -1327,9 +1329,8 @@ constrain_aspect_ratio (MetaWindow *window,
new_width, new_height,
&best_width, &best_height);
- /* Yeah, I suck for doing implicit rounding -- sue me */
- new_width = best_width;
- new_height = best_height;
+ new_width = round (best_width);
+ new_height = round (best_height);
break;
}