]> git.ipfire.org Git - thirdparty/newt.git/commitdiff
- fix handling windows larger than screen size (#189981)
authormlichvar <mlichvar>
Fri, 15 Sep 2006 13:27:33 +0000 (13:27 +0000)
committermlichvar <mlichvar>
Fri, 15 Sep 2006 13:27:33 +0000 (13:27 +0000)
newt.c
newt.h

diff --git a/newt.c b/newt.c
index c1c9e0ac0a7b02409da29cc4b954607e73f94997..6f2df55543466c46357d7a58a74ff79e243148eb 100644 (file)
--- a/newt.c
+++ b/newt.c
@@ -610,14 +610,14 @@ void newtClearKeyBuffer(void) {
 
 /**
  * Open a new window.
- * @param left. unsigned int Size; _not_ including border
- * @param top: unsigned int size, _not_ including border
+ * @param left. int Size; _not_ including border
+ * @param top: int size, _not_ including border
  * @param width unsigned int
  * @param height unsigned int
  * @param title - title string
  * @return zero on success (currently no errors reported)
  */
-int newtOpenWindow(unsigned int left, unsigned int top, 
+int newtOpenWindow(int left, int top, 
                    unsigned int width, unsigned int height,
                          const char * title) {
     int j, row, col;
@@ -708,14 +708,14 @@ int newtOpenWindow(unsigned int left, unsigned int top,
  */
 int newtCenteredWindow(unsigned int width,unsigned int height, 
                        const char * title) {
-    unsigned int top, left;
+    int top, left;
 
-    top = (SLtt_Screen_Rows - height) / 2;
+    top = (int)(SLtt_Screen_Rows - height) / 2;
 
     /* I don't know why, but this seems to look better */
     if ((SLtt_Screen_Rows % 2) && (top % 2)) top--;
 
-    left = (SLtt_Screen_Cols - width) / 2;
+    left = (int)(SLtt_Screen_Cols - width) / 2;
 
     newtOpenWindow(left, top, width, height, title);
 
diff --git a/newt.h b/newt.h
index b179da105f556307c03f0030c3f387f28e9a2937..6ac75bb50d7df25d20da3495057e027f20ea9105 100644 (file)
--- a/newt.h
+++ b/newt.h
@@ -115,7 +115,7 @@ void newtWaitForKey(void);
 void newtClearKeyBuffer(void);
 void newtDelay(unsigned int usecs);
 /* top, left are *not* counting the border */
-int newtOpenWindow(unsigned int left,unsigned int top, 
+int newtOpenWindow(int left,int top, 
                   unsigned int width,unsigned  int height, 
                  const char * title);
 int newtCenteredWindow(unsigned int width,unsigned int height, const char * title);