diff os2/dw.c @ 1498:f8b4d6075cac

Added auto-size support during dw_window_set_pos() on OS/2, Mac and Windows. Since dw_window_set_pos() can have unexpected results on unsized windows... if a window is unsized attempt to auto-size at that point. Auto-sizing during dw_window_set_pos() will cause auto-sizing not to happen during dw_window_show() so make sure it is completely packed before setting the position.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 25 Dec 2011 13:56:30 +0000
parents 3b4dc98d753b
children c6ab88dcf016
line wrap: on
line diff
--- a/os2/dw.c	Sun Dec 25 06:58:53 2011 +0000
+++ b/os2/dw.c	Sun Dec 25 13:56:30 2011 +0000
@@ -7084,8 +7084,14 @@
 void API dw_window_set_pos(HWND handle, LONG x, LONG y)
 {
    unsigned long width, height;
-   
+
    dw_window_get_pos_size(handle, NULL, NULL, &width, &height);
+   /* Can't position an unsized window, so attempt to auto-size */
+   if(width == 0 || height == 0)
+   {
+      dw_window_set_size(handle, 0, 0);
+      dw_window_get_pos_size(handle, NULL, NULL, &width, &height);
+   }
    _handle_gravity(handle, &x, &y, width, height);
    WinSetWindowPos(handle, NULLHANDLE, x, y, 0, 0, SWP_MOVE);
 }