# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1324788359 0 # Node ID 3b4dc98d753b72a77e16c6d04e14321f8e4966af # Parent cf960e266444bd0c704b62138e01a0bf0b35abd3 Initial gravity obstacles support for OS/2. diff -r cf960e266444 -r 3b4dc98d753b os2/dw.c --- a/os2/dw.c Sun Dec 25 03:55:24 2011 +0000 +++ b/os2/dw.c Sun Dec 25 04:45:59 2011 +0000 @@ -62,6 +62,7 @@ int _load_bitmap_file(char *file, HWND handle, HBITMAP *hbm, HDC *hdc, HPS *hps, unsigned long *width, unsigned long *height); void _free_menu_data(HWND menu); ULONG (API_FUNC _PmPrintfString)(char *String) = 0; +BOOL (API_FUNC _WinQueryDesktopWorkArea)(HWND hwndDesktop, PWRECT pwrcWorkArea) = 0; char ClassName[] = "dynamicwindows"; char SplitbarClassName[] = "dwsplitbar"; @@ -79,7 +80,7 @@ PRECORDCORE pCoreEmph = NULL; ULONG aulBuffer[4]; HWND lasthcnr = 0, lastitem = 0, popup = 0, desktop; -HMOD wpconfig = 0, pmprintf = 0; +HMOD wpconfig = 0, pmprintf = 0, pmmerge = 0; static char _dw_exec_dir[MAX_PATH+1] = {0}; unsigned long _colors[] = { @@ -3998,6 +3999,8 @@ DosLoadModule((PSZ)objnamebuf, sizeof(objnamebuf), (PSZ)"WPCONFIG", &wpconfig); if(!DosLoadModule((PSZ)objnamebuf, sizeof(objnamebuf), (PSZ)"PMPRINTF", &pmprintf)) DosQueryProcAddr(pmprintf, 0, (PSZ)"PmPrintfString", (PFN*)&_PmPrintfString); + if(!DosLoadModule((PSZ)objnamebuf, sizeof(objnamebuf), (PSZ)"PMMERGE", &pmmerge)) + DosQueryProcAddr(pmmerge, 5469, NULL, (PFN*)&_WinQueryDesktopWorkArea); return rc; } @@ -4286,7 +4289,7 @@ /* If the MDI parent isn't visible... * we can't calculate. Drop out. */ - if(cx < 1 | cy < 1) + if(cx < 1 || cy < 1) { WinSetWindowPos(handle, NULLHANDLE, 0, 0, 0, 0, SWP_MOVE); return rc; @@ -7047,6 +7050,28 @@ *x = newx; *y = newy; } + /* Adjust the values to avoid WarpCenter/XCenter/eCenter if requested */ + if(_WinQueryDesktopWorkArea && (horz | vert) & DW_GRAV_OBSTACLES) + { + RECTL rect; + + _WinQueryDesktopWorkArea(HWND_DESKTOP, &rect); + + if(horz & DW_GRAV_OBSTACLES) + { + if((horz & 0xf) == DW_GRAV_LEFT) + *x += rect.xLeft; + else if((horz & 0xf) == DW_GRAV_RIGHT) + *x -= dw_screen_width() - rect.xRight; + } + if(vert & DW_GRAV_OBSTACLES) + { + if((vert & 0xf) == DW_GRAV_BOTTOM) + *y += rect.yBottom; + else if((vert & 0xf) == DW_GRAV_TOP) + *y -= dw_screen_height() - rect.yTop; + } + } } /*