From a819fe0b817e953156789cb433cb760b7ee2bd0b Mon Sep 17 00:00:00 2001 From: Jonathan Schleifer Date: Sun, 26 Aug 2012 16:21:16 +0200 Subject: [PATCH] Add OGK_DISPLAY_POSITION_DEFAULT. --- src/OGKDisplay.h | 5 +++++ src/OGKDisplay.m | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/OGKDisplay.h b/src/OGKDisplay.h index bd76ddb..04547eb 100644 --- a/src/OGKDisplay.h +++ b/src/OGKDisplay.h @@ -18,10 +18,15 @@ * 3.) This notice may not be removed or altered from any source distribution. */ +/* For NAN */ +#include + #include #import +#define OGK_DISPLAY_POSITION_DEFAULT of_point(NAN, NAN) + typedef enum ogk_display_flags_t { OGK_DISPLAY_FLAGS_FULLSCREEN = 0x01, OGK_DISPLAY_FLAGS_RESIZABLE = 0x02, diff --git a/src/OGKDisplay.m b/src/OGKDisplay.m index 645cb46..0534807 100644 --- a/src/OGKDisplay.m +++ b/src/OGKDisplay.m @@ -65,7 +65,10 @@ static OFDataArray *allegroDisplays = nil; self = [super init]; - al_set_new_window_position(position.x, position.y); + if (isnan(position.x) || isnan(position.y)) + al_set_new_window_position(INT_MAX, INT_MAX); + else + al_set_new_window_position(position.x, position.y); if (flags & OGK_DISPLAY_FLAGS_FULLSCREEN) allegroFlags |= ALLEGRO_FULLSCREEN; @@ -129,6 +132,9 @@ static OFDataArray *allegroDisplays = nil; al_get_window_position(display, &x, &y); + if (x == INT_MAX && y == INT_MAX) + return of_point(NAN, NAN); + return of_point(x, y); }