# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1324655893 0 # Node ID 73f2ad84d4ecdd2aadafd030ec43b651a125a7cf # Parent dd584f431f9f756f9080c2c7a74866475ec62043 Fixed OS/2 windows being shown when setting position/size. Moved the OS/2 specific DW_OS2_NEW_WINDOW flag into os2/dw.c. Deprecated and essentially removed DW_FCF_SHELLPOSITION and DW_FCF_NOBYTEALIGN. These were OS/2 specific and are set automatically now... FCF_SHELLPOSITION was causing the positioning problems that necessitated the window being shown to set the size and position. Right now SHELLPOSITION isn't used at all... causing shell positioning to not work. I hope to have a way to allow shell positioning to work again soon but the idea I had to do this did not work. diff -r dd584f431f9f -r 73f2ad84d4ec dw.h --- a/dw.h Thu Dec 22 14:48:38 2011 +0000 +++ b/dw.h Fri Dec 23 15:58:13 2011 +0000 @@ -137,9 +137,7 @@ #define DW_FCF_HORZSCROLL FCF_HORZSCROLL #define DW_FCF_DLGBORDER FCF_DLGBORDER #define DW_FCF_BORDER FCF_BORDER -#define DW_FCF_SHELLPOSITION FCF_SHELLPOSITION #define DW_FCF_TASKLIST FCF_TASKLIST -#define DW_FCF_NOBYTEALIGN FCF_NOBYTEALIGN #define DW_FCF_NOMOVEWITHOWNER FCF_NOMOVEWITHOWNER #define DW_FCF_SYSMODAL FCF_SYSMODAL #define DW_FCF_HIDEBUTTON FCF_HIDEBUTTON @@ -176,8 +174,6 @@ #define DW_BS_NOBORDER BS_NOBORDER -#define DW_OS2_NEW_WINDOW 1 - /* flag values for dw_messagebox() */ #define DW_MB_OK MB_OK #define DW_MB_OKCANCEL MB_OKCANCEL @@ -352,9 +348,7 @@ #define DW_FCF_HORZSCROLL 0 #define DW_FCF_DLGBORDER 0 #define DW_FCF_BORDER 0 -#define DW_FCF_SHELLPOSITION 0 #define DW_FCF_TASKLIST 0 -#define DW_FCF_NOBYTEALIGN 0 #define DW_FCF_NOMOVEWITHOWNER 0 #define DW_FCF_SYSMODAL 0 #define DW_FCF_HIDEBUTTON 0 @@ -535,9 +529,7 @@ #define DW_FCF_HORZSCROLL WS_HSCROLL #define DW_FCF_DLGBORDER WS_DLGFRAME #define DW_FCF_BORDER WS_BORDER -#define DW_FCF_SHELLPOSITION 0 #define DW_FCF_TASKLIST WS_VSCROLL -#define DW_FCF_NOBYTEALIGN 0 #define DW_FCF_NOMOVEWITHOWNER 0 #define DW_FCF_SYSMODAL 0 #define DW_FCF_HIDEBUTTON WS_MINIMIZEBOX @@ -818,9 +810,7 @@ #define DW_FCF_HORZSCROLL 0 #define DW_FCF_DLGBORDER 0 #define DW_FCF_BORDER Ph_WM_RENDER_BORDER -#define DW_FCF_SHELLPOSITION 0 #define DW_FCF_TASKLIST 0 -#define DW_FCF_NOBYTEALIGN 0 #define DW_FCF_NOMOVEWITHOWNER 0 #define DW_FCF_SYSMODAL 0 #define DW_FCF_HIDEBUTTON 0 @@ -1003,9 +993,7 @@ #define DW_FCF_HORZSCROLL (1 << 8) #define DW_FCF_DLGBORDER (1 << 9) #define DW_FCF_BORDER (1 << 10) -#define DW_FCF_SHELLPOSITION (1 << 11) #define DW_FCF_TASKLIST (1 << 12) -#define DW_FCF_NOBYTEALIGN (1 << 13) #define DW_FCF_NOMOVEWITHOWNER (1 << 14) #define DW_FCF_SYSMODAL (1 << 15) #define DW_FCF_HIDEBUTTON (1 << 16) @@ -1358,7 +1346,10 @@ /* Obsolete, should disappear sometime */ #define BOXHORZ DW_HORZ #define BOXVERT DW_VERT +#define DW_FCF_SHELLPOSITION 0 +#define DW_FCF_NOBYTEALIGN 0 +/* Scrolling constants */ #define DW_SCROLL_UP 0 #define DW_SCROLL_DOWN 1 #define DW_SCROLL_TOP 2 diff -r dd584f431f9f -r 73f2ad84d4ec os2/dw.c --- a/os2/dw.c Thu Dec 22 14:48:38 2011 +0000 +++ b/os2/dw.c Fri Dec 23 15:58:13 2011 +0000 @@ -101,6 +101,8 @@ CLR_WHITE }; +#define DW_OS2_NEW_WINDOW 1 + #define IS_WARP4() (aulBuffer[0] == 20 && aulBuffer[1] >= 40) #ifndef min @@ -4245,7 +4247,7 @@ */ int API dw_window_show(HWND handle) { - int rc = WinSetWindowPos(handle, NULLHANDLE, 0, 0, 0, 0, SWP_SHOW); + int rc = WinShowWindow(handle, TRUE); HSWITCH hswitch; SWCNTRL swcntrl; @@ -4267,6 +4269,9 @@ if(blah && !(blah->flags & DW_OS2_NEW_WINDOW)) { + /* Make sure windows shown for the first time are + * completely visible if possible. + */ ULONG cx = dw_screen_width(), cy = dw_screen_height(); int newx, newy, changed = 0; SWP swp; @@ -4278,12 +4283,12 @@ newx = swp.x; newy = swp.y; - if((swp.x+swp.cx) > cx) + if(swp.cx < cx && (swp.x+swp.cx) > cx) { newx = (cx - swp.cx)/2; changed = 1; } - if((swp.y+swp.cy) > cy) + if(swp.cy < cy && (swp.y+swp.cy) > cy) { newy = (cy - swp.cy)/2; changed = 1; @@ -4922,9 +4927,6 @@ else flStyle |= FCF_TITLEBAR; - if(!(flStyle & FCF_SHELLPOSITION)) - blah->flags |= DW_OS2_NEW_WINDOW; - if(flStyle & WS_MAXIMIZED) { winStyle |= WS_MAXIMIZED; @@ -4936,6 +4938,8 @@ flStyle &= ~WS_MINIMIZED; } + /* Then create the real window window without FCF_SHELLPOSITION */ + flStyle &= ~FCF_SHELLPOSITION; hwndframe = WinCreateStdWindow(hwndOwner, winStyle, &flStyle, (PSZ)ClassName, (PSZ)title, 0L, NULLHANDLE, 0L, &newbox->hwnd); newbox->hwndtitle = WinWindowFromID(hwndframe, FID_TITLEBAR); if(!newbox->titlebar && newbox->hwndtitle) @@ -4943,7 +4947,6 @@ blah->oldproc = WinSubclassWindow(hwndframe, _sizeproc); WinSetWindowPtr(hwndframe, QWP_USER, blah); WinSetWindowPtr(newbox->hwnd, QWP_USER, newbox); - return hwndframe; } @@ -6907,7 +6910,7 @@ _get_window_for_size(handle, &width, &height); /* Finally set the size */ - WinSetWindowPos(handle, NULLHANDLE, 0, 0, width, height, SWP_SHOW | SWP_SIZE); + WinSetWindowPos(handle, NULLHANDLE, 0, 0, width, height, SWP_SIZE); } /* @@ -7025,7 +7028,7 @@ _handle_gravity(handle, &x, &y, width, height); /* Finally set the size */ - WinSetWindowPos(handle, NULLHANDLE, x, y, width, height, SWP_SHOW | SWP_MOVE | SWP_SIZE); + WinSetWindowPos(handle, NULLHANDLE, x, y, width, height, SWP_MOVE | SWP_SIZE); } /* @@ -9063,7 +9066,7 @@ DWDialog *dwwait; HMTX mtx = dw_mutex_new(); - window = dw_window_new( HWND_DESKTOP, "Choose Color", FCF_SHELLPOSITION | FCF_TITLEBAR | FCF_DLGBORDER | FCF_CLOSEBUTTON | FCF_SYSMENU); + window = dw_window_new( HWND_DESKTOP, "Choose Color", FCF_TITLEBAR | FCF_DLGBORDER | FCF_CLOSEBUTTON | FCF_SYSMENU); vbox = dw_box_new(DW_VERT, 5); @@ -10879,7 +10882,7 @@ DWDialog *dwwait; HMTX mtx = dw_mutex_new(); - window = dw_window_new( HWND_DESKTOP, title, FCF_SHELLPOSITION | FCF_TITLEBAR | FCF_SIZEBORDER | FCF_MINMAX); + window = dw_window_new( HWND_DESKTOP, title, FCF_TITLEBAR | FCF_SIZEBORDER | FCF_MINMAX); vbox = dw_box_new(DW_VERT, 5); @@ -11293,7 +11296,7 @@ } /* Create the print dialog */ - window = dw_window_new(HWND_DESKTOP, "Choose Printer", FCF_SHELLPOSITION | FCF_TITLEBAR | FCF_DLGBORDER | FCF_CLOSEBUTTON | FCF_SYSMENU); + window = dw_window_new(HWND_DESKTOP, "Choose Printer", FCF_TITLEBAR | FCF_DLGBORDER | FCF_CLOSEBUTTON | FCF_SYSMENU); vbox = dw_box_new(DW_VERT, 5); diff -r dd584f431f9f -r 73f2ad84d4ec readme --- a/readme Thu Dec 22 14:48:38 2011 +0000 +++ b/readme Fri Dec 23 15:58:13 2011 +0000 @@ -50,6 +50,8 @@ Fixed auto-sizing top-level windows on Windows; added on OS/2 and Mac. Fixed bubble help not being displayed on Windows. Fixed menu bar items remaining highlighted on Mac. +Fixed OS/2 and Windows showing windows during dw_window_set_pos/size(). +Deprecated DW_FCF_NOBYTEALIGN and DW_FCF_SHELLPOSITION flags. Dynamic Windows Documentation is available at: