Windows default placement is now at the center of the screen
diff --git a/contiki/ctk/ctk.c b/contiki/ctk/ctk.c
index 3809db7..2dc40b7 100644
--- a/contiki/ctk/ctk.c
+++ b/contiki/ctk/ctk.c
@@ -32,7 +32,7 @@
*
* This file is part of the "ctk" console GUI toolkit for cc65
*
- * $Id: ctk.c,v 1.10 2003/04/09 13:45:07 adamdunkels Exp $
+ * $Id: ctk.c,v 1.11 2003/04/09 19:22:19 adamdunkels Exp $
*
*/
@@ -454,7 +454,18 @@
unsigned char w, unsigned char h,
char *title)
{
- window->x = window->y = 0;
+
+ if(w >= width - 2) {
+ window->x = 0;
+ } else {
+ window->x = (width - w - 2) / 2;
+ }
+ if(h >= height - 3) {
+ window->y = 0;
+ } else {
+ window->y = (height - h - 1) / 2;
+ }
+
window->w = w;
window->h = h;
window->title = title;
@@ -483,9 +494,6 @@
unsigned char w, unsigned char h)
{
window_new(window, w, h, NULL);
-
- window->x = (width - w) / 2;
- window->y = (height - h - 1) / 2;
}
/*-----------------------------------------------------------------------------------*/
void