Mercurial > dwindows
comparison os2/dw.c @ 1439:09fa437d6a5f
Fixed auto-sizing top-level windows in OS/2.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 08 Dec 2011 09:58:17 +0000 |
parents | bde7ebced556 |
children | 02a329b2b0cd |
comparison
equal
deleted
inserted
replaced
1438:bde7ebced556 | 1439:09fa437d6a5f |
---|---|
6855 void API dw_window_set_size(HWND handle, ULONG width, ULONG height) | 6855 void API dw_window_set_size(HWND handle, ULONG width, ULONG height) |
6856 { | 6856 { |
6857 Box *thisbox; | 6857 Box *thisbox; |
6858 HWND box; | 6858 HWND box; |
6859 | 6859 |
6860 if((width < 1 || height < 1) && (box = WinWindowFromID(window, FID_CLIENT)) && | 6860 if((width < 1 || height < 1) && (box = WinWindowFromID(handle, FID_CLIENT)) && |
6861 (thisbox = WinQueryWindowPtr(box, QWP_USER))) | 6861 (thisbox = WinQueryWindowPtr(box, QWP_USER))) |
6862 { | 6862 { |
6863 int depth = 0; | 6863 int depth = 0, border = WinQuerySysValue(HWND_DESKTOP, SV_CXSIZEBORDER) * 2; |
6864 | 6864 |
6865 /* Calculate space requirements */ | 6865 /* Calculate space requirements */ |
6866 _resize_box(thisbox, &depth, width, height, 1); | 6866 _resize_box(thisbox, &depth, width, height, 1); |
6867 | 6867 |
6868 /* Might need to take into account the window border here */ | 6868 /* Might need to take into account the window border here */ |
6869 if(width < 1) width = thisbox->minwidth; | 6869 if(width < 1) width = thisbox->minwidth + border; |
6870 if(height < 1) height = thisbox->minheight; | 6870 if(height < 1) height = thisbox->minheight + WinQuerySysValue(HWND_DESKTOP, SV_CYTITLEBAR) + border; |
6871 } | 6871 } |
6872 | 6872 |
6873 /* Finally set the size */ | 6873 /* Finally set the size */ |
6874 WinSetWindowPos(handle, NULLHANDLE, 0, 0, width, height, SWP_SHOW | SWP_SIZE); | 6874 WinSetWindowPos(handle, NULLHANDLE, 0, 0, width, height, SWP_SHOW | SWP_SIZE); |
6875 } | 6875 } |
6941 { | 6941 { |
6942 int myy = _get_frame_height(handle) - (y + height); | 6942 int myy = _get_frame_height(handle) - (y + height); |
6943 Box *thisbox; | 6943 Box *thisbox; |
6944 HWND box; | 6944 HWND box; |
6945 | 6945 |
6946 if((width < 1 || height < 1) && (box = WinWindowFromID(window, FID_CLIENT)) && | 6946 if((width < 1 || height < 1) && (box = WinWindowFromID(handle, FID_CLIENT)) && |
6947 (thisbox = WinQueryWindowPtr(box, QWP_USER))) | 6947 (thisbox = WinQueryWindowPtr(box, QWP_USER))) |
6948 { | 6948 { |
6949 int depth = 0; | 6949 int depth = 0, border = WinQuerySysValue(HWND_DESKTOP, SV_CXSIZEBORDER) * 2; |
6950 | 6950 |
6951 /* Calculate space requirements */ | 6951 /* Calculate space requirements */ |
6952 _resize_box(thisbox, &depth, width, height, 1); | 6952 _resize_box(thisbox, &depth, width, height, 1); |
6953 | 6953 |
6954 /* Might need to take into account the window border here */ | 6954 /* Might need to take into account the window border here */ |
6955 if(width < 1) width = thisbox->minwidth; | 6955 if(width < 1) width = thisbox->minwidth + border; |
6956 if(height < 1) height = thisbox->minheight; | 6956 if(height < 1) height = thisbox->minheight + WinQuerySysValue(HWND_DESKTOP, SV_CYTITLEBAR) + border; |
6957 } | 6957 } |
6958 | 6958 |
6959 /* Finally set the size */ | 6959 /* Finally set the size */ |
6960 WinSetWindowPos(handle, NULLHANDLE, x, myy, width, height, SWP_MOVE | SWP_SIZE | SWP_SHOW); | 6960 WinSetWindowPos(handle, NULLHANDLE, x, myy, width, height, SWP_MOVE | SWP_SIZE | SWP_SHOW); |
6961 } | 6961 } |