aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-05-28 16:07:58 -0400
committerDavid Robillard <d@drobilla.net>2021-05-28 16:17:41 -0400
commit9801d98e257ce6a60418d3b4327b5b1d571adb82 (patch)
treee01b1971add6c38610a7a02c88b077eafd419079 /src
parentb0dd657d6db1dba485702f74126c98d3463aee12 (diff)
downloadpugl-9801d98e257ce6a60418d3b4327b5b1d571adb82.tar.gz
pugl-9801d98e257ce6a60418d3b4327b5b1d571adb82.tar.bz2
pugl-9801d98e257ce6a60418d3b4327b5b1d571adb82.zip
Fix questionable float equality comparison
This avoids a warning, and makes more sense in this situation anyway because negatives are also a bad configuration.
Diffstat (limited to 'src')
-rw-r--r--src/win.c4
-rw-r--r--src/x11.c6
2 files changed, 5 insertions, 5 deletions
diff --git a/src/win.c b/src/win.c
index 190a87c..dc1e62c 100644
--- a/src/win.c
+++ b/src/win.c
@@ -1195,8 +1195,8 @@ puglWinCreateWindow(PuglView* const view,
const unsigned winFlags = puglWinGetWindowFlags(view);
const unsigned winExFlags = puglWinGetWindowExFlags(view);
- if (view->frame.width == 0.0 && view->frame.height == 0.0) {
- if (view->defaultWidth == 0.0 && view->defaultHeight == 0.0) {
+ if (view->frame.width <= 0.0 && view->frame.height <= 0.0) {
+ if (view->defaultWidth <= 0.0 && view->defaultHeight <= 0.0) {
return PUGL_BAD_CONFIGURATION;
}
diff --git a/src/x11.c b/src/x11.c
index 6ac7b90..57dbea5 100644
--- a/src/x11.c
+++ b/src/x11.c
@@ -303,8 +303,8 @@ puglRealize(PuglView* const view)
}
// Set the size to the default if it has not already been set
- if (view->frame.width == 0.0 && view->frame.height == 0.0) {
- if (view->defaultWidth == 0.0 || view->defaultHeight == 0.0) {
+ if (view->frame.width <= 0.0 && view->frame.height <= 0.0) {
+ if (view->defaultWidth <= 0.0 || view->defaultHeight <= 0.0) {
return PUGL_BAD_CONFIGURATION;
}
@@ -313,7 +313,7 @@ puglRealize(PuglView* const view)
}
// Center top-level windows if a position has not been set
- if (!view->parent && view->frame.x == 0.0 && view->frame.y == 0.0) {
+ if (!view->parent && view->frame.x <= 0.0 && view->frame.y <= 0.0) {
const int screenWidth = DisplayWidth(display, screen);
const int screenHeight = DisplayHeight(display, screen);